mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
2390 lines
79 KiB
PHP
2390 lines
79 KiB
PHP
<?php //[STAMP] b08a68f76e9949287107c90f548717f0
|
|
|
|
// This class was automatically generated by build task
|
|
// You should not change it manually as it will be overwritten on next build
|
|
// @codingStandardsIgnoreFile
|
|
|
|
|
|
use Codeception\Module\PhpBrowser;
|
|
use Codeception\Module\REST;
|
|
|
|
/**
|
|
* Inherited Methods
|
|
* @method void wantToTest($text)
|
|
* @method void wantTo($text)
|
|
* @method void execute($callable)
|
|
* @method void expectTo($prediction)
|
|
* @method void expect($prediction)
|
|
* @method void amGoingTo($argumentation)
|
|
* @method void am($role)
|
|
* @method void lookForwardTo($achieveValue)
|
|
* @method void comment($description)
|
|
* @method void haveFriend($name, $actorClass = null)
|
|
*
|
|
* @SuppressWarnings(PHPMD)
|
|
*/
|
|
class ApiTester extends \Codeception\Actor
|
|
{
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
*
|
|
* @see \Codeception\Module\PhpBrowser::setHeader()
|
|
*/
|
|
public function setHeader($header, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('setHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds HTTP authentication via username/password.
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @see \Codeception\Module\REST::amHttpAuthenticated()
|
|
*/
|
|
public function amHttpAuthenticated($username, $password) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opens the page for the given relative URI.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // opens front page
|
|
* $I->amOnPage('/');
|
|
* // opens /register page
|
|
* $I->amOnPage('/register');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $page
|
|
* @see \Codeception\Module\PhpBrowser::amOnPage()
|
|
*/
|
|
public function amOnPage($page) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Open web page at the given absolute URL and sets its hostname as the base host.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->amOnUrl('http://codeception.com');
|
|
* $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart
|
|
* ?>
|
|
* ```
|
|
* @see \Codeception\Module\PhpBrowser::amOnUrl()
|
|
*/
|
|
public function amOnUrl($url) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Changes the subdomain for the 'url' configuration parameter.
|
|
* Does not open a page; use `amOnPage` for that.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // If config is: 'http://mysite.com'
|
|
* // or config is: 'http://www.mysite.com'
|
|
* // or config is: 'http://company.mysite.com'
|
|
*
|
|
* $I->amOnSubdomain('user');
|
|
* $I->amOnPage('/');
|
|
* // moves to http://user.mysite.com/
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $subdomain
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Module\PhpBrowser::amOnSubdomain()
|
|
*/
|
|
public function amOnSubdomain($subdomain) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Low-level API method.
|
|
* If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->executeInGuzzle(function (\GuzzleHttp\Client $client) {
|
|
* $client->get('/get', ['query' => ['foo' => 'bar']]);
|
|
* });
|
|
* ?>
|
|
* ```
|
|
*
|
|
* It is not recommended to use this command on a regular basis.
|
|
* If Codeception lacks important Guzzle Client methods, implement them and submit patches.
|
|
*
|
|
* @param callable $function
|
|
* @see \Codeception\Module\PhpBrowser::executeInGuzzle()
|
|
*/
|
|
public function executeInGuzzle($function) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Perform a click on a link or a button, given by a locator.
|
|
* If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
* For buttons, the "value" attribute, "name" attribute, and inner text are searched.
|
|
* For links, the link text is searched.
|
|
* For images, the "alt" attribute and inner text of any parent links are searched.
|
|
*
|
|
* The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
*
|
|
* Note that if the locator matches a button of type `submit`, the form will be submitted.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // simple link
|
|
* $I->click('Logout');
|
|
* // button of form
|
|
* $I->click('Submit');
|
|
* // CSS button
|
|
* $I->click('#form input[type=submit]');
|
|
* // XPath
|
|
* $I->click('//form/*[@type=submit]');
|
|
* // link in context
|
|
* $I->click('Logout', '#nav');
|
|
* // using strict locator
|
|
* $I->click(['link' => 'Login']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $link
|
|
* @param $context
|
|
* @see \Codeception\Lib\InnerBrowser::click()
|
|
*/
|
|
public function click($link, $context = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('click', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page contains the given string.
|
|
* Specify a locator as the second parameter to match a specific region.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->see('Logout'); // I can suppose user is logged in
|
|
* $I->see('Sign Up','h1'); // I can suppose it's a signup page
|
|
* $I->see('Sign Up','//body/h1'); // with XPath
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $selector
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::see()
|
|
*/
|
|
public function canSee($text, $selector = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page contains the given string.
|
|
* Specify a locator as the second parameter to match a specific region.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->see('Logout'); // I can suppose user is logged in
|
|
* $I->see('Sign Up','h1'); // I can suppose it's a signup page
|
|
* $I->see('Sign Up','//body/h1'); // with XPath
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $selector
|
|
* @see \Codeception\Lib\InnerBrowser::see()
|
|
*/
|
|
public function see($text, $selector = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page doesn't contain the text specified.
|
|
* Give a locator as the second parameter to match a specific region.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSee('Login'); // I can suppose user is already logged in
|
|
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
|
|
* $I->dontSee('Sign Up','//body/h1'); // with XPath
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $selector
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSee()
|
|
*/
|
|
public function cantSee($text, $selector = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current page doesn't contain the text specified.
|
|
* Give a locator as the second parameter to match a specific region.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->dontSee('Login'); // I can suppose user is already logged in
|
|
* $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
|
|
* $I->dontSee('Sign Up','//body/h1'); // with XPath
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $selector
|
|
* @see \Codeception\Lib\InnerBrowser::dontSee()
|
|
*/
|
|
public function dontSee($text, $selector = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there's a link with the specified text.
|
|
* Give a full URL as the second parameter to match links with that exact URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeLink('Logout'); // matches <a href="#">Logout</a>
|
|
* $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $url
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeLink()
|
|
*/
|
|
public function canSeeLink($text, $url = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there's a link with the specified text.
|
|
* Give a full URL as the second parameter to match links with that exact URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeLink('Logout'); // matches <a href="#">Logout</a>
|
|
* $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $url
|
|
* @see \Codeception\Lib\InnerBrowser::seeLink()
|
|
*/
|
|
public function seeLink($text, $url = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page doesn't contain a link with the given string.
|
|
* If the second parameter is given, only links with a matching "href" attribute will be checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeLink('Logout'); // I suppose user is not logged in
|
|
* $I->dontSeeLink('Checkout now', '/store/cart.php');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $url
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeLink()
|
|
*/
|
|
public function cantSeeLink($text, $url = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page doesn't contain a link with the given string.
|
|
* If the second parameter is given, only links with a matching "href" attribute will be checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeLink('Logout'); // I suppose user is not logged in
|
|
* $I->dontSeeLink('Checkout now', '/store/cart.php');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $text
|
|
* @param null $url
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeLink()
|
|
*/
|
|
public function dontSeeLink($text, $url = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that current URI contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match: /home/dashboard
|
|
* $I->seeInCurrentUrl('home');
|
|
* // to match: /users/1
|
|
* $I->seeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
|
|
*/
|
|
public function canSeeInCurrentUrl($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that current URI contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match: /home/dashboard
|
|
* $I->seeInCurrentUrl('home');
|
|
* // to match: /users/1
|
|
* $I->seeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
|
|
*/
|
|
public function seeInCurrentUrl($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URI doesn't contain the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
|
|
*/
|
|
public function cantSeeInCurrentUrl($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URI doesn't contain the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInCurrentUrl('/users/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
|
|
*/
|
|
public function dontSeeInCurrentUrl($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL is equal to the given string.
|
|
* Unlike `seeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
|
|
*/
|
|
public function canSeeCurrentUrlEquals($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL is equal to the given string.
|
|
* Unlike `seeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
|
|
*/
|
|
public function seeCurrentUrlEquals($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL doesn't equal the given string.
|
|
* Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // current url is not root
|
|
* $I->dontSeeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
|
|
*/
|
|
public function cantSeeCurrentUrlEquals($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL doesn't equal the given string.
|
|
* Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // current url is not root
|
|
* $I->dontSeeCurrentUrlEquals('/');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
|
|
*/
|
|
public function dontSeeCurrentUrlEquals($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL matches the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
|
|
*/
|
|
public function canSeeCurrentUrlMatches($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the current URL matches the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
|
|
*/
|
|
public function seeCurrentUrlMatches($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that current url doesn't match the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
|
|
*/
|
|
public function cantSeeCurrentUrlMatches($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that current url doesn't match the given regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // to match root url
|
|
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
|
|
*/
|
|
public function dontSeeCurrentUrlMatches($uri) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Executes the given regular expression against the current URI and returns the first match.
|
|
* If no parameters are provided, the full URI is returned.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
|
|
* $uri = $I->grabFromCurrentUrl();
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param null $uri
|
|
*
|
|
* @internal param $url
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
|
|
*/
|
|
public function grabFromCurrentUrl($uri = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the specified checkbox is checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
|
|
* $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
|
|
*/
|
|
public function canSeeCheckboxIsChecked($checkbox) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the specified checkbox is checked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
|
|
* $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
|
|
*/
|
|
public function seeCheckboxIsChecked($checkbox) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Check that the specified checkbox is unchecked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
|
|
*/
|
|
public function cantSeeCheckboxIsChecked($checkbox) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Check that the specified checkbox is unchecked.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
|
|
* $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $checkbox
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
|
|
*/
|
|
public function dontSeeCheckboxIsChecked($checkbox) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given input field or textarea contains the given value.
|
|
* For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInField('Body','Type your comment here');
|
|
* $I->seeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->seeInField('form input[type=hidden]','hidden_value');
|
|
* $I->seeInField('#searchform input','Search');
|
|
* $I->seeInField('//form/*[@name=search]','Search');
|
|
* $I->seeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeInField()
|
|
*/
|
|
public function canSeeInField($field, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given input field or textarea contains the given value.
|
|
* For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInField('Body','Type your comment here');
|
|
* $I->seeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->seeInField('form input[type=hidden]','hidden_value');
|
|
* $I->seeInField('#searchform input','Search');
|
|
* $I->seeInField('//form/*[@name=search]','Search');
|
|
* $I->seeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::seeInField()
|
|
*/
|
|
public function seeInField($field, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that an input field or textarea doesn't contain the given value.
|
|
* For fuzzy locators, the field is matched by label text, CSS and XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInField('Body','Type your comment here');
|
|
* $I->dontSeeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->dontSeeInField('form input[type=hidden]','hidden_value');
|
|
* $I->dontSeeInField('#searchform input','Search');
|
|
* $I->dontSeeInField('//form/*[@name=search]','Search');
|
|
* $I->dontSeeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInField()
|
|
*/
|
|
public function cantSeeInField($field, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that an input field or textarea doesn't contain the given value.
|
|
* For fuzzy locators, the field is matched by label text, CSS and XPath.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeInField('Body','Type your comment here');
|
|
* $I->dontSeeInField('form textarea[name=body]','Type your comment here');
|
|
* $I->dontSeeInField('form input[type=hidden]','hidden_value');
|
|
* $I->dontSeeInField('#searchform input','Search');
|
|
* $I->dontSeeInField('//form/*[@name=search]','Search');
|
|
* $I->dontSeeInField(['name' => 'search'], 'Search');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInField()
|
|
*/
|
|
public function dontSeeInField($field, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Submits the given form on the page, optionally with the given form values.
|
|
* Give the form fields values as an array.
|
|
*
|
|
* Skipped fields will be filled by their values from the page.
|
|
* You don't need to click the 'Submit' button afterwards.
|
|
* This command itself triggers the request to form's action.
|
|
*
|
|
* You can optionally specify what button's value to include
|
|
* in the request with the last parameter as an alternative to
|
|
* explicitly setting its value in the second parameter, as
|
|
* button values are not otherwise included in the request.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));
|
|
* // or
|
|
* $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'), 'submitButtonName');
|
|
*
|
|
* ```
|
|
*
|
|
* For example, given this sample "Sign Up" form:
|
|
*
|
|
* ``` html
|
|
* <form action="/sign_up">
|
|
* Login: <input type="text" name="user[login]" /><br/>
|
|
* Password: <input type="password" name="user[password]" /><br/>
|
|
* Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/>
|
|
* Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select>
|
|
* <input type="submit" name="submitButton" value="Submit" />
|
|
* </form>
|
|
* ```
|
|
*
|
|
* You could write the following to submit it:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)), 'submitButton');
|
|
*
|
|
* ```
|
|
* Note that "2" will be the submitted value for the "plan" field, as it is the selected option.
|
|
*
|
|
* You can also emulate a JavaScript submission by not specifying any buttons in the third parameter to submitForm.
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));
|
|
*
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $params
|
|
* @param $button
|
|
* @see \Codeception\Lib\InnerBrowser::submitForm()
|
|
*/
|
|
public function submitForm($selector, $params, $button = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Fills a text field or textarea with the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->fillField("//input[@type='text']", "Hello World!");
|
|
* $I->fillField(['name' => 'email'], 'jon@mail.com');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $value
|
|
* @see \Codeception\Lib\InnerBrowser::fillField()
|
|
*/
|
|
public function fillField($field, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Selects an option in a select tag or in radio button group.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->selectOption('form select[name=account]', 'Premium');
|
|
* $I->selectOption('form input[name=payment]', 'Monthly');
|
|
* $I->selectOption('//form/select[@name=account]', 'Monthly');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* Provide an array for the second argument to select multiple options:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->selectOption('Which OS do you use?', array('Windows','Linux'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $select
|
|
* @param $option
|
|
* @see \Codeception\Lib\InnerBrowser::selectOption()
|
|
*/
|
|
public function selectOption($select, $option) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->checkOption('#agree');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $option
|
|
* @see \Codeception\Lib\InnerBrowser::checkOption()
|
|
*/
|
|
public function checkOption($option) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Unticks a checkbox.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->uncheckOption('#notify');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $option
|
|
* @see \Codeception\Lib\InnerBrowser::uncheckOption()
|
|
*/
|
|
public function uncheckOption($option) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Attaches a file relative to the Codeception data directory to the given file upload field.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // file is stored in 'tests/_data/prices.xls'
|
|
* $I->attachFile('input[@type="file"]', 'prices.xls');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $field
|
|
* @param $filename
|
|
* @see \Codeception\Lib\InnerBrowser::attachFile()
|
|
*/
|
|
public function attachFile($field, $filename) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* If your page triggers an ajax request, you can perform it manually.
|
|
* This action sends a GET ajax request with specified params.
|
|
*
|
|
* See ->sendAjaxPostRequest for examples.
|
|
*
|
|
* @param $uri
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest()
|
|
*/
|
|
public function sendAjaxGetRequest($uri, $params = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* If your page triggers an ajax request, you can perform it manually.
|
|
* This action sends a POST ajax request with specified params.
|
|
* Additional params can be passed as array.
|
|
*
|
|
* Example:
|
|
*
|
|
* Imagine that by clicking checkbox you trigger ajax request which updates user settings.
|
|
* We emulate that click by running this ajax request manually.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST
|
|
* $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET
|
|
*
|
|
* ```
|
|
*
|
|
* @param $uri
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest()
|
|
*/
|
|
public function sendAjaxPostRequest($uri, $params = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* If your page triggers an ajax request, you can perform it manually.
|
|
* This action sends an ajax request with specified method and params.
|
|
*
|
|
* Example:
|
|
*
|
|
* You need to perform an ajax request specifying the HTTP method.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title'));
|
|
*
|
|
* ```
|
|
*
|
|
* @param $method
|
|
* @param $uri
|
|
* @param $params
|
|
* @see \Codeception\Lib\InnerBrowser::sendAjaxRequest()
|
|
*/
|
|
public function sendAjaxRequest($method, $uri, $params = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Finds and returns the text contents of the given element.
|
|
* If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $heading = $I->grabTextFrom('h1');
|
|
* $heading = $I->grabTextFrom('descendant-or-self::h1');
|
|
* $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cssOrXPathOrRegex
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabTextFrom()
|
|
*/
|
|
public function grabTextFrom($cssOrXPathOrRegex) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Grabs the value of the given attribute value from the given element.
|
|
* Fails if element is not found.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->grabAttributeFrom('#tooltip', 'title');
|
|
* ?>
|
|
* ```
|
|
*
|
|
*
|
|
* @param $cssOrXpath
|
|
* @param $attribute
|
|
* @internal param $element
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
|
|
*/
|
|
public function grabAttributeFrom($cssOrXpath, $attribute) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* @param $field
|
|
*
|
|
* @return array|mixed|null|string
|
|
* @see \Codeception\Lib\InnerBrowser::grabValueFrom()
|
|
*/
|
|
public function grabValueFrom($field) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets a cookie with the given name and value.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cookie
|
|
* @param $value
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::setCookie()
|
|
*/
|
|
public function setCookie($name, $val) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Grabs a cookie value.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::grabCookie()
|
|
*/
|
|
public function grabCookie($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that a cookie with the given name is set.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCookie('PHPSESSID');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @return mixed
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
|
*/
|
|
public function canSeeCookie($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that a cookie with the given name is set.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeCookie('PHPSESSID');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeCookie()
|
|
*/
|
|
public function seeCookie($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there isn't a cookie with the given name.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @return mixed
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
|
*/
|
|
public function cantSeeCookie($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there isn't a cookie with the given name.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
|
|
*/
|
|
public function dontSeeCookie($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Unsets cookie with the given name.
|
|
*
|
|
* @param $cookie
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::resetCookie()
|
|
*/
|
|
public function resetCookie($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given element exists on the page and is visible.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeElement('.error');
|
|
* $I->seeElement('//form/input[1]');
|
|
* $I->seeElement('input', ['name' => 'login']);
|
|
* $I->seeElement('input', ['value' => '123456']);
|
|
*
|
|
* // strict locator in first arg, attributes in second
|
|
* $I->seeElement(['css' => 'form input'], ['name' => 'login']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @return
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeElement()
|
|
*/
|
|
public function canSeeElement($selector, $attributes = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given element exists on the page and is visible.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeElement('.error');
|
|
* $I->seeElement('//form/input[1]');
|
|
* $I->seeElement('input', ['name' => 'login']);
|
|
* $I->seeElement('input', ['value' => '123456']);
|
|
*
|
|
* // strict locator in first arg, attributes in second
|
|
* $I->seeElement(['css' => 'form input'], ['name' => 'login']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @return
|
|
* @see \Codeception\Lib\InnerBrowser::seeElement()
|
|
*/
|
|
public function seeElement($selector, $attributes = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given element is invisible or not present on the page.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeElement('.error');
|
|
* $I->dontSeeElement('//form/input[1]');
|
|
* $I->dontSeeElement('input', ['name' => 'login']);
|
|
* $I->dontSeeElement('input', ['value' => '123456']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeElement()
|
|
*/
|
|
public function cantSeeElement($selector, $attributes = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given element is invisible or not present on the page.
|
|
* You can also specify expected attributes of this element.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeElement('.error');
|
|
* $I->dontSeeElement('//form/input[1]');
|
|
* $I->dontSeeElement('input', ['name' => 'login']);
|
|
* $I->dontSeeElement('input', ['value' => '123456']);
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param array $attributes
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeElement()
|
|
*/
|
|
public function dontSeeElement($selector, $attributes = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there are a certain number of elements matched by the given locator on the page.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeNumberOfElements('tr', 10);
|
|
* $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
|
|
* ?>
|
|
* ```
|
|
* @param $selector
|
|
* @param mixed $expected:
|
|
* - string: strict number
|
|
* - array: range of numbers [0,10]
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
|
|
*/
|
|
public function canSeeNumberOfElements($selector, $expected) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that there are a certain number of elements matched by the given locator on the page.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeNumberOfElements('tr', 10);
|
|
* $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
|
|
* ?>
|
|
* ```
|
|
* @param $selector
|
|
* @param mixed $expected:
|
|
* - string: strict number
|
|
* - array: range of numbers [0,10]
|
|
* @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
|
|
*/
|
|
public function seeNumberOfElements($selector, $expected) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given option is selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
|
|
*/
|
|
public function canSeeOptionIsSelected($select, $optionText) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given option is selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
|
|
*/
|
|
public function seeOptionIsSelected($select, $optionText) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given option is not selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
|
|
*/
|
|
public function cantSeeOptionIsSelected($select, $optionText) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the given option is not selected.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $selector
|
|
* @param $optionText
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
|
|
*/
|
|
public function dontSeeOptionIsSelected($select, $optionText) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Asserts that current page has 404 response status code.
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seePageNotFound()
|
|
*/
|
|
public function canSeePageNotFound() {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Asserts that current page has 404 response status code.
|
|
* @see \Codeception\Lib\InnerBrowser::seePageNotFound()
|
|
*/
|
|
public function seePageNotFound() {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks response code equals to provided value.
|
|
*
|
|
* @param $code
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseCodeIs()
|
|
*/
|
|
public function canSeeResponseCodeIs($code) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks response code equals to provided value.
|
|
*
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::seeResponseCodeIs()
|
|
*/
|
|
public function seeResponseCodeIs($code) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page title contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInTitle('Blog - Post #1');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::seeInTitle()
|
|
*/
|
|
public function canSeeInTitle($title) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page title contains the given string.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeInTitle('Blog - Post #1');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::seeInTitle()
|
|
*/
|
|
public function seeInTitle($title) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page title does not contain the given string.
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
|
|
*/
|
|
public function cantSeeInTitle($title) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that the page title does not contain the given string.
|
|
*
|
|
* @param $title
|
|
*
|
|
* @return mixed
|
|
* @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
|
|
*/
|
|
public function dontSeeInTitle($title) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sets HTTP header
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @see \Codeception\Module\REST::haveHttpHeader()
|
|
*/
|
|
public function haveHttpHeader($name, $value) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeHttpHeader()
|
|
*/
|
|
public function canSeeHttpHeader($name, $value = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeader', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @see \Codeception\Module\REST::seeHttpHeader()
|
|
*/
|
|
public function seeHttpHeader($name, $value = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are not there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeHttpHeader()
|
|
*/
|
|
public function cantSeeHttpHeader($name, $value = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks over the given HTTP header and (optionally)
|
|
* its value, asserting that are not there
|
|
*
|
|
* @param $name
|
|
* @param $value
|
|
* @see \Codeception\Module\REST::dontSeeHttpHeader()
|
|
*/
|
|
public function dontSeeHttpHeader($name, $value = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that http response header is received only once.
|
|
* HTTP RFC2616 allows multiple response headers with the same name.
|
|
* You can check that you didn't accidentally sent the same header twice.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeHttpHeaderOnce('Cache-Control');
|
|
* ?>>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeHttpHeaderOnce()
|
|
*/
|
|
public function canSeeHttpHeaderOnce($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that http response header is received only once.
|
|
* HTTP RFC2616 allows multiple response headers with the same name.
|
|
* You can check that you didn't accidentally sent the same header twice.
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $I->seeHttpHeaderOnce('Cache-Control');
|
|
* ?>>
|
|
* ```
|
|
*
|
|
* @param $name
|
|
* @see \Codeception\Module\REST::seeHttpHeaderOnce()
|
|
*/
|
|
public function seeHttpHeaderOnce($name) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeHttpHeaderOnce', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns the value of the specified header name
|
|
*
|
|
* @param $name
|
|
* @param Boolean $first Whether to return the first value or all header values
|
|
*
|
|
* @return string|array The first header value if $first is true, an array of values otherwise
|
|
* @see \Codeception\Module\REST::grabHttpHeader()
|
|
*/
|
|
public function grabHttpHeader($name, $first = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabHttpHeader', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds Digest authentication via username/password.
|
|
*
|
|
* @param $username
|
|
* @param $password
|
|
* @see \Codeception\Module\REST::amDigestAuthenticated()
|
|
*/
|
|
public function amDigestAuthenticated($username, $password) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Condition('amDigestAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Adds Bearer authentication via access token.
|
|
*
|
|
* @param $accessToken
|
|
* @see \Codeception\Module\REST::amBearerAuthenticated()
|
|
*/
|
|
public function amBearerAuthenticated($accessToken) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Condition('amBearerAuthenticated', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a POST request to given uri.
|
|
*
|
|
* Parameters and files (as array of filenames) can be provided.
|
|
*
|
|
* @param $url
|
|
* @param array|\JsonSerializable $params
|
|
* @param array $files
|
|
* @see \Codeception\Module\REST::sendPOST()
|
|
*/
|
|
public function sendPOST($url, $params = null, $files = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendPOST', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a HEAD request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @see \Codeception\Module\REST::sendHEAD()
|
|
*/
|
|
public function sendHEAD($url, $params = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendHEAD', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends an OPTIONS request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @see \Codeception\Module\REST::sendOPTIONS()
|
|
*/
|
|
public function sendOPTIONS($url, $params = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendOPTIONS', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends a GET request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @see \Codeception\Module\REST::sendGET()
|
|
*/
|
|
public function sendGET($url, $params = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendGET', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends PUT request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @see \Codeception\Module\REST::sendPUT()
|
|
*/
|
|
public function sendPUT($url, $params = null, $files = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendPUT', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends PATCH request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @see \Codeception\Module\REST::sendPATCH()
|
|
*/
|
|
public function sendPATCH($url, $params = null, $files = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendPATCH', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends DELETE request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $params
|
|
* @param array $files
|
|
* @see \Codeception\Module\REST::sendDELETE()
|
|
*/
|
|
public function sendDELETE($url, $params = null, $files = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendDELETE', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends LINK request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $linkEntries (entry is array with keys "uri" and "link-param")
|
|
*
|
|
* @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4
|
|
*
|
|
* @author samva.ua@gmail.com
|
|
* @see \Codeception\Module\REST::sendLINK()
|
|
*/
|
|
public function sendLINK($url, $linkEntries) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendLINK', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Sends UNLINK request to given uri.
|
|
*
|
|
* @param $url
|
|
* @param array $linkEntries (entry is array with keys "uri" and "link-param")
|
|
* @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4
|
|
* @author samva.ua@gmail.com
|
|
* @see \Codeception\Module\REST::sendUNLINK()
|
|
*/
|
|
public function sendUNLINK($url, $linkEntries) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('sendUNLINK', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid JSON.
|
|
* This is done with json_last_error function.
|
|
*
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseIsJson()
|
|
*/
|
|
public function canSeeResponseIsJson() {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid JSON.
|
|
* This is done with json_last_error function.
|
|
*
|
|
* @see \Codeception\Module\REST::seeResponseIsJson()
|
|
*/
|
|
public function seeResponseIsJson() {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseIsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid XML.
|
|
* This is done with libxml_get_last_error function.
|
|
*
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseIsXml()
|
|
*/
|
|
public function canSeeResponseIsXml() {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response was valid XML.
|
|
* This is done with libxml_get_last_error function.
|
|
*
|
|
* @see \Codeception\Module\REST::seeResponseIsXml()
|
|
*/
|
|
public function seeResponseIsXml() {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last response contains text.
|
|
*
|
|
* @param $text
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseContains()
|
|
*/
|
|
public function canSeeResponseContains($text) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last response contains text.
|
|
*
|
|
* @param $text
|
|
* @see \Codeception\Module\REST::seeResponseContains()
|
|
*/
|
|
public function seeResponseContains($text) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response do not contain text.
|
|
*
|
|
* @param $text
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseContains()
|
|
*/
|
|
public function cantSeeResponseContains($text) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether last response do not contain text.
|
|
*
|
|
* @param $text
|
|
* @see \Codeception\Module\REST::dontSeeResponseContains()
|
|
*/
|
|
public function dontSeeResponseContains($text) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseContains', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last JSON response contains provided array.
|
|
* The response is converted to array with json_decode($response, true)
|
|
* Thus, JSON is represented by associative array.
|
|
* This method matches that response array contains provided array.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {name: john, email: john@gmail.com}
|
|
* $I->seeResponseContainsJson(array('name' => 'john'));
|
|
*
|
|
* // response {user: john, profile: { email: john@gmail.com }}
|
|
* $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* This method recursively checks if one array can be found inside of another.
|
|
*
|
|
* @param array $json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseContainsJson()
|
|
*/
|
|
public function canSeeResponseContainsJson($json = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks whether the last JSON response contains provided array.
|
|
* The response is converted to array with json_decode($response, true)
|
|
* Thus, JSON is represented by associative array.
|
|
* This method matches that response array contains provided array.
|
|
*
|
|
* Examples:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // response: {name: john, email: john@gmail.com}
|
|
* $I->seeResponseContainsJson(array('name' => 'john'));
|
|
*
|
|
* // response {user: john, profile: { email: john@gmail.com }}
|
|
* $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
|
|
*
|
|
* ?>
|
|
* ```
|
|
*
|
|
* This method recursively checks if one array can be found inside of another.
|
|
*
|
|
* @param array $json
|
|
* @see \Codeception\Module\REST::seeResponseContainsJson()
|
|
*/
|
|
public function seeResponseContainsJson($json = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseContainsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns current response so that it can be used in next scenario steps.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user_id = $I->grabResponse();
|
|
* $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 1.1
|
|
* @return string
|
|
* @see \Codeception\Module\REST::grabResponse()
|
|
*/
|
|
public function grabResponse() {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabResponse', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns data from the current JSON response using specified path
|
|
* so that it can be used in next scenario steps.
|
|
*
|
|
* **this method is deprecated in favor of `grabDataFromResponseByJsonPath`**
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* $user_id = $I->grabDataFromJsonResponse('user.user_id');
|
|
* $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @deprecated please use `grabDataFromResponseByJsonPath`
|
|
* @param string $path
|
|
* @return string
|
|
* @see \Codeception\Module\REST::grabDataFromJsonResponse()
|
|
*/
|
|
public function grabDataFromJsonResponse($path = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabDataFromJsonResponse', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Returns data from the current JSON response using [JSONPath](http://goessner.net/articles/JsonPath/) as selector.
|
|
* JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* Even for a single value an array is returned.
|
|
*
|
|
* This method **require [`flow/jsonpath`](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* Example:
|
|
*
|
|
* ``` php
|
|
* <?php
|
|
* // match the first `user.id` in json
|
|
* $firstUser = $I->grabDataFromJsonResponse('$..users[0].id');
|
|
* $I->sendPUT('/user', array('id' => $firstUser[0], 'name' => 'davert'));
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @param $jsonPath
|
|
* @return array
|
|
* @version 2.0.9
|
|
* @throws \Exception
|
|
* @see \Codeception\Module\REST::grabDataFromResponseByJsonPath()
|
|
*/
|
|
public function grabDataFromResponseByJsonPath($jsonPath) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Action('grabDataFromResponseByJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches the xpath provided.
|
|
* JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath.
|
|
* This assertion allows you to check the structure of response json.
|
|
* *
|
|
* ```json
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book/author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book[1]/author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesXpath('/store//price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 2.0.9
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesXpath()
|
|
*/
|
|
public function canSeeResponseJsonMatchesXpath($xpath) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches the xpath provided.
|
|
* JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath.
|
|
* This assertion allows you to check the structure of response json.
|
|
* *
|
|
* ```json
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book/author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesXpath('//store/book[1]/author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesXpath('/store//price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesXpath()
|
|
*/
|
|
public function seeResponseJsonMatchesXpath($xpath) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesXpath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/).
|
|
* JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* This assertion allows you to check the structure of response json.
|
|
*
|
|
* This method **require [`flow/jsonpath`](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store..price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 2.0.9
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function canSeeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/).
|
|
* JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/).
|
|
* This assertion allows you to check the structure of response json.
|
|
*
|
|
* This method **require [`flow/jsonpath`](https://github.com/FlowCommunications/JSONPath/) library to be installed**.
|
|
*
|
|
* ```json
|
|
* { "store": {
|
|
* "book": [
|
|
* { "category": "reference",
|
|
* "author": "Nigel Rees",
|
|
* "title": "Sayings of the Century",
|
|
* "price": 8.95
|
|
* },
|
|
* { "category": "fiction",
|
|
* "author": "Evelyn Waugh",
|
|
* "title": "Sword of Honour",
|
|
* "price": 12.99
|
|
* }
|
|
* ],
|
|
* "bicycle": {
|
|
* "color": "red",
|
|
* "price": 19.95
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*
|
|
* ```php
|
|
* <?php
|
|
* // at least one book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author');
|
|
* // first book in store has author
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author');
|
|
* // at least one item in store has price
|
|
* $I->seeResponseJsonMatchesJsonPath('$.store..price');
|
|
* ?>
|
|
* ```
|
|
*
|
|
* @version 2.0.9
|
|
* @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath()
|
|
*/
|
|
public function seeResponseJsonMatchesJsonPath($jsonPath) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesJsonPath', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseContainsJson
|
|
*
|
|
* @param array $json
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseContainsJson()
|
|
*/
|
|
public function cantSeeResponseContainsJson($json = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Opposite to seeResponseContainsJson
|
|
*
|
|
* @param array $json
|
|
* @see \Codeception\Module\REST::dontSeeResponseContainsJson()
|
|
*/
|
|
public function dontSeeResponseContainsJson($json = null) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseContainsJson', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if response is exactly the same as provided.
|
|
*
|
|
* @param $response
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::seeResponseEquals()
|
|
*/
|
|
public function canSeeResponseEquals($response) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks if response is exactly the same as provided.
|
|
*
|
|
* @param $response
|
|
* @see \Codeception\Module\REST::seeResponseEquals()
|
|
*/
|
|
public function seeResponseEquals($response) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args()));
|
|
}
|
|
|
|
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that response code is not equal to provided value.
|
|
*
|
|
* @param $code
|
|
* Conditional Assertion: Test won't be stopped on fail
|
|
* @see \Codeception\Module\REST::dontSeeResponseCodeIs()
|
|
*/
|
|
public function cantSeeResponseCodeIs($code) {
|
|
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args()));
|
|
}
|
|
/**
|
|
* [!] Method is generated. Documentation taken from corresponding module.
|
|
*
|
|
* Checks that response code is not equal to provided value.
|
|
*
|
|
* @param $code
|
|
* @see \Codeception\Module\REST::dontSeeResponseCodeIs()
|
|
*/
|
|
public function dontSeeResponseCodeIs($code) {
|
|
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args()));
|
|
}
|
|
}
|