From c7f3eb6339b16dfc2b08c00f4e4dbac32c35bb4e Mon Sep 17 00:00:00 2001 From: Tavo Nieves J Date: Fri, 5 Feb 2021 23:59:17 -0500 Subject: [PATCH] Make url parameter optional in seePageIsAvailable --- .../Module/Symfony/BrowserAssertionsTrait.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Codeception/Module/Symfony/BrowserAssertionsTrait.php b/src/Codeception/Module/Symfony/BrowserAssertionsTrait.php index 9ecec478..6921eb19 100644 --- a/src/Codeception/Module/Symfony/BrowserAssertionsTrait.php +++ b/src/Codeception/Module/Symfony/BrowserAssertionsTrait.php @@ -34,20 +34,26 @@ public function rebootClientKernel(): void } /** - * Goes to a page and check that it can be accessed. + * Verifies that a page is available. + * By default it checks the current page, specify the `$url` parameter to change it. * * ```php * seePageIsAvailable('/dashboard'); + * $I->amOnPage('/dashboard'); + * $I->seePageIsAvailable(); + * + * $I->seePageIsAvailable('/dashboard'); // Same as above * ``` * - * @param string $url + * @param string|null $url */ - public function seePageIsAvailable(string $url): void + public function seePageIsAvailable(string $url = null): void { - $this->amOnPage($url); + if ($url !== null) { + $this->amOnPage($url); + $this->seeInCurrentUrl($url); + } $this->seeResponseCodeIsSuccessful(); - $this->seeInCurrentUrl($url); } /**