Skip to content

Added availability check functions #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/Codeception/Module/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,45 @@ public function seeInCurrentRoute($routeName)
$this->assertEquals($matchedRouteName, $routeName);
}

/**
* Goes to a page and check that it can be accessed.
*
* ```php
* <?php
* $I->seePageIsAvailable('/dashboard');
* ```
*
* @param string $url
*/
public function seePageIsAvailable($url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can take this into InnerBrowser so it would be available to all frameworks and php browser?
This doesn't seem to be Symfony related

{
$this->amOnPage($url);
$this->seeResponseCodeIsSuccessful();
$this->seeInCurrentUrl($url);
}

/**
* Goes to a page and check that it redirects to another.
*
* ```php
* <?php
* $I->seePageRedirectsTo('/admin', '/login');
* ```
*
* @param string $page
* @param string $redirectsTo
*/
public function seePageRedirectsTo($page, $redirectsTo)
{
$this->client->followRedirects(false);
$this->amOnPage($page);
$this->assertTrue(
$this->client->getResponse()->isRedirection()
);
$this->client->followRedirect();
$this->seeInCurrentUrl($redirectsTo);
}

/**
* Checks if the desired number of emails was sent.
* If no argument is provided then at least one email must be sent to satisfy the check.
Expand Down