Skip to content

Commit 50dc461

Browse files
authored
test(extension): add tests for creating paper wallet via 'Add new wallet' flow (#1445)
1 parent 62bfcee commit 50dc461

11 files changed

+197
-42
lines changed

packages/e2e-tests/src/assert/AddNewWalletAssert.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AddNewWalletAssert {
2525
await AddNewWalletMainModal.container.waitForDisplayed({ reverse: true });
2626
}
2727

28-
async assertSeeWalletSetupPageInModal() {
28+
async assertSeeWalletSetupPageInModal(flow: 'Create' | 'Create paper wallet' | 'Restore') {
2929
await AddNewWalletMainModal.container.waitForDisplayed({ timeout: 5000 });
3030
await AddNewWalletMainModal.closeButton.waitForEnabled();
3131
await OnboardingWalletSetupPageAssert.assertSeeStepTitle(await t('core.walletNameAndPasswordSetupStep.title'));
@@ -35,7 +35,7 @@ class AddNewWalletAssert {
3535
await OnboardingWalletSetupPageAssert.assertSeeWalletNameInput();
3636
await OnboardingWalletSetupPageAssert.assertSeePasswordInput();
3737
await OnboardingWalletSetupPageAssert.assertSeeBackButton();
38-
await OnboardingWalletSetupPageAssert.assertSeeEnterWalletButton();
38+
await OnboardingWalletSetupPageAssert.assertSeeEnterWalletButton(flow === 'Create paper wallet');
3939
}
4040

4141
async asserSeeConnectYourDevicePageInModal() {
@@ -60,11 +60,10 @@ class AddNewWalletAssert {
6060
expect(await CancelAddingNewWalletDialog.title.getText()).to.equal(
6161
await t('core.multiWallet.confirmationDialog.title')
6262
);
63-
// TODO: uncomment when https://github.com/input-output-hk/lace-ui-toolkit/pull/31 is merged and released
64-
// await CancelAddingNewWalletDialog.description.waitForDisplayed();
65-
// expect(await CancelAddingNewWalletDialog.description.getText()).to.equal(
66-
// await t('core.multiWallet.confirmationDialog.description')
67-
// );
63+
await CancelAddingNewWalletDialog.description.waitForDisplayed();
64+
expect(await CancelAddingNewWalletDialog.description.getText()).to.equal(
65+
await t('core.multiWallet.confirmationDialog.description')
66+
);
6867
await CancelAddingNewWalletDialog.goBackButton.waitForDisplayed();
6968
expect(await CancelAddingNewWalletDialog.goBackButton.getText()).to.equal(
7069
await t('core.multiWallet.confirmationDialog.cancel')
@@ -75,12 +74,6 @@ class AddNewWalletAssert {
7574
);
7675
}
7776
}
78-
79-
async assertSeeChooseRecoveryMethodPageInModal() {
80-
await AddNewWalletMainModal.container.waitForDisplayed({ timeout: 5000 });
81-
await AddNewWalletMainModal.closeButton.waitForEnabled();
82-
// TODO: add proper assertions when paper wallet feature is ready
83-
}
8477
}
8578

8679
export default new AddNewWalletAssert();

packages/e2e-tests/src/assert/onboarding/ChooseRecoveryMethodPageAssert.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ import ChooseRecoveryMethodPage from '../../elements/onboarding/ChooseRecoveryMe
33
import { t } from '../../utils/translationService';
44
import { expect } from 'chai';
55
import { TimelineSteps } from '../../enums/Onboarding';
6+
import AddNewWalletMainModal from '../../elements/addNewWallet/MainModal';
67

78
class ChooseRecoveryMethodPageAssert extends OnboardingCommonAssert {
8-
async assertSeeChooseRecoveryMethodPage(flowType: 'Create' | 'Restore') {
9+
async assertSeeChooseRecoveryMethodPage(flowType: 'Create' | 'Restore', isModal = false) {
10+
if (isModal) {
11+
await AddNewWalletMainModal.container.waitForDisplayed({ timeout: 5000 });
12+
await AddNewWalletMainModal.closeButton.waitForEnabled();
13+
} else {
14+
await this.assertSeeHelpAndSupportButton();
15+
await this.assertSeeLegalLinks();
16+
}
917
await this.assertSeeStepTitle(await t('paperWallet.chooseRecoveryMethod.title'));
1018
const expectedDescription =
1119
flowType === 'Create'
@@ -24,11 +32,9 @@ class ChooseRecoveryMethodPageAssert extends OnboardingCommonAssert {
2432

2533
await this.assertSeeBackButton();
2634
await this.assertNextButtonTextEquals(await t('core.walletSetupStep.next'));
27-
await this.assertSeeHelpAndSupportButton();
28-
await this.assertSeeLegalLinks();
2935
}
3036

31-
private async assertSeePaperWalletOption(flowType: 'Create' | 'Restore') {
37+
async assertSeePaperWalletOption(flowType: 'Create' | 'Restore') {
3238
await ChooseRecoveryMethodPage.paperWalletRadioButton.waitForDisplayed();
3339
await ChooseRecoveryMethodPage.paperWalletLabel.waitForDisplayed();
3440
expect(await ChooseRecoveryMethodPage.paperWalletLabel.getText()).to.equal(
@@ -52,7 +58,7 @@ class ChooseRecoveryMethodPageAssert extends OnboardingCommonAssert {
5258
}
5359
}
5460

55-
private async assertSeeRecoveryPhraseOption() {
61+
async assertSeeRecoveryPhraseOption() {
5662
await ChooseRecoveryMethodPage.recoveryPhraseRadioButton.waitForDisplayed();
5763
await ChooseRecoveryMethodPage.recoveryPhraseLabel.waitForDisplayed();
5864
expect(await ChooseRecoveryMethodPage.recoveryPhraseLabel.getText()).to.equal(

packages/e2e-tests/src/assert/onboarding/SaveYourPaperWalletPageAssert.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ import { t } from '../../utils/translationService';
33
import { TimelineSteps } from '../../enums/Onboarding';
44
import SaveYourPaperWalletPage from '../../elements/onboarding/SaveYourPaperWalletPage';
55
import { expect } from 'chai';
6+
import AddNewWalletMainModal from '../../elements/addNewWallet/MainModal';
67

78
class SaveYourPaperWalletPageAssert extends OnboardingCommonAssert {
8-
async assertSeeSaveYourPaperWalletPage(expectedPaperWalletName: string) {
9+
async assertSeeSaveYourPaperWalletPage(expectedPaperWalletName: string, isModal = false) {
10+
if (isModal) {
11+
await AddNewWalletMainModal.container.waitForDisplayed({ timeout: 5000 });
12+
await AddNewWalletMainModal.closeButton.waitForEnabled();
13+
} else {
14+
await this.assertSeeHelpAndSupportButton();
15+
await this.assertSeeLegalLinks();
16+
}
17+
918
await this.assertSeeStepTitle(await t('paperWallet.savePaperWallet.title'));
1019
await this.assertSeeStepSubtitle(await t('paperWallet.savePaperWallet.description'));
1120
await this.assertSeeActiveStepOnProgressTimeline(TimelineSteps.WALLET_SETUP);
@@ -54,9 +63,6 @@ class SaveYourPaperWalletPageAssert extends OnboardingCommonAssert {
5463
expect(await SaveYourPaperWalletPage.openWalletButton.getText()).to.equal(
5564
await t('core.walletSetupStep.enterWallet')
5665
);
57-
58-
await this.assertSeeHelpAndSupportButton();
59-
await this.assertSeeLegalLinks();
6066
}
6167

6268
async assertOpenWalletButtonEnabled(shouldBeEnabled: boolean): Promise<void> {

packages/e2e-tests/src/assert/onboarding/SecureYourPaperWalletPageAssert.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ import { TimelineSteps } from '../../enums/Onboarding';
33
import { t } from '../../utils/translationService';
44
import SecureYourPaperWalletPage from '../../elements/onboarding/SecureYourPaperWalletPage';
55
import { expect } from 'chai';
6+
import AddNewWalletMainModal from '../../elements/addNewWallet/MainModal';
67

78
class SecureYourPaperWalletPageAssert extends OnboardingCommonAssert {
8-
async assertSeeSecureYourPaperWalletPage() {
9+
async assertSeeSecureYourPaperWalletPage(isModal = false) {
10+
if (isModal) {
11+
await AddNewWalletMainModal.container.waitForDisplayed({ timeout: 5000 });
12+
await AddNewWalletMainModal.closeButton.waitForEnabled();
13+
} else {
14+
await this.assertSeeHelpAndSupportButton();
15+
await this.assertSeeLegalLinks();
16+
}
17+
918
await this.assertSeeStepTitle(await t('paperWallet.securePaperWallet.title'));
1019
await this.assertSeeStepSubtitle(await t('paperWallet.securePaperWallet.description'));
1120
await this.assertSeeActiveStepOnProgressTimeline(TimelineSteps.RECOVERY_SETUP);
@@ -23,8 +32,6 @@ class SecureYourPaperWalletPageAssert extends OnboardingCommonAssert {
2332

2433
await this.assertSeeBackButton();
2534
await this.assertNextButtonTextEquals(await t('core.walletSetupStep.next'));
26-
await this.assertSeeHelpAndSupportButton();
27-
await this.assertSeeLegalLinks();
2835
}
2936

3037
async assertSeeFingerprint(expectedFingerprint: string) {

packages/e2e-tests/src/features/AddNewWalletCreate.part1.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Feature: Add new wallet - Create wallet
4040
Given I opened "Create" flow via "Add new wallet" feature
4141
And I click "Next" button during wallet setup
4242
When I click "Back" button during wallet setup
43-
Then "Choose recovery method" page is displayed in modal
43+
Then "Choose recovery method" page is displayed in modal for "Create" flow
4444

4545
@LW-9348
4646
Scenario: Extended-view - Multi-wallet - Create - "Enter your recovery phrase" page - Back button click

packages/e2e-tests/src/features/AddNewWalletCreate.part2.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Feature: Add new wallet - Create wallet
3434
Given I opened "Create" flow via "Add new wallet" feature
3535
When I go to "Mnemonic verification" page from "Create" wallet flow and fill values
3636
And I click "Next" button during wallet setup
37-
Then "Wallet setup" page is displayed in modal
37+
Then "Let's set up your new wallet" page is displayed in modal for "Create" flow
3838
And "Wallet setup" step is marked as active on progress timeline
3939
When I click "Back" button during wallet setup
4040
Then "Mnemonic verification" page is displayed from "Create wallet" flow with 24 words
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
@AddNewWalletCreatePaperWallet @Testnet @Mainnet
2+
Feature: Add new wallet - Create paper wallet
3+
4+
Background:
5+
Given Lace is ready for test
6+
7+
@LW-11327
8+
Scenario: Add new wallet - Create - "Choose recovery method" page is displayed
9+
When I opened "Create" flow via "Add new wallet" feature
10+
Then "Choose recovery method" page is displayed in modal for "Create" flow
11+
12+
@LW-11328
13+
Scenario: Add new wallet - Create - Choose recovery method - Paper Wallet - click "Next" button
14+
When I opened "Create" flow via "Add new wallet" feature
15+
And I select "Paper wallet" as a recovery method
16+
And I click "Next" button during wallet setup
17+
Then "Secure your paper wallet" page is displayed in modal
18+
19+
@LW-11329
20+
Scenario: Add new wallet - Create - Choose recovery method - Paper Wallet - click "Back" button
21+
When I opened "Create" flow via "Add new wallet" feature
22+
And I click "Back" button during wallet setup
23+
Then I see onboarding main screen within modal over the active Lace page in expanded view
24+
25+
@LW-11332
26+
Scenario: Add new wallet - Create - Secure your paper wallet - click "Back" button
27+
When I opened "Create" flow via "Add new wallet" feature
28+
And I select "Paper wallet" as a recovery method
29+
And I click "Next" button during wallet setup
30+
And I click "Back" button during wallet setup
31+
Then "Choose recovery method" page is displayed in modal for "Create" flow
32+
33+
@LW-11333
34+
Scenario: Add new wallet - Create - Paper Wallet - Secure your paper wallet - enter valid public PGP key
35+
When I opened "Create" flow via "Add new wallet" feature
36+
And I select "Paper wallet" as a recovery method
37+
And I click "Next" button during wallet setup
38+
And I enter valid key into "Your PUBLIC PGP key block" input
39+
Then public PGP key fingerprint is displayed: "F960 B291 7BFB A908 C031 A5AA 23E4 0848 BAB6 E1CB"
40+
And "Next" button is enabled during onboarding process
41+
42+
@LW-11334
43+
Scenario Outline: Add new wallet - Create - Paper Wallet - Secure your paper wallet - enter invalid public PGP key - <error_case>
44+
When I opened "Create" flow via "Add new wallet" feature
45+
And I select "Paper wallet" as a recovery method
46+
And I click "Next" button during wallet setup
47+
And I enter <error_case> into "Your PUBLIC PGP key block" input
48+
Then error message is displayed for public PGP key input with <error_case>
49+
And "Next" button is disabled during onboarding process
50+
Examples:
51+
| error_case |
52+
| malformed key |
53+
| private key |
54+
| too weak key |
55+
56+
@LW-11336
57+
Scenario: Add new wallet - Create - Secure your paper wallet - click "Next" button
58+
When I opened "Create" flow via "Add new wallet" feature
59+
And I select "Paper wallet" as a recovery method
60+
And I click "Next" button during wallet setup
61+
And I enter "Paper Wallet Test 1" into "PGP key name" input
62+
And I enter valid key into "Your PUBLIC PGP key block" input
63+
And I click "Next" button during wallet setup
64+
Then "Let's set up your new wallet" page is displayed in modal for "Create paper wallet" flow
65+
66+
@LW-11337
67+
Scenario: Add new wallet - Create - Paper Wallet - Let's set up your new wallet - click "Generate paper wallet" button
68+
When I opened "Create" flow via "Add new wallet" feature
69+
And I select "Paper wallet" as a recovery method
70+
And I click "Next" button during wallet setup
71+
And I enter "Paper Wallet Test 1" into "PGP key name" input
72+
And I enter valid key into "Your PUBLIC PGP key block" input
73+
And I click "Next" button during wallet setup
74+
And I enter wallet name: "Wallet 1", password: "N_8J@bne87A" and password confirmation: "N_8J@bne87A"
75+
Then "Generate paper wallet" button is enabled
76+
When I click "Generate paper wallet" button
77+
Then "Save your paper wallet" page is displayed in modal with "Wallet_1_PaperWallet.pdf" file name
78+
79+
@LW-11338
80+
Scenario: Add new wallet - Create - Paper Wallet - Let's set up your wallet - click "Back" button
81+
When I opened "Create" flow via "Add new wallet" feature
82+
And I select "Paper wallet" as a recovery method
83+
And I click "Next" button during wallet setup
84+
And I enter "Paper Wallet Test 1" into "PGP key name" input
85+
And I enter valid key into "Your PUBLIC PGP key block" input
86+
And I click "Next" button during wallet setup
87+
And I click "Back" button during wallet setup
88+
Then "Secure your paper wallet" page is displayed in modal
89+
90+
@LW-11341
91+
Scenario: Add new wallet - Create - Paper wallet - Save your paper wallet - click "Open wallet" button
92+
When I opened "Create" flow via "Add new wallet" feature
93+
And I select "Paper wallet" as a recovery method
94+
And I click "Next" button during wallet setup
95+
And I enter "Paper Wallet Test 1" into "PGP key name" input
96+
And I enter valid key into "Your PUBLIC PGP key block" input
97+
And I click "Next" button during wallet setup
98+
And I enter wallet name: "Paper Wallet 1", password: "N_8J@bne87A" and password confirmation: "N_8J@bne87A"
99+
And I click "Generate paper wallet" button
100+
Then "Open wallet" button is disabled on "Save your paper wallet" page
101+
When I click on "Download" button on "Save your paper wallet" page
102+
And I click on "Open wallet" button on "Save your paper wallet" page
103+
And I wait for main loader to disappear
104+
Then I see LW homepage
105+
And "Paper Wallet 1" is displayed as a wallet name on the menu button
106+
When I click the menu button
107+
Then Wallet number 2 with "Paper Wallet 1" name is displayed on the user menu
108+
109+
@LW-11342
110+
Scenario: Add new wallet - Create - Paper wallet - Choose recovery method - click "Learn more" link
111+
When I opened "Create" flow via "Add new wallet" feature
112+
And I select "Paper wallet" as a recovery method
113+
And I click "Learn more" link on "Choose recovery method" page
114+
Then FAQ page is displayed

packages/e2e-tests/src/features/AddNewWalletRestore.feature

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: Add new wallet - Restore wallet
77
@LW-9368
88
Scenario: Extended-view - Multi-wallet - Restore - Restore button click
99
When I opened "Restore" flow via "Add new wallet" feature
10-
Then "Choose recovery method" page is displayed in modal
10+
Then "Choose recovery method" page is displayed in modal for "Restore" flow
1111
And "Recovery method" step is marked as active on progress timeline
1212
And "Next" button is enabled during onboarding process
1313

@@ -16,7 +16,7 @@ Feature: Add new wallet - Restore wallet
1616
Given I opened "Restore" flow via "Add new wallet" feature
1717
And I click "Next" button during wallet setup
1818
When I click "Back" button during wallet setup
19-
Then "Choose recovery method" page is displayed in modal
19+
Then "Choose recovery method" page is displayed in modal for "Restore" flow
2020

2121
@LW-9383
2222
Scenario: Extended-view - Multi-wallet - Restore - "Enter your recovery phrase" page - Mnemonic fill - paste from clipboard
@@ -61,7 +61,7 @@ Feature: Add new wallet - Restore wallet
6161
Given I opened "Restore" flow via "Add new wallet" feature
6262
When I go to "Mnemonic verification" page from "Restore" wallet flow and fill values
6363
And I click "Next" button during wallet setup
64-
Then "Wallet setup" page is displayed in modal
64+
Then "Let's set up your new wallet" page is displayed in modal for "Create" flow
6565
And "Wallet setup" step is marked as active on progress timeline
6666
When I click "Back" button during wallet setup
6767
Then "Mnemonic verification" page is displayed from "Restore wallet" flow with 24 words
@@ -124,6 +124,7 @@ Feature: Add new wallet - Restore wallet
124124
Then "Enter wallet" button is enabled
125125
When I click "Enter wallet" button
126126
Then I see LW homepage
127+
And I wait for main loader to disappear
127128
And "ValidName" is displayed as a wallet name on the menu button
128129
When I click the menu button
129130
Then Wallet number 2 with "ValidName" name is displayed on the user menu
@@ -169,7 +170,7 @@ Feature: Add new wallet - Restore wallet
169170
Examples:
170171
| page | step |
171172
| Mnemonic verification | "Mnemonic verification" page is displayed from "Restore wallet" flow with 24 words |
172-
| Wallet setup | "Wallet setup" page is displayed in modal |
173+
| Wallet setup | "Let's set up your new wallet" page is displayed in modal for "Create" flow |
173174

174175
@LW-9248
175176
Scenario Outline: Extended-view - Multi-wallet - Restore - "Add new wallet" - <page> - "Are you sure you want to cancel adding a new wallet?" dialog - proceed

packages/e2e-tests/src/fixture/localStorageInitializer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ class LocalStorageInitializer {
9393
await localStorageManager.removeItem('isMultiDelegationDAppCompatibilityModalVisible');
9494
};
9595

96+
disableShowPinExtension = async () => {
97+
await localStorageManager.setItem('showPinExtension', 'false');
98+
};
99+
96100
initialiseBasicLocalStorageData = async (
97101
walletName: string,
98102
chainName: 'Preprod' | 'Preview' | 'Mainnet'

packages/e2e-tests/src/hooks/beforeTagHooks.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,13 @@ Before(
269269
}
270270
);
271271

272-
Before({ tags: '@AddNewWalletCreate or @AddNewWalletRestore or @AddNewWalletConnect' }, async () => {
273-
await extendedViewRepositoryWalletInitialization([TestWalletName.AddNewWallet]);
274-
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
275-
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
276-
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
277-
});
272+
Before(
273+
{ tags: '@AddNewWalletCreate or @AddNewWalletRestore or @AddNewWalletConnect or @AddNewWalletCreatePaperWallet' },
274+
async () => {
275+
await extendedViewRepositoryWalletInitialization([TestWalletName.AddNewWallet]);
276+
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
277+
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
278+
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
279+
await localStorageInitializer.disableShowPinExtension();
280+
}
281+
);

0 commit comments

Comments
 (0)