[e2e] Fix some tests

stable
David Barragán Merino 2015-09-22 18:58:26 +02:00
parent 167a67558f
commit c091744fa1
3 changed files with 23 additions and 19 deletions

View File

@ -28,7 +28,7 @@ describe('Issue detail', async function(){
it('assigned to edition', utils.detail.assignedToTesting);
it('watchers edition', utils.detail.watchersTesting);
it.only('watchers edition', utils.detail.watchersTesting);
it('history', utils.detail.historyTesting);

View File

@ -58,10 +58,12 @@ helper.tags = function() {
clearTags: async function() {
let tags = await el.$$('.icon-delete');
let totalTags = tags.length;
let htmlChanges = null;
while (totalTags > 0) {
el.$$('.icon-delete').first().click();
await browser.waitForAngular();
htmlChanges = await utils.common.outerHtmlChanges(el.$(".tags-container"));
await el.$$('.icon-delete').first().click();
totalTags --;
await htmlChanges();
}
},
@ -76,10 +78,14 @@ helper.tags = function() {
},
addTags: async function(tags) {
let htmlChanges = null
el.$('.add-tag').click();
for (let tag of tags){
htmlChanges = await utils.common.outerHtmlChanges(el.$(".tags-container"));
el.$('.tag-input').sendKeys(tag);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await htmlChanges();
}
}
};
@ -381,24 +387,24 @@ helper.watchers = function() {
let obj = {
el: el,
addWatcher: function() {
el.$('.add-watcher').click();
addWatcher: async function() {
await el.$('.add-watcher').click();
},
getWatchersUserNames: function() {
getWatchersUserNames: async function() {
return el.$$('.watcher-name span').getText();
},
removeAllWathchers: async function() {
let deleteIcons = await el.$$('.icon-delete');
let totalWatchers = deleteIcons.length;
let totalWatchers = await await el.$$('.icon-delete').count();
let htmlChanges = htmlChanges = await utils.common.outerHtmlChanges(el);
while (totalWatchers > 0) {
el.$$('.icon-delete').first().click();
await el.$$('.icon-delete').first().click();
await utils.lightbox.confirm.ok();
await browser.waitForAngular();
totalWatchers --;
}
await htmlChanges();
}
};

View File

@ -28,7 +28,6 @@ helper.tagsTesting = async function() {
let date = Date.now();
let tags = [1, 2, 3, 4, 5].map((i) => date + "-" + i);
tagsHelper.addTags(tags);
await browser.waitForAngular();
let newtagsText = await tagsHelper.getTagsText();
expect(newtagsText).to.be.not.equal(tagsText);
}
@ -189,22 +188,21 @@ helper.deleteTesting = async function() {
helper.watchersTesting = async function() {
let watchersHelper = detailHelper.watchers();
await watchersHelper.removeAllWathchers();
let watchersLightboxHelper = detailHelper.watchersLightbox();
let userNames = await watchersHelper.getWatchersUserNames();
//Add watcher
watchersHelper.addWatcher();
await watchersHelper.addWatcher();
await watchersLightboxHelper.waitOpen();
let newWatcherName = await watchersLightboxHelper.getFirstName();
watchersLightboxHelper.selectFirst();
await watchersLightboxHelper.selectFirst();
await watchersLightboxHelper.waitClose();
let newUserNames = await watchersHelper.getWatchersUserNames();
userNames.push(newWatcherName);
await userNames.push(newWatcherName);
expect(newUserNames.join(',')).to.be.equal(userNames.join(','));