Fixing e2e tests for firefox

stable
Alejandro Alonso 2015-11-01 10:44:03 +01:00
parent bde2c2c850
commit c1dd703d9f
5 changed files with 72 additions and 7 deletions

View File

@ -43,6 +43,58 @@ exports.config = {
team: "e2e/full/team.e2e.js"
},
onPrepare: function() {
// track mouse movements
var trackMouse = function() {
angular.module('trackMouse', []).run(function($document) {
function addDot(ev) {
var color = 'black',
size = 6;
switch (ev.type) {
case 'click':
color = 'red';
break;
case 'dblclick':
color = 'blue';
break;
case 'mousemove':
color = 'green';
break;
}
var dotEl = $('<div></div>')
.css({
position: 'fixed',
height: size + 'px',
width: size + 'px',
'background-color': color,
top: ev.clientY,
left: ev.clientX,
'z-index': 9999,
// make sure this dot won't interfere with the mouse events of other elements
'pointer-events': 'none'
})
.appendTo('body');
setTimeout(function() {
dotEl.remove();
}, 1000)
}
$document.on({
click: addDot,
dblclick: addDot,
mousemove: addDot
});
});
};
browser.addMockModule('trackMouse', trackMouse);
require('./e2e/capabilities.js');
browser.driver.manage().window().maximize();

View File

@ -575,9 +575,9 @@ describe('backlog', function() {
}
async function dragClosedUsToMilestone() {
await backlogHelper.setUsStatus(0, 5);
await backlogHelper.setUsStatus(2, 5);
let dragElement = backlogHelper.userStories().get(0);
let dragElement = backlogHelper.userStories().get(2);
let dragElementHandler = dragElement.$('.icon-drag-v');
let sprint = backlogHelper.sprints().last();

View File

@ -13,7 +13,7 @@ describe('taskboard', function() {
before(async function() {
await utils.nav
.init()
.project('Project Example 0')
.project('Project Example 1')
.backlog()
.taskboard(0)
.go();

View File

@ -83,7 +83,7 @@ describe('Public', async function(){
});
it('task detail', function() {
browser.get(browser.params.glob.host + 'project/project-3/backlog');
browser.get(browser.params.glob.host + 'project/project-1/backlog');
utils.nav
.init()

View File

@ -56,6 +56,20 @@ common.link = async function(el) {
.mouseMove(el)
.perform();
// Ugly hack for firefox:
// In firefox if we have a href split in two lines the point where the cursor
// is located is just in the middle of the two lines and the hover events
// aren't fired (we need them for the tg-nav calculation). Moving the cursor
// "a little bit" tries to ensure the href text is really hovered and the
// events are fired
browser.actions()
.mouseMove({x: -10, y: -10})
.perform();
browser.actions()
.mouseMove({x: 10, y: 10})
.perform();
await browser.wait(async function() {
let href = await el.getAttribute('href');
return href.length > 1 && href !== browser.params.glob.host + "#";
@ -69,9 +83,8 @@ common.link = async function(el) {
return browser.wait(async function() {
let newUrl = await browser.getCurrentUrl();
return oldUrl !== newUrl;
}, 5000);
}, 5000);
};
common.waitLoader = function () {
@ -401,9 +414,9 @@ common.uploadImagePath = function() {
};
common.closeJoyride = function() {
browser.waitForAngular();
$('.introjs-skipbutton').isPresent().then((present) => {
if (present) {
browser.waitForAngular();
$('.introjs-skipbutton').click();
browser.sleep(600);
}