Skip to content

Commit 27e0c13

Browse files
authored
Fix firefox test flake on firewall rule targets (#2705)
fix firefox test flake on firewall rule targets
1 parent db94dea commit 27e0c13

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

playwright.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export default {
1919
retries: process.env.CI ? 2 : 0,
2020
// use all available cores (2) on github actions. default is 50%, use that locally
2121
workers: process.env.CI ? '100%' : undefined,
22-
timeout: 2 * 60 * 1000, // 2 minutes, surely overkill
22+
timeout: 60 * 1000, // 1 minute
2323
fullyParallel: true,
2424
use: {
25-
trace: 'on-all-retries',
25+
trace: process.env.CI ? 'on-first-retry' : 'retain-on-failure',
2626
baseURL: 'http://localhost:4009',
2727
},
2828
projects: [

test/e2e/firewall-rules.e2e.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { expect, test, type Locator, type Page } from '@playwright/test'
1010

11-
import { clickRowAction, expectRowVisible, selectOption } from './utils'
11+
import { clickRowAction, expectRowVisible, selectOption, sleep } from './utils'
1212

1313
const defaultRules = ['allow-internal-inbound', 'allow-ssh', 'allow-icmp']
1414

@@ -168,6 +168,11 @@ test('firewall rule form targets table', async ({ page }) => {
168168
await targetVpcNameField.fill('abc')
169169
// hit enter one time to choose the custom value
170170
await targetVpcNameField.press('Enter')
171+
172+
// pressing enter twice here in quick succession causes test flake in firefox
173+
// specifically and this fixes it
174+
await sleep(300)
175+
171176
// hit enter a second time to submit the subform
172177
await targetVpcNameField.press('Enter')
173178
await expectRowVisible(targets, { Type: 'vpc', Value: 'abc' })

test/e2e/utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ export async function expectRowVisible(
6969
) {
7070
// wait for header and rows to avoid flake town
7171
const headerLoc = table.locator('thead >> role=cell')
72-
await headerLoc.first().waitFor() // nth=0 bc error if there's more than 1
72+
// unlike most things, waitFor has no timeout by default
73+
await headerLoc.first().waitFor({ timeout: 10_000 }) // nth=0 bc error if there's more than 1
7374

7475
const rowLoc = table.locator('tbody >> role=row')
75-
await rowLoc.first().waitFor()
76+
await rowLoc.first().waitFor({ timeout: 10_000 })
7677

7778
async function getRows() {
7879
// need to pull header keys every time because the whole page can change

0 commit comments

Comments
 (0)