-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path01-create-account.spec.ts
272 lines (232 loc) · 11.4 KB
/
01-create-account.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
require("module-alias/register");
import {
closeApplication,
launchApplication,
maximizeWindow,
saveUserRecoverySeed,
} from "@helpers/commands";
import { WINDOWS_DRIVER } from "@helpers/constants";
import CreateOrImportScreen from "@screenobjects/account-creation/CreateOrImportScreen";
import CreatePinScreen from "@screenobjects/account-creation/CreatePinScreen";
import CreateUserScreen from "@screenobjects/account-creation/CreateUserScreen";
import SaveRecoverySeedScreen from "@screenobjects/account-creation/SaveRecoverySeedScreen";
import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen";
export default async function createAccountTests() {
it("Enter Pin Screen - Validate warning texts are displayed on screen", async () => {
const unlockWarningHeader = await CreatePinScreen.unlockWarningHeader;
await unlockWarningHeader.waitForExist();
await expect(unlockWarningHeader).toHaveText("LET'S CHOOSE YOUR PASSWORD");
const unlockWarningParagraph = await CreatePinScreen.unlockWarningParagraph;
await unlockWarningParagraph.waitForExist();
await expect(unlockWarningParagraph).toHaveText(
"(this is used to encrypt all of the data Uplink stores on your computer when you're not using it so nobody can read your data.)",
);
});
it("Enter Pin Screen - Create Account button should be disabled if no pin has been entered", async () => {
const statusOfButton =
await CreatePinScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
});
// Skipping test failing on CI
xit("Enter Pin Screen - - Help Button Tooltip", async () => {
// Wait until app is reset
await CreatePinScreen.unlockWarningHeader.waitForExist();
// Validate Help Button tooltip
await CreatePinScreen.hoverOnHelpButton();
const helpButtonTooltipText = await CreatePinScreen.helpButtonTooltipText;
await expect(helpButtonTooltipText).toHaveText("Help (right-click)");
});
it("Enter Pin Screen - Reset Account is shown after right clicking on Help Button", async () => {
// Right click on Help Button to show the help menu
await CreatePinScreen.openHelpButtonMenu();
// Right click again on Help Button to hide the help menu
await CreatePinScreen.openHelpButtonMenu();
});
it("Enter Pin Screen - Enter an empty pin", async () => {
await CreatePinScreen.unlockWarningParagraph.waitForExist();
await CreatePinScreen.enterPinOnCreateAccount("1");
await CreatePinScreen.pinInput.clearValue();
await CreatePinScreen.inputError.waitForExist();
const inputErrorText = await CreatePinScreen.inputErrorText;
await expect(inputErrorText).toHaveText(
"Please enter at least 4 characters.",
);
const statusOfButton =
await CreatePinScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
});
it("Enter Pin Screen - Enter a pin with less than 4 characters", async () => {
await CreatePinScreen.enterPinOnCreateAccount("123");
await CreatePinScreen.inputError.waitForExist();
const inputErrorText = await CreatePinScreen.inputErrorText;
await expect(inputErrorText).toHaveText(
"Please enter at least 4 characters.",
);
const statusOfButton =
await CreatePinScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreatePinScreen.pinInput.clearValue();
});
// Skipping test failing when appium stops typing
xit("Enter Pin Screen - Enter a pin with more than 32 characters", async () => {
await CreatePinScreen.enterPinOnCreateAccount(
"12345678901234567890123456789012",
);
await CreatePinScreen.inputError.waitForExist();
const inputErrorText = await CreatePinScreen.inputErrorText;
await expect(inputErrorText).toHaveText(
"Maximum of 32 characters exceeded.",
);
const statusOfButton =
await CreatePinScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreatePinScreen.pinInput.clearValue();
});
// Skipping test failing when appium stops typing
xit("Enter Pin Screen - Enter a pin with spaces", async () => {
// Enter pin value with spaces
await CreatePinScreen.pinInput.click();
await CreatePinScreen.enterPinOnCreateAccount("1234" + " ");
await CreatePinScreen.inputError.waitForExist();
const inputErrorText = await CreatePinScreen.inputErrorText;
await expect(inputErrorText).toHaveText("Spaces are not allowed.");
const statusOfButton =
await CreatePinScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreatePinScreen.pinInput.clearValue();
});
it("Enter Pin Screen - Enter a valid pin and continue creating a username", async () => {
await CreatePinScreen.enterPinOnCreateAccount("1234");
await CreatePinScreen.waitUntilCreateAccountButtonIsEnabled();
const statusOfButton =
await CreatePinScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("true");
await CreatePinScreen.clickOnCreateAccount();
});
it("Create or Import Account - Validate screen contents and click on Create New Account", async () => {
await CreateOrImportScreen.waitForIsShown(true);
const instructionsParagraph =
await CreateOrImportScreen.recoveryParagraphText;
const createOrImportHeader =
await CreateOrImportScreen.createOrRecoverLabelText;
await expect(instructionsParagraph).toHaveText(
"We're going to create an account for you. On the next screen, you'll see a set of words. Screenshot this or write it down. This is the only way to backup your account.",
);
await expect(createOrImportHeader).toHaveText("ACCOUNT CREATION");
await CreateOrImportScreen.clickOnCreateAccount();
});
it("Enter Username Screen - Cannot continue with empty value", async () => {
await CreateUserScreen.waitForIsShown(true);
const helperText = await CreateUserScreen.createUserHelperText;
const headerText = await CreateUserScreen.createUserLabelText;
await expect(helperText).toHaveText(
"Time to pick your username, you can change this later at any time in settings.",
);
await expect(headerText).toHaveText("ENTER USERNAME");
await CreateUserScreen.enterUsername("1");
await CreateUserScreen.enterUsername("");
const statusOfButton =
await CreateUserScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreateUserScreen.inputError.waitForExist();
const inputErrorText = await CreateUserScreen.inputErrorText;
await expect(inputErrorText).toHaveText(
"Please enter at least 4 characters.",
);
});
it("Enter Username Screen - Username with less than 4 characters and attempt to continue", async () => {
await CreateUserScreen.enterUsername("12");
const statusOfButton =
await CreateUserScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreateUserScreen.inputError.waitForExist();
const inputErrorText = await CreateUserScreen.inputErrorText;
await expect(inputErrorText).toHaveText(
"Please enter at least 4 characters.",
);
});
it("Enter Username Screen - Username with more than 32 characters and attempt to continue", async () => {
await CreateUserScreen.enterUsername("123456789012345678901234567890123");
const statusOfButton =
await CreateUserScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreateUserScreen.inputError.waitForExist();
const inputErrorText = await CreateUserScreen.inputErrorText;
await expect(inputErrorText).toHaveText(
"Maximum of 32 characters exceeded.",
);
});
it("Enter Username Screen - Username with spaces and attempt to continue", async () => {
// Enter pin value with spaces
await CreateUserScreen.usernameInput.click();
await CreateUserScreen.enterUsername("1234" + " ");
const statusOfButton =
await CreateUserScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreateUserScreen.inputError.waitForExist();
const inputErrorText = await CreateUserScreen.inputErrorText;
await expect(inputErrorText).toHaveText("Spaces are not allowed.");
});
it("Enter Username Screen - Username with non-alphanumeric characters", async () => {
await CreateUserScreen.enterUsername("test..%@");
const statusOfButton =
await CreateUserScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("false");
await CreateUserScreen.inputError.waitForExist();
const inputErrorText = await CreateUserScreen.inputErrorText;
await expect(inputErrorText).toHaveText("Not allowed character(s): .%@");
});
it("Enter Username Screen - Enter valid username to continue", async () => {
await CreateUserScreen.enterUsername("Test123");
await CreateUserScreen.waitUntilCreateAccountButtonIsEnabled();
const statusOfButton =
await CreateUserScreen.getStatusOfCreateAccountButton();
await expect(statusOfButton).toEqual("true");
await CreateUserScreen.clickOnCreateAccount();
});
it("Save Recovery Seed Screen - Contents validation", async () => {
// Validate contents of Save Recovery Seed Screen
await SaveRecoverySeedScreen.waitForIsShown(true);
const helperText = await SaveRecoverySeedScreen.copySeedHelperText;
const copySeedTitle = await SaveRecoverySeedScreen.copySeedWordsLabelText;
await expect(helperText).toHaveText(
"Write these words down in the order that they appear. Having the correct order is crucial when you are recovering your account.",
);
await expect(copySeedTitle).toHaveText("RECOVERY SEED");
// Validate 12 recovery seed words are displayed on screen
const seedWords = await SaveRecoverySeedScreen.getSeedWords();
await expect(seedWords.length).toEqual(12);
});
it("Save Recovery Seed Screen - User can go back to previous screen", async () => {
// Go Back to Create or Import Account screen
await SaveRecoverySeedScreen.clickOnGoBackButton();
await CreateOrImportScreen.waitForIsShown(true);
// Return to Save Recovery Seed Screen
await CreateOrImportScreen.clickOnCreateAccount();
// Enter username again
await CreateUserScreen.enterUsername("Test123");
await CreateUserScreen.waitUntilCreateAccountButtonIsEnabled();
await CreateUserScreen.clickOnCreateAccount();
});
it("Save Recovery Seed Screen - User can click Copy to Clipboard and then on I Saved It to continue", async () => {
// Click on I Saved It Button to continue to Enter Username Screen
await SaveRecoverySeedScreen.waitForIsShown(true);
await SaveRecoverySeedScreen.clickOnCopySeedButton();
const recoverySeed = await SaveRecoverySeedScreen.getSeedWords();
await saveUserRecoverySeed("Test123", recoverySeed);
await SaveRecoverySeedScreen.clickOnISavedItButton();
await WelcomeScreen.waitForIsShown(true);
// Close first application
await closeApplication();
});
it("User can enter pin to log back into application", async () => {
await launchApplication();
await CreatePinScreen.loginWithTestUser();
await WelcomeScreen.welcomeLayout.waitForExist({ timeout: 60000 });
// If current driver is Windows, then maximize screen
const currentDriver = await WelcomeScreen.getCurrentDriver();
if (currentDriver === WINDOWS_DRIVER) {
await maximizeWindow();
}
});
}