File tree Expand file tree Collapse file tree
test/e2e/helpers/pageObjectModels Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -uo pipefail
3+
4+ SUCCESS_FILE=" /tmp/e2e-stress-run-success-count"
5+
6+ if [[ ! -f .env.development ]]; then
7+ echo " Missing .env.development file" >&2
8+ exit 1
9+ fi
10+
11+ # Load dev environment variables so every Playwright run matches local stress conditions.
12+ set -a
13+ source .env.development
14+ set +a
15+
16+ if [[ ! -f " $SUCCESS_FILE " ]]; then
17+ echo " 0" > " $SUCCESS_FILE "
18+ fi
19+
20+ while true ; do
21+ CI=1 FORCE_COLOR=1 E2E_MOCKS=1 npx playwright test
22+ status=$?
23+
24+ if [[ $status -eq 0 ]]; then
25+ count=$( < " $SUCCESS_FILE " )
26+ if ! [[ " $count " =~ ^[0-9]+$ ]]; then
27+ count=0
28+ fi
29+ count=$(( count + 1 ))
30+ echo " $count " > " $SUCCESS_FILE "
31+ echo " Number of successful runs: $count "
32+ else
33+ count=$( < " $SUCCESS_FILE " )
34+ if ! [[ " $count " =~ ^[0-9]+$ ]]; then
35+ count=0
36+ fi
37+ echo " Number of successful runs before failure: $count "
38+ exit $status
39+ fi
40+
41+ done
Original file line number Diff line number Diff line change @@ -862,8 +862,9 @@ export class BasePage {
862862 async expectNoErrors ( ) : Promise < Array < Error > > {
863863 await this . waitForPageComplete ( )
864864 const errors = await this . _page . pageErrors ( )
865- expect ( errors ) . toHaveLength ( 0 )
866- return await this . _page . pageErrors ( )
865+ const filteredErrors = errors . filter ( ( error ) => ! this . isIgnorablePageError ( error ) )
866+ expect ( filteredErrors ) . toHaveLength ( 0 )
867+ return filteredErrors
867868 }
868869
869870 /**
@@ -1177,4 +1178,16 @@ export class BasePage {
11771178 await expect ( label ) . toBeVisible ( )
11781179 await expect ( label ) . toContainText ( pattern )
11791180 }
1181+
1182+ /**
1183+ * Filter recurring non-actionable browser errors (e.g., Firefox HMR websockets) from pageErrors().
1184+ */
1185+ private isIgnorablePageError ( error : Error ) : boolean {
1186+ const message = error ?. message ?? ''
1187+
1188+ // Firefox occasionally surfaces this when Vite's HMR websocket retries during stress runs.
1189+ if ( message . includes ( 'WebSocket closed without opened' ) ) return true
1190+
1191+ return false
1192+ }
11801193}
You can’t perform that action at this time.
0 commit comments