From 11225bc5bb088ea6b0ea601a84c83ce0fe7ed9c0 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 20:34:01 +0100 Subject: [PATCH 1/6] Merge intersecting e2e test scenarios --- features/forging.feature | 11 ++++------- features/menu.feature | 5 +---- features/transactions.feature | 15 +++------------ features/voting.feature | 14 +++----------- 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/features/forging.feature b/features/forging.feature index 3e9abe259..d3241cd73 100644 --- a/features/forging.feature +++ b/features/forging.feature @@ -1,12 +1,9 @@ Feature: Forging tab - Scenario: should allow to view forging center if account is delegate + Scenario: should allow to view forging center if account is delegate and should show more blocks on scroll Given I'm logged in as "delegate" When I click tab number 3 Then I should see forging center + And I should see table with 20 lines + And I scroll to the bottom + And I should see table with 40 lines - Scenario: should show more blocks on scroll - Given I'm logged in as "delegate" - When I click tab number 3 - Then I should see table with 20 lines - When I scroll to the bottom - Then I should see table with 40 lines diff --git a/features/menu.feature b/features/menu.feature index 70034a133..0793fd31d 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -33,10 +33,7 @@ Feature: Top right menu And I click "ok button" And I wait 15 seconds And I should see text "test" in "delegate name" element - - Scenario: should not allow to register a delegate again - Given I'm logged in as "delegate" - Then There is no "register as delegate" in main menu + And There is no "register as delegate" in main menu Scenario: should allow to register a delegate with second passphrase Given I'm logged in as "second passphrase account" diff --git a/features/transactions.feature b/features/transactions.feature index 267ef7f62..1b1519cb0 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -1,10 +1,5 @@ Feature: Transactions tab - Scenario: should show transactions - Given I'm logged in as "genesis" - When I click tab number 1 - Then I should see table with 40 lines - - Scenario: should show more transactions on scroll + Scenario: should show transactions and more on scroll Given I'm logged in as "genesis" When I click tab number 1 Then I should see table with 40 lines @@ -28,15 +23,11 @@ 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." - Scenario: should provide "No transactions" message - Given I'm logged in as "empty account" - When I click tab number 1 - Then I should see table with 0 lines - And I should see text "There are no transactions, yet. RECEIVE LSK" in "empty message" element - Scenario: should provide "Receive LSK" modal if there are "No transactions" Given I'm logged in as "empty account" When I click tab number 1 + And I should see table with 0 lines + And I should see text "There are no transactions, yet. RECEIVE LSK" in "empty message" element And I click "receive lsk button" And I wait 1 seconds Then I should see text "5932438298200837883L" in "receive modal address" element diff --git a/features/voting.feature b/features/voting.feature index 78dbb3d5d..deadbc4ea 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -1,10 +1,5 @@ Feature: Voting tab - Scenario: should allow to view delegates - Given I'm logged in as "any account" - When I click tab number 2 - Then I should see table with 100 lines - - Scenario: should allow to view more delegates on scroll + Scenario: should allow to view delegates and more on scroll Given I'm logged in as "any account" When I click tab number 2 Then I should see table with 100 lines @@ -21,12 +16,9 @@ Feature: Voting tab When I click tab number 2 And I fill in "genesis_42" to "search" field Then I should see table with 1 lines - - Scenario: search delegates should provide "no results" message - Given I'm logged in as "any account" - When I click tab number 2 + And I clear "search" field And I fill in "doesntexist" to "search" field - Then I should see table with 0 lines + And I should see table with 0 lines And I should see text "No delegates found" in "empty message" element Scenario: should allow to view my votes From 2cd87f94d231745a0ac0188492aff2c67d79ade0 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 20:40:18 +0100 Subject: [PATCH 2/6] Remove e2e scenarios covered elsewhere either in unit tests or in other e2e tests --- features/login.feature | 8 -------- features/send.feature | 15 --------------- features/top.feature | 18 ------------------ 3 files changed, 41 deletions(-) delete mode 100644 features/top.feature diff --git a/features/login.feature b/features/login.feature index 3c5c1c88e..94c40d587 100644 --- a/features/login.feature +++ b/features/login.feature @@ -23,14 +23,6 @@ Feature: Login page Then I should be logged in And I should see text "Mainnet" in "peer network" element - Scenario: should allow to login to Testnet - Given I'm on 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" - Then I should be logged in - And I should see text "Testnet" in "peer network" element - Scenario: should remember the selected network Given I'm on login page When I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field diff --git a/features/send.feature b/features/send.feature index 02b80d7b0..dcb4145b4 100644 --- a/features/send.feature +++ b/features/send.feature @@ -15,13 +15,6 @@ Feature: Send dialog And I fill in "537318935439898807L" to "recipient" field Then I should see "Insufficient funds" error message - Scenario: should not allow to send when invalid address - Given I'm logged in as "any account" - When I click "send button" - And I fill in "1243409812409" to "recipient" field - And I fill in "1" to "amount" field - Then I should see "Invalid" error message - Scenario: should allow to exit send dialog Given I'm logged in as "any account" When I click "send button" @@ -29,14 +22,6 @@ Feature: Send dialog And I click "cancel button" Then I should see no "modal dialog" - Scenario: should allow to send all funds - Given I'm logged in as "send all account" - When I click "send button" - 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 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" When I click "send button" diff --git a/features/top.feature b/features/top.feature deleted file mode 100644 index 55b17c173..000000000 --- a/features/top.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Main page top area - Scenario: should allow to logout - Given I'm logged in as "any account" - When I click "logout button" - Then I should be on login page - - Scenario: should show peer - Given I'm logged in as "any account" - Then I should see text "Custom Node" in "peer network" element - - Scenario: should show address - Given I'm logged in as "genesis" - Then I should see text "16313739661670634666L" in "address" element - - Scenario: should show balance - Given I'm logged in as "empty account" - Then I should see text "0 LSK" in "balance value" element - From 3022fc4593a0bdc965e1754a5b4f23957916e258 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 20:51:18 +0100 Subject: [PATCH 3/6] Add @integration tag to e2e tests that should be integration tests --- features/accountManagement.feature | 2 ++ features/menu.feature | 7 +++++++ features/send.feature | 2 ++ features/transactions.feature | 2 ++ features/voting.feature | 6 ++++++ 5 files changed, 19 insertions(+) diff --git a/features/accountManagement.feature b/features/accountManagement.feature index bfcae7f92..dfb3c5005 100644 --- a/features/accountManagement.feature +++ b/features/accountManagement.feature @@ -34,12 +34,14 @@ Feature: Account management And I refresh the page And I should be on login page + @integration Scenario: should allow to exit save account dialog with "cancel button" Given I'm logged in as "any account" When I click "save account" in main menu And I click "cancel button" Then I should see no "modal dialog" + @integration Scenario: should allow to exit save account dialog with "x button" Given I'm logged in as "any account" When I click "save account" in main menu diff --git a/features/menu.feature b/features/menu.feature index 0793fd31d..530816fa5 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -12,12 +12,14 @@ Feature: Top right menu Given I'm logged in as "second passphrase account" Then There is no "register second passphrase" in main menu + @integration Scenario: should not allow to set 2nd passphrase if not enough funds for the fee Given I'm logged in as "empty account" When I click "register second passphrase" in main menu Then I should see "Insufficient funds for 5 LSK fee" error message And "next button" should be disabled + @integration 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 @@ -43,12 +45,14 @@ Feature: Top right menu And I click "register button" 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." + @integration 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 click "cancel button" Then I should see no "modal dialog" + @integration Scenario: should not allow to register delegate if not enough funds for the fee Given I'm logged in as "empty account" When I click "register as delegate" in main menu @@ -72,12 +76,14 @@ Feature: Top right menu -----END LISK SIGNED MESSAGE----- """ + @integration 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 click "cancel button" Then I should see no "modal dialog" + @integration 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 @@ -91,6 +97,7 @@ Feature: Top right menu And I fill in "079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64" to "signature" field Then I should see "Hello world" in "result" field + @integration Scenario: should allow to exit verify message dialog Given I'm logged in as "any account" When I click "verify message" in main menu diff --git a/features/send.feature b/features/send.feature index dcb4145b4..c44e836aa 100644 --- a/features/send.feature +++ b/features/send.feature @@ -8,6 +8,7 @@ Feature: Send dialog 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." + @integration Scenario: should not allow to send when not enough funds Given I'm logged in as "empty account" When I click "send button" @@ -15,6 +16,7 @@ Feature: Send dialog And I fill in "537318935439898807L" to "recipient" field Then I should see "Insufficient funds" error message + @integration Scenario: should allow to exit send dialog Given I'm logged in as "any account" When I click "send button" diff --git a/features/transactions.feature b/features/transactions.feature index 1b1519cb0..6e6bd8f24 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -6,6 +6,7 @@ Feature: Transactions tab When I scroll to the bottom Then I should see table with 60 lines + @integration Scenario: should allow send to address Given I'm logged in as "genesis" When I click tab number 1 @@ -14,6 +15,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." + @integration @pending Scenario: should allow to repeat the transaction Given I'm logged in as "genesis" diff --git a/features/voting.feature b/features/voting.feature index deadbc4ea..38590c296 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -21,12 +21,14 @@ Feature: Voting tab And I should see table with 0 lines And I should see text "No delegates found" in "empty message" element + @integration Scenario: should allow to view my votes Given I'm logged in as "genesis" When I click tab number 2 And I click "my votes button" Then I should see delegates list with 101 lines + @integration Scenario: should not allow to vote if not enough funds for the fee Given I'm logged in as "empty account" When I click tab number 2 @@ -35,6 +37,7 @@ Feature: Voting tab Then I should see "Insufficient funds for 1 LSK fee" error message And "submit button" should be disabled + @integration Scenario: should display voting bar with numbers of selected votes if any selected Given I'm logged in as "delegate candidate" When I click tab number 2 @@ -82,6 +85,7 @@ Feature: Voting tab 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." + @integration Scenario: should allow to select delegates in the "Vote" dialog and vote for them Given I'm logged in as "delegate candidate" When I click tab number 2 @@ -90,6 +94,7 @@ Feature: Voting tab 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." + @integration Scenario: should allow to remove votes form delegates Given I'm logged in as "genesis" When I click tab number 2 @@ -100,6 +105,7 @@ Feature: Voting tab 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." + @integration Scenario: should allow to exit vote dialog Given I'm logged in as "genesis" When I click tab number 2 From 766466c79b18434f2454658703d106462a702850 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 21:10:29 +0100 Subject: [PATCH 4/6] Split menu.feature into multiple *.feature files --- features/menu.feature | 105 ---------------------- features/registerDelegate.feature | 35 ++++++++ features/registerSecondPassphrase.feature | 28 ++++++ features/signMessage.feature | 33 +++++++ features/verifyMessage.feature | 15 ++++ 5 files changed, 111 insertions(+), 105 deletions(-) delete mode 100644 features/menu.feature create mode 100644 features/registerDelegate.feature create mode 100644 features/registerSecondPassphrase.feature create mode 100644 features/signMessage.feature create mode 100644 features/verifyMessage.feature diff --git a/features/menu.feature b/features/menu.feature deleted file mode 100644 index 530816fa5..000000000 --- a/features/menu.feature +++ /dev/null @@ -1,105 +0,0 @@ -Feature: Top right menu - Scenario: should allow to set 2nd passphrase - Given I'm logged in as "second passphrase candidate" - When I click "register second passphrase" in main menu - And I click "next button" - And I 250 times move mouse randomly - And I remember passphrase, click "next button", fill in missing word - And I click "next button" - Then I should see alert dialog with title "Success" and text "Second passphrase registration was successfully submitted. It can take several seconds before it is processed." - - Scenario: should not allow to set 2nd passphrase again - Given I'm logged in as "second passphrase account" - Then There is no "register second passphrase" in main menu - - @integration - Scenario: should not allow to set 2nd passphrase if not enough funds for the fee - Given I'm logged in as "empty account" - When I click "register second passphrase" in main menu - Then I should see "Insufficient funds for 5 LSK fee" error message - And "next button" should be disabled - - @integration - 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 click "cancel button" - Then I should see no "modal dialog" - - Scenario: should allow to register a delegate - Given I'm logged in as "delegate candidate" - 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 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 - And There is no "register as delegate" in main menu - - Scenario: should allow to register a delegate with second passphrase - Given I'm logged in as "second passphrase account" - When I click "register as delegate" in main 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 with username: "test2". It can take several seconds before it is processed." - - @integration - 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 click "cancel button" - Then I should see no "modal dialog" - - @integration - Scenario: should not allow to register delegate if not enough funds for the fee - Given I'm logged in as "empty account" - When I click "register as delegate" in main menu - Then I should see "Insufficient funds for 25 LSK fee" error message - And "register button" should be disabled - - Scenario: should allow to sign message - Given I'm logged in as "any account" - When I click "sign message" in main menu - And I fill in "Hello world" to "message" field - And I click "primary button" - Then I should see in "result" field: - """ - -----BEGIN LISK SIGNED MESSAGE----- - -----MESSAGE----- - Hello world - -----PUBLIC KEY----- - c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f - -----SIGNATURE----- - 079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64 - -----END LISK SIGNED MESSAGE----- - """ - - @integration - 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 click "cancel button" - Then I should see no "modal dialog" - - @integration - 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 click "x button" - Then I should see no "modal dialog" - - Scenario: should allow to verify message - Given I'm logged in as "any account" - When I click "verify message" in main menu - And I fill in "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f" to "public key" field - And I fill in "079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64" to "signature" field - Then I should see "Hello world" in "result" field - - @integration - 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 click "x button" - Then I should see no "modal dialog" diff --git a/features/registerDelegate.feature b/features/registerDelegate.feature new file mode 100644 index 000000000..f5b0459c2 --- /dev/null +++ b/features/registerDelegate.feature @@ -0,0 +1,35 @@ +Feature: Register delegate + Scenario: should allow to register a delegate + Given I'm logged in as "delegate candidate" + 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 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 + And There is no "register as delegate" in main menu + + Scenario: should allow to register a delegate with second passphrase + Given I'm logged in as "second passphrase account" + When I click "register as delegate" in main 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 with username: "test2". It can take several seconds before it is processed." + + @integration + 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 click "cancel button" + Then I should see no "modal dialog" + + @integration + Scenario: should not allow to register delegate if not enough funds for the fee + Given I'm logged in as "empty account" + When I click "register as delegate" in main menu + Then I should see "Insufficient funds for 25 LSK fee" error message + And "register button" should be disabled + + diff --git a/features/registerSecondPassphrase.feature b/features/registerSecondPassphrase.feature new file mode 100644 index 000000000..66826c240 --- /dev/null +++ b/features/registerSecondPassphrase.feature @@ -0,0 +1,28 @@ +Feature: Register second passphrase + Scenario: should allow to set 2nd passphrase + Given I'm logged in as "second passphrase candidate" + When I click "register second passphrase" in main menu + And I click "next button" + And I 250 times move mouse randomly + And I remember passphrase, click "next button", fill in missing word + And I click "next button" + Then I should see alert dialog with title "Success" and text "Second passphrase registration was successfully submitted. It can take several seconds before it is processed." + + Scenario: should not allow to set 2nd passphrase again + Given I'm logged in as "second passphrase account" + Then There is no "register second passphrase" in main menu + + @integration + Scenario: should not allow to set 2nd passphrase if not enough funds for the fee + Given I'm logged in as "empty account" + When I click "register second passphrase" in main menu + Then I should see "Insufficient funds for 5 LSK fee" error message + And "next button" should be disabled + + @integration + 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 click "cancel button" + Then I should see no "modal dialog" + diff --git a/features/signMessage.feature b/features/signMessage.feature new file mode 100644 index 000000000..142b955e9 --- /dev/null +++ b/features/signMessage.feature @@ -0,0 +1,33 @@ +Feature: Sign message + Scenario: should allow to sign message + Given I'm logged in as "any account" + When I click "sign message" in main menu + And I fill in "Hello world" to "message" field + And I click "primary button" + Then I should see in "result" field: + """ + -----BEGIN LISK SIGNED MESSAGE----- + -----MESSAGE----- + Hello world + -----PUBLIC KEY----- + c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f + -----SIGNATURE----- + 079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64 + -----END LISK SIGNED MESSAGE----- + """ + + @integration + 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 click "cancel button" + Then I should see no "modal dialog" + + @integration + 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 click "x button" + Then I should see no "modal dialog" + + diff --git a/features/verifyMessage.feature b/features/verifyMessage.feature new file mode 100644 index 000000000..fc2098a55 --- /dev/null +++ b/features/verifyMessage.feature @@ -0,0 +1,15 @@ +Feature: Verify message + Scenario: should allow to verify message + Given I'm logged in as "any account" + When I click "verify message" in main menu + And I fill in "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f" to "public key" field + And I fill in "079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64" to "signature" field + Then I should see "Hello world" in "result" field + + @integration + 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 click "x button" + Then I should see no "modal dialog" + From 0a6a1c45cb3fc3fca8b0887b7d83c3e735b463c9 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 21:42:34 +0100 Subject: [PATCH 5/6] Make unstable e2e scenario temporarily @pending --- features/voting.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/voting.feature b/features/voting.feature index 38590c296..56a6d0aa7 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -86,6 +86,7 @@ Feature: Voting tab 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." @integration + @pending Scenario: should allow to select delegates in the "Vote" dialog and vote for them Given I'm logged in as "delegate candidate" When I click tab number 2 From 96d7555d687f2c7b1c2781b0ea63b6a10c6ac41b Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 9 Nov 2017 09:27:49 +0100 Subject: [PATCH 6/6] Move menu.step.js code to generic.step.js ... because there is no menu.feature anymore --- features/step_definitions/generic.step.js | 20 +++++++++++++++ features/step_definitions/menu.step.js | 30 ----------------------- 2 files changed, 20 insertions(+), 30 deletions(-) delete mode 100644 features/step_definitions/menu.step.js diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index ae58a643a..6c976a2c7 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -199,5 +199,25 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { When('I scroll to the bottom', () => { browser.executeScript('window.scrollBy(0, 10000);'); }); + + When('I click "{itemSelector}" in main menu', (itemSelector, callback) => { + waitForElemAndClickIt('.main-menu-icon-button'); + browser.sleep(1000); + waitForElemAndClickIt(`.${itemSelector.replace(/ /g, '-')}`); + browser.sleep(1000).then(callback); + }); + + Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => { + waitForElemAndClickIt('.main-menu-icon-button'); + browser.sleep(500); + expect(element.all(by.css(`md-menu-item .md-button.${itemSelector.replace(/ /g, '-')}`)).count()).to.eventually.equal(0) + .and.notify(callback); + }); + + Then('I should see in "{fieldName}" field:', (fieldName, value, callback) => { + const elem = element(by.css(`.${fieldName.replace(/ /g, '-')} textarea`)); + expect(elem.getAttribute('value')).to.eventually.equal(value) + .and.notify(callback); + }); }); diff --git a/features/step_definitions/menu.step.js b/features/step_definitions/menu.step.js deleted file mode 100644 index 14a76d194..000000000 --- a/features/step_definitions/menu.step.js +++ /dev/null @@ -1,30 +0,0 @@ -/* eslint-disable import/no-extraneous-dependencies */ -const { defineSupportCode } = require('cucumber'); -const chai = require('chai'); -const chaiAsPromised = require('chai-as-promised'); -const { waitForElemAndClickIt } = require('../support/util.js'); - -chai.use(chaiAsPromised); -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, '-')}`); - browser.sleep(1000).then(callback); - }); - - Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => { - waitForElemAndClickIt('.main-menu-icon-button'); - browser.sleep(500); - expect(element.all(by.css(`md-menu-item .md-button.${itemSelector.replace(/ /g, '-')}`)).count()).to.eventually.equal(0) - .and.notify(callback); - }); - - Then('I should see in "{fieldName}" field:', (fieldName, value, callback) => { - const elem = element(by.css(`.${fieldName.replace(/ /g, '-')} textarea`)); - expect(elem.getAttribute('value')).to.eventually.equal(value) - .and.notify(callback); - }); -});