From d95e4778c837cd2b2a46dc79c4a54b6b870d0d50 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Wed, 28 Sep 2016 09:56:32 +0200 Subject: [PATCH] improve lightbox close e2e --- e2e/shared/detail.js | 3 ++- e2e/suites/backlog.e2e.js | 6 ++++-- e2e/utils/lightbox.js | 25 ++++++++++--------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/e2e/shared/detail.js b/e2e/shared/detail.js index f8694cbd..364813c5 100644 --- a/e2e/shared/detail.js +++ b/e2e/shared/detail.js @@ -357,9 +357,10 @@ shared.attachmentTesting = async function() { let previewSrc2 = await attachmentHelper.getPreviewSrc(); - expect(previewSrc).not.to.be.equal(previewSrc2); await lightbox.exit(); + expect(previewSrc).not.to.be.equal(previewSrc2); + // Deleting attachmentsLength = await attachmentHelper.countAttachments(); await attachmentHelper.deleteLastAttachment(); diff --git a/e2e/suites/backlog.e2e.js b/e2e/suites/backlog.e2e.js index 396db50b..f847a4f2 100644 --- a/e2e/suites/backlog.e2e.js +++ b/e2e/suites/backlog.e2e.js @@ -10,6 +10,7 @@ var sharedFilters = require('../shared/filters'); chai.use(chaiAsPromised); var expect = chai.expect; + describe('backlog', function() { before(async function() { browser.get(browser.params.glob.host + 'project/project-3/backlog'); @@ -160,6 +161,7 @@ describe('backlog', function() { }); }); + it('edit status inline', async function() { await backlogHelper.setUsStatus(0, 1); @@ -209,7 +211,7 @@ describe('backlog', function() { expect(firstElementTextRef).to.be.equal(draggedElementRef); }); - it.skip('reorder multiple us', async function() { + it('reorder multiple us', async function() { let dragableElements = backlogHelper.userStories(); let count = await dragableElements.count(); @@ -237,7 +239,7 @@ describe('backlog', function() { expect(elementRef1).to.be.equal(draggedRefs[1]); }); - it.skip('drag multiple us to milestone', async function() { + it('drag multiple us to milestone', async function() { let sprint = backlogHelper.sprints().get(0); let initUssSprintCount = await backlogHelper.getSprintUsertories(sprint).count(); diff --git a/e2e/utils/lightbox.js b/e2e/utils/lightbox.js index a6222d99..8c041672 100644 --- a/e2e/utils/lightbox.js +++ b/e2e/utils/lightbox.js @@ -13,6 +13,8 @@ lightbox.exit = function(el) { } el.$('.close').click(); + + return lightbox.close(el); }; lightbox.open = async function(el) { @@ -38,7 +40,6 @@ lightbox.open = async function(el) { }; lightbox.close = async function(el) { - var deferred = protractor.promise.defer(); var present = true; if (typeof el == 'string' || el instanceof String) { @@ -47,22 +48,16 @@ lightbox.close = async function(el) { present = await el.isPresent(); - if (!present) { - deferred.fulfill(true); - } else { - return browser.wait(function() { - return common.hasClass(el, 'open').then(function(open) { + if (present) { + try { + await browser.wait(async function() { + let open = await common.hasClass(el, 'open'); return !open; - }); - }, 4000) - .then(function() { - return deferred.fulfill(true); - }, function() { - deferred.reject(new Error('Lightbox doesn\'t close')); - }); + }, 4000); + } catch (e) { + new Error('Lightbox doesn\'t close') + } } - - return deferred.promise; }; lightbox.confirm = {};