Skip to content

Commit b7f872c

Browse files
committed
test: (wip) e2e test for new SRP flow
1 parent 69a36ff commit b7f872c

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import OnboardingCarouselView from '../../pages/Onboarding/OnboardingCarouselView';
2+
import OnboardingView from '../../pages/Onboarding/OnboardingView';
3+
import ImportWalletView from '../../pages/Onboarding/ImportWalletView';
4+
import TestHelpers from '../../helpers';
5+
import Assertions from '../../utils/Assertions';
6+
import { Regression } from '../../tags';
7+
import CreatePasswordView from '../../pages/Onboarding/CreatePasswordView';
8+
import { acceptTermOfUse } from '../../viewHelper';
9+
import MetaMetricsOptInView from '../../pages/Onboarding/MetaMetricsOptInView';
10+
import OnboardingSuccessView from '../../pages/Onboarding/OnboardingSuccessView';
11+
12+
const VALID_SRP = 'all huge boy erupt choose people leaf awful can twenty point swap';
13+
const INVALID_SRP = 'asdf huge boy erupt choose people leaf awful can twenty point swap';
14+
15+
const enterSRPFlow = async () => {
16+
await OnboardingCarouselView.tapOnGetStartedButton();
17+
await acceptTermOfUse();
18+
};
19+
20+
const hideKeyboard = async () => {
21+
// tap on title to hide keyboard
22+
await ImportWalletView.tapTitle();
23+
};
24+
25+
describe(Regression('New SRP flow'), () => {
26+
beforeAll(async () => {
27+
jest.setTimeout(150000);
28+
await TestHelpers.launchApp();
29+
});
30+
31+
describe('On Onboarding View', () => {
32+
it('should display Onboarding View', async () => {
33+
await enterSRPFlow();
34+
await Assertions.checkIfVisible(OnboardingView.container);
35+
});
36+
37+
it('should enable button "Have an existing wallet"', async () => {
38+
await Assertions.checkIfEnabled(OnboardingView.importSeedButton);
39+
});
40+
41+
it('should navigate to "Import Wallet View" when "Have an existing wallet" button is pressed', async () => {
42+
await OnboardingView.tapImportWalletFromSeedPhrase();
43+
await Assertions.checkIfVisible(ImportWalletView.container);
44+
});
45+
});
46+
47+
describe('On Import Wallet View', () => {
48+
49+
// TODO: comment out when UI bug fixed
50+
// it('should display error message when invalid SRP is entered', async () => {
51+
// await ImportWalletView.enterSecretRecoveryPhrase(INVALID_SRP);
52+
// await Assertions.checkIfVisible(ImportWalletView.errorMessage);
53+
// });
54+
55+
// it('should enable "Continue" button when valid SRP is entered', async () => {
56+
// await ImportWalletView.clearSecretRecoveryPhrase();
57+
// await ImportWalletView.enterSecretRecoveryPhrase(VALID_SRP);
58+
// await Assertions.checkIfEnabled(ImportWalletView.continueButton);
59+
// });
60+
61+
it('should be able to paste Seed Phrase from clipboard', async () => {
62+
await hideKeyboard();
63+
await ImportWalletView.tapPasteClearButton();
64+
// TODO: assert SRP is pasted correctly
65+
// await Assertions.checkIfElementToHaveText( ImportWalletView.seedPhraseInput ,'all huge boy erupt choose people leaf awful can twenty point swap');
66+
await Assertions.checkIfEnabled(ImportWalletView.continueButton);
67+
});
68+
69+
it('should hide all seed phrase words when "Show/Hide Seed Phrase" button is pressed', async () => {
70+
await ImportWalletView.tapShowHideSeedPhraseButton();
71+
await Assertions.checkIfTextIsNotDisplayed('all');
72+
73+
await ImportWalletView.tapShowHideSeedPhraseButton();
74+
await Assertions.checkIfTextIsDisplayed('all');
75+
});
76+
77+
it('should clear seed phrase when "Clear" button is pressed', async () => {
78+
await ImportWalletView.tapPasteClearButton();
79+
await Assertions.checkIfVisible(ImportWalletView.srpPlaceholderText, 500);
80+
});
81+
82+
it('should navigate to "Create Password View" when "Continue" button is pressed', async () => {
83+
await hideKeyboard();
84+
await ImportWalletView.tapPasteClearButton();
85+
await hideKeyboard();
86+
await ImportWalletView.tapContinueButton();
87+
await Assertions.checkIfVisible(CreatePasswordView.container, 500);
88+
});
89+
90+
});
91+
92+
describe('On Create Password View', () => {
93+
it('should be able to input Password', async () => {
94+
await CreatePasswordView.enterPassword('123456789');
95+
await CreatePasswordView.reEnterPassword('123456789');
96+
await CreatePasswordView.tapIUnderstandCheckBox();
97+
await CreatePasswordView.tapCreatePasswordButton();
98+
await Assertions.checkIfVisible(MetaMetricsOptInView.container);
99+
});
100+
});
101+
102+
describe('On Meta Metrics Opt In View', () => {
103+
it('should be able to agree to Meta Metrics', async () => {
104+
await MetaMetricsOptInView.tapIUnderstandCheckBox();
105+
await MetaMetricsOptInView.tapAgreeButton();
106+
});
107+
108+
it('should navigate to Onboarding Success View', async () => {
109+
await Assertions.checkIfVisible(OnboardingSuccessView.container);
110+
await Assertions.checkIfVisible(OnboardingSuccessView.title);
111+
await Assertions.checkIfEnabled(OnboardingSuccessView.doneButton);
112+
});
113+
114+
it('should complete SRP import flow', async () => {
115+
await OnboardingSuccessView.tapDone();
116+
});
117+
});
118+
});

0 commit comments

Comments
 (0)