fix drag&drop tests
parent
91662a8ad7
commit
211d8972a0
|
@ -2,6 +2,7 @@
|
|||
var multipleSortableClass = 'ui-multisortable-multiple';
|
||||
var mainClass = 'main-drag-item';
|
||||
var inProgress = false;
|
||||
var removeEventFn = null;
|
||||
|
||||
var reset = function(elm) {
|
||||
$(elm)
|
||||
|
@ -59,7 +60,7 @@
|
|||
var current = dragMultiple.items.elm;
|
||||
var container = dragMultiple.items.container;
|
||||
|
||||
$(window).off('mousemove.dragmultiple');
|
||||
document.documentElement.removeEventListener('mousemove', removeEventFn);
|
||||
|
||||
// reset
|
||||
dragMultiple.items = {};
|
||||
|
@ -199,12 +200,14 @@
|
|||
|
||||
dragMultiple.start = function(item, container) {
|
||||
if (isMultiple(item, container)) {
|
||||
$(window).on('mousemove.dragmultiple', function() {
|
||||
document.documentElement.addEventListener('mousemove', function() {
|
||||
if (!inProgress) {
|
||||
dragMultiple.prepare(item, container);
|
||||
}
|
||||
|
||||
drag();
|
||||
|
||||
removeEventFn = arguments.callee;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ div.kanban-table(tg-kanban-squish-column, tg-kanban-sortable)
|
|||
)
|
||||
tg-svg.bulk-action(svg-icon="icon-bulk")
|
||||
|
||||
a.option(
|
||||
a.option.e2e-archived(
|
||||
href=""
|
||||
ng-attr-title="{{title}}"
|
||||
ng-class="class"
|
||||
|
|
|
@ -130,10 +130,20 @@ helper.openNewMilestone = function(item) {
|
|||
$('.add-sprint').click();
|
||||
};
|
||||
|
||||
helper.getClosedSprintTable = function() {
|
||||
return $$('.sprint-empty').last();
|
||||
};
|
||||
|
||||
helper.toggleClosedSprints = function() {
|
||||
$('.filter-closed-sprints').click();
|
||||
};
|
||||
|
||||
helper.toggleSprint = async function(el) {
|
||||
el.$('.compact-sprint').click();
|
||||
|
||||
await utils.common.waitTransitionTime(el.$('.sprint-table'));
|
||||
};
|
||||
|
||||
helper.closedSprints = function() {
|
||||
return $$('.sprint-closed');
|
||||
};
|
||||
|
@ -164,6 +174,18 @@ helper.getUsRef = function(elm) {
|
|||
return elm.$('span[tg-bo-ref]').getText();
|
||||
};
|
||||
|
||||
helper.loadFullBacklog = async function() {
|
||||
do {
|
||||
var uss = helper.userStories();
|
||||
var count = await uss.count();
|
||||
var last = uss.last();
|
||||
|
||||
await browser.executeScript("arguments[0].scrollIntoView();", last.getWebElement());
|
||||
|
||||
var newcount = await uss.count();
|
||||
} while(count < newcount);
|
||||
};
|
||||
|
||||
// get ref with the larger length
|
||||
helper.getTestingFilterRef = async function() {
|
||||
let userstories = helper.userStories();
|
||||
|
|
|
@ -47,7 +47,7 @@ describe('custom-fields', function() {
|
|||
expect(notification).to.be.true;
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let nameOld = await customFieldsHelper.getName(typeIndex, 0);
|
||||
|
||||
await customFieldsHelper.drag(typeIndex, 0, 1);
|
||||
|
@ -99,7 +99,7 @@ describe('custom-fields', function() {
|
|||
expect(utils.notifications.success.open()).to.be.eventually.true;
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let nameOld = await customFieldsHelper.getName(typeIndex, 0);
|
||||
|
||||
await customFieldsHelper.drag(typeIndex, 0, 1);
|
||||
|
@ -151,7 +151,7 @@ describe('custom-fields', function() {
|
|||
expect(utils.notifications.success.open()).to.be.eventually.true;
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let nameOld = await customFieldsHelper.getName(typeIndex, 0);
|
||||
|
||||
await customFieldsHelper.drag(typeIndex, 0, 1);
|
||||
|
|
|
@ -86,7 +86,7 @@ describe('attributes - points', function() {
|
|||
expect(newStatuses.indexOf(newStatusName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let points = await adminAttributesHelper.getPointsNames(section.el);
|
||||
|
|
|
@ -84,7 +84,7 @@ describe('attributes - priorities', function() {
|
|||
expect(newPriorities.indexOf(newPriorityName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let priorities = await adminAttributesHelper.getGenericNames(section.el);
|
||||
|
|
|
@ -84,7 +84,7 @@ describe('attributes - severities', function() {
|
|||
expect(newObjs.indexOf(newName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let objs = await adminAttributesHelper.getGenericNames(section.el);
|
||||
|
|
|
@ -110,7 +110,7 @@ describe('attributes - status', function() {
|
|||
expect(newStatuses.indexOf(newStatusName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let statuses = await adminAttributesHelper.getStatusNames(section.el);
|
||||
|
|
|
@ -8,7 +8,7 @@ var chaiAsPromised = require('chai-as-promised');
|
|||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
|
||||
describe.only('attributes - tags', function() {
|
||||
describe('attributes - tags', function() {
|
||||
before(async function(){
|
||||
browser.get(browser.params.glob.host + 'project/project-0/admin/project-values/tags');
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ describe('attributes - types', function() {
|
|||
expect(newObjs.indexOf(newName)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it.skip('drag', async function() {
|
||||
it('drag', async function() {
|
||||
let section = adminAttributesHelper.getSection(0);
|
||||
let rows = section.rows();
|
||||
let objs = await adminAttributesHelper.getGenericNames(section.el);
|
||||
|
|
|
@ -199,13 +199,14 @@ describe('backlog', function() {
|
|||
expect(newUsCount).to.be.equal(usCount - 1);
|
||||
});
|
||||
|
||||
it.skip('drag backlog us', async function() {
|
||||
it('drag backlog us', async function() {
|
||||
let dragableElements = backlogHelper.userStories();
|
||||
|
||||
let dragElement = dragableElements.get(1);
|
||||
let dragElement = dragableElements.get(4);
|
||||
let dragElementHandler = dragElement.$('.icon-drag');
|
||||
let draggedElementRef = await backlogHelper.getUsRef(dragElement);
|
||||
|
||||
|
||||
await utils.common.drag(dragElementHandler, dragableElements.get(0));
|
||||
await browser.waitForAngular();
|
||||
|
||||
|
@ -214,7 +215,7 @@ describe('backlog', function() {
|
|||
expect(firstElementTextRef).to.be.equal(draggedElementRef);
|
||||
});
|
||||
|
||||
it.skip('reorder multiple us', async function() {
|
||||
it('reorder multiple us', async function() {
|
||||
let dragableElements = backlogHelper.userStories();
|
||||
|
||||
let count = await dragableElements.count();
|
||||
|
@ -233,8 +234,7 @@ describe('backlog', function() {
|
|||
let ref2 = await backlogHelper.getUsRef(dragElement);
|
||||
draggedRefs.push(await backlogHelper.getUsRef(dragElement));
|
||||
|
||||
await utils.common.drag(dragElement, dragableElements.get(0));
|
||||
await browser.sleep(200);
|
||||
await utils.common.drag(dragElement.$('.icon-drag'), dragableElements.get(0));
|
||||
|
||||
let elementRef1 = await backlogHelper.getUsRef(dragableElements.get(0));
|
||||
let elementRef2 = await backlogHelper.getUsRef(dragableElements.get(1));
|
||||
|
@ -243,7 +243,7 @@ describe('backlog', function() {
|
|||
expect(elementRef1).to.be.equal(draggedRefs[1]);
|
||||
});
|
||||
|
||||
it.skip('drag multiple us to milestone', async function() {
|
||||
it.only('drag multiple us to milestone', async function() {
|
||||
let sprint = backlogHelper.sprints().get(0);
|
||||
let initUssSprintCount = await backlogHelper.getSprintUsertories(sprint).count();
|
||||
|
||||
|
@ -256,7 +256,7 @@ describe('backlog', function() {
|
|||
let dragElement = dragableElements.get(0);
|
||||
let dragElementHandler = dragElement.$('.icon-drag');
|
||||
|
||||
await utils.common.drag(dragElementHandler, sprint);
|
||||
await utils.common.drag(dragElementHandler, sprint.$('.sprint-table'));
|
||||
await browser.waitForAngular();
|
||||
|
||||
let ussSprintCount = await backlogHelper.getSprintUsertories(sprint).count();
|
||||
|
@ -264,8 +264,8 @@ describe('backlog', function() {
|
|||
expect(ussSprintCount).to.be.equal(initUssSprintCount + 2);
|
||||
});
|
||||
|
||||
it.skip('drag us to milestone', async function() {
|
||||
let sprint = backlogHelper.sprints().get(0);
|
||||
it('drag us to milestone', async function() {
|
||||
let sprint = backlogHelper.sprints().get(0).$('.sprint-table');
|
||||
|
||||
let dragableElements = backlogHelper.userStories();
|
||||
let dragElement = dragableElements.get(0);
|
||||
|
@ -303,7 +303,7 @@ describe('backlog', function() {
|
|||
expect(sprintRefs.indexOf(draggedRef)).to.be.not.equal(-1);
|
||||
});
|
||||
|
||||
it.skip('reorder milestone us', async function() {
|
||||
it('reorder milestone us', async function() {
|
||||
let sprint = backlogHelper.sprints().get(0);
|
||||
let dragableElements = backlogHelper.getSprintUsertories(sprint);
|
||||
|
||||
|
@ -318,7 +318,7 @@ describe('backlog', function() {
|
|||
expect(firstElementRef).to.be.equal(firstElementRef);
|
||||
});
|
||||
|
||||
it.skip('drag us from milestone to milestone', async function() {
|
||||
it('drag us from milestone to milestone', async function() {
|
||||
let sprint1 = backlogHelper.sprints().get(0);
|
||||
let sprint2 = backlogHelper.sprints().get(1);
|
||||
|
||||
|
@ -326,7 +326,7 @@ describe('backlog', function() {
|
|||
|
||||
let dragElement = backlogHelper.getSprintUsertories(sprint1).get(0);
|
||||
|
||||
await utils.common.drag(dragElement, sprint2);
|
||||
await utils.common.drag(dragElement, sprint2.$('.sprint-table'));
|
||||
await browser.waitForAngular();
|
||||
|
||||
let firstElement = backlogHelper.getSprintUsertories(sprint2).get(0);
|
||||
|
@ -606,12 +606,29 @@ describe('backlog', function() {
|
|||
}
|
||||
|
||||
async function dragClosedUsToMilestone() {
|
||||
await backlogHelper.setUsStatus(2, 5);
|
||||
//create us
|
||||
backlogHelper.openNewUs();
|
||||
|
||||
let dragElement = backlogHelper.userStories().get(2);
|
||||
let createUSLightbox = backlogHelper.getCreateEditUsLightbox();
|
||||
|
||||
await createUSLightbox.waitOpen();
|
||||
|
||||
createUSLightbox.subject().sendKeys('subject');
|
||||
|
||||
//closed status
|
||||
createUSLightbox.status(5).click();
|
||||
|
||||
createUSLightbox.submit();
|
||||
|
||||
await utils.lightbox.close(createUSLightbox.el);
|
||||
|
||||
await backlogHelper.loadFullBacklog();
|
||||
|
||||
// drag us to milestone
|
||||
let dragElement = backlogHelper.userStories().last();
|
||||
let dragElementHandler = dragElement.$('.icon-drag');
|
||||
|
||||
let sprint = backlogHelper.sprints().last();
|
||||
let sprint = backlogHelper.getClosedSprintTable();
|
||||
await utils.common.drag(dragElementHandler, sprint);
|
||||
|
||||
return browser.waitForAngular();
|
||||
|
@ -638,16 +655,19 @@ describe('backlog', function() {
|
|||
expect(closedSprints).to.be.equal(0);
|
||||
});
|
||||
|
||||
it.skip('open sprint by drag open US to closed sprint', async function() {
|
||||
it('open sprint by drag open US to closed sprint', async function() {
|
||||
backlogHelper.toggleClosedSprints();
|
||||
|
||||
await backlogHelper.setUsStatus(1, 0);
|
||||
await backlogHelper.setUsStatus(1, 1);
|
||||
|
||||
let dragElement = backlogHelper.userStories().get(0);
|
||||
let dragElement = backlogHelper.userStories().get(1);
|
||||
let dragElementHandler = dragElement.$('.icon-drag');
|
||||
|
||||
let sprint = backlogHelper.sprints().last();
|
||||
await utils.common.drag(dragElementHandler, sprint);
|
||||
|
||||
await backlogHelper.toggleSprint(sprint);
|
||||
|
||||
await utils.common.drag(dragElementHandler, sprint.$('.sprint-table'));
|
||||
await browser.waitForAngular();
|
||||
|
||||
let closedSprints = await backlogHelper.closedSprints().count();
|
||||
|
|
|
@ -47,7 +47,7 @@ describe('home', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip("project drag and drop", function() {
|
||||
describe("project drag and drop", function() {
|
||||
var draggedElementText;
|
||||
|
||||
before(async function() {
|
||||
|
@ -72,7 +72,7 @@ describe('home', function() {
|
|||
});
|
||||
|
||||
it('projects menu has the new order', async function() {
|
||||
var firstElementText = await $$('div[tg-dropdown-project-list] ul a').first().getInnerHtml();
|
||||
var firstElementText = await $$('div[tg-dropdown-project-list] ul a span').first().getInnerHtml();
|
||||
|
||||
expect(firstElementText).to.be.equal(draggedElementText);
|
||||
});
|
||||
|
|
|
@ -225,7 +225,7 @@ describe('kanban', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it.skip('move us between columns', async function() {
|
||||
it('move us between columns', async function() {
|
||||
let initOriginUsCount = await kanbanHelper.getBoxUss(0).count();
|
||||
let initDestinationUsCount = await kanbanHelper.getBoxUss(1).count();
|
||||
|
||||
|
@ -243,7 +243,7 @@ describe('kanban', function() {
|
|||
expect(destinationUsCount).to.be.equal(initDestinationUsCount + 1);
|
||||
});
|
||||
|
||||
describe.skip('archive', function() {
|
||||
describe('archive', function() {
|
||||
it('move to archive', async function() {
|
||||
let initOriginUsCount = await kanbanHelper.getBoxUss(3).count();
|
||||
|
||||
|
@ -264,7 +264,7 @@ describe('kanban', function() {
|
|||
});
|
||||
|
||||
it('show archive', async function() {
|
||||
$('.icon-open-eye').click();
|
||||
$('.e2e-archived').click();
|
||||
|
||||
await kanbanHelper.scrollRight();
|
||||
|
||||
|
@ -276,7 +276,7 @@ describe('kanban', function() {
|
|||
});
|
||||
|
||||
it('close archive', async function() {
|
||||
$('.icon-closed-eye').click();
|
||||
$('.e2e-archived').click();
|
||||
|
||||
let usCount = await kanbanHelper.getBoxUss(5).count();
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ describe('taskboard', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip('move tasks', function() {
|
||||
describe('move tasks', function() {
|
||||
it('move task between statuses', async function() {
|
||||
let initOriginTaskCount = await taskboardHelper.getBoxTasks(0, 0).count();
|
||||
let initDestinationTaskCount = await taskboardHelper.getBoxTasks(0, 1).count();
|
||||
|
@ -232,8 +232,7 @@ describe('taskboard', function() {
|
|||
expect(destinationTaskCount).to.be.equal(initDestinationTaskCount + 1);
|
||||
});
|
||||
|
||||
// jquery ui drag bug
|
||||
it.skip('move task between US\s', async function() {
|
||||
it('move task between US\s', async function() {
|
||||
let initOriginTaskCount = await taskboardHelper.getBoxTasks(0, 0).count();
|
||||
let initDestinationTaskCount = await taskboardHelper.getBoxTasks(1, 1).count();
|
||||
|
||||
|
|
|
@ -176,41 +176,63 @@ common.prepare = function() {
|
|||
|
||||
common.dragEnd = function(elm) {
|
||||
return browser.wait(async function() {
|
||||
let count = await $$('.ui-sortable-helper').count();
|
||||
let count = await $$('.gu-mirror').count();
|
||||
|
||||
return count === 0;
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
common.drag = async function(elm, elm2, offset) {
|
||||
// this code doesn't have sense (jquery ui + scroll drag + selenium = :( )
|
||||
await browser.actions()
|
||||
.mouseMove(elm)
|
||||
.mouseDown()
|
||||
.perform();
|
||||
common.drag = async function(elm, elm2) {
|
||||
var drag = `
|
||||
var drag = arguments[0].origin;
|
||||
var dest = arguments[0].dest;
|
||||
|
||||
await browser.actions()
|
||||
.mouseMove(elm2, offset)
|
||||
.perform();
|
||||
function triggerMouseEvent (node, eventType, opts) {
|
||||
var event = new CustomEvent(eventType);
|
||||
event.initEvent (eventType, true, true);
|
||||
|
||||
await browser.sleep(60);
|
||||
if(opts && opts.cords) {
|
||||
event.pageX = opts.cords.x;
|
||||
event.clientX = opts.cords.x;
|
||||
event.pageY = opts.cords.y;
|
||||
event.clientY = opts.cords.y - window.pageYOffset;
|
||||
|
||||
await browser.actions()
|
||||
.mouseMove({x: 10, y: -10}) // fire jqueryui mousemove event always
|
||||
.perform();
|
||||
dest.scrollIntoView();
|
||||
}
|
||||
|
||||
await browser.sleep(60);
|
||||
event.which = 1;
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
|
||||
await browser.actions()
|
||||
.mouseMove({x: -10, y: 10})
|
||||
.perform();
|
||||
triggerMouseEvent(drag, "mousedown");
|
||||
|
||||
await browser.sleep(60);
|
||||
triggerMouseEvent(document.documentElement, "mousemove", {
|
||||
cords: {
|
||||
x: $(dest).offset().left,
|
||||
y: $(dest).offset().top
|
||||
}
|
||||
});
|
||||
|
||||
return browser.actions()
|
||||
.mouseUp()
|
||||
.perform()
|
||||
.then(common.dragEnd);
|
||||
triggerMouseEvent(document.documentElement, "mousemove", {
|
||||
cords: {
|
||||
x: $(dest).offset().left,
|
||||
y: $(dest).offset().top
|
||||
}
|
||||
});
|
||||
|
||||
triggerMouseEvent(document.documentElement, "mouseup", {
|
||||
cords: {
|
||||
x: $(dest).offset().left,
|
||||
y: $(dest).offset().top
|
||||
}
|
||||
});
|
||||
`;
|
||||
|
||||
// return browser.executeScript(drag, elm, elm2);
|
||||
return browser.executeScript(drag, {
|
||||
origin: elm.getWebElement(),
|
||||
dest: elm2.getWebElement()
|
||||
}).then(common.dragEnd);
|
||||
};
|
||||
|
||||
common.transitionend = function(selector, property) {
|
||||
|
|
Loading…
Reference in New Issue