@@ -4,19 +4,19 @@ import { injectAuthCookies } from "../support/auth.ts";
44import type { PlaywrightWorld } from "../support/world" ;
55
66Given ( "I am on {string}" , async function ( this : PlaywrightWorld , path : string ) {
7- await this . page . goto ( `${ this . baseUrl } ${ path } ` ) ;
7+ await this . requirePage ( ) . goto ( `${ this . baseUrl } ${ path } ` ) ;
88} ) ;
99
1010Given ( "I am logged in" , async function ( this : PlaywrightWorld ) {
1111 // Perform login in a separate page and inject cookies into context
12- await injectAuthCookies ( this . context ) ;
12+ await injectAuthCookies ( this . requireContext ( ) ) ;
1313} ) ;
1414
1515// Generic click step using the {role} parameter type (canonical phrases only)
1616When (
1717 "I click on the {string} {role}" ,
1818 async function ( this : PlaywrightWorld , label : string , role : AriaRole ) {
19- await this . page . getByRole ( role , { name : label } ) . click ( ) ;
19+ await this . requirePage ( ) . getByRole ( role , { name : label } ) . click ( ) ;
2020 } ,
2121) ;
2222
@@ -25,23 +25,23 @@ When(
2525Then (
2626 "I should see the text {string}" ,
2727 async function ( this : PlaywrightWorld , text : string ) {
28- await expect ( this . page . getByText ( text ) ) . toBeVisible ( ) ;
28+ await expect ( this . requirePage ( ) . getByText ( text ) ) . toBeVisible ( ) ;
2929 } ,
3030) ;
3131
3232Then (
3333 "I should see a heading {string}" ,
3434 async function ( this : PlaywrightWorld , heading : string ) {
3535 await expect (
36- this . page . getByRole ( "heading" , { name : heading } ) ,
36+ this . requirePage ( ) . getByRole ( "heading" , { name : heading } ) ,
3737 ) . toBeVisible ( ) ;
3838 } ,
3939) ;
4040
4141Then (
4242 "I should be on {string}" ,
4343 async function ( this : PlaywrightWorld , path : string ) {
44- await expect ( this . page ) . toHaveURL (
44+ await expect ( this . requirePage ( ) ) . toHaveURL (
4545 new RegExp (
4646 `${ this . baseUrl } ${ path . replace ( / [ - / \\ ^ $ * + ? . ( ) | [ \] { } ] / g, "\\$&" ) } $` ,
4747 ) ,
0 commit comments