fix e2e protractor 3 - attachments

stable
Juanfran 2016-01-22 14:27:06 +01:00
parent 808115ccb1
commit 4a32076edd
1 changed files with 12 additions and 3 deletions

View File

@ -260,6 +260,13 @@ helper.attachment = function() {
let obj = { let obj = {
el:el, 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) { upload: async function(filePath, name) {
let addAttach = el.$('#add-attach'); let addAttach = el.$('#add-attach');
@ -274,15 +281,16 @@ helper.attachment = function() {
await browser.waitForAngular(); await browser.waitForAngular();
await browser.wait(async () => { 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); }, 5000);
await el.$$('tg-attachment .editable-attachment-comment input').last().sendKeys(name); await el.$$('tg-attachment .editable-attachment-comment input').last().sendKeys(name);
await browser.actions().sendKeys(protractor.Key.ENTER).perform(); await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await browser.executeScript(toggleInput); await browser.executeScript(toggleInput);
await browser.waitForAngular(); await browser.waitForAngular();
await obj.waitEditableClose();
}, },
renameLastAttchment: async function (name) { 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 .attachment-settings .icon-edit').last().click();
await el.$$('tg-attachment .editable-attachment-comment input').last().sendKeys(name); await el.$$('tg-attachment .editable-attachment-comment input').last().sendKeys(name);
await browser.actions().sendKeys(protractor.Key.ENTER).perform(); await browser.actions().sendKeys(protractor.Key.ENTER).perform();
return browser.waitForAngular(); await browser.waitForAngular();
await obj.waitEditableClose();
}, },
getFirstAttachmentName: async function () { getFirstAttachmentName: async function () {