firefox e2e test

stable
Juanfran 2015-07-28 14:32:48 +02:00
parent d4ecc6bd69
commit 785794dd3b
9 changed files with 110 additions and 59 deletions

View File

@ -8,13 +8,17 @@ exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub', seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'mocha', framework: 'mocha',
mochaOpts: { mochaOpts: {
timeout: 11000 timeout: 30000
}, },
suites: { suites: {
auth: 'e2e/auth/*.e2e.js', auth: 'e2e/auth/*.e2e.js',
full: 'e2e/full/**/*.e2e.js' full: 'e2e/full/**/*.e2e.js'
}, },
onPrepare: function() { onPrepare: function() {
browser.getCapabilities().then(function (cap) {
browser.browserName = cap.caps_.browserName;
});
browser.get('http://localhost:9001/login'); browser.get('http://localhost:9001/login');
var username = $('input[name="username"]'); var username = $('input[name="username"]');
@ -33,6 +37,11 @@ exports.config = {
.then(function(url) { .then(function(url) {
return url === 'http://localhost:9001/'; return url === 'http://localhost:9001/';
}); });
}, 10000); }, 10000)
.then(function() {
return browser.getCapabilities();
}).then(function (cap) {
browser.browserName = cap.caps_.browserName;
});
} }
} }

View File

@ -200,7 +200,7 @@ describe('backlog', function() {
expect(firstElementTextRef).to.be.equal(draggedElementRef); expect(firstElementTextRef).to.be.equal(draggedElementRef);
}); });
it('reorder multiple us', async function() { utils.common.browserSkip('firefox', 'reorder multiple us', async function() {
let dragableElements = backlogHelper.userStories(); let dragableElements = backlogHelper.userStories();
let count = await dragableElements.count(); let count = await dragableElements.count();
@ -228,7 +228,7 @@ describe('backlog', function() {
expect(elementRef1).to.be.equal(draggedRefs[1]); expect(elementRef1).to.be.equal(draggedRefs[1]);
}); });
it('drag us to milestone', async function() { utils.common.browserSkip('firefox', 'drag us to milestone', async function() {
let sprint = backlogHelper.sprints().get(1); let sprint = backlogHelper.sprints().get(1);
let dragableElements = backlogHelper.userStories(); let dragableElements = backlogHelper.userStories();
@ -245,7 +245,7 @@ describe('backlog', function() {
expect(draggedElementRef).to.be.equal(firstElementSprintRef); expect(draggedElementRef).to.be.equal(firstElementSprintRef);
}); });
it('drag multiple us to milestone', async function() { utils.common.browserSkip('firefox', 'drag multiple us to milestone', async function() {
let sprint = backlogHelper.sprints().get(1); let sprint = backlogHelper.sprints().get(1);
let dragableElements = backlogHelper.userStories(); let dragableElements = backlogHelper.userStories();
@ -293,7 +293,7 @@ describe('backlog', function() {
expect(sprintRefs.indexOf(draggedRef)).to.be.not.equal(-1); expect(sprintRefs.indexOf(draggedRef)).to.be.not.equal(-1);
}); });
it('reorder milestone us', async function() { utils.common.browserSkip('firefox', 'reorder milestone us', async function() {
let sprint = backlogHelper.sprints().get(0); let sprint = backlogHelper.sprints().get(0);
let dragableElements = backlogHelper.getSprintUsertories(sprint); let dragableElements = backlogHelper.getSprintUsertories(sprint);
@ -308,7 +308,7 @@ describe('backlog', function() {
expect(firstElementRef).to.be.equal(firstElementRef); expect(firstElementRef).to.be.equal(firstElementRef);
}); });
it('drag us from milestone to milestone', async function() { utils.common.browserSkip('firefox', 'drag us from milestone to milestone', async function() {
let sprint1 = backlogHelper.sprints().get(0); let sprint1 = backlogHelper.sprints().get(0);
let sprint2 = backlogHelper.sprints().get(1); let sprint2 = backlogHelper.sprints().get(1);
@ -375,6 +375,8 @@ describe('backlog', function() {
await createMilestoneLightbox.waitOpen(); await createMilestoneLightbox.waitOpen();
await createMilestoneLightbox.name().clear();
let sprintName = 'sprintName' + new Date().getTime(); let sprintName = 'sprintName' + new Date().getTime();
createMilestoneLightbox.name().sendKeys(sprintName); createMilestoneLightbox.name().sendKeys(sprintName);
@ -466,21 +468,18 @@ describe('backlog', function() {
let firstUs = userstories.first(); let firstUs = userstories.first();
let ref = await backlogHelper.getUsRef(firstUs); let ref = await backlogHelper.getUsRef(firstUs);
ref = ref.replace('#', ''); ref = ref.replace('#', '');
await filterQ.sendKeys(ref); await filterQ.sendKeys(ref);
await htmlChanges(); await htmlChanges();
let newUsCount = await userstories.count(); let newUsCount = await userstories.count();
expect(newUsCount).to.be.equal(1); expect(newUsCount).to.be.equal(1);
// clear status // clear status
await filterQ.clear(); await filterQ.clear();
htmlChanges = await utils.common.outerHtmlChanges('.backlog-table-body'); htmlChanges = await utils.common.outerHtmlChanges('.backlog-table-body');
await htmlChanges(); await htmlChanges();
}); });

View File

@ -65,13 +65,13 @@ describe('home', function() {
await browser.waitForAngular(); await browser.waitForAngular();
}); });
it('projects list has the new order', function() { utils.common.browserSkip('firefox', 'projects list has the new order', function() {
var firstElement = $$('.project-list-single a').first().getText(); var firstElement = $$('.project-list-single a').first().getText();
expect(firstElement).to.be.eventually.equal(draggedElementText); expect(firstElement).to.be.eventually.equal(draggedElementText);
}); });
it('projects menu has the new order', function() { utils.common.browserSkip('firefox', 'projects menu has the new order', function() {
var firstElementText = $$('div[tg-dropdown-project-list] ul a').first().getInnerHtml(); var firstElementText = $$('div[tg-dropdown-project-list] ul a').first().getInnerHtml();
expect(firstElementText).to.be.eventually.equal(draggedElementText); expect(firstElementText).to.be.eventually.equal(draggedElementText);

View File

@ -9,11 +9,14 @@ var expect = chai.expect;
describe('Issue detail', async function(){ describe('Issue detail', async function(){
let issuesUrl = ""; let issuesUrl = "";
before(async function(){ before(async function(){
utils.common.goHome(); await utils.common.goHome();
utils.common.goToFirstProject(); await utils.common.goToFirstProject();
utils.common.goToIssues();
await utils.common.goToIssues();
issuesUrl = await browser.getCurrentUrl(); issuesUrl = await browser.getCurrentUrl();
utils.common.goToFirstIssue();
await utils.common.goToFirstIssue();
}); });
it('screenshot', async function() { it('screenshot', async function() {
@ -34,7 +37,7 @@ describe('Issue detail', async function(){
it('block', utils.detail.blockTesting); it('block', utils.detail.blockTesting);
it('attachments', utils.detail.attachmentTesting) it('attachments', utils.detail.attachmentTesting);
it('screenshot', async function() { it('screenshot', async function() {
await utils.common.takeScreenshot("issues", "detail updated"); await utils.common.takeScreenshot("issues", "detail updated");
@ -46,5 +49,4 @@ describe('Issue detail', async function(){
let url = await browser.getCurrentUrl(); let url = await browser.getCurrentUrl();
expect(url.endsWith(issuesUrl)).to.be.true; expect(url.endsWith(issuesUrl)).to.be.true;
}); });
});
})

View File

@ -235,7 +235,7 @@ describe('kanban', function() {
}); });
describe('archive', function() { describe('archive', function() {
it('move to archive', async function() { utils.common.browserSkip('firefox', 'move to archive', async function() {
let initOriginUsCount = await kanbanHelper.getBoxUss(3).count(); let initOriginUsCount = await kanbanHelper.getBoxUss(3).count();
let usOrigin = kanbanHelper.getBoxUss(3).first(); let usOrigin = kanbanHelper.getBoxUss(3).first();
@ -254,7 +254,7 @@ describe('kanban', function() {
expect(originUsCount).to.be.equal(initOriginUsCount - 1); expect(originUsCount).to.be.equal(initOriginUsCount - 1);
}); });
it('show archive', async function() { utils.common.browserSkip('firefox', 'show archive', async function() {
$('.icon-open-eye').click(); $('.icon-open-eye').click();
await kanbanHelper.scrollRight(); await kanbanHelper.scrollRight();
@ -266,7 +266,7 @@ describe('kanban', function() {
expect(usCount).to.be.above(0); expect(usCount).to.be.above(0);
}); });
it('close archive', async function() { utils.common.browserSkip('firefox', 'close archive', async function() {
$('.icon-closed-eye').click(); $('.icon-closed-eye').click();
let usCount = await kanbanHelper.getBoxUss(5).count(); let usCount = await kanbanHelper.getBoxUss(5).count();

View File

@ -16,9 +16,8 @@ describe('project home', function() {
await utils.common.takeScreenshot("project", "home"); await utils.common.takeScreenshot("project", "home");
}); });
it('go to project', function() { it('go to project', async function() {
browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform(); await utils.common.goToFirstProject();
$$('div[tg-dropdown-project-list] ul a').first().click();
}); });
it('timeline filled', function() { it('timeline filled', function() {

View File

@ -57,7 +57,7 @@ helper.tags = function() {
clearTags: async function() { clearTags: async function() {
let tags = await el.$$('.icon-delete'); let tags = await el.$$('.icon-delete');
let totalTags = tags.length let totalTags = tags.length;
while (totalTags > 0) { while (totalTags > 0) {
el.$$('.icon-delete').first().click(); el.$$('.icon-delete').first().click();
await browser.waitForAngular(); await browser.waitForAngular();
@ -94,9 +94,11 @@ helper.assignedTo = function() {
el: el, el: el,
clear: async function() { clear: async function() {
el.$('.icon-delete').click(); await browser.actions().mouseMove(el).perform();
await utils.lightbox.confirm.ok();
await browser.waitForAngular(); el.$('.icon-delete').click();
await utils.lightbox.confirm.ok();
await browser.waitForAngular();
}, },
assign: function() { assign: function() {
@ -152,7 +154,7 @@ helper.history = function() {
}, },
countComments: async function() { countComments: async function() {
let moreComments = el.$('.comments-list .show-more-comments') let moreComments = el.$('.comments-list .show-more-comments');
let moreCommentsIsPresent = await moreComments.isPresent(); let moreCommentsIsPresent = await moreComments.isPresent();
if (moreCommentsIsPresent){ if (moreCommentsIsPresent){
moreComments.click(); moreComments.click();
@ -163,10 +165,11 @@ helper.history = function() {
}, },
countActivities: async function() { countActivities: async function() {
let moreActivities = el.$('.changes-list .show-more-comments') let moreActivities = el.$('.changes-list .show-more-comments');
let selectActivityTabIsPresent = await moreActivities.isPresent(); let selectActivityTabIsPresent = await moreActivities.isPresent();
if (selectActivityTabIsPresent){ if (selectActivityTabIsPresent){
moreActivities.click(); utils.common.link(moreActivities);
// moreActivities.click();
} }
await browser.waitForAngular(); await browser.waitForAngular();
let activities = await el.$$(".activity-single.activity"); let activities = await el.$$(".activity-single.activity");
@ -174,7 +177,7 @@ helper.history = function() {
}, },
countDeletedComments: async function() { countDeletedComments: async function() {
let moreComments = el.$('.comments-list .show-more-comments') let moreComments = el.$('.comments-list .show-more-comments');
let moreCommentsIsPresent = await moreComments.isPresent(); let moreCommentsIsPresent = await moreComments.isPresent();
if (moreCommentsIsPresent){ if (moreCommentsIsPresent){
moreComments.click(); moreComments.click();
@ -249,10 +252,10 @@ helper.delete = function() {
el.$('.button-red').click(); el.$('.button-red').click();
await utils.lightbox.confirm.ok(); await utils.lightbox.confirm.ok();
} }
} };
return obj; return obj;
} };
helper.attachment = function() { helper.attachment = function() {
let el = $('tg-attachments'); let el = $('tg-attachments');
@ -260,12 +263,20 @@ helper.attachment = function() {
let obj = { let obj = {
el:el, el:el,
upload: async function(filePath, name) { upload: async function(filePath, name) {
let addAttach = el.$('#add-attach');
let toggleInput = function() {
$('#add-attach').toggle();
};
await browser.executeScript(toggleInput);
await el.$('#add-attach').sendKeys(filePath); await el.$('#add-attach').sendKeys(filePath);
await browser.waitForAngular(); await browser.waitForAngular();
//TODO: ask JF why this is needed //TODO: ask JF why this is needed
await browser.sleep(2000) await browser.sleep(2000);
await el.$$('div[tg-attachment] .editable-attachment-comment input').last().sendKeys(name); await el.$$('div[tg-attachment] .editable-attachment-comment input').last().sendKeys(name);
await browser.actions().sendKeys(protractor.Key.ENTER).perform(); await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await browser.executeScript(toggleInput);
await browser.waitForAngular(); await browser.waitForAngular();
}, },

View File

@ -9,10 +9,24 @@ common.hasClass = async function (element, cls) {
return classes.split(' ').indexOf(cls) !== -1; return classes.split(' ').indexOf(cls) !== -1;
}; };
common.isBrowser = async function(browserName) {
let cap = await browser.getCapabilities();
return browserName === cap.caps_.browserName;
};
common.browserSkip = function(browserName, name, fn) {
if (browser.browserName !== browserName) {
return it.call(this, name, fn);
} else {
return it.skip.call(this, name, fn);
}
};
common.link = async function(el) { common.link = async function(el) {
await browser.actions().mouseMove(el).perform(); await browser.actions().mouseMove(el).perform();
el.click(); await el.click();
}; };
common.waitLoader = function () { common.waitLoader = function () {
@ -212,41 +226,54 @@ common.clear = function(elem, length) {
common.goHome = async function() { common.goHome = async function() {
browser.get('http://localhost:9001'); browser.get('http://localhost:9001');
await utils.common.waitLoader();
await common.waitLoader();
}; };
common.goToFirstProject = async function() { common.goToFirstProject = async function() {
browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform(); await browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform();
$$('div[tg-dropdown-project-list] li a').first().click();
await utils.common.waitLoader(); let project = $$('div[tg-dropdown-project-list] li a').first();
await common.link(project);
await common.waitLoader();
}; };
common.goToIssues = async function() { common.goToIssues = async function() {
$('#nav-issues').click(); await common.link($('#nav-issues a'));
await utils.common.waitLoader();
await common.waitLoader();
}; };
common.goToFirstIssue = async function() { common.goToFirstIssue = async function() {
$$('section.issues-table .row.table-main .subject a').first().click(); let issue = $$('section.issues-table .row.table-main .subject a').first();
await utils.common.waitLoader();
await common.link(issue);
await common.waitLoader();
}; };
common.goToBacklog = async function() { common.goToBacklog = async function() {
$('#nav-backlog').click(); await common.link($('#nav-backlog a'));
await utils.common.waitLoader();
await common.waitLoader();
} }
common.goToFirstUserStory = async function() { common.goToFirstUserStory = async function() {
$$('.user-story-name>a').first().click(); await common.link($$('.user-story-name>a').first());
await utils.common.waitLoader();
await common.waitLoader();
} }
common.goToFirstSprint = async function() { common.goToFirstSprint = async function() {
$$('div[tg-backlog-sprint] a.button-gray').first().click(); await common.link($$('div[tg-backlog-sprint] a.button-gray').first());
await utils.common.waitLoader();
await common.waitLoader();
} }
common.goToFirstTask = async function() { common.goToFirstTask = async function() {
$$('div[tg-taskboard-task] a.task-name').first().click(); await common.link($$('div[tg-taskboard-task] a.task-name').first());
await utils.common.waitLoader();
await common.waitLoader();
} }

View File

@ -12,7 +12,7 @@ var helper = module.exports;
helper.titleTesting = async function() { helper.titleTesting = async function() {
let titleHelper = detailHelper.title(); let titleHelper = detailHelper.title();
let title = await titleHelper.getTitle(); let title = await titleHelper.getTitle();
let date = Date.now() let date = Date.now();
titleHelper.setTitle("New title " + date); titleHelper.setTitle("New title " + date);
let newTitle = await titleHelper.getTitle(); let newTitle = await titleHelper.getTitle();
expect(newTitle).to.be.not.equal(title); expect(newTitle).to.be.not.equal(title);
@ -23,7 +23,7 @@ helper.tagsTesting = async function() {
let tagsText = await tagsHelper.getTagsText(); let tagsText = await tagsHelper.getTagsText();
await tagsHelper.clearTags(); await tagsHelper.clearTags();
let date = Date.now(); let date = Date.now();
let tags = [1, 2, 3, 4, 5].map(function(i){ return date + "-" + i}) let tags = [1, 2, 3, 4, 5].map((i) => date + "-" + i);
tagsHelper.addTags(tags); tagsHelper.addTags(tags);
await browser.waitForAngular(); await browser.waitForAngular();
let newtagsText = await tagsHelper.getTagsText(); let newtagsText = await tagsHelper.getTagsText();
@ -33,9 +33,9 @@ helper.tagsTesting = async function() {
helper.descriptionTesting = async function() { helper.descriptionTesting = async function() {
let descriptionHelper = detailHelper.description(); let descriptionHelper = detailHelper.description();
let description = await descriptionHelper.getInnerHtml(); let description = await descriptionHelper.getInnerHtml();
let date = Date.now() let date = Date.now();
descriptionHelper.enabledEditionMode(); descriptionHelper.enabledEditionMode();
descriptionHelper.setText("New description " + date) descriptionHelper.setText("New description " + date);
descriptionHelper.save(); descriptionHelper.save();
let newDescription = await descriptionHelper.getInnerHtml(); let newDescription = await descriptionHelper.getInnerHtml();
expect(newDescription).to.be.not.equal(description); expect(newDescription).to.be.not.equal(description);
@ -61,11 +61,12 @@ helper.historyTesting = async function() {
//Adding a comment //Adding a comment
historyHelper.selectCommentsTab(); historyHelper.selectCommentsTab();
let commentsCounter = await historyHelper.countComments(); let commentsCounter = await historyHelper.countComments();
let date = Date.now() let date = Date.now();
await historyHelper.addComment("New comment " + date); await historyHelper.addComment("New comment " + date);
let newCommentsCounter = await historyHelper.countComments(); let newCommentsCounter = await historyHelper.countComments();
expect(newCommentsCounter).to.be.equal(commentsCounter+1); expect(newCommentsCounter).to.be.equal(commentsCounter+1);
//Deleting last comment //Deleting last comment
let deletedCommentsCounter = await historyHelper.countDeletedComments(); let deletedCommentsCounter = await historyHelper.countDeletedComments();
await historyHelper.deleteLastComment(); await historyHelper.deleteLastComment();
@ -80,7 +81,9 @@ helper.historyTesting = async function() {
//Check activity //Check activity
historyHelper.selectActivityTab(); historyHelper.selectActivityTab();
let activitiesCounter = await historyHelper.countActivities(); let activitiesCounter = await historyHelper.countActivities();
expect(activitiesCounter).to.be.least(newCommentsCounter); expect(activitiesCounter).to.be.least(newCommentsCounter);
} }
@ -107,6 +110,7 @@ helper.attachmentTesting = async function() {
var fileToUpload = './upload-file-test.txt', var fileToUpload = './upload-file-test.txt',
absolutePath = path.resolve(process.cwd(), 'e2e', fileToUpload); absolutePath = path.resolve(process.cwd(), 'e2e', fileToUpload);
await attachmentHelper.upload(absolutePath, 'This is the testing name ' + date); await attachmentHelper.upload(absolutePath, 'This is the testing name ' + date);
// Check set name // Check set name
let name = await attachmentHelper.getLastAttachmentName(); let name = await attachmentHelper.getLastAttachmentName();
expect(name).to.be.equal('This is the testing name ' + date); expect(name).to.be.equal('This is the testing name ' + date);
@ -122,7 +126,7 @@ helper.attachmentTesting = async function() {
// Renaming // Renaming
await attachmentHelper.renameLastAttchment('This is the new testing name ' + date); await attachmentHelper.renameLastAttchment('This is the new testing name ' + date);
name = await attachmentHelper.getLastAttachmentName(); name = await attachmentHelper.getLastAttachmentName();
expect(name).to.be.equal('This is the new testing name ' + date) expect(name).to.be.equal('This is the new testing name ' + date);
// Deprecating // Deprecating
let deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments(); let deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments();