File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,14 +30,17 @@ function visit(string $url): PendingTest
3030 /**
3131 * Visits the given URL, and starts a new browser test.
3232 */
33- function page (string $ url = ' / ' ): Page
33+ function page (? string $ url = null ): Page
3434 {
3535 Server::instance ()->start ();
3636 Client::instance ()->connectTo (Server::instance ()->url ('?browser=chromium ' ));
3737
3838 $ browser = Playwright::chromium ()->launch ();
3939 $ page = $ browser ->newPage ();
40- $ page ->goto ($ url );
40+
41+ if ($ url !== null ) {
42+ $ page ->goto ($ url );
43+ }
4144
4245 return $ page ;
4346 }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public function visit(string $url): PendingTest
2222 /**
2323 * gets the page instance for given URL.
2424 */
25- public function page (string $ url ): Page
25+ public function page (? string $ url = null ): Page
2626 {
2727 return page ($ url );
2828 }
Original file line number Diff line number Diff line change 66
77describe ('assertChecked ' , function (): void {
88 it ('passes when checkbox is checked ' , function (): void {
9- $ page = $ this ->page (playgroundUrl ('/test/form-inputs ' ));
9+ $ page = $ this ->page ()-> goto ( playgroundUrl ('/test/form-inputs ' ));
1010
1111 expect ($ page ->querySelector ('input[name="checked-checkbox"] ' ))->toBeChecked ();
1212 });
1313
1414 it ('fails when checkbox is checked ' , function (): void {
15- $ page = $ this ->page (playgroundUrl ('/test/form-inputs ' ));
15+ $ page = $ this ->page ()-> goto ( playgroundUrl ('/test/form-inputs ' ));
1616
1717 expect ($ page ->querySelector ('input[name="checked-checkbox"] ' ))->not ->toBeChecked ();
1818 })->throws (ExpectationFailedException::class);
1919
2020 it ('passes when checkbox is not checked ' , function (): void {
21- $ page = $ this ->page (playgroundUrl ('/test/form-inputs ' ));
21+ $ page = $ this ->page ()-> goto ( playgroundUrl ('/test/form-inputs ' ));
2222
2323 expect ($ page ->querySelector ('input[name="unchecked-checkbox"] ' ))->not ->toBeChecked ();
2424 });
2525
2626 it ('fails when checkbox is not checked ' , function (): void {
27- $ page = $ this ->page (playgroundUrl ('/test/form-inputs ' ));
27+ $ page = $ this ->page ()-> goto ( playgroundUrl ('/test/form-inputs ' ));
2828
2929 expect ($ page ->querySelector ('input[name="unchecked-checkbox"] ' ))->toBeChecked ();
3030 })->throws (ExpectationFailedException::class);
You can’t perform that action at this time.
0 commit comments