@@ -7,6 +7,7 @@ test.afterEach("Cleanup session", async ({ page }) => {
77
88test . beforeEach ( async ( { page } ) => {
99 await page . goto ( "/" ) ;
10+ await page . waitForLoadState ( "networkidle" ) ;
1011} ) ;
1112
1213test . describe ( "SkipLink:" , function ( ) {
@@ -17,30 +18,22 @@ test.describe("SkipLink:", function () {
1718
1819 // Check initial styling (hidden)
1920 const transform = await skipLink . evaluate ( el => getComputedStyle ( el ) . transform ) ;
20- expect ( transform ) . toContain ( "translateY(-120%)" ) || expect ( transform ) . toContain ( "matrix ") ;
21+ expect ( transform ) . toContain ( "matrix(1, 0, 0, 1, 0, -48) " ) ;
2122 } ) ;
2223
2324 test ( "skip link becomes visible when focused via keyboard" , async ( { page } ) => {
2425 // Tab to focus the skip link (should be first focusable element)
26+ const skipLink = page . locator ( ".skip-link" ) . first ( ) ;
2527 await page . keyboard . press ( "Tab" ) ;
2628
27- const skipLink = page . locator ( ".skip-link" ) . first ( ) ;
2829 await expect ( skipLink ) . toBeFocused ( ) ;
29-
30+ await page . waitForTimeout ( 1000 ) ;
3031 // Check that it becomes visible when focused
3132 const transform = await skipLink . evaluate ( el => getComputedStyle ( el ) . transform ) ;
32- expect ( transform ) . toContain ( "translateY(0px)" ) || expect ( transform ) . toBe ( "none" ) ;
33+ expect ( transform ) . toContain ( "matrix(1, 0, 0, 1, 0, 0)" )
3334 } ) ;
3435
3536 test ( "skip link navigates to main content when activated" , async ( { page } ) => {
36- // Create a main content element to test focus behavior
37- await page . evaluate ( ( ) => {
38- const main = document . createElement ( "main" ) ;
39- main . id = "main-content" ;
40- main . textContent = "Main content area" ;
41- document . body . appendChild ( main ) ;
42- } ) ;
43-
4437 // Tab to focus the skip link
4538 await page . keyboard . press ( "Tab" ) ;
4639
@@ -51,7 +44,7 @@ test.describe("SkipLink:", function () {
5144 await page . keyboard . press ( "Enter" ) ;
5245
5346 // Check that main content is now focused
54- const mainContent = page . locator ( "# main-content " ) ;
47+ const mainContent = page . locator ( "main" ) ;
5548 await expect ( mainContent ) . toBeFocused ( ) ;
5649 } ) ;
5750
@@ -62,7 +55,7 @@ test.describe("SkipLink:", function () {
6255 await expect ( skipLink ) . toHaveText ( "Skip to main content" ) ;
6356
6457 // Check href attribute
65- await expect ( skipLink ) . toHaveAttribute ( "href" , "#main-content " ) ;
58+ await expect ( skipLink ) . toHaveAttribute ( "href" , "#" ) ;
6659
6760 // Check tabindex
6861 await expect ( skipLink ) . toHaveAttribute ( "tabindex" , "0" ) ;
0 commit comments