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',
framework: 'mocha',
mochaOpts: {
timeout: 11000
timeout: 30000
},
suites: {
auth: 'e2e/auth/*.e2e.js',
full: 'e2e/full/**/*.e2e.js'
},
onPrepare: function() {
browser.getCapabilities().then(function (cap) {
browser.browserName = cap.caps_.browserName;
});
browser.get('http://localhost:9001/login');
var username = $('input[name="username"]');
@ -33,6 +37,11 @@ exports.config = {
.then(function(url) {
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);
});
it('reorder multiple us', async function() {
utils.common.browserSkip('firefox', 'reorder multiple us', async function() {
let dragableElements = backlogHelper.userStories();
let count = await dragableElements.count();
@ -228,7 +228,7 @@ describe('backlog', function() {
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 dragableElements = backlogHelper.userStories();
@ -245,7 +245,7 @@ describe('backlog', function() {
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 dragableElements = backlogHelper.userStories();
@ -293,7 +293,7 @@ describe('backlog', function() {
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 dragableElements = backlogHelper.getSprintUsertories(sprint);
@ -308,7 +308,7 @@ describe('backlog', function() {
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 sprint2 = backlogHelper.sprints().get(1);
@ -375,6 +375,8 @@ describe('backlog', function() {
await createMilestoneLightbox.waitOpen();
await createMilestoneLightbox.name().clear();
let sprintName = 'sprintName' + new Date().getTime();
createMilestoneLightbox.name().sendKeys(sprintName);
@ -466,21 +468,18 @@ describe('backlog', function() {
let firstUs = userstories.first();
let ref = await backlogHelper.getUsRef(firstUs);
ref = ref.replace('#', '');
await filterQ.sendKeys(ref);
await htmlChanges();
let newUsCount = await userstories.count();
expect(newUsCount).to.be.equal(1);
// clear status
await filterQ.clear();
htmlChanges = await utils.common.outerHtmlChanges('.backlog-table-body');
await htmlChanges();
});

View File

@ -65,13 +65,13 @@ describe('home', function() {
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();
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();
expect(firstElementText).to.be.eventually.equal(draggedElementText);

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ helper.tags = function() {
clearTags: async function() {
let tags = await el.$$('.icon-delete');
let totalTags = tags.length
let totalTags = tags.length;
while (totalTags > 0) {
el.$$('.icon-delete').first().click();
await browser.waitForAngular();
@ -94,6 +94,8 @@ helper.assignedTo = function() {
el: el,
clear: async function() {
await browser.actions().mouseMove(el).perform();
el.$('.icon-delete').click();
await utils.lightbox.confirm.ok();
await browser.waitForAngular();
@ -152,7 +154,7 @@ helper.history = 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();
if (moreCommentsIsPresent){
moreComments.click();
@ -163,10 +165,11 @@ helper.history = 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();
if (selectActivityTabIsPresent){
moreActivities.click();
utils.common.link(moreActivities);
// moreActivities.click();
}
await browser.waitForAngular();
let activities = await el.$$(".activity-single.activity");
@ -174,7 +177,7 @@ helper.history = 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();
if (moreCommentsIsPresent){
moreComments.click();
@ -249,10 +252,10 @@ helper.delete = function() {
el.$('.button-red').click();
await utils.lightbox.confirm.ok();
}
}
};
return obj;
}
};
helper.attachment = function() {
let el = $('tg-attachments');
@ -260,12 +263,20 @@ helper.attachment = function() {
let obj = {
el:el,
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 browser.waitForAngular();
//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 browser.actions().sendKeys(protractor.Key.ENTER).perform();
await browser.executeScript(toggleInput);
await browser.waitForAngular();
},

View File

@ -9,10 +9,24 @@ common.hasClass = async function (element, cls) {
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) {
await browser.actions().mouseMove(el).perform();
el.click();
await el.click();
};
common.waitLoader = function () {
@ -212,41 +226,54 @@ common.clear = function(elem, length) {
common.goHome = async function() {
browser.get('http://localhost:9001');
await utils.common.waitLoader();
await common.waitLoader();
};
common.goToFirstProject = async function() {
browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform();
$$('div[tg-dropdown-project-list] li a').first().click();
await utils.common.waitLoader();
await browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform();
let project = $$('div[tg-dropdown-project-list] li a').first();
await common.link(project);
await common.waitLoader();
};
common.goToIssues = async function() {
$('#nav-issues').click();
await utils.common.waitLoader();
await common.link($('#nav-issues a'));
await common.waitLoader();
};
common.goToFirstIssue = async function() {
$$('section.issues-table .row.table-main .subject a').first().click();
await utils.common.waitLoader();
let issue = $$('section.issues-table .row.table-main .subject a').first();
await common.link(issue);
await common.waitLoader();
};
common.goToBacklog = async function() {
$('#nav-backlog').click();
await utils.common.waitLoader();
await common.link($('#nav-backlog a'));
await common.waitLoader();
}
common.goToFirstUserStory = async function() {
$$('.user-story-name>a').first().click();
await utils.common.waitLoader();
await common.link($$('.user-story-name>a').first());
await common.waitLoader();
}
common.goToFirstSprint = async function() {
$$('div[tg-backlog-sprint] a.button-gray').first().click();
await utils.common.waitLoader();
await common.link($$('div[tg-backlog-sprint] a.button-gray').first());
await common.waitLoader();
}
common.goToFirstTask = async function() {
$$('div[tg-taskboard-task] a.task-name').first().click();
await utils.common.waitLoader();
await common.link($$('div[tg-taskboard-task] a.task-name').first());
await common.waitLoader();
}

View File

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