@@ -18,7 +18,7 @@ test.describe('Dark Mode Theme Switching', () => {
1818 addPageAnnotationBeforeEach ( PAGES . SHARE . THEME_TOGGLE ) ;
1919 let themePage : ThemePage ;
2020
21- test . beforeEach ( async ( { page, browserName } ) => {
21+ test . beforeEach ( async ( { page } ) => {
2222 themePage = new ThemePage ( page ) ;
2323 await page . goto ( '/' ) ;
2424 await waitForZeppelinReady ( page ) ;
@@ -31,8 +31,6 @@ test.describe('Dark Mode Theme Switching', () => {
3131 } ) ;
3232
3333 test ( 'Scenario: User can switch to dark mode and persistence is maintained' , async ( { page, context } ) => {
34- let currentPage = page ;
35-
3634 // GIVEN: User is on the main page, which starts in 'system' mode by default (localStorage cleared).
3735 await test . step ( 'GIVEN the page starts in system mode' , async ( ) => {
3836 await themePage . assertSystemTheme ( ) ; // Robot icon for system theme
@@ -47,26 +45,10 @@ test.describe('Dark Mode Theme Switching', () => {
4745 } ) ;
4846
4947 // WHEN: User switches to dark mode by setting localStorage and reloading.
50- await test . step ( 'WHEN the user switches to dark mode' , async ( ) => {
48+ await test . step ( 'WHEN the user explicitly sets theme to dark mode' , async ( ) => {
5149 await themePage . setThemeInLocalStorage ( 'dark' ) ;
52- const newPage = await context . newPage ( ) ;
53- await newPage . goto ( currentPage . url ( ) , { waitUntil : 'networkidle' } ) ;
54- await waitForZeppelinReady ( newPage ) ;
55-
56- // Update themePage to use newPage and verify dark mode
57- themePage = new ThemePage ( newPage ) ;
58- currentPage = newPage ;
59- await themePage . assertDarkTheme ( ) ;
60- } ) ;
61-
62- // AND: User refreshes the page.
63- await test . step ( 'AND the user refreshes the page' , async ( ) => {
64- await currentPage . reload ( ) ;
65- await waitForZeppelinReady ( currentPage ) ;
66- } ) ;
67-
68- // THEN: Dark mode is maintained after refresh.
69- await test . step ( 'THEN dark mode is maintained after refresh' , async ( ) => {
50+ await page . reload ( ) ;
51+ await waitForZeppelinReady ( page ) ;
7052 await themePage . assertDarkTheme ( ) ;
7153 } ) ;
7254
0 commit comments