This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #966 from LiskHQ/573-multi-account-management
Allow to save and manage multiple accounts in local storage - Closes #573
- Loading branch information
Showing
35 changed files
with
726 additions
and
437 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Feature: Saved Accounts | ||
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 "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 | ||
And I wait 2 seconds | ||
Then I should be logged in | ||
And I click "send button" | ||
And I should see empty "passphrase" field | ||
And I fill in "1" to "amount" field | ||
And I fill in "537318935439898807L" to "recipient" field | ||
And I fill in passphrase of "genesis" to "passphrase" field | ||
And I click "submit button" | ||
And I click "ok button" | ||
And I wait 1 seconds | ||
And I click "send button" | ||
And I fill in "2" to "amount" field | ||
And I fill in "537318935439898807L" to "recipient" field | ||
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 save second account | ||
Given I'm logged in as "genesis" | ||
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 click "logout button" | ||
And I'm logged in as "empty account" | ||
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 "empty account" account | ||
|
||
Scenario: should allow to forget second account | ||
Given I'm logged in as "genesis" | ||
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 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 "saved accounts" in main menu | ||
And I click "add active account button" | ||
And I click "x button" | ||
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 | ||
|
||
Scenario: should login to last active saved account | ||
Given I'm logged in as "genesis" | ||
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 click "logout button" | ||
And I'm logged in as "empty account" | ||
And I click "saved accounts" in main menu | ||
And I click "add active account button" | ||
And I click "x button" | ||
And I refresh the page | ||
And I should be logged in as "empty account" account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const { defineSupportCode } = require('cucumber'); | ||
const { waitForElemAndCheckItsText } = require('../support/util.js'); | ||
|
||
defineSupportCode(({ Given, Then }) => { | ||
defineSupportCode(({ Given }) => { | ||
Given('I\'m on login page', (callback) => { | ||
browser.get(browser.params.baseURL).then(callback); | ||
}); | ||
|
||
Then('I should be logged in', (callback) => { | ||
waitForElemAndCheckItsText('.logout-button', 'LOGOUT', callback); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,58 @@ | ||
import actionTypes from '../constants/actions'; | ||
import { getSavedAccount, setSavedAccount, removeSavedAccount } from '../utils/saveAccount'; | ||
import { | ||
getSavedAccounts, | ||
setSavedAccount, | ||
removeSavedAccount, | ||
setLastActiveAccount, | ||
getLastActiveAccount, | ||
} from '../utils/savedAccounts'; | ||
|
||
/** | ||
* An action to dispatch accountSaved | ||
* | ||
*/ | ||
export const accountSaved = (data) => { | ||
setSavedAccount(data); | ||
export const accountSaved = (account) => { | ||
setSavedAccount(account); | ||
setLastActiveAccount(account); | ||
return { | ||
data, | ||
data: account, | ||
type: actionTypes.accountSaved, | ||
}; | ||
}; | ||
|
||
/** | ||
* An action to dispatch accountRemoved | ||
*/ | ||
export const accountRemoved = (publicKey) => { | ||
removeSavedAccount(publicKey); | ||
export const accountRemoved = (account) => { | ||
removeSavedAccount(account); | ||
return { | ||
data: publicKey, | ||
data: account, | ||
type: actionTypes.accountRemoved, | ||
}; | ||
}; | ||
|
||
/** | ||
* An action to dispatch accountSwitched | ||
*/ | ||
export const accountSwitched = (account) => { | ||
setLastActiveAccount(account); | ||
return { | ||
data: account, | ||
type: actionTypes.accountSwitched, | ||
}; | ||
}; | ||
|
||
/** | ||
* The action to initiate savedAccounts store with the retrieved accounts | ||
* | ||
* @todo since the utility returns only one item, this action puts it in the array | ||
* eventually it should receive an array and return that to reducer | ||
* | ||
*/ | ||
export const accountsRetrieved = () => { | ||
const accounts = getSavedAccount(); | ||
const data = accounts !== undefined ? accounts : []; | ||
return { | ||
data, | ||
type: actionTypes.accountsRetrieved, | ||
}; | ||
}; | ||
export const accountsRetrieved = () => ({ | ||
data: { | ||
accounts: getSavedAccounts(), | ||
lastActive: getLastActiveAccount(), | ||
}, | ||
type: actionTypes.accountsRetrieved, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.