From c091744fa18f43e2cf32f0a9b842a600d336e940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Tue, 22 Sep 2015 18:58:26 +0200 Subject: [PATCH] [e2e] Fix some tests --- e2e/full/issues/issue-detail.e2e.js | 2 +- e2e/helpers/detail-helper.js | 32 +++++++++++++++++------------ e2e/utils/detail.js | 8 +++----- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/e2e/full/issues/issue-detail.e2e.js b/e2e/full/issues/issue-detail.e2e.js index 530e5411..7f33b362 100644 --- a/e2e/full/issues/issue-detail.e2e.js +++ b/e2e/full/issues/issue-detail.e2e.js @@ -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); diff --git a/e2e/helpers/detail-helper.js b/e2e/helpers/detail-helper.js index 0b342208..ed904189 100644 --- a/e2e/helpers/detail-helper.js +++ b/e2e/helpers/detail-helper.js @@ -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(); - totalTags --; + 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 utils.lightbox.confirm.ok(); - await browser.waitForAngular(); - totalWatchers --; + await el.$$('.icon-delete').first().click(); + await utils.lightbox.confirm.ok(); + totalWatchers --; } + await htmlChanges(); } }; diff --git a/e2e/utils/detail.js b/e2e/utils/detail.js index bb0cd1ce..59754efc 100644 --- a/e2e/utils/detail.js +++ b/e2e/utils/detail.js @@ -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(','));