diff --git a/features/accountManagement.feature b/features/accountManagement.feature index f4cccbc62..155825de3 100644 --- a/features/accountManagement.feature +++ b/features/accountManagement.feature @@ -1,8 +1,9 @@ Feature: Account management Scenario: should allow to save account locally, after page reload it should require passphrase to do the first transaction, and remember the passphrase for next transactions Given I'm logged in as "genesis" - When I click "save account" in main menu - And I click "save account button" + When I click "saved accounts" in main menu + And I click "add active account button" + And I click "x button" And I wait 1 seconds And I should see text "Account saved" in "toast" element And I refresh the page @@ -22,83 +23,59 @@ Feature: Account management And I click "submit button" And I should see alert dialog with title "Success" and text "Your transaction of 2 LSK to 537318935439898807L was accepted and will be processed in a few seconds." - Scenario: should allow to forget locally saved account - 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 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 should be on login page - - 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" - - 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 - And I click "x button" - Then I should see no "modal dialog" - - @pending Scenario: should allow to save second account Given I'm logged in as "genesis" - When I click "save account" in main menu - And I click "save account button" + When I click "saved accounts" in main menu + And I click "add active account button" And I click "x button" - And I log out - And I log in as "delegate" - And I click "save account" in main menu - And I click "save account button" - Then I should see table with 2 lines + And I wait 1 seconds + And I click "logout button" + And I'm logged in as "delegate" + And I click "saved accounts" in main menu + And I click "add active account button" + Then I should see "saved accounts table" table with 2 lines And I refresh the page And I wait 2 seconds And I should be logged in as "genesis" account - @pending Scenario: should allow to forget second account Given I'm logged in as "genesis" - When I click "save account" in main menu - And I click "save account button" + When I click "saved accounts" in main menu + And I click "add active account button" And I click "x button" - And I log out - And I log in as "delegate" - And I click "save account" in main menu - And I click "save account button" - And I should see table with 2 lines - And I click "forget account button" - Then I should see table with 1 lines + And I wait 1 seconds + And I click "logout button" + And I'm logged in as "delegate" + And I click "saved accounts" in main menu + And I click "add active account button" + And I should see "saved accounts table" table with 2 lines + And I click "forget button" + Then I should see "saved accounts table" table with 1 lines - @pending Scenario: should allow to switch account Given I'm logged in as "genesis" - When I click "save account" in main menu - And I click "save account button" - And I log out - And I log in as "delegate" - And I click "save account" in main menu - And I click "save account button" + When I click "saved accounts" in main menu + And I click "add active account button" And I click "x button" - And I select option no. 1 from "account" select - And I should be logged in as "delegate" account + And I wait 1 seconds + And I click "logout button" + And I'm logged in as "delegate" + And I click "saved accounts" in main menu + And I click "add active account button" + And I click "switch button" + And I wait 1 seconds + And I should be logged in as "genesis" account @pending - Scenario: should allow to set default account + Scenario: should login to last active saved account Given I'm logged in as "genesis" - When I click "save account" in main menu - And I click "save account button" + When I click "saved accounts" in main menu + And I click "add active account button" And I click "x button" - And I log out - And I log in as "delegate" - And I click "save account" in main menu - And I click "save account button" - And I click "set as default button" - And I select option no. 1 from "account" select + And I wait 1 seconds + And I click "logout button" + And I'm logged in as "delegate" + And I click "saved accounts" in main menu + And I click "add active account button" And I refresh the page - And I should be logged in as "genesis" account + And I should be logged in as "delegate" account diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 8e96e9386..088846915 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -99,6 +99,13 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { .and.notify(callback); }); + Then('I should see "{elementName}" table with {lineCount} lines', (elementName, lineCount, callback) => { + browser.sleep(500); + expect(element.all(by.css(`table.${elementName.replace(/ /g, '-')} tbody tr`)).count()).to.eventually.equal(parseInt(lineCount, 10)) + .and.notify(callback); + }); + + Then('I should see no "{elementName}"', (elementName, callback) => { const selector = `.${elementName.replace(/ /g, '-')}`; waitForElemRemoved(selector).then(() => { @@ -139,7 +146,6 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { }); Given('I\'m logged in as "{accountName}"', { timeout: 2 * defaultTimeout }, (accountName, callback) => { - browser.get(browser.params.baseURL); const passphrase = browser.params.useTestnetPassphrase ? browser.params.testnetPassphrase : accounts[accountName].passphrase; @@ -203,5 +209,9 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { Then('I should be logged in', (callback) => { waitForElemAndCheckItsText('.logout-button', 'LOGOUT', callback); }); + + Then('I should be logged in as "{accountName}" account', (accountName, callback) => { + waitForElemAndCheckItsText('.full.address', accounts[accountName].address, callback); + }); }); diff --git a/features/step_definitions/hooks.js b/features/step_definitions/hooks.js index 60a4b3892..8ade23514 100644 --- a/features/step_definitions/hooks.js +++ b/features/step_definitions/hooks.js @@ -41,6 +41,7 @@ defineSupportCode(({ Before, After }) => { localStorage.clear(); localStorage.setItem('address', browser.params.liskCoreURL); localStorage.setItem('network', networks[browser.params.network].code); + browser.get(browser.params.baseURL); callback(); }); diff --git a/src/components/header/header.js b/src/components/header/header.js index 86ac4f3e9..b82455285 100644 --- a/src/components/header/header.js +++ b/src/components/header/header.js @@ -53,7 +53,7 @@ const Header = props => ( - {props.t('Saved accounts')} diff --git a/src/components/saveAccount/saveAccount.js b/src/components/saveAccount/saveAccount.js index 771801bee..2091c41bd 100644 --- a/src/components/saveAccount/saveAccount.js +++ b/src/components/saveAccount/saveAccount.js @@ -36,7 +36,7 @@ const SaveAccount = ({ {t('This will save public key of your account on this device, so next time it will launch without the need to log in. However, you will be prompted to enter the passphrase once you want to do any transaction.')} :
- +
{t('Switch')} {t('Address')}