From 6f5b4bd8b86b8ea1ebc52be78b61637a7e7abe44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Thu, 19 Oct 2017 20:00:28 +0200 Subject: [PATCH 01/27] Wait for modal dialog animation to finish in e2e tests --- features/menu.feature | 5 +++++ features/send.feature | 1 + features/voting.feature | 1 + 3 files changed, 7 insertions(+) diff --git a/features/menu.feature b/features/menu.feature index 6d33e8c7e..5e09c260f 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -21,6 +21,7 @@ Feature: Top right menu Scenario: should allow to exit 2nd passphrase registration dialog Given I'm logged in as "genesis" When I click "register second passphrase" in main menu + And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" @@ -49,6 +50,7 @@ Feature: Top right menu Scenario: should allow to exit delegate registration dialog Given I'm logged in as "genesis" When I click "register as delegate" in main menu + And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" @@ -78,12 +80,14 @@ Feature: Top right menu Scenario: should allow to exit sign message dialog with "cancel button" Given I'm logged in as "any account" When I click "sign message" in main menu + And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" Scenario: should allow to exit sign message dialog with "x button" Given I'm logged in as "any account" When I click "sign message" in main menu + And I wait 1 seconds And I click "x button" Then I should see no "modal dialog" @@ -97,5 +101,6 @@ Feature: Top right menu Scenario: should allow to exit verify message dialog Given I'm logged in as "any account" When I click "verify message" in main menu + And I wait 1 seconds And I click "x button" Then I should see no "modal dialog" diff --git a/features/send.feature b/features/send.feature index 4c99ad562..e1dc6d8d0 100644 --- a/features/send.feature +++ b/features/send.feature @@ -24,6 +24,7 @@ Feature: Send dialog Scenario: should allow to exit send dialog Given I'm logged in as "any account" When I click "send button" + And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" diff --git a/features/voting.feature b/features/voting.feature index 09c5bb63c..a984a87cb 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -109,6 +109,7 @@ Feature: Voting tab Given I'm logged in as "genesis" When I click tab number 2 And I click "vote button" + And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" From e18b152bd8f63bd539db9ec02cc594418003f318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Thu, 19 Oct 2017 22:34:25 +0200 Subject: [PATCH 02/27] Move wait for modal dialog animation to step_definitions --- features/menu.feature | 5 ----- features/step_definitions/menu.step.js | 7 ++++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/features/menu.feature b/features/menu.feature index 5e09c260f..6d33e8c7e 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -21,7 +21,6 @@ Feature: Top right menu Scenario: should allow to exit 2nd passphrase registration dialog Given I'm logged in as "genesis" When I click "register second passphrase" in main menu - And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" @@ -50,7 +49,6 @@ Feature: Top right menu Scenario: should allow to exit delegate registration dialog Given I'm logged in as "genesis" When I click "register as delegate" in main menu - And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" @@ -80,14 +78,12 @@ Feature: Top right menu Scenario: should allow to exit sign message dialog with "cancel button" Given I'm logged in as "any account" When I click "sign message" in main menu - And I wait 1 seconds And I click "cancel button" Then I should see no "modal dialog" Scenario: should allow to exit sign message dialog with "x button" Given I'm logged in as "any account" When I click "sign message" in main menu - And I wait 1 seconds And I click "x button" Then I should see no "modal dialog" @@ -101,6 +97,5 @@ Feature: Top right menu Scenario: should allow to exit verify message dialog Given I'm logged in as "any account" When I click "verify message" in main menu - And I wait 1 seconds And I click "x button" Then I should see no "modal dialog" diff --git a/features/step_definitions/menu.step.js b/features/step_definitions/menu.step.js index 163ba0ca8..ec5eef6ca 100644 --- a/features/step_definitions/menu.step.js +++ b/features/step_definitions/menu.step.js @@ -10,13 +10,14 @@ const expect = chai.expect; defineSupportCode(({ When, Then }) => { When('I click "{itemSelector}" in main menu', (itemSelector, callback) => { waitForElemAndClickIt('.main-menu-icon-button'); - browser.sleep(1000); - waitForElemAndClickIt(`.${itemSelector.replace(/ /g, '-')}`, callback); + browser.sleep(500); + waitForElemAndClickIt(`.${itemSelector.replace(/ /g, '-')}`); + browser.sleep(500).then(callback); }); Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => { waitForElemAndClickIt('.main-menu-icon-button'); - browser.sleep(1000); + browser.sleep(500); expect(element.all(by.css(`md-menu-item .md-button.${itemSelector.replace(/ /g, '-')}`)).count()).to.eventually.equal(0) .and.notify(callback); }); From 61c10dc66b55902005acedc96c44b16898ff0b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Fri, 20 Oct 2017 07:23:32 +0200 Subject: [PATCH 03/27] Wait for new account modal in e2e test --- features/login.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/login.feature b/features/login.feature index 8f4260292..6876a76ad 100644 --- a/features/login.feature +++ b/features/login.feature @@ -45,6 +45,7 @@ Feature: Login page Scenario: should allow to create a new account Given I'm on login page When I click "new account button" + And I wait 1 seconds And I click "next button" And I 250 times move mouse randomly And I remember passphrase, click "next button", fill in missing word From b78da40a282c6b659ae0a75587f79d5846cdbcea Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 08:37:16 +0200 Subject: [PATCH 04/27] Stabilize vote launch protocol e2e test ... with use of regexp because the order of delegates is not deterministic --- features/step_definitions/generic.step.js | 5 +++-- features/support/util.js | 8 ++++++++ features/voting.feature | 9 ++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 97769717a..e13746e5b 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -4,6 +4,7 @@ const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); const { waitForElemAndCheckItsText, + waitForElemAndMatchItsText, waitForElemRemoved, waitForElemAndClickIt, waitForElemAndSendKeys, @@ -123,9 +124,9 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { waitForElemAndCheckItsText(selectorClass, text, callback); }); - Then('I should see "{elementName}" element with text:', (elementName, text, callback) => { + Then('I should see "{elementName}" element with text matching regexp:', (elementName, text, callback) => { const selectorClass = `.${elementName.replace(/ /g, '-')}`; - waitForElemAndCheckItsText(selectorClass, text, callback); + waitForElemAndMatchItsText(selectorClass, text, callback); }); Then('I should see element "{elementName}" that contains text:', (elementName, text, callback) => { diff --git a/features/support/util.js b/features/support/util.js index 910f77c4e..3b0b2876e 100644 --- a/features/support/util.js +++ b/features/support/util.js @@ -53,6 +53,13 @@ function waitForElemAndCheckItsText(selector, text, callback) { }); } +function waitForElemAndMatchItsText(selector, text, callback) { + waitForElem(selector, (elem) => { + expect(elem.getText()).to.eventually.match(new RegExp(text), `inside element "${selector}"`) + .and.notify(callback || (() => {})); + }); +} + function waitForElemRemoved(selector, callback) { const elem = element(by.css(selector)); const stepName = `waiting for element '${selector}' not present`; @@ -87,6 +94,7 @@ function checkAlertDialog(title, text, callback) { module.exports = { waitForElemAndCheckItsText, + waitForElemAndMatchItsText, waitForElemRemoved, waitForElemAndClickIt, waitForElemAndSendKeys, diff --git a/features/voting.feature b/features/voting.feature index a984a87cb..aeb0a1277 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -119,10 +119,9 @@ Feature: Voting tab Then I should see text "3 delegate names were successfully resolved for voting." in "upvotes message" element And I should see text "1 of the delegate names selected for unvoting was not currently voted for:standby_33" in "notVotedYet message" element And I should see text "1 of the provided delegate names could not be resolved:nonexisting_22" in "notFound message" element - And I should see "vote list" element with text: + And I should see "vote list" element with text matching regexp: """ - standby_27 - standby_28 - standby_29 + standby_2[789] + standby_2[789] + standby_2[789] """ - From 9fc4c4a8302579685dc0b754e3527fe700e2a1d5 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 08:50:45 +0200 Subject: [PATCH 05/27] Wait in vote by URL e2e test --- features/voting.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/voting.feature b/features/voting.feature index aeb0a1277..34c1f0086 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -116,6 +116,7 @@ Feature: Voting tab Scenario: should allow to select delegates by URL Given I'm logged in as "delegate candidate" When I go to "/main/voting/vote?votes=standby_27,standby_28,standby_29,nonexisting_22&unvotes=standby_33" + And I wait 3 seconds Then I should see text "3 delegate names were successfully resolved for voting." in "upvotes message" element And I should see text "1 of the delegate names selected for unvoting was not currently voted for:standby_33" in "notVotedYet message" element And I should see text "1 of the provided delegate names could not be resolved:nonexisting_22" in "notFound message" element From 617ed4b20dd15d6f290325ac3e523a3a98cc2918 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 09:16:12 +0200 Subject: [PATCH 06/27] Refactor e2e waitForElem to use promise --- features/step_definitions/generic.step.js | 10 ++--- features/support/util.js | 46 ++++++++++++----------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index e13746e5b..9b2c8668b 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -102,7 +102,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { Then('I should see no "{elementName}"', (elementName, callback) => { const selector = `.${elementName.replace(/ /g, '-')}`; - waitForElemRemoved(selector, () => { + waitForElemRemoved(selector).then(() => { expect(element.all(by.css(selector)).count()).to.eventually.equal(0) .and.notify(callback); }); @@ -174,7 +174,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { When('I remember passphrase, click "{nextButtonSelector}", fill in missing word', { timeout: 2 * defaultTimeout }, (nextButtonSelector, callback) => { waitForElemAndCheckItsText('.passphrase label', 'Save your passphrase in a safe place!'); - waitForElem('.passphrase textarea', (textareaElem) => { + waitForElem('.passphrase textarea').then((textareaElem) => { textareaElem.getText().then((passphrase) => { // eslint-disable-next-line no-unused-expressions expect(passphrase).to.not.be.undefined; @@ -182,16 +182,16 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { expect(passphraseWords.length).to.equal(12); waitForElemAndClickIt(`.${nextButtonSelector.replace(/ /g, '-')}`); - waitForElem('.passphrase-verifier p span', (elem) => { + waitForElem('.passphrase-verifier p span').then((elem) => { elem.getText().then((firstPartOfPassphrase) => { const missingWordIndex = firstPartOfPassphrase.length ? firstPartOfPassphrase.split(' ').length : 0; waitForElemAndSendKeys('.passphrase-verifier input', passphraseWords[missingWordIndex], callback); }); - }); + }).catch(callback); }); - }); + }).catch(callback); }); When('I Refresh the page', (callback) => { diff --git a/features/support/util.js b/features/support/util.js index 3b0b2876e..00693cef1 100644 --- a/features/support/util.js +++ b/features/support/util.js @@ -37,52 +37,54 @@ function takeScreenshot(screnarioSlug, callback) { }); } -function waitForElem(selector, callback) { - const elem = element(by.css(selector)); - const stepName = `waiting for element '${selector}'`; - browser.wait(EC.presenceOf(elem), waitTime, stepName) - .then(() => { if (callback) { callback(elem); } }) - // catch to prevent whole test suite to fail - current scenario will timeout - .catch(error => console.error(`${error}`)); // eslint-disable-line no-console +function waitForElem(selector) { + return new Promise((resolve, reject) => { + const elem = element(by.css(selector)); + const stepName = `waiting for element '${selector}'`; + browser.wait(EC.presenceOf(elem), waitTime, stepName) + .then(() => resolve(elem)) + .catch(reject); + }); } function waitForElemAndCheckItsText(selector, text, callback) { - waitForElem(selector, (elem) => { + waitForElem(selector).then((elem) => { expect(elem.getText()).to.eventually.equal(text, `inside element "${selector}"`) .and.notify(callback || (() => {})); - }); + }).catch(error => callback && callback(error)); } function waitForElemAndMatchItsText(selector, text, callback) { - waitForElem(selector, (elem) => { + waitForElem(selector).then((elem) => { expect(elem.getText()).to.eventually.match(new RegExp(text), `inside element "${selector}"`) .and.notify(callback || (() => {})); - }); + }).catch(error => callback && callback(error)); } -function waitForElemRemoved(selector, callback) { - const elem = element(by.css(selector)); - const stepName = `waiting for element '${selector}' not present`; - browser.wait(EC.not(EC.presenceOf(elem)), waitTime, stepName) - .then(callback || (() => {})) - // catch to prevent whole test suite to fail - current scenario will timeout - .catch(error => console.error(`${error}`)); // eslint-disable-line no-console +function waitForElemRemoved(selector) { + return new Promise((resolve, reject) => { + const elem = element(by.css(selector)); + const stepName = `waiting for element '${selector}' not present`; + browser.wait(EC.not(EC.presenceOf(elem)), waitTime, stepName) + .then(() => resolve(elem)) + .catch(reject); + }); } function waitForElemAndClickIt(selector, callback) { - waitForElem(selector, (elem) => { + waitForElem(selector).then((elem) => { elem.click().then(() => { if (callback) callback(); }); - }); + }).catch(error => callback && callback(error)); } function waitForElemAndSendKeys(selector, keys, callback) { - waitForElem(selector, (elem) => { + waitForElem(selector).then((elem) => { elem.sendKeys(keys).then(() => { if (callback) callback(); }); - }); + }).catch(error => callback && callback(error)); } function checkAlertDialog(title, text, callback) { From 162c3f4e6fd165e1636850439a755c9fe404ee54 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 09:54:55 +0200 Subject: [PATCH 07/27] Catch errors of click in e2e tests --- features/step_definitions/generic.step.js | 2 +- features/support/util.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 9b2c8668b..9afce77bd 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -81,7 +81,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { const optionElem = element.all(by.css(selector)).get(index - 1); browser.wait(EC.presenceOf(optionElem), waitTime) .catch(error => console.error(`${error}`)); // eslint-disable-line no-console - optionElem.click().then(callback); + optionElem.click().then(callback).catch(callback); }); Then('the option "{optionText}" is selected in "{selectName}" select', (optionText, selectName, callback) => { diff --git a/features/support/util.js b/features/support/util.js index 00693cef1..1bb3eab2a 100644 --- a/features/support/util.js +++ b/features/support/util.js @@ -75,7 +75,7 @@ function waitForElemAndClickIt(selector, callback) { waitForElem(selector).then((elem) => { elem.click().then(() => { if (callback) callback(); - }); + }).catch(callback); }).catch(error => callback && callback(error)); } From 457d0e118e2b8a680379dd27ba5db4526e3ae849 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 14:10:01 +0200 Subject: [PATCH 08/27] Increase wait for main menu open in e2e tests --- features/step_definitions/menu.step.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/menu.step.js b/features/step_definitions/menu.step.js index ec5eef6ca..14a76d194 100644 --- a/features/step_definitions/menu.step.js +++ b/features/step_definitions/menu.step.js @@ -10,9 +10,9 @@ const expect = chai.expect; defineSupportCode(({ When, Then }) => { When('I click "{itemSelector}" in main menu', (itemSelector, callback) => { waitForElemAndClickIt('.main-menu-icon-button'); - browser.sleep(500); + browser.sleep(1000); waitForElemAndClickIt(`.${itemSelector.replace(/ /g, '-')}`); - browser.sleep(500).then(callback); + browser.sleep(1000).then(callback); }); Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => { From 03a6cbfdeb9e48ad35f399dfbb550f53aaf02084 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 14:37:43 +0200 Subject: [PATCH 09/27] Move screenshot code back to hooks.js because it is not used anywhere else anymore --- features/step_definitions/hooks.js | 31 ++++++++++++++++++++++++++++- features/support/util.js | 32 ------------------------------ 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/features/step_definitions/hooks.js b/features/step_definitions/hooks.js index 1afc228a3..2a5a9f094 100644 --- a/features/step_definitions/hooks.js +++ b/features/step_definitions/hooks.js @@ -1,6 +1,35 @@ /* eslint-disable import/no-extraneous-dependencies */ const { defineSupportCode } = require('cucumber'); -const { takeScreenshot, slugify } = require('../support/util.js'); +const fs = require('fs'); + +function slugify(text) { + return text.toString().toLowerCase() + .replace(/\s+/g, '-') // Replace spaces with - + .replace(/[^\w-]+/g, '') // Remove all non-word chars + .replace(/--+/g, '-') // Replace multiple - with single - + .replace(/^-+/, '') // Trim - from start of text + .replace(/-+$/, ''); // Trim - from end of text +} + +function writeScreenShot(data, filename) { + const stream = fs.createWriteStream(filename); + stream.write(new Buffer(data, 'base64')); + stream.end(); +} + +function takeScreenshot(screnarioSlug, callback) { + browser.takeScreenshot().then((screenshotBuffer) => { + if (!fs.existsSync(browser.params.screenshotFolder)) { + fs.mkdirSync(browser.params.screenshotFolder); + } + const screenshotPath = `${browser.params.screenshotFolder}/${screnarioSlug}.png`; + writeScreenShot(screenshotBuffer, screenshotPath); + console.log(`Screenshot saved to ${screenshotPath}`); // eslint-disable-line no-console + if (callback) { + callback(); + } + }); +} defineSupportCode(({ After }) => { After((scenario, callback) => { diff --git a/features/support/util.js b/features/support/util.js index 1bb3eab2a..8b7b58653 100644 --- a/features/support/util.js +++ b/features/support/util.js @@ -1,42 +1,12 @@ /* eslint-disable import/no-extraneous-dependencies */ const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); -const fs = require('fs'); chai.use(chaiAsPromised); const expect = chai.expect; const EC = protractor.ExpectedConditions; const waitTime = 5000; -function slugify(text) { - return text.toString().toLowerCase() - .replace(/\s+/g, '-') // Replace spaces with - - .replace(/[^\w-]+/g, '') // Remove all non-word chars - .replace(/--+/g, '-') // Replace multiple - with single - - .replace(/^-+/, '') // Trim - from start of text - .replace(/-+$/, ''); // Trim - from end of text -} - -function writeScreenShot(data, filename) { - const stream = fs.createWriteStream(filename); - stream.write(new Buffer(data, 'base64')); - stream.end(); -} - -function takeScreenshot(screnarioSlug, callback) { - browser.takeScreenshot().then((screenshotBuffer) => { - if (!fs.existsSync(browser.params.screenshotFolder)) { - fs.mkdirSync(browser.params.screenshotFolder); - } - const screenshotPath = `${browser.params.screenshotFolder}/${screnarioSlug}.png`; - writeScreenShot(screenshotBuffer, screenshotPath); - console.log(`Screenshot saved to ${screenshotPath}`); // eslint-disable-line no-console - if (callback) { - callback(); - } - }); -} - function waitForElem(selector) { return new Promise((resolve, reject) => { const elem = element(by.css(selector)); @@ -102,7 +72,5 @@ module.exports = { waitForElemAndSendKeys, checkAlertDialog, waitTime, - takeScreenshot, - slugify, waitForElem, }; From c1ae8444bebf710e9396ef04ecdc8394565a0c71 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 14:38:20 +0200 Subject: [PATCH 10/27] Increase wait time for select to open --- features/step_definitions/generic.step.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 9afce77bd..aa51ae799 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -76,7 +76,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { When('I select option no. {index} from "{selectName}" select', (index, selectName, callback) => { waitForElemAndClickIt(`.${selectName}`); - browser.sleep(500); + browser.sleep(1000); const selector = `.${selectName} ul li`; const optionElem = element.all(by.css(selector)).get(index - 1); browser.wait(EC.presenceOf(optionElem), waitTime) From bc83eb757dadc4b947e6508679999ae0d6cd5e3b Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 16:21:36 +0200 Subject: [PATCH 11/27] Move e2e setup to Before block --- features/step_definitions/generic.step.js | 9 +-------- features/step_definitions/hooks.js | 13 ++++++++++++- features/step_definitions/login.step.js | 9 +-------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index aa51ae799..078b170f1 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -13,7 +13,6 @@ const { waitTime, } = require('../support/util.js'); const accounts = require('../support/accounts.js'); -const localStorage = require('../support/localStorage.js'); chai.use(chaiAsPromised); const expect = chai.expect; @@ -139,13 +138,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { browser.executeScript(`window.document.querySelector("${selectorClass} input, ${selectorClass} textarea").value = "";`); }); - Given('I\'m logged in as "{accountName}"', { timeout: 2 * defaultTimeout }, (accountName, callback) => { - browser.ignoreSynchronization = true; - browser.driver.manage().window().setSize(1000, 1000); - browser.get(browser.params.baseURL); - localStorage.clear(); - localStorage.setItem('address', browser.params.liskCoreURL); - localStorage.setItem('network', 2); + Given('I\'m logged in as "{accountName}"', (accountName, callback) => { browser.get(browser.params.baseURL); waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase); waitForElemAndClickIt('.login-button', callback); diff --git a/features/step_definitions/hooks.js b/features/step_definitions/hooks.js index 2a5a9f094..900965fc1 100644 --- a/features/step_definitions/hooks.js +++ b/features/step_definitions/hooks.js @@ -1,6 +1,7 @@ /* eslint-disable import/no-extraneous-dependencies */ const { defineSupportCode } = require('cucumber'); const fs = require('fs'); +const localStorage = require('../support/localStorage.js'); function slugify(text) { return text.toString().toLowerCase() @@ -31,7 +32,17 @@ function takeScreenshot(screnarioSlug, callback) { }); } -defineSupportCode(({ After }) => { +defineSupportCode(({ Before, After }) => { + Before((scenario, callback) => { + browser.ignoreSynchronization = true; + browser.driver.manage().window().setSize(1000, 1000); + browser.get(browser.params.baseURL); + localStorage.clear(); + localStorage.setItem('address', browser.params.liskCoreURL); + localStorage.setItem('network', 2); + callback(); + }); + After((scenario, callback) => { if (scenario.isFailed()) { const screnarioSlug = slugify([scenario.scenario.feature.name, scenario.scenario.name].join(' ')); diff --git a/features/step_definitions/login.step.js b/features/step_definitions/login.step.js index 8a4873992..31ed605f7 100644 --- a/features/step_definitions/login.step.js +++ b/features/step_definitions/login.step.js @@ -2,18 +2,11 @@ const { defineSupportCode } = require('cucumber'); const { waitForElemAndCheckItsText } = require('../support/util.js'); -defineSupportCode(({ Given, Then, When }) => { +defineSupportCode(({ Given, Then }) => { Given('I\'m on login page', (callback) => { - browser.ignoreSynchronization = true; - browser.driver.manage().window().setSize(1000, 1000); - browser.driver.get('about:blank'); browser.get(browser.params.baseURL).then(callback); }); - When('I refresh the page', (callback) => { - browser.driver.navigate().refresh().then(callback); - }); - Then('I should be logged in', (callback) => { waitForElemAndCheckItsText('.logout-button', 'LOGOUT', callback); }); From 43c6a6c585953f2e3da02aa972e1a1186c559bb2 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 20 Oct 2017 16:46:25 +0200 Subject: [PATCH 12/27] Fix capitalization of "I refresh the page" e2e step --- features/accountManagement.feature | 6 +++--- features/step_definitions/generic.step.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/accountManagement.feature b/features/accountManagement.feature index fd7967e36..bfcae7f92 100644 --- a/features/accountManagement.feature +++ b/features/accountManagement.feature @@ -5,7 +5,7 @@ Feature: Account management And I click "save account button" And I wait 1 seconds And I should see text "Account saved" in "toast" element - And I Refresh the page + And I refresh the page And I wait 2 seconds Then I should be logged in And I click "send button" @@ -26,12 +26,12 @@ Feature: Account management Given I'm logged in as "any account" When I click "save account" in main menu And I click "save account button" - And I Refresh the page + And I refresh the page And I wait 2 seconds And I click "forget account" in main menu And I wait 1 seconds Then I should see text "Account was successfully forgotten." in "toast" element - And I Refresh the page + And I refresh the page And I should be on login page Scenario: should allow to exit save account dialog with "cancel button" diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 078b170f1..f9519c029 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -187,7 +187,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { }).catch(callback); }); - When('I Refresh the page', (callback) => { + When('I refresh the page', (callback) => { browser.refresh().then(callback); }); From 7e054ee07f817aa24f12d09815ab3bb525943d94 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 09:22:57 +0100 Subject: [PATCH 13/27] Double the timeout of "Given I'm logged it" --- features/step_definitions/generic.step.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index f9519c029..632058cb1 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -138,7 +138,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { browser.executeScript(`window.document.querySelector("${selectorClass} input, ${selectorClass} textarea").value = "";`); }); - Given('I\'m logged in as "{accountName}"', (accountName, callback) => { + Given('I\'m logged in as "{accountName}"', { timeout: 2 * defaultTimeout }, (accountName, callback) => { browser.get(browser.params.baseURL); waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase); waitForElemAndClickIt('.login-button', callback); From d9440b58d5f641f30ea52ac4e5dc8e998b9685da Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 09:23:44 +0100 Subject: [PATCH 14/27] Stabilize "remeber network" e2e test ... by adding wait before refresh --- features/login.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/login.feature b/features/login.feature index 6876a76ad..3c5c1c88e 100644 --- a/features/login.feature +++ b/features/login.feature @@ -36,6 +36,7 @@ Feature: Login page When I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field And I select option no. 2 from "network" select And I click "login button" + And I wait 2 seconds And I refresh the page And I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field And I click "login button" From 1482a3b57cc8450d3a8004dfb9ffefc1bc3bdc4f Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 11:38:09 +0100 Subject: [PATCH 15/27] Handle undefined callbacks in e2e utils ... to prevent Error: EPIPE write EPIPE --- features/support/util.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/features/support/util.js b/features/support/util.js index 8b7b58653..6a74c5169 100644 --- a/features/support/util.js +++ b/features/support/util.js @@ -6,6 +6,7 @@ chai.use(chaiAsPromised); const expect = chai.expect; const EC = protractor.ExpectedConditions; const waitTime = 5000; +const emptyFn = () => {}; function waitForElem(selector) { return new Promise((resolve, reject) => { @@ -17,18 +18,18 @@ function waitForElem(selector) { }); } -function waitForElemAndCheckItsText(selector, text, callback) { +function waitForElemAndCheckItsText(selector, text, callback = emptyFn) { waitForElem(selector).then((elem) => { expect(elem.getText()).to.eventually.equal(text, `inside element "${selector}"`) - .and.notify(callback || (() => {})); - }).catch(error => callback && callback(error)); + .and.notify(callback); + }).catch(callback); } -function waitForElemAndMatchItsText(selector, text, callback) { +function waitForElemAndMatchItsText(selector, text, callback = emptyFn) { waitForElem(selector).then((elem) => { expect(elem.getText()).to.eventually.match(new RegExp(text), `inside element "${selector}"`) - .and.notify(callback || (() => {})); - }).catch(error => callback && callback(error)); + .and.notify(callback); + }).catch(callback); } function waitForElemRemoved(selector) { @@ -41,27 +42,21 @@ function waitForElemRemoved(selector) { }); } -function waitForElemAndClickIt(selector, callback) { +function waitForElemAndClickIt(selector, callback = emptyFn) { waitForElem(selector).then((elem) => { - elem.click().then(() => { - if (callback) callback(); - }).catch(callback); - }).catch(error => callback && callback(error)); + elem.click().then(callback).catch(callback); + }).catch(callback); } -function waitForElemAndSendKeys(selector, keys, callback) { +function waitForElemAndSendKeys(selector, keys, callback = emptyFn) { waitForElem(selector).then((elem) => { - elem.sendKeys(keys).then(() => { - if (callback) callback(); - }); - }).catch(error => callback && callback(error)); + elem.sendKeys(keys).then(callback).catch(callback); + }).catch(callback); } -function checkAlertDialog(title, text, callback) { +function checkAlertDialog(title, text, callback = emptyFn) { waitForElemAndCheckItsText('.modal-dialog h1', title); - waitForElemAndCheckItsText('.modal-dialog .modal-dialog-body', text, () => { - if (callback) callback(); - }); + waitForElemAndCheckItsText('.modal-dialog .modal-dialog-body', text, callback); } module.exports = { From be042edb0e86f4a0f18b4283dfd354e5d47a2bda Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 12:00:12 +0100 Subject: [PATCH 16/27] Fix alert dialog e2e step --- features/support/util.js | 2 +- src/components/dialog/alert.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/support/util.js b/features/support/util.js index 6a74c5169..17f646523 100644 --- a/features/support/util.js +++ b/features/support/util.js @@ -56,7 +56,7 @@ function waitForElemAndSendKeys(selector, keys, callback = emptyFn) { function checkAlertDialog(title, text, callback = emptyFn) { waitForElemAndCheckItsText('.modal-dialog h1', title); - waitForElemAndCheckItsText('.modal-dialog .modal-dialog-body', text, callback); + waitForElemAndCheckItsText('.modal-dialog .alert-dialog-message', text, callback); } module.exports = { diff --git a/src/components/dialog/alert.js b/src/components/dialog/alert.js index c8da75e03..e341fabf9 100644 --- a/src/components/dialog/alert.js +++ b/src/components/dialog/alert.js @@ -6,7 +6,7 @@ import grid from 'flexboxgrid/dist/flexboxgrid.css'; const Alert = ({ text, closeDialog, t }) => (
-

{text}

+

{text}


From 431d53b98e0e4527f74056c8415bdebb2b334905 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 12:18:07 +0100 Subject: [PATCH 17/27] Fix message wordings in e2e tests --- features/menu.feature | 4 ++-- features/send.feature | 2 +- features/transactions.feature | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/menu.feature b/features/menu.feature index 6d33e8c7e..70034a133 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -29,7 +29,7 @@ Feature: Top right menu When I click "register as delegate" in main menu And I fill in "test" to "username" field And I click "register button" - Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted. It can take several seconds before it is processed." + Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted with username: "test". It can take several seconds before it is processed." And I click "ok button" And I wait 15 seconds And I should see text "test" in "delegate name" element @@ -44,7 +44,7 @@ Feature: Top right menu And I fill in "test2" to "username" field And I fill in second passphrase of "second passphrase account" to "second passphrase" field And I click "register button" - Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted. It can take several seconds before it is processed." + Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted with username: "test2". It can take several seconds before it is processed." Scenario: should allow to exit delegate registration dialog Given I'm logged in as "genesis" diff --git a/features/send.feature b/features/send.feature index e1dc6d8d0..8bdee9b0e 100644 --- a/features/send.feature +++ b/features/send.feature @@ -34,7 +34,7 @@ Feature: Send dialog And I fill in "537318935439898807L" to "recipient" field And I click "send maximum amount" in "transaction amount" menu And I click "submit button" - Then I should see alert dialog with title "Success" and text "Your transaction of 101 LSK to 537318935439898807L was accepted and will be processed in a few seconds." + Then I should see alert dialog with title "Success" and text "Your transaction of 100 LSK to 537318935439898807L was accepted and will be processed in a few seconds." Scenario: should allow to send with second passphrase Given I'm logged in as "second passphrase account" diff --git a/features/transactions.feature b/features/transactions.feature index 2702f9bfe..13a74b381 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -24,7 +24,7 @@ Feature: Transactions tab When I click tab number 1 And I click "amount" element on table row no. 1 And I click "submit button" - Then I should see alert dialog with title "Success" and text "Your transaction of 100 LSK to 537318935439898807L was accepted and will be processed in a few seconds." + Then I should see alert dialog with title "Success" and text "Your transaction of 1 LSK to 537318935439898807L was accepted and will be processed in a few seconds." Scenario: should provide "No transactions" message Given I'm logged in as "empty account" From 3623d6c9acd674c13687f696bf8fe7f663bbf23d Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 12:21:11 +0100 Subject: [PATCH 18/27] Add wait to repeat transaction e2e test --- features/transactions.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/transactions.feature b/features/transactions.feature index 13a74b381..185e518c4 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -23,6 +23,7 @@ Feature: Transactions tab Given I'm logged in as "genesis" When I click tab number 1 And I click "amount" element on table row no. 1 + And I wait 1 seconds And I click "submit button" Then I should see alert dialog with title "Success" and text "Your transaction of 1 LSK to 537318935439898807L was accepted and will be processed in a few seconds." From 6f55fc5627d95a882a295bc3317a5f220ef3cfd3 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 12:27:30 +0100 Subject: [PATCH 19/27] Fix forging e2e test --- features/step_definitions/forging.step.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/forging.step.js b/features/step_definitions/forging.step.js index 9de1a033a..534ba0def 100644 --- a/features/step_definitions/forging.step.js +++ b/features/step_definitions/forging.step.js @@ -4,7 +4,7 @@ const { waitForElemAndCheckItsText } = require('../support/util.js'); defineSupportCode(({ Then }) => { Then('I should see forging center', (callback) => { - waitForElemAndCheckItsText('.delegate-name', 'genesis_17', callback); + waitForElemAndCheckItsText('.delegate-name', 'genesis_17'); waitForElemAndCheckItsText('.forged-blocks h5', 'Forged Blocks', callback); }); }); From 351aab5b6f4673c328c66ae67216c1ac2b21adba Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 2 Nov 2017 12:36:53 +0100 Subject: [PATCH 20/27] Change repeat transaction e2e test value to make the next test independent of this one --- features/transactions.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/transactions.feature b/features/transactions.feature index 185e518c4..4bc1d8ee9 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -15,9 +15,9 @@ Feature: Transactions tab Given I'm logged in as "genesis" When I click tab number 1 And I click "from-to" element on table row no. 1 - And I fill in "100" to "amount" field + And I fill in "1" to "amount" field And I click "submit button" - Then I should see alert dialog with title "Success" and text "Your transaction of 100 LSK to 537318935439898807L was accepted and will be processed in a few seconds." + Then I should see alert dialog with title "Success" and text "Your transaction of 1 LSK to 537318935439898807L was accepted and will be processed in a few seconds." Scenario: should allow to repeat the transaction Given I'm logged in as "genesis" From 906b568a254c91b81a6bce78f3644730330f027b Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 3 Nov 2017 10:28:37 +0100 Subject: [PATCH 21/27] Fix login e2e step to wait for async event --- features/step_definitions/generic.step.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 632058cb1..3fd46f392 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -140,8 +140,9 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { Given('I\'m logged in as "{accountName}"', { timeout: 2 * defaultTimeout }, (accountName, callback) => { browser.get(browser.params.baseURL); - waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase); - waitForElemAndClickIt('.login-button', callback); + waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase, () => { + waitForElemAndClickIt('.login-button', callback); + }); }); When('I go to "{url}"', (url, callback) => { From 149db614827e9634907357d9fec22c4e64407993 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 3 Nov 2017 10:43:12 +0100 Subject: [PATCH 22/27] Fix async e2e steps to wait for previous command --- features/step_definitions/generic.step.js | 36 +++++++++++------------ features/step_definitions/voting.step.js | 9 +++--- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 3fd46f392..8a9937f21 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -166,26 +166,26 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { }); When('I remember passphrase, click "{nextButtonSelector}", fill in missing word', { timeout: 2 * defaultTimeout }, (nextButtonSelector, callback) => { - waitForElemAndCheckItsText('.passphrase label', 'Save your passphrase in a safe place!'); - - waitForElem('.passphrase textarea').then((textareaElem) => { - textareaElem.getText().then((passphrase) => { - // eslint-disable-next-line no-unused-expressions - expect(passphrase).to.not.be.undefined; - const passphraseWords = passphrase.split(' '); - expect(passphraseWords.length).to.equal(12); - waitForElemAndClickIt(`.${nextButtonSelector.replace(/ /g, '-')}`); - - waitForElem('.passphrase-verifier p span').then((elem) => { - elem.getText().then((firstPartOfPassphrase) => { - const missingWordIndex = firstPartOfPassphrase.length ? - firstPartOfPassphrase.split(' ').length : - 0; - waitForElemAndSendKeys('.passphrase-verifier input', passphraseWords[missingWordIndex], callback); + waitForElemAndCheckItsText('.passphrase label', 'Save your passphrase in a safe place!', () => { + waitForElem('.passphrase textarea').then((textareaElem) => { + textareaElem.getText().then((passphrase) => { + // eslint-disable-next-line no-unused-expressions + expect(passphrase).to.not.be.undefined; + const passphraseWords = passphrase.split(' '); + expect(passphraseWords.length).to.equal(12); + waitForElemAndClickIt(`.${nextButtonSelector.replace(/ /g, '-')}`, () => { + waitForElem('.passphrase-verifier p span').then((elem) => { + elem.getText().then((firstPartOfPassphrase) => { + const missingWordIndex = firstPartOfPassphrase.length ? + firstPartOfPassphrase.split(' ').length : + 0; + waitForElemAndSendKeys('.passphrase-verifier input', passphraseWords[missingWordIndex], callback); + }).catch(callback); + }).catch(callback); }); }).catch(callback); - }); - }).catch(callback); + }).catch(callback); + }); }); When('I refresh the page', (callback) => { diff --git a/features/step_definitions/voting.step.js b/features/step_definitions/voting.step.js index e659e74bd..81815753c 100644 --- a/features/step_definitions/voting.step.js +++ b/features/step_definitions/voting.step.js @@ -14,10 +14,11 @@ defineSupportCode(({ When, Then }) => { When('Search twice for "{searchTerm}" in vote dialog', (searchTerm, callback) => { element.all(by.css('.votedListSearch input')).get(0).sendKeys(searchTerm); - waitForElemAndClickIt('#votedResult ul li:nth-child(1)'); - element.all(by.css('.votedListSearch input')).get(0).sendKeys(searchTerm); - browser.sleep(500); - waitForElemAndClickIt('#votedResult ul li:nth-child(1)', callback); + waitForElemAndClickIt('#votedResult ul li:nth-child(1)', () => { + element.all(by.css('.votedListSearch input')).get(0).sendKeys(searchTerm); + browser.sleep(500); + waitForElemAndClickIt('#votedResult ul li:nth-child(1)', callback); + }); }); Then('I should see delegates list with {count} lines', (count, callback) => { From 43bc18d67150977f924eb7d2fb1462bd7f376e0b Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Fri, 3 Nov 2017 22:57:36 +0100 Subject: [PATCH 23/27] Run e2e tests in Jenkins on built index.html ... instead of on webpack dev server --- Jenkinsfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8e1639cd6..6d7ea741f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -118,15 +118,13 @@ node('lisk-nano') { ansiColor('xterm') { sh ''' N=${EXECUTOR_NUMBER:-0} - NODE_ENV= npm run --silent dev -- --port 808$N > .lisk-nano.log 2>&1 & - sleep 30 # End to End test configuration export DISPLAY=:1$N Xvfb :1$N -ac -screen 0 1280x1024x24 & # Run end-to-end tests - npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:808$N/ --params.liskCoreURL http://127.0.0.1:400$N + npm run --silent e2e-test -- --params.baseURL file://$WORKSPACE/app/build/index.html --params.liskCoreURL http://127.0.0.1:400$N ''' } } catch (err) { @@ -143,8 +141,6 @@ node('lisk-nano') { ( cd ~/lisk-Linux-x86_64 && bash lisk.sh stop_node -p etc/pm2-lisk_$N.json ) || true pgrep --list-full -f "Xvfb :1$N" || true pkill --echo -f "Xvfb :1$N" -9 || echo "pkill returned code $?" - pgrep --list-full -f "webpack.*808$N" || true - pkill --echo -f "webpack.*808$N" -9 || echo "pkill returned code $?" ''' dir('node_modules') { deleteDir() From 6c390d8155bfbb1495d9d1b686bd8d4579e4d81e Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 6 Nov 2017 06:52:05 +0100 Subject: [PATCH 24/27] Add wait for vote dialog to animate in --- features/voting.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/voting.feature b/features/voting.feature index 34c1f0086..2d359e637 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -74,6 +74,7 @@ Feature: Voting tab And I click checkbox on table row no. 5 And I click checkbox on table row no. 8 And I click "vote button" + And I wait 1 seconds And I click "submit button" Then I should see alert dialog with title "Success" and text "Your votes were successfully submitted. It can take several seconds before they are processed." @@ -102,6 +103,7 @@ Feature: Voting tab And I click checkbox on table row no. 3 And I click checkbox on table row no. 5 And I click "vote button" + And I wait 1 seconds And I click "submit button" Then I should see alert dialog with title "Success" and text "Your votes were successfully submitted. It can take several seconds before they are processed." From 348dd5461bc351aad11a5696ecdbdf4f4100c6fe Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 6 Nov 2017 08:39:59 +0100 Subject: [PATCH 25/27] Add e2e test hook to for @pending tag --- features/step_definitions/hooks.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/step_definitions/hooks.js b/features/step_definitions/hooks.js index 900965fc1..129160772 100644 --- a/features/step_definitions/hooks.js +++ b/features/step_definitions/hooks.js @@ -43,6 +43,10 @@ defineSupportCode(({ Before, After }) => { callback(); }); + Before('@pending', (scenario, callback) => { + callback(null, 'pending'); + }); + After((scenario, callback) => { if (scenario.isFailed()) { const screnarioSlug = slugify([scenario.scenario.feature.name, scenario.scenario.name].join(' ')); From 4414e5840f6f162415a5a093d3486f069fedee02 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 6 Nov 2017 08:40:23 +0100 Subject: [PATCH 26/27] Make unstable e2e "repeat transaction" scenario @pending --- features/transactions.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/transactions.feature b/features/transactions.feature index 4bc1d8ee9..267ef7f62 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -19,6 +19,7 @@ Feature: Transactions tab And I click "submit button" Then I should see alert dialog with title "Success" and text "Your transaction of 1 LSK to 537318935439898807L was accepted and will be processed in a few seconds." + @pending Scenario: should allow to repeat the transaction Given I'm logged in as "genesis" When I click tab number 1 From 735514369d76dfd51b3a4291b0701dc8ae9c6fa3 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 6 Nov 2017 08:45:06 +0100 Subject: [PATCH 27/27] Wait for `.votedListSearch input` in e2e tests voting --- features/step_definitions/voting.step.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/features/step_definitions/voting.step.js b/features/step_definitions/voting.step.js index 81815753c..639ffb888 100644 --- a/features/step_definitions/voting.step.js +++ b/features/step_definitions/voting.step.js @@ -2,7 +2,10 @@ const { defineSupportCode } = require('cucumber'); const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); -const { waitForElemAndClickIt } = require('../support/util.js'); +const { + waitForElemAndClickIt, + waitForElemAndSendKeys, +} = require('../support/util.js'); chai.use(chaiAsPromised); const expect = chai.expect; @@ -13,11 +16,12 @@ defineSupportCode(({ When, Then }) => { }); When('Search twice for "{searchTerm}" in vote dialog', (searchTerm, callback) => { - element.all(by.css('.votedListSearch input')).get(0).sendKeys(searchTerm); - waitForElemAndClickIt('#votedResult ul li:nth-child(1)', () => { - element.all(by.css('.votedListSearch input')).get(0).sendKeys(searchTerm); - browser.sleep(500); - waitForElemAndClickIt('#votedResult ul li:nth-child(1)', callback); + waitForElemAndSendKeys('.votedListSearch input', searchTerm, () => { + waitForElemAndClickIt('#votedResult ul li:nth-child(1)', () => { + element.all(by.css('.votedListSearch input')).get(0).sendKeys(searchTerm); + browser.sleep(500); + waitForElemAndClickIt('#votedResult ul li:nth-child(1)', callback); + }); }); });