File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,11 +7,19 @@ const knownHydrationErrors = [
77 / M i n i f i e d R e a c t e r r o r # 4 2 5 \b / ,
88] ;
99
10+ const knownPlaygroundBootstrapErrors = [
11+ / S y s _ e r r o r .* f i l e a l r e a d y e x i s t s / i,
12+ / \/ s t a t i c \/ B e l t \. c m i \s * : \s * f i l e a l r e a d y e x i s t s / i,
13+ ] ;
14+
1015Cypress . on ( "uncaught:exception" , ( err ) => {
1116 const message = err && err . message ? err . message : "" ;
1217 const isKnownHydrationError = knownHydrationErrors . some ( ( pattern ) =>
1318 pattern . test ( message ) ,
1419 ) ;
20+ const isKnownPlaygroundBootstrapError = knownPlaygroundBootstrapErrors . some (
21+ ( pattern ) => pattern . test ( message ) ,
22+ ) ;
1523
1624 if ( isKnownHydrationError ) {
1725 console . warn ( "Suppressing known React hydration exception in Cypress:" , {
@@ -20,4 +28,15 @@ Cypress.on("uncaught:exception", (err) => {
2028 } ) ;
2129 return false ;
2230 }
31+
32+ if ( isKnownPlaygroundBootstrapError ) {
33+ console . warn (
34+ "Suppressing known Playground bootstrap exception in Cypress:" ,
35+ {
36+ message,
37+ error : err ,
38+ } ,
39+ ) ;
40+ return false ;
41+ }
2342} ) ;
Original file line number Diff line number Diff line change @@ -81,17 +81,26 @@ describe("Playground", () => {
8181
8282 // Verify playground shell is in light mode
8383 get ("main" )-> shouldWithValue ("have.class" , "playground-theme-light" )-> ignore
84+ cyWindow ()
85+ -> its ("localStorage" )
86+ -> invokeWithArg ("getItem" , "playgroundTheme" )
87+ -> shouldWithValue ("eq" , "light" )
88+ -> ignore
8489
8590 // Switch back to dark mode from Settings
8691 contains ("Settings" )-> click -> ignore
87- contains ("Playground Theme" )
88- -> closest ("div" )
92+ get ("main" )
8993 -> find ("button" )
9094 -> containsChainable ("Dark" )
9195 -> click
9296 -> ignore
9397
9498 // Verify playground shell is back to dark mode
9599 get ("main" )-> shouldWithValue ("have.class" , "playground-theme-dark" )-> ignore
100+ cyWindow ()
101+ -> its ("localStorage" )
102+ -> invokeWithArg ("getItem" , "playgroundTheme" )
103+ -> shouldWithValue ("eq" , "dark" )
104+ -> ignore
96105 })
97106})
You can’t perform that action at this time.
0 commit comments