Skip to content

Commit e1455c5

Browse files
committed
chore: update-flakey-tests
1 parent f7e3e62 commit e1455c5

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
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: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ 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();
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();
2230
await expect(page.getByRole('heading', { name: 'Success' })).toBeVisible();
2331
});
2432

@@ -40,9 +48,12 @@ test.describe('Device registration tests', () => {
4048
await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser');
4149
await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser');
4250
await page.getByRole('button', { name: 'Continue' }).click();
43-
await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible();
51+
await expect(
52+
async () =>
53+
await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible(),
54+
).toPass();
4455
await page.getByRole('button', { name: 'Continue' }).click();
45-
await page.getByRole('button', { name: 'Logout' }).click();
56+
expect(async () => await page.getByRole('button', { name: 'Logout' }).click()).toPass();
4657

4758
/***
4859
* Login with the new user
@@ -52,7 +63,7 @@ test.describe('Device registration tests', () => {
5263
await expect(page.getByText('SDK Automation - Sign On')).toBeVisible();
5364
await page.getByRole('textbox', { name: 'Username' }).fill(username);
5465
await page.getByRole('textbox', { name: 'Password' }).fill(password);
55-
await page.getByRole('button', { name: 'Sign On' }).click();
66+
expect(async () => await page.getByRole('button', { name: 'Sign On' }).click()).toPass();
5667

5768
/** Register a device */
5869
await expect(page.getByText('Select Test Form')).toBeVisible();
@@ -83,10 +94,10 @@ test.describe('Device registration tests', () => {
8394
await page.getByRole('textbox', { name: 'Password' }).fill(password);
8495
await page.getByRole('textbox', { name: 'Given Name' }).fill('demouser');
8596
await page.getByRole('textbox', { name: 'Family Name' }).fill('demouser');
86-
await page.getByRole('button', { name: 'Continue' }).click();
97+
expect(async () => await page.getByRole('button', { name: 'Continue' }).click()).toPass();
8798
await expect(page.getByRole('heading', { name: 'Registration Complete' })).toBeVisible();
8899
await page.getByRole('button', { name: 'Continue' }).click();
89-
await page.getByRole('button', { name: 'Logout' }).click();
100+
expect(async () => await page.getByRole('button', { name: 'Logout' }).click()).toPass();
90101

91102
/**
92103
* Login with the new user
@@ -96,7 +107,7 @@ test.describe('Device registration tests', () => {
96107
await expect(page.getByText('SDK Automation - Sign On')).toBeVisible();
97108
await page.getByRole('textbox', { name: 'Username' }).fill(username);
98109
await page.getByRole('textbox', { name: 'Password' }).fill(password);
99-
await page.getByRole('button', { name: 'Sign On' }).click();
110+
expect(async () => await page.getByRole('button', { name: 'Sign On' }).click()).toPass();
100111

101112
/** Register a Device */
102113
await expect(page.getByText('Select Test Form')).toBeVisible();
@@ -107,6 +118,6 @@ test.describe('Device registration tests', () => {
107118
await page.getByRole('textbox', { name: 'Enter Phone Number' }).fill('3035550100');
108119
await page.getByRole('button', { name: 'Submit' }).click();
109120
await expect(page.getByText('SMS/Voice MFA Registered')).toBeVisible();
110-
await page.getByRole('button', { name: 'Continue' }).click();
121+
expect(async () => await page.getByRole('button', { name: 'Continue' }).click()).toPass();
111122
});
112123
});

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)