Skip to content

Commit 7eff7b1

Browse files
committed
chore: update-flakey-tests
1 parent 247eea1 commit 7eff7b1

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

e2e/davinci-suites/src/basic.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test('Test happy paths on test page', async ({ page }) => {
2121

2222
await page.getByRole('button', { name: 'Sign On' }).click();
2323

24-
await expect(page.getByText('Complete')).toBeVisible();
24+
await expect(async () => await expect(page.getByText('Complete')).toBeVisible()).toPass();
2525

2626
const sessionToken = await page.locator('#sessionToken').innerText();
2727
const authCode = await page.locator('#authCode').innerText();

e2e/davinci-suites/src/phone-number-field.test.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ test.describe('Device registration tests', () => {
1818
await page.getByRole('textbox', { name: 'Password' }).fill(password);
1919
await page.getByRole('button', { name: 'Sign On' }).click();
2020

21-
await page.getByRole('button', { name: 'USER_DELETE' }).click();
22-
await expect(page.getByRole('heading', { name: 'Success' })).toBeVisible();
21+
/**
22+
* This implements a retry automatically on a timeout
23+
* because this code path is not critical to the functionality
24+
* we should consider this pattern because its flakey.
25+
*
26+
*/
27+
await expect(
28+
async () => await page.getByRole('button', { name: 'USER_DELETE' }).click(),
29+
).toPass();
30+
expect(
31+
async () => await expect(page.getByRole('heading', { name: 'Success' })).toBeVisible(),
32+
).toPass();
2333
});
2434

2535
test('Login - add email device - authenticate with email device', async ({ page }) => {
@@ -40,9 +50,12 @@ test.describe('Device registration tests', () => {
4050
await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser');
4151
await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser');
4252
await page.getByRole('button', { name: 'Continue' }).click();
43-
await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible();
53+
await expect(
54+
async () =>
55+
await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible(),
56+
).toPass();
4457
await page.getByRole('button', { name: 'Continue' }).click();
45-
await page.getByRole('button', { name: 'Logout' }).click();
58+
expect(async () => await page.getByRole('button', { name: 'Logout' }).click()).toPass();
4659

4760
/***
4861
* Login with the new user
@@ -52,7 +65,7 @@ test.describe('Device registration tests', () => {
5265
await expect(page.getByText('SDK Automation - Sign On')).toBeVisible();
5366
await page.getByRole('textbox', { name: 'Username' }).fill(username);
5467
await page.getByRole('textbox', { name: 'Password' }).fill(password);
55-
await page.getByRole('button', { name: 'Sign On' }).click();
68+
expect(async () => await page.getByRole('button', { name: 'Sign On' }).click()).toPass();
5669

5770
/** Register a device */
5871
await expect(page.getByText('Select Test Form')).toBeVisible();
@@ -83,10 +96,10 @@ test.describe('Device registration tests', () => {
8396
await page.getByRole('textbox', { name: 'Password' }).fill(password);
8497
await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser');
8598
await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser');
86-
await page.getByRole('button', { name: 'Continue' }).click();
99+
expect(async () => await page.getByRole('button', { name: 'Continue' }).click()).toPass();
87100
await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible();
88101
await page.getByRole('button', { name: 'Continue' }).click();
89-
await page.getByRole('button', { name: 'Logout' }).click();
102+
expect(async () => await page.getByRole('button', { name: 'Logout' }).click()).toPass();
90103

91104
/**
92105
* Login with the new user
@@ -96,7 +109,7 @@ test.describe('Device registration tests', () => {
96109
await expect(page.getByText('SDK Automation - Sign On')).toBeVisible();
97110
await page.getByRole('textbox', { name: 'Username' }).fill(username);
98111
await page.getByRole('textbox', { name: 'Password' }).fill(password);
99-
await page.getByRole('button', { name: 'Sign On' }).click();
112+
expect(async () => await page.getByRole('button', { name: 'Sign On' }).click()).toPass();
100113

101114
/** Register a Device */
102115
await expect(page.getByText('Select Test Form')).toBeVisible();
@@ -107,6 +120,6 @@ test.describe('Device registration tests', () => {
107120
await page.getByRole('textbox', { name: 'Enter Phone Number' }).fill('3035550100');
108121
await page.getByRole('button', { name: 'Submit' }).click();
109122
await expect(page.getByText('SMS/Voice MFA Registered')).toBeVisible();
110-
await page.getByRole('button', { name: 'Continue' }).click();
123+
expect(async () => await page.getByRole('button', { name: 'Continue' }).click()).toPass();
111124
});
112125
});

e2e/oidc-suites/src/logout.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ test.describe('Logout tests', () => {
3838

3939
await page.getByLabel('User Name').fill(pingAmUsername);
4040
await page.getByRole('textbox', { name: 'Password' }).fill(pingAmPassword);
41-
await Promise.all([
42-
page.waitForURL('http://localhost:8443/ping-am/**'),
43-
page.getByRole('button', { name: 'Next' }).click(),
44-
]);
41+
const promise = page.waitForURL('http://localhost:8443/ping-am/**');
42+
await page.getByRole('button', { name: 'Next' }).click();
43+
44+
/**
45+
* This block is flakey, changing to this pattern
46+
* https://playwright.dev/docs/network#network-events
47+
**/
48+
await promise;
4549
expect(page.url()).toContain('code');
4650
expect(page.url()).toContain('state');
4751
await expect(page.getByRole('button', { name: 'Login (Background)' })).toBeHidden();

0 commit comments

Comments
 (0)