From 4a32076edd65e9640e967d2cb004a4f5ba416a63 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Fri, 22 Jan 2016 14:27:06 +0100 Subject: [PATCH] fix e2e protractor 3 - attachments --- e2e/helpers/detail-helper.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/e2e/helpers/detail-helper.js b/e2e/helpers/detail-helper.js index 345febc7..dd715dfe 100644 --- a/e2e/helpers/detail-helper.js +++ b/e2e/helpers/detail-helper.js @@ -260,6 +260,13 @@ helper.attachment = function() { let obj = { el:el, + waitEditableClose: function() { + return browser.wait(async () => { + let editableAttachmentsCount = await $$('tg-attachment .editable-attachment-comment').count(); + + return !editableAttachmentsCount; + }, 5000); + }, upload: async function(filePath, name) { let addAttach = el.$('#add-attach'); @@ -274,15 +281,16 @@ helper.attachment = function() { await browser.waitForAngular(); await browser.wait(async () => { - let newCountAttachments = await $$('tg-attachment').count(); + let count = await $$('tg-attachment .editable-attachment-comment input').count(); - return newCountAttachments == countAttachments + 1; + return !!count; }, 5000); await el.$$('tg-attachment .editable-attachment-comment input').last().sendKeys(name); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); await browser.executeScript(toggleInput); await browser.waitForAngular(); + await obj.waitEditableClose(); }, renameLastAttchment: async function (name) { @@ -290,7 +298,8 @@ helper.attachment = function() { await el.$$('tg-attachment .attachment-settings .icon-edit').last().click(); await el.$$('tg-attachment .editable-attachment-comment input').last().sendKeys(name); await browser.actions().sendKeys(protractor.Key.ENTER).perform(); - return browser.waitForAngular(); + await browser.waitForAngular(); + await obj.waitEditableClose(); }, getFirstAttachmentName: async function () {