Skip to content

Commit 64de17a

Browse files
committed
fix(tests): Add more playwright test tweaks
1 parent 2bea7c5 commit 64de17a

34 files changed

Lines changed: 79 additions & 77 deletions

packages/functional-tests/pages/relier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class RelierPage extends BaseLayout {
1515
return this.page.getByRole('heading', { name: '123done' });
1616
}
1717

18-
goto(query?: string) {
18+
async goto(query?: string) {
1919
const url = query
2020
? `${this.target.relierUrl}?${query}`
2121
: this.target.relierUrl;

packages/functional-tests/tests/key-stretching-v2/recoveryKey.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ test.describe('severity-2 #smoke', () => {
6969
await page.goto(
7070
`${target.contentServerUrl}/?forceExperiment=generalizedReactApp&forceExperimentGroup=react&${signupVersion.query}`
7171
);
72+
await page.waitForURL(/\//);
7273
await signup.fillOutEmailForm(email);
7374
await signup.fillOutSignupForm(password, AGE_21);
7475
await expect(page).toHaveURL(/confirm_signup_code/);
7576
const code = await target.emailClient.getVerifyShortCode(email);
7677
await confirmSignupCode.fillOutCodeForm(code);
7778

79+
await page.waitForURL(/settings/);
80+
7881
await expect(page).toHaveURL(/settings/);
7982

8083
await settings.signOut();
@@ -87,18 +90,21 @@ test.describe('severity-2 #smoke', () => {
8790
await page.goto(
8891
`${target.contentServerUrl}/?forceExperiment=generalizedReactApp&forceExperimentGroup=react&${resetVersion.query}`
8992
);
93+
await page.waitForURL(/\//);
9094
await signin.fillOutEmailFirstForm(email);
9195
await signin.fillOutPasswordForm(password);
92-
96+
await page.waitForURL(/settings/);
9397
await expect(page).toHaveURL(/settings/);
9498

9599
await settings.goto(`${resetVersion.version}`);
100+
await page.waitForURL(/settings/);
96101
await settings.recoveryKey.createButton.click();
97102
const key = await recoveryKey.createRecoveryKey(password, HINT);
98103
await settings.signOut();
99104
await page.goto(
100105
`${target.contentServerUrl}/reset_password?${resetVersion.query}`
101106
);
107+
await page.waitForURL(/reset_password/);
102108
await resetPassword.fillOutEmailForm(email);
103109
const resetCode = await target.emailClient.getResetPasswordCode(email);
104110
await resetPassword.fillOutResetPasswordCodeForm(resetCode);
@@ -115,10 +121,12 @@ test.describe('severity-2 #smoke', () => {
115121
await page.goto(
116122
`${target.contentServerUrl}/?forceExperiment=generalizedReactApp&forceExperimentGroup=react&${signinVersion.query}`
117123
);
124+
await page.waitForURL(/\//);
118125
// a successful password reset means that the user is signed in
119126
await expect(signin.cachedSigninHeading).toBeVisible();
120127
await signin.signInButton.click();
121128

129+
await page.waitForURL(/settings/);
122130
await expect(page).toHaveURL(/settings/);
123131
const keys2 = await _getKeys(
124132
signinVersion.version,

packages/functional-tests/tests/misc/recoveryKeyPromoInline.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ test.describe('recovery key promo', () => {
2525
await page.goto(
2626
`${target.contentServerUrl}?context=fx_desktop_v3&service=sync&action=email`
2727
);
28+
await page.waitForURL(/\//);
2829
await signup.fillOutEmailForm(credentials.email);
2930
await signup.fillOutSignupForm(credentials.password, '21');
31+
await signup.page.waitForURL(/confirm_signup_code/);
3032

3133
const code = await target.emailClient.getVerifyShortCode(
3234
credentials.email
3335
);
3436
await login.setCode(code);
3537
await login.clickSubmit();
3638

39+
await page.waitForURL(/pair/);
40+
3741
await expect(connectAnotherDevice.fxaConnected).toBeEnabled();
3842
});
3943

@@ -52,10 +56,10 @@ test.describe('recovery key promo', () => {
5256

5357
// Sign-in without Sync, otw you will get prompted to create a recovery key
5458
await page.goto(target.contentServerUrl);
55-
59+
await page.waitForURL(/\//);
5660
await signin.fillOutEmailFirstForm(credentials.email);
5761
await signin.fillOutPasswordForm(credentials.password);
58-
62+
await page.waitForURL(/settings/);
5963
await settings.recoveryKey.createButton.click();
6064
await recoveryKey.acknowledgeInfoForm();
6165
await recoveryKey.fillOutConfirmPasswordForm(credentials.password);
@@ -224,6 +228,8 @@ test.describe('recovery key promo', () => {
224228

225229
await connectAnotherDevice.clickNotNowPair();
226230

231+
await page.waitForURL(/settings/);
232+
227233
await expect(settings.settingsHeading).toBeVisible();
228234
await expect(settings.recoveryKey.status).toHaveText('Not Set');
229235

packages/functional-tests/tests/misc/relayIntegration.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ test.describe('relay integration', () => {
2525
await signup.emailTextbox.fill(email);
2626
await signup.submitButton.click();
2727

28+
await page.waitForURL(/signup/);
29+
2830
await expect(
2931
signup.page.getByText(
3032
'A password is needed to securely manage your masked emails and access ⁨Mozilla⁩’s security tools.'

packages/functional-tests/tests/oauth/loginHintCachedCredentials.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ test.describe('severity-2 #smoke', () => {
99
test('cached credentials, login_hint specified by relier', async ({
1010
pages: { page, signin, relier },
1111
testAccountTracker,
12+
target,
1213
}) => {
1314
const credentials = await testAccountTracker.signUp();
1415
const loginHintCredentials = await testAccountTracker.signUp();
@@ -19,6 +20,8 @@ test.describe('severity-2 #smoke', () => {
1920
await signin.fillOutEmailFirstForm(credentials.email);
2021
await signin.fillOutPasswordForm(credentials.password);
2122

23+
await page.waitForURL(target.relierUrl);
24+
2225
expect(await relier.isLoggedIn()).toBe(true);
2326

2427
await relier.signOut();
@@ -27,6 +30,8 @@ test.describe('severity-2 #smoke', () => {
2730
await relier.goto(`login_hint=${loginHintCredentials.email}`);
2831
await relier.clickEmailFirst();
2932

33+
await page.waitForURL(/signin/);
34+
3035
// Email is prefilled
3136
await expect(signin.passwordFormHeading).toBeVisible();
3237
await expect(page.getByText(loginHintCredentials.email)).toBeVisible();

packages/functional-tests/tests/oauth/oauthPromptNone.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async function signInAccount(
232232
await page.goto(target.contentServerUrl);
233233
await signin.fillOutEmailFirstForm(credentials.email);
234234
await signin.fillOutPasswordForm(credentials.password);
235-
235+
await page.waitForURL(/settings/);
236236
//Verify logged in on Settings page
237237
await expect(settings.settingsHeading).toBeVisible();
238238

packages/functional-tests/tests/oauth/syncSignIn.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ test.describe('severity-1 #smoke', () => {
5353
await relier.signOut();
5454
await relier.clickSignIn();
5555

56+
await page.waitForURL(/oauth\/signin/);
57+
5658
// By default, we should see the email we signed up for Sync with
5759
await expect(page.getByText(syncCredentials.email)).toBeVisible();
5860

packages/functional-tests/tests/oauth/totp.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ test.describe('severity-1 #smoke', () => {
4444
expect(await relier.isLoggedIn()).toBe(true);
4545

4646
await settings.goto();
47+
await settings.page.waitForURL(/settings/);
4748
await settings.disconnectTotp();
4849
});
4950

@@ -68,6 +69,7 @@ test.describe('severity-1 #smoke', () => {
6869

6970
await relier.goto();
7071
await relier.clickEmailFirst();
72+
await signin.page.waitForURL(/signin/);
7173
await signin.signInButton.click();
7274

7375
expect(await relier.isLoggedIn()).toBe(true);
@@ -148,9 +150,10 @@ async function signInAccount(
148150
): Promise<Credentials> {
149151
const credentials = await testAccountTracker.signUp();
150152
await page.goto(target.contentServerUrl);
153+
await page.waitForURL(/\//);
151154
await signin.fillOutEmailFirstForm(credentials.email);
152155
await signin.fillOutPasswordForm(credentials.password);
153-
156+
await page.waitForURL(/settings/);
154157
// Verify logged in on Settings page
155158
await expect(settings.settingsHeading).toBeVisible();
156159

packages/functional-tests/tests/postVerify/forcePasswordChange.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ test.describe('severity-2 #smoke', () => {
3737
await postVerify.fillOutChangePassword(credentials.password, newPassword);
3838
await postVerify.submit();
3939

40+
await settings.page.waitForURL(/settings/);
4041
//Verify logged in on Settings page
4142
await expect(settings.settingsHeading).toBeVisible();
4243
await settings.deleteAccountButton.click();

packages/functional-tests/tests/react-conversion/oauthSignin.spec.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ test.describe('severity-1 #smoke', () => {
2727

2828
await page.waitForURL(/oauth\//);
2929

30-
// reload page with React experiment params
31-
await page.goto(
32-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
33-
);
34-
3530
await signin.fillOutEmailFirstForm(credentials.email);
3631
await signin.fillOutPasswordForm(credentials.password);
3732

@@ -49,10 +44,6 @@ test.describe('severity-1 #smoke', () => {
4944

5045
await page.waitForURL(/oauth\//);
5146

52-
// reload page with React experiment params
53-
await page.goto(
54-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
55-
);
5647
await signin.fillOutEmailFirstForm(credentials.email);
5748
await signin.fillOutPasswordForm(credentials.password);
5849

@@ -67,11 +58,6 @@ test.describe('severity-1 #smoke', () => {
6758
await page.waitForURL(/oauth\/signin/);
6859
await expect(page).toHaveURL(/oauth\/signin/);
6960

70-
// reload page with React experiment params
71-
await page.goto(
72-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
73-
);
74-
7561
await expect(signin.cachedSigninHeading).toBeVisible();
7662
// Email is prefilled
7763
await expect(page.getByText(credentials.email)).toBeVisible();
@@ -92,10 +78,6 @@ test.describe('severity-1 #smoke', () => {
9278

9379
await page.waitForURL(/oauth\//);
9480

95-
// reload page with React experiment params
96-
await page.goto(
97-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
98-
);
9981
await signin.fillOutEmailFirstForm(credentials.email);
10082
await signin.fillOutPasswordForm(credentials.password);
10183

@@ -110,11 +92,6 @@ test.describe('severity-1 #smoke', () => {
11092
await page.waitForURL(/oauth\/signin/);
11193
await expect(page).toHaveURL(/oauth\/signin/);
11294

113-
// reload page with React experiment params
114-
await page.goto(
115-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
116-
);
117-
11895
await expect(signin.cachedSigninHeading).toBeVisible();
11996
// Email is prefilled
12097
await expect(page.getByText(credentials.email)).toBeVisible();
@@ -128,11 +105,6 @@ test.describe('severity-1 #smoke', () => {
128105

129106
await page.waitForURL(/oauth\//);
130107

131-
// reload page with React experiment params
132-
await page.goto(
133-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
134-
);
135-
136108
// User will have to re-enter login information
137109
await signin.fillOutEmailFirstForm(credentials.email);
138110
await signin.fillOutPasswordForm(credentials.password);
@@ -160,11 +132,6 @@ test.describe('severity-1 #smoke', () => {
160132

161133
await page.waitForURL(/oauth\//);
162134

163-
// reload page with React experiment params
164-
await page.goto(
165-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
166-
);
167-
168135
await signin.fillOutEmailFirstForm(credentials.email);
169136
await signin.fillOutPasswordForm(credentials.password);
170137

@@ -206,11 +173,6 @@ test.describe('severity-1 #smoke', () => {
206173
await page.waitForURL(/oauth\/signin/);
207174
await expect(page).toHaveURL(/oauth\/signin/);
208175

209-
// reload page with React experiment params
210-
await page.goto(
211-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
212-
);
213-
214176
// Cached user detected
215177
// redirect is slow, wait for the cached signin heading to appear
216178
await expect(signin.cachedSigninHeading).toBeVisible();
@@ -245,11 +207,6 @@ test.describe('severity-1 #smoke', () => {
245207

246208
await page.waitForURL(/oauth\//);
247209

248-
// reload page with React experiment params
249-
await page.goto(
250-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
251-
);
252-
253210
await signup.fillOutEmailForm(email);
254211
await expect(signup.signupFormHeading).toBeVisible();
255212
await signup.fillOutSignupForm(password, AGE_21);
@@ -268,11 +225,6 @@ test.describe('severity-1 #smoke', () => {
268225
await page.waitForURL(/oauth\/signin/);
269226
await expect(page).toHaveURL(/oauth\/signin/);
270227

271-
// reload page with React experiment params
272-
await page.goto(
273-
`${page.url()}&forceExperiment=generalizedReactApp&forceExperimentGroup=react`
274-
);
275-
276228
await expect(signin.cachedSigninHeading).toBeVisible();
277229
await expect(page.getByText(email)).toBeVisible();
278230
});

0 commit comments

Comments
 (0)