Skip to content

Commit

Permalink
[DDW-1180] Add E2E tests for wallet resync feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomislav Horaček committed Jan 17, 2020
1 parent 2ab1bbe commit 31940f1
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/settings/e2e/features/wallet-settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,24 @@ Feature: Wallet Settings
| キュビズム |
And I click outside "name" input field
Then I should see new wallet name "キュビズム"

Scenario: User force Rewards Wallet resync
Given I am on the "first" wallet "settings" screen
When I click "Resync wallet" button
And I see "Resync wallet" button spinner
Then I should see the restore status notification while restore is running
And I should not see the restore status notification once restore is finished
And I should not see "Resync wallet" button spinner anymore

@watch
Scenario: User force Balance Wallet resync
Given I restore "Test balance Wallet" balance wallet with funds
And I am on the "Test balance Wallet" wallet "settings" screen
And I should not see the restore status notification once restore is finished
When I click "Resync wallet" button
And I see "Resync wallet" button spinner
Then I should see the restore status notification while restore is running
And I should not see the restore status notification once restore is finished
And I should not see "Resync wallet" button spinner anymore


12 changes: 12 additions & 0 deletions tests/settings/e2e/steps/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,15 @@ Then(
return this.client.waitForVisible('.ChangeSpendingPasswordDialog_error');
}
);

When(/^I click "Resync wallet" button$/, function() {
return this.client.click('.ResyncWalletButton_root');
});

When(/^I see "Resync wallet" button spinner$/, function() {
return this.client.waitForVisible('.ResyncWalletButton_isSubmitting');
});

When(/^I should not see "Resync wallet" button spinner anymore$/, function() {
return this.client.waitForVisible('.ResyncWalletButton_isSubmitting', null, true);
});
18 changes: 18 additions & 0 deletions tests/wallets/e2e/steps/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ const createWalletsSequentially = async (wallets: Array<any>, context: Object) =
}
};

export const restoreLegacyWallet = async (client: Object, { walletName, recoveryPhrase }: { walletName: string, hasFunds?: boolean, recoveryPhrase?: Array<string> }) =>
client.executeAsync((name, recoveryPhrase, done) => {
daedalus.api.ada
.restoreByronRandomWallet({
walletName: name,
recoveryPhrase:
recoveryPhrase || ['arctic', 'decade', 'pink', 'easy', 'jar', 'index', 'base', 'bright', 'vast', 'ocean', 'hard', 'pizza'],
spendingPassword: 'Secret1234',
})
.then(() =>
daedalus.stores.wallets
.refreshWalletsData()
.then(done)
.catch(error => done(error))
)
.catch(error => done(error));
}, walletName, recoveryPhrase);

export const fillOutWalletSendForm = async function(values: Object) {
const formSelector = '.WalletSendForm_component';
await this.client.setValue(
Expand Down
7 changes: 7 additions & 0 deletions tests/wallets/e2e/steps/wallets.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
waitUntilWalletIsLoaded,
addOrSetWalletsForScenario,
restoreWalletWithFunds,
restoreLegacyWallet,
waitUntilUrlEquals,
navigateTo,
i18n,
Expand Down Expand Up @@ -391,6 +392,12 @@ When(/^I try to import the wallet with funds again$/, async function() {
this.waitAndClick('.Dialog_actions button');
});

Given(/^I restore "([^"]*)" balance wallet with funds$/, async function(walletName) {
await restoreLegacyWallet(this.client, { walletName });
const wallet = await waitUntilWalletIsLoaded.call(this, walletName);
addOrSetWalletsForScenario.call(this, wallet);
});

Then(
/^I should see section "([^"]*)"$/,
async function(text) {
Expand Down

0 comments on commit 31940f1

Please sign in to comment.