Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/ddw 242 Step for active restore notification is too fragile #885

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Changelog

- Added acceptance tests for displaying transactions in various contexts ([PR 870](https://github.com/input-output-hk/daedalus/pull/870))
- Refactored various magic numbers & strings into constants ([PR 881](https://github.com/input-output-hk/daedalus/pull/881))
- Fixed wallet restoration and import fragile acceptance tests steps definitions ([PR 885](https://github.com/input-output-hk/daedalus/pull/885))

## 0.10.0

Expand Down
15 changes: 12 additions & 3 deletions features/step_definitions/wallets-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import sidebar from '../support/helpers/sidebar-helpers';
import addWalletPage from '../support/helpers/add-wallet-page-helpers';
import importWalletDialog from '../support/helpers/dialogs/import-wallet-dialog-helpers';
import i18n from '../support/helpers/i18n-helpers';
import { waitForActiveRestoreNotification } from '../support/helpers/notifications-helpers';
import {
isActiveWalletBeingRestored,
waitForActiveRestoreNotification
} from '../support/helpers/notifications-helpers';

const defaultWalletKeyFilePath = path.resolve(__dirname, '../support/default-wallet.key');
const defaultWalletJSONFilePath = path.resolve(__dirname, '../support/default-wallet.json');
Expand Down Expand Up @@ -352,15 +355,21 @@ Then(/^I should not see the restore wallet dialog anymore$/, function () {
});

Then(/^I should see the restore status notification while import is running$/, async function () {
await waitForActiveRestoreNotification(this.client);
// Only check the rendered DOM if the restore is still in progress
if (await isActiveWalletBeingRestored(this.client)) {
await waitForActiveRestoreNotification(this.client);
}
});

Then(/^I should not see the restore status notification once import is finished$/, async function () {
await waitForActiveRestoreNotification(this.client, { isHidden: true });
});

Then(/^I should see the restore status notification while restore is running$/, async function () {
await waitForActiveRestoreNotification(this.client);
// Only check the rendered DOM if the restore is still in progress
if (await isActiveWalletBeingRestored(this.client)) {
await waitForActiveRestoreNotification(this.client);
}
});

Then(/^I should not see the restore status notification once restore is finished$/, async function () {
Expand Down
9 changes: 9 additions & 0 deletions features/support/helpers/notifications-helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { syncStateTags } from '../../../source/renderer/app/domains/Wallet';

export const isActiveWalletBeingRestored = async (client) => {
const result = await client.execute((expectedSyncTag) => (
daedalus.stores.ada.wallets.active.syncState.tag === expectedSyncTag
), syncStateTags.RESTORING);
return result.value;
};

export const waitForActiveRestoreNotification = (client, { isHidden } = {}) => (
client.waitForVisible('.ActiveRestoreNotification', null, isHidden)
);