diff --git a/tests/README.md b/tests/README.md index bb4f22e..eb9a0fe 100644 --- a/tests/README.md +++ b/tests/README.md @@ -4,6 +4,7 @@ These tests are developed with [Codeception PHP Testing Framework](http://codece To run the tests, follow these steps: 1. [Install Codeception](http://codeception.com/quickstart) if you do not have it yet. +2. Update tests 2. Create test configuration files based on your environment: - Copy `acceptance.suite.dist.yml` to `acceptance.suite.yml` and customize it; - Copy `functional.suite.dist.yml` to `functional.suite.yml` and customize it; @@ -11,5 +12,10 @@ To run the tests, follow these steps: 3. Switch to the parent folder and run tests: ``` -php codecept.phar run +cd .. +php codecept.phar build // rebuild test scripts, only need to be run once +php codecept.phar run // run all available tests ``` + +Please refer to [Codeception tutorial](http://codeception.com/docs/01-Introduction) for +more details about writing acceptance, functional and unit tests. diff --git a/tests/acceptance/WebGuy.php b/tests/acceptance/WebGuy.php index e6cc370..f08ed9c 100644 --- a/tests/acceptance/WebGuy.php +++ b/tests/acceptance/WebGuy.php @@ -17,13 +17,21 @@ use Codeception\Module\WebHelper; * @method void expect($prediction) * @method void amGoingTo($argumentation) * @method void am($role) - * @method void lookForwardTo($role) + * @method void lookForwardTo($achieveValue) + * @method void offsetGet($offset) + * @method void offsetSet($offset, $value) + * @method void offsetExists($offset) + * @method void offsetUnset($offset) */ class WebGuy extends \Codeception\AbstractGuy { /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Submits a form located on page. * Specify the form by it's css or xpath selector. * Fill the form fields values as array. @@ -36,7 +44,7 @@ class WebGuy extends \Codeception\AbstractGuy * * ``` php * submitForm('#login', ['login' => 'davert', 'password' => '123456']); + * $I->submitForm('#login', array('login' => 'davert', 'password' => '123456')); * * ``` * @@ -55,20 +63,18 @@ class WebGuy extends \Codeception\AbstractGuy * * ``` php * submitForm('#userForm', ['user' => ['login' => 'Davert', 'password' => '123456', 'agree' => true]]); + * $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); * * ``` * Note, that pricing plan will be set to Paid, as it's selected on page. * * @param $selector * @param $params - * @see PhpBrowser::submitForm() + * @see Codeception\Module\PhpBrowser::submitForm() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function submitForm($selector, $params) { - $this->scenario->action('submitForm', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('submitForm', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -78,6 +84,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This 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. @@ -89,20 +99,18 @@ class WebGuy extends \Codeception\AbstractGuy * * ``` php * sendAjaxPostRequest('/updateSettings', ['notifications' => true]; // POST - * $I->sendAjaxGetRequest('/updateSettings', ['notifications' => true]; // GET + * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST + * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET * * ``` * * @param $uri * @param $params - * @see PhpBrowser::sendAjaxPostRequest() + * @see Codeception\Module\PhpBrowser::sendAjaxPostRequest() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function sendAjaxPostRequest($uri, $params = null) { - $this->scenario->action('sendAjaxPostRequest', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -112,6 +120,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This 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. * @@ -119,13 +131,11 @@ class WebGuy extends \Codeception\AbstractGuy * * @param $uri * @param $params - * @see PhpBrowser::sendAjaxGetRequest() + * @see Codeception\Module\PhpBrowser::sendAjaxGetRequest() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function sendAjaxGetRequest($uri, $params = null) { - $this->scenario->action('sendAjaxGetRequest', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -135,14 +145,34 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Asserts that current page has 404 response status code. - * @see PhpBrowser::seePageNotFound() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Module\PhpBrowser::seePageNotFound() + * @return \Codeception\Maybe + */ + public function canSeePageNotFound() { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Asserts that current page has 404 response status code. + * @see Codeception\Module\PhpBrowser::seePageNotFound() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seePageNotFound() { - $this->scenario->assertion('seePageNotFound', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -152,17 +182,40 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that response code is equal to value provided. * * @param $code * @return mixed - * @see PhpBrowser::seeResponseCodeIs() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Module\PhpBrowser::seeResponseCodeIs() + * @return \Codeception\Maybe + */ + public function canSeeResponseCodeIs($code) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that response code is equal to value provided. + * + * @param $code + * @return mixed + * @see Codeception\Module\PhpBrowser::seeResponseCodeIs() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeResponseCodeIs($code) { - $this->scenario->assertion('seeResponseCodeIs', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -172,17 +225,19 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Adds HTTP authentication via username/password. * * @param $username * @param $password - * @see PhpBrowser::amHttpAuthenticated() + * @see Codeception\Module\PhpBrowser::amHttpAuthenticated() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function amHttpAuthenticated($username, $password) { - $this->scenario->condition('amHttpAuthenticated', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -192,6 +247,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This 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 * @@ -202,12 +261,12 @@ class WebGuy extends \Codeception\AbstractGuy * // from the official Guzzle manual * $I->amGoingTo('Sign all requests with OAuth'); * $I->executeInGuzzle(function (\Guzzle\Http\Client $client) { - * $client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin([ + * $client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(array( * 'consumer_key' => '***', * 'consumer_secret' => '***', * 'token' => '***', * 'token_secret' => '***' - * ])); + * ))); * }); * ?> * ``` @@ -216,13 +275,11 @@ class WebGuy extends \Codeception\AbstractGuy * If Codeception lacks important Guzzle Client methods implement then and submit patches. * * @param callable $function - * @see PhpBrowser::executeInGuzzle() + * @see Codeception\Module\PhpBrowser::executeInGuzzle() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function executeInGuzzle($function) { - $this->scenario->action('executeInGuzzle', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -232,16 +289,142 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Assert if the specified checkbox is checked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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\Module\PhpBrowser::seeCheckboxIsChecked() + * @return \Codeception\Maybe + */ + public function canSeeCheckboxIsChecked($checkbox) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Assert if the specified checkbox is checked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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\Module\PhpBrowser::seeCheckboxIsChecked() + * @return \Codeception\Maybe + */ + public function seeCheckboxIsChecked($checkbox) { + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Assert if the specified checkbox is unchecked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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\Module\PhpBrowser::dontSeeCheckboxIsChecked() + * @return \Codeception\Maybe + */ + public function cantSeeCheckboxIsChecked($checkbox) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Assert if the specified checkbox is unchecked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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\Module\PhpBrowser::dontSeeCheckboxIsChecked() + * @return \Codeception\Maybe + */ + public function dontSeeCheckboxIsChecked($checkbox) { + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Opens the page. * * @param $page - * @see Mink::amOnPage() + * @see Codeception\Util\Mink::amOnPage() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function amOnPage($page) { - $this->scenario->condition('amOnPage', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -251,6 +434,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Sets 'url' configuration parameter to hosts subdomain. * It does not open a page on subdomain. Use `amOnPage` for that * @@ -267,13 +454,11 @@ class WebGuy extends \Codeception\AbstractGuy * ``` * @param $subdomain * @return mixed - * @see Mink::amOnSubdomain() + * @see Codeception\Util\Mink::amOnSubdomain() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function amOnSubdomain($subdomain) { - $this->scenario->condition('amOnSubdomain', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -283,27 +468,40 @@ class WebGuy extends \Codeception\AbstractGuy /** - * Check if current page doesn't contain the text specified. - * Specify the css selector to match only specific region. + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * Examples: + * @param string $text + * @param string $selector * - * ```php - * 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 Mink::dontSee() + * @return void + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSee() + * @return \Codeception\Maybe + */ + public function cantSee($text, $selector = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * @param string $text + * @param string $selector + * + * @return void + * @see Codeception\Util\Mink::dontSee() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSee($text, $selector = null) { - $this->scenario->action('dontSee', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -313,6 +511,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Check if current page contains the text specified. * Specify the css selector to match only specific region. * @@ -323,18 +525,48 @@ class WebGuy extends \Codeception\AbstractGuy * $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 Mink::see() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::see() + * @return \Codeception\Maybe + */ + public function canSee($text, $selector = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Check if current page contains the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ``` php + * 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\Util\Mink::see() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function see($text, $selector = null) { - $this->scenario->assertion('see', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('see', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -344,6 +576,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if there is a link with text specified. * Specify url to match link with exact this url. * @@ -353,18 +589,47 @@ class WebGuy extends \Codeception\AbstractGuy * seeLink('Logout'); // matches Logout * $I->seeLink('Logout','/logout'); // matches Logout - * + * ?> * ``` * * @param $text * @param null $url - * @see Mink::seeLink() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeLink() + * @return \Codeception\Maybe + */ + public function canSeeLink($text, $url = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if there is a link with text specified. + * Specify url to match link with exact this url. + * + * Examples: + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * @see Codeception\Util\Mink::seeLink() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeLink($text, $url = null) { - $this->scenario->assertion('seeLink', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -374,6 +639,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if page doesn't contain the link with text specified. * Specify url to narrow the results. * @@ -382,18 +651,46 @@ class WebGuy extends \Codeception\AbstractGuy * ``` php * dontSeeLink('Logout'); // I suppose user is not logged in - * + * ?> * ``` * * @param $text * @param null $url - * @see Mink::dontSeeLink() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeLink() + * @return \Codeception\Maybe + */ + public function cantSeeLink($text, $url = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if page doesn't contain the link with text specified. + * Specify url to narrow the results. + * + * Examples: + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * ?> + * ``` + * + * @param $text + * @param null $url + * @see Codeception\Util\Mink::dontSeeLink() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeLink($text, $url = null) { - $this->scenario->action('dontSeeLink', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -403,6 +700,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Perform a click on link or button. * Link or button are found by their names or CSS selector. * Submits a form if button is a submit type. @@ -431,13 +732,11 @@ class WebGuy extends \Codeception\AbstractGuy * ``` * @param $link * @param $context - * @see Mink::click() + * @see Codeception\Util\Mink::click() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function click($link, $context = null) { - $this->scenario->action('click', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -447,47 +746,107 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if element exists on a page, matching it by CSS or XPath * * ``` php * seeElement('.error'); - * $I->seeElement(//form/input[1]); + * $I->seeElement('//form/input[1]'); * ?> * ``` * @param $selector - * @see Mink::seeElement() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeElement() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ - public function seeElement($selector) { - $this->scenario->assertion('seeElement', func_get_args()); + public function canSeeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); } return new Maybe(); } - - /** - * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if element exists on a page, matching it by CSS or XPath * * ``` php * dontSeeElement('.error'); - * $I->dontSeeElement(//form/input[1]); + * $I->seeElement('.error'); + * $I->seeElement('//form/input[1]'); * ?> * ``` * @param $selector - * @see Mink::dontSeeElement() + * @see Codeception\Util\Mink::seeElement() + * @return \Codeception\Maybe + */ + public function seeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * + * Example: + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * ?> + * ``` + * @param $selector + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeElement() + * @return \Codeception\Maybe + */ + public function cantSeeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * + * Example: + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * ?> + * ``` + * @param $selector + * @see Codeception\Util\Mink::dontSeeElement() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeElement($selector) { - $this->scenario->action('dontSeeElement', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -497,14 +856,16 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Reloads current page - * @see Mink::reloadPage() + * @see Codeception\Util\Mink::reloadPage() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function reloadPage() { - $this->scenario->action('reloadPage', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('reloadPage', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -514,14 +875,16 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Moves back in history - * @see Mink::moveBack() + * @see Codeception\Util\Mink::moveBack() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function moveBack() { - $this->scenario->action('moveBack', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('moveBack', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -531,14 +894,16 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Moves forward in history - * @see Mink::moveForward() + * @see Codeception\Util\Mink::moveForward() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function moveForward() { - $this->scenario->action('moveForward', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('moveForward', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -548,17 +913,27 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Fills a text field or textarea with value. + * + * Example: + * + * ``` php + * fillField("//input[@type='text']", "Hello World!"); + * ?> + * ``` * * @param $field * @param $value - * @see Mink::fillField() + * @see Codeception\Util\Mink::fillField() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function fillField($field, $value) { - $this->scenario->action('fillField', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('fillField', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -568,6 +943,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Selects an option in select tag or in radio button group. * * Example: @@ -580,15 +959,21 @@ class WebGuy extends \Codeception\AbstractGuy * ?> * ``` * + * Can select multiple options if second argument is array: + * + * ``` php + * selectOption('Which OS do you use?', array('Windows','Linux')); + * ?> + * ``` + * * @param $select * @param $option - * @see Mink::selectOption() + * @see Codeception\Util\Mink::selectOption() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function selectOption($select, $option) { - $this->scenario->action('selectOption', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('selectOption', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -598,6 +983,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Ticks a checkbox. * For radio buttons use `selectOption` method. * @@ -610,13 +999,11 @@ class WebGuy extends \Codeception\AbstractGuy * ``` * * @param $option - * @see Mink::checkOption() + * @see Codeception\Util\Mink::checkOption() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function checkOption($option) { - $this->scenario->action('checkOption', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('checkOption', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -626,6 +1013,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Unticks a checkbox. * * Example: @@ -637,13 +1028,11 @@ class WebGuy extends \Codeception\AbstractGuy * ``` * * @param $option - * @see Mink::uncheckOption() + * @see Codeception\Util\Mink::uncheckOption() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function uncheckOption($option) { - $this->scenario->action('uncheckOption', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -653,6 +1042,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current uri contains a value * * ``` php @@ -665,13 +1058,40 @@ class WebGuy extends \Codeception\AbstractGuy * ``` * * @param $uri - * @see Mink::seeInCurrentUrl() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeInCurrentUrl() + * @return \Codeception\Maybe + */ + public function canSeeInCurrentUrl($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current uri contains a value + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Mink::seeInCurrentUrl() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeInCurrentUrl($uri) { - $this->scenario->assertion('seeInCurrentUrl', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -681,6 +1101,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current uri does not contain a value * * ``` php @@ -690,13 +1114,37 @@ class WebGuy extends \Codeception\AbstractGuy * ``` * * @param $uri - * @see Mink::dontSeeInCurrentUrl() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeInCurrentUrl() + * @return \Codeception\Maybe + */ + public function cantSeeInCurrentUrl($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current uri does not contain a value + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Mink::dontSeeInCurrentUrl() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeInCurrentUrl($uri) { - $this->scenario->action('dontSeeInCurrentUrl', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -706,22 +1154,54 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url is equal to value. * Unlike `seeInCurrentUrl` performs a strict check. * + * ``` php * seeCurrentUrlEquals('/'); * ?> + * ``` * * @param $uri - * @see Mink::seeCurrentUrlEquals() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeCurrentUrlEquals() + * @return \Codeception\Maybe + */ + public function canSeeCurrentUrlEquals($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url is equal to value. + * Unlike `seeInCurrentUrl` performs a strict check. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Mink::seeCurrentUrlEquals() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeCurrentUrlEquals($uri) { - $this->scenario->assertion('seeCurrentUrlEquals', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -731,22 +1211,54 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url is not equal to value. * Unlike `dontSeeInCurrentUrl` performs a strict check. * + * ``` php * dontSeeCurrentUrlEquals('/'); * ?> + * ``` * * @param $uri - * @see Mink::dontSeeCurrentUrlEquals() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals() + * @return \Codeception\Maybe + */ + public function cantSeeCurrentUrlEquals($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url is not equal to value. + * Unlike `dontSeeInCurrentUrl` performs a strict check. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Mink::dontSeeCurrentUrlEquals() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeCurrentUrlEquals($uri) { - $this->scenario->action('dontSeeCurrentUrlEquals', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -756,21 +1268,52 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url is matches a RegEx value * + * ``` php * seeCurrentUrlMatches('~$/users/(\d+)~'); * ?> + * ``` * * @param $uri - * @see Mink::seeCurrentUrlMatches() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeCurrentUrlMatches() + * @return \Codeception\Maybe + */ + public function canSeeCurrentUrlMatches($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url is matches a RegEx value + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Mink::seeCurrentUrlMatches() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeCurrentUrlMatches($uri) { - $this->scenario->assertion('seeCurrentUrlMatches', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -780,21 +1323,52 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url does not match a RegEx value * + * ``` php * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); * ?> + * ``` * * @param $uri - * @see Mink::dontSeeCurrentUrlMatches() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches() + * @return \Codeception\Maybe + */ + public function cantSeeCurrentUrlMatches($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url does not match a RegEx value + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Mink::dontSeeCurrentUrlMatches() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeCurrentUrlMatches($uri) { - $this->scenario->action('dontSeeCurrentUrlMatches', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -804,14 +1378,40 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Mink::seeCookie() + * Checks that cookie is set. + * + * @param $cookie + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeCookie() + * @return \Codeception\Maybe + */ + public function canSeeCookie($cookie) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that cookie is set. + * + * @param $cookie + * @return mixed + * @see Codeception\Util\Mink::seeCookie() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeCookie($cookie) { - $this->scenario->assertion('seeCookie', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -821,14 +1421,40 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Mink::dontSeeCookie() + * Checks that cookie doesn't exist + * + * @param $cookie + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeCookie() + * @return \Codeception\Maybe + */ + public function cantSeeCookie($cookie) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that cookie doesn't exist + * + * @param $cookie + * @return mixed + * @see Codeception\Util\Mink::dontSeeCookie() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeCookie($cookie) { - $this->scenario->action('dontSeeCookie', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -838,14 +1464,20 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Mink::setCookie() + * Sets a cookie. + * + * @param $cookie + * @param $value + * @return mixed + * @see Codeception\Util\Mink::setCookie() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function setCookie($cookie, $value) { - $this->scenario->action('setCookie', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('setCookie', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -855,14 +1487,19 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Mink::resetCookie() + * Unsets cookie + * + * @param $cookie + * @return mixed + * @see Codeception\Util\Mink::resetCookie() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function resetCookie($cookie) { - $this->scenario->action('resetCookie', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('resetCookie', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -872,14 +1509,19 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Mink::grabCookie() + * Grabs a cookie value. + * + * @param $cookie + * @return mixed + * @see Codeception\Util\Mink::grabCookie() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabCookie($cookie) { - $this->scenario->action('grabCookie', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabCookie', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -889,6 +1531,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Takes a parameters from current URI by RegEx. * If no url provided returns full URI. * @@ -902,13 +1548,11 @@ class WebGuy extends \Codeception\AbstractGuy * @param null $uri * @internal param $url * @return mixed - * @see Mink::grabFromCurrentUrl() + * @see Codeception\Util\Mink::grabFromCurrentUrl() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabFromCurrentUrl($uri = null) { - $this->scenario->action('grabFromCurrentUrl', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -918,26 +1562,28 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Attaches file from Codeception data directory to upload field. * * Example: * * ``` php * attachFile('prices.xls'); + * // file is stored in 'tests/_data/prices.xls' + * $I->attachFile('input[@type="file"]', 'prices.xls'); * ?> * ``` * * @param $field * @param $filename - * @see Mink::attachFile() + * @see Codeception\Util\Mink::attachFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function attachFile($field, $filename) { - $this->scenario->action('attachFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('attachFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -947,6 +1593,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if option is selected in select field. * * ``` php @@ -958,13 +1608,39 @@ class WebGuy extends \Codeception\AbstractGuy * @param $selector * @param $optionText * @return mixed - * @see Mink::seeOptionIsSelected() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeOptionIsSelected() + * @return \Codeception\Maybe + */ + public function canSeeOptionIsSelected($select, $text) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if option is selected in select field. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * @return mixed + * @see Codeception\Util\Mink::seeOptionIsSelected() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeOptionIsSelected($select, $text) { - $this->scenario->assertion('seeOptionIsSelected', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -974,6 +1650,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if option is not selected in select field. * * ``` php @@ -985,13 +1665,39 @@ class WebGuy extends \Codeception\AbstractGuy * @param $selector * @param $optionText * @return mixed - * @see Mink::dontSeeOptionIsSelected() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeOptionIsSelected() + * @return \Codeception\Maybe + */ + public function cantSeeOptionIsSelected($select, $text) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if option is not selected in select field. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * @return mixed + * @see Codeception\Util\Mink::dontSeeOptionIsSelected() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeOptionIsSelected($select, $text) { - $this->scenario->action('dontSeeOptionIsSelected', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1001,65 +1707,10 @@ class WebGuy extends \Codeception\AbstractGuy /** - * Assert if the specified checkbox is checked. - * Use css selector or xpath to match. + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * Example: - * - * ``` php - * 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 Mink::seeCheckboxIsChecked() - * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! - */ - public function seeCheckboxIsChecked($checkbox) { - $this->scenario->assertion('seeCheckboxIsChecked', func_get_args()); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** - * Assert if the specified checkbox is unchecked. - * Use css selector or xpath to match. - * - * Example: - * - * ``` php - * 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 Mink::dontSeeCheckboxIsChecked() - * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! - */ - public function dontSeeCheckboxIsChecked($checkbox) { - $this->scenario->action('dontSeeCheckboxIsChecked', func_get_args()); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** * Checks that an input field or textarea contains value. * Field is matched either by label or CSS or Xpath * @@ -1077,13 +1728,45 @@ class WebGuy extends \Codeception\AbstractGuy * * @param $field * @param $value - * @see Mink::seeInField() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeInField() + * @return \Codeception\Maybe + */ + public function canSeeInField($field, $value) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that an input field or textarea contains value. + * Field is matched either by label or CSS or Xpath + * + * Example: + * + * ``` php + * 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'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see Codeception\Util\Mink::seeInField() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeInField($field, $value) { - $this->scenario->assertion('seeInField', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1093,6 +1776,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that an input field or textarea doesn't contain value. * Field is matched either by label or CSS or Xpath * Example: @@ -1109,13 +1796,44 @@ class WebGuy extends \Codeception\AbstractGuy * * @param $field * @param $value - * @see Mink::dontSeeInField() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeInField() + * @return \Codeception\Maybe + */ + public function cantSeeInField($field, $value) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that an input field or textarea doesn't contain value. + * Field is matched either by label or CSS or Xpath + * Example: + * + * ``` php + * 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'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see Codeception\Util\Mink::dontSeeInField() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeInField($field, $value) { - $this->scenario->action('dontSeeInField', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1125,6 +1843,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Finds and returns text contents of element. * Element is searched by CSS selector, XPath or matcher by regex. * @@ -1140,13 +1862,11 @@ class WebGuy extends \Codeception\AbstractGuy * * @param $cssOrXPathOrRegex * @return mixed - * @see Mink::grabTextFrom() + * @see Codeception\Util\Mink::grabTextFrom() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabTextFrom($cssOrXPathOrRegex) { - $this->scenario->action('grabTextFrom', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1156,6 +1876,10 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Finds and returns field and returns it's value. * Searches by field name, then by CSS, then by XPath * @@ -1171,13 +1895,11 @@ class WebGuy extends \Codeception\AbstractGuy * * @param $field * @return mixed - * @see Mink::grabValueFrom() + * @see Codeception\Util\Mink::grabValueFrom() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabValueFrom($field) { - $this->scenario->action('grabValueFrom', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1187,14 +1909,95 @@ class WebGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Mink::grabAttribute() + * Checks that page title contains text. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::seeInTitle() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ - public function grabAttribute() { - $this->scenario->action('grabAttribute', func_get_args()); + public function canSeeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title contains text. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * @return mixed + * @see Codeception\Util\Mink::seeInTitle() + * @return \Codeception\Maybe + */ + public function seeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title does not contain text. + * + * @param $title + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Mink::dontSeeInTitle() + * @return \Codeception\Maybe + */ + public function cantSeeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title does not contain text. + * + * @param $title + * @return mixed + * @see Codeception\Util\Mink::dontSeeInTitle() + * @return \Codeception\Maybe + */ + public function dontSeeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); diff --git a/tests/functional/TestGuy.php b/tests/functional/TestGuy.php index 58baf56..553a44f 100644 --- a/tests/functional/TestGuy.php +++ b/tests/functional/TestGuy.php @@ -18,24 +18,30 @@ use Codeception\Module\Yii2; * @method void expect($prediction) * @method void amGoingTo($argumentation) * @method void am($role) - * @method void lookForwardTo($role) + * @method void lookForwardTo($achieveValue) + * @method void offsetGet($offset) + * @method void offsetSet($offset, $value) + * @method void offsetExists($offset) + * @method void offsetUnset($offset) */ class TestGuy extends \Codeception\AbstractGuy { /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Enters a directory In local filesystem. * Project root directory is used by default * * @param $path - * @see Filesystem::amInPath() + * @see Codeception\Module\Filesystem::amInPath() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function amInPath($path) { - $this->scenario->condition('amInPath', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Condition('amInPath', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -45,6 +51,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Opens a file and stores it's content. * * Usage: @@ -57,13 +67,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $filename - * @see Filesystem::openFile() + * @see Codeception\Module\Filesystem::openFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function openFile($filename) { - $this->scenario->action('openFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('openFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -73,6 +81,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Deletes a file * * ``` php @@ -82,13 +94,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $filename - * @see Filesystem::deleteFile() + * @see Codeception\Module\Filesystem::deleteFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function deleteFile($filename) { - $this->scenario->action('deleteFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('deleteFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -98,6 +108,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Deletes directory with all subdirectories * * ``` php @@ -107,13 +121,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $dirname - * @see Filesystem::deleteDir() + * @see Codeception\Module\Filesystem::deleteDir() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function deleteDir($dirname) { - $this->scenario->action('deleteDir', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('deleteDir', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -123,6 +135,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Copies directory with all contents * * ``` php @@ -133,13 +149,11 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $src * @param $dst - * @see Filesystem::copyDir() + * @see Codeception\Module\Filesystem::copyDir() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function copyDir($src, $dst) { - $this->scenario->action('copyDir', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('copyDir', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -149,6 +163,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks If opened file has `text` in it. * * Usage: @@ -161,13 +179,40 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $text - * @see Filesystem::seeInThisFile() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Module\Filesystem::seeInThisFile() + * @return \Codeception\Maybe + */ + public function canSeeInThisFile($text) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks If opened file has `text` in it. + * + * Usage: + * + * ``` php + * openFile('composer.json'); + * $I->seeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $text + * @see Codeception\Module\Filesystem::seeInThisFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeInThisFile($text) { - $this->scenario->assertion('seeInThisFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -177,6 +222,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks the strict matching of file contents. * Unlike `seeInThisFile` will fail if file has something more then expected lines. * Better to use with HEREDOC strings. @@ -190,13 +239,41 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $text - * @see Filesystem::seeFileContentsEqual() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Module\Filesystem::seeFileContentsEqual() + * @return \Codeception\Maybe + */ + public function canSeeFileContentsEqual($text) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks the strict matching of file contents. + * Unlike `seeInThisFile` will fail if file has something more then expected lines. + * Better to use with HEREDOC strings. + * Matching is done after removing "\r" chars from file content. + * + * ``` php + * openFile('process.pid'); + * $I->seeFileContentsEqual('3192'); + * ?> + * ``` + * + * @param $text + * @see Codeception\Module\Filesystem::seeFileContentsEqual() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeFileContentsEqual($text) { - $this->scenario->assertion('seeFileContentsEqual', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -206,23 +283,52 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks If opened file doesn't contain `text` in it * * ``` php * openFile('composer.json'); - * $I->seeInThisFile('codeception/codeception'); + * $I->dontSeeInThisFile('codeception/codeception'); * ?> * ``` * * @param $text - * @see Filesystem::dontSeeInThisFile() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Module\Filesystem::dontSeeInThisFile() + * @return \Codeception\Maybe + */ + public function cantSeeInThisFile($text) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks If opened file doesn't contain `text` in it + * + * ``` php + * openFile('composer.json'); + * $I->dontSeeInThisFile('codeception/codeception'); + * ?> + * ``` + * + * @param $text + * @see Codeception\Module\Filesystem::dontSeeInThisFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeInThisFile($text) { - $this->scenario->action('dontSeeInThisFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -232,14 +338,16 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Deletes a file - * @see Filesystem::deleteThisFile() + * @see Codeception\Module\Filesystem::deleteThisFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function deleteThisFile() { - $this->scenario->action('deleteThisFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('deleteThisFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -249,6 +357,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if file exists in path. * Opens a file when it's exists * @@ -260,13 +372,39 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $filename * @param string $path - * @see Filesystem::seeFileFound() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Module\Filesystem::seeFileFound() + * @return \Codeception\Maybe + */ + public function canSeeFileFound($filename, $path = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if file exists in path. + * Opens a file when it's exists + * + * ``` php + * seeFileFound('UserModel.php','app/models'); + * ?> + * ``` + * + * @param $filename + * @param string $path + * @see Codeception\Module\Filesystem::seeFileFound() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeFileFound($filename, $path = null) { - $this->scenario->assertion('seeFileFound', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -276,6 +414,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Erases directory contents * * ``` php @@ -285,13 +427,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $dirname - * @see Filesystem::cleanDir() + * @see Codeception\Module\Filesystem::cleanDir() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function cleanDir($dirname) { - $this->scenario->action('cleanDir', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('cleanDir', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -301,17 +441,19 @@ class TestGuy extends \Codeception\AbstractGuy /** - * Adds HTTP authentication via username/password. + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Authenticates user for HTTP_AUTH * * @param $username * @param $password - * @see Framework::amHttpAuthenticated() + * @see Codeception\Util\Framework::amHttpAuthenticated() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function amHttpAuthenticated($username, $password) { - $this->scenario->condition('amHttpAuthenticated', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -321,6 +463,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Opens the page. * Requires relative uri as parameter * @@ -336,13 +482,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $page - * @see Framework::amOnPage() + * @see Codeception\Util\Framework::amOnPage() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function amOnPage($page) { - $this->scenario->condition('amOnPage', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -352,6 +496,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Perform a click on link or button. * Link or button are found by their names or CSS selector. * Submits a form if button is a submit type. @@ -380,13 +528,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * @param $link * @param $context - * @see Framework::click() + * @see Codeception\Util\Framework::click() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function click($link, $context = null) { - $this->scenario->action('click', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -396,6 +542,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Check if current page contains the text specified. * Specify the css selector to match only specific region. * @@ -406,18 +556,48 @@ class TestGuy extends \Codeception\AbstractGuy * $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 Framework::see() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::see() + * @return \Codeception\Maybe + */ + public function canSee($text, $selector = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Check if current page contains the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ``` php + * 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\Util\Framework::see() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function see($text, $selector = null) { - $this->scenario->assertion('see', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('see', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -427,6 +607,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Check if current page doesn't contain the text specified. * Specify the css selector to match only specific region. * @@ -437,17 +621,48 @@ class TestGuy extends \Codeception\AbstractGuy * $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 Framework::dontSee() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSee() + * @return \Codeception\Maybe + */ + public function cantSee($text, $selector = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Check if current page doesn't contain the text specified. + * Specify the css selector to match only specific region. + * + * Examples: + * + * ```php + * 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\Util\Framework::dontSee() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSee($text, $selector = null) { - $this->scenario->action('dontSee', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -457,6 +672,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if there is a link with text specified. * Specify url to match link with exact this url. * @@ -466,18 +685,47 @@ class TestGuy extends \Codeception\AbstractGuy * seeLink('Logout'); // matches Logout * $I->seeLink('Logout','/logout'); // matches Logout - * + * ?> * ``` * * @param $text * @param null $url - * @see Framework::seeLink() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeLink() + * @return \Codeception\Maybe + */ + public function canSeeLink($text, $url = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if there is a link with text specified. + * Specify url to match link with exact this url. + * + * Examples: + * + * ``` php + * seeLink('Logout'); // matches Logout + * $I->seeLink('Logout','/logout'); // matches Logout + * ?> + * ``` + * + * @param $text + * @param null $url + * @see Codeception\Util\Framework::seeLink() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeLink($text, $url = null) { - $this->scenario->assertion('seeLink', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -487,6 +735,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if page doesn't contain the link with text specified. * Specify url to narrow the results. * @@ -495,18 +747,46 @@ class TestGuy extends \Codeception\AbstractGuy * ``` php * dontSeeLink('Logout'); // I suppose user is not logged in - * + * ?> * ``` * * @param $text * @param null $url - * @see Framework::dontSeeLink() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeLink() + * @return \Codeception\Maybe + */ + public function cantSeeLink($text, $url = null) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if page doesn't contain the link with text specified. + * Specify url to narrow the results. + * + * Examples: + * + * ``` php + * dontSeeLink('Logout'); // I suppose user is not logged in + * ?> + * ``` + * + * @param $text + * @param null $url + * @see Codeception\Util\Framework::dontSeeLink() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeLink($text, $url = null) { - $this->scenario->action('dontSeeLink', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -516,6 +796,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current uri contains a value * * ``` php @@ -528,13 +812,40 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $uri - * @see Framework::seeInCurrentUrl() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeInCurrentUrl() + * @return \Codeception\Maybe + */ + public function canSeeInCurrentUrl($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current uri contains a value + * + * ``` php + * seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Framework::seeInCurrentUrl() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeInCurrentUrl($uri) { - $this->scenario->assertion('seeInCurrentUrl', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -544,6 +855,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current uri does not contain a value * * ``` php @@ -553,13 +868,37 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $uri - * @see Framework::dontSeeInCurrentUrl() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeInCurrentUrl() + * @return \Codeception\Maybe + */ + public function cantSeeInCurrentUrl($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current uri does not contain a value + * + * ``` php + * dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Framework::dontSeeInCurrentUrl() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeInCurrentUrl($uri) { - $this->scenario->action('dontSeeInCurrentUrl', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -569,22 +908,54 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url is equal to value. * Unlike `seeInCurrentUrl` performs a strict check. * + * ``` php * seeCurrentUrlEquals('/'); * ?> + * ``` * * @param $uri - * @see Framework::seeCurrentUrlEquals() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeCurrentUrlEquals() + * @return \Codeception\Maybe + */ + public function canSeeCurrentUrlEquals($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url is equal to value. + * Unlike `seeInCurrentUrl` performs a strict check. + * + * ``` php + * seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Framework::seeCurrentUrlEquals() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeCurrentUrlEquals($uri) { - $this->scenario->assertion('seeCurrentUrlEquals', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -594,22 +965,54 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url is not equal to value. * Unlike `dontSeeInCurrentUrl` performs a strict check. * + * ``` php * dontSeeCurrentUrlEquals('/'); * ?> + * ``` * * @param $uri - * @see Framework::dontSeeCurrentUrlEquals() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeCurrentUrlEquals() + * @return \Codeception\Maybe + */ + public function cantSeeCurrentUrlEquals($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url is not equal to value. + * Unlike `dontSeeInCurrentUrl` performs a strict check. + * + * ``` php + * dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Framework::dontSeeCurrentUrlEquals() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeCurrentUrlEquals($uri) { - $this->scenario->action('dontSeeCurrentUrlEquals', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -619,21 +1022,52 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url is matches a RegEx value * + * ``` php * seeCurrentUrlMatches('~$/users/(\d+)~'); * ?> + * ``` * * @param $uri - * @see Framework::seeCurrentUrlMatches() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeCurrentUrlMatches() + * @return \Codeception\Maybe + */ + public function canSeeCurrentUrlMatches($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url is matches a RegEx value + * + * ``` php + * seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Framework::seeCurrentUrlMatches() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeCurrentUrlMatches($uri) { - $this->scenario->assertion('seeCurrentUrlMatches', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -643,21 +1077,52 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that current url does not match a RegEx value * + * ``` php * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); * ?> + * ``` * * @param $uri - * @see Framework::dontSeeCurrentUrlMatches() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeCurrentUrlMatches() + * @return \Codeception\Maybe + */ + public function cantSeeCurrentUrlMatches($uri) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that current url does not match a RegEx value + * + * ``` php + * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see Codeception\Util\Framework::dontSeeCurrentUrlMatches() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeCurrentUrlMatches($uri) { - $this->scenario->action('dontSeeCurrentUrlMatches', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -667,6 +1132,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Takes a parameters from current URI by RegEx. * If no url provided returns full URI. * @@ -680,13 +1149,11 @@ class TestGuy extends \Codeception\AbstractGuy * @param null $uri * @internal param $url * @return mixed - * @see Framework::grabFromCurrentUrl() + * @see Codeception\Util\Framework::grabFromCurrentUrl() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabFromCurrentUrl($uri = null) { - $this->scenario->action('grabFromCurrentUrl', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -696,6 +1163,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Assert if the specified checkbox is checked. * Use css selector or xpath to match. * @@ -706,17 +1177,46 @@ class TestGuy extends \Codeception\AbstractGuy * $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 Framework::seeCheckboxIsChecked() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeCheckboxIsChecked() + * @return \Codeception\Maybe + */ + public function canSeeCheckboxIsChecked($checkbox) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Assert if the specified checkbox is checked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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\Util\Framework::seeCheckboxIsChecked() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeCheckboxIsChecked($checkbox) { - $this->scenario->assertion('seeCheckboxIsChecked', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -726,6 +1226,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Assert if the specified checkbox is unchecked. * Use css selector or xpath to match. * @@ -735,17 +1239,45 @@ class TestGuy extends \Codeception\AbstractGuy * 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 Framework::dontSeeCheckboxIsChecked() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeCheckboxIsChecked() + * @return \Codeception\Maybe + */ + public function cantSeeCheckboxIsChecked($checkbox) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Assert if the specified checkbox is unchecked. + * Use css selector or xpath to match. + * + * Example: + * + * ``` php + * 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\Util\Framework::dontSeeCheckboxIsChecked() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeCheckboxIsChecked($checkbox) { - $this->scenario->action('dontSeeCheckboxIsChecked', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -755,6 +1287,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that an input field or textarea contains value. * Field is matched either by label or CSS or Xpath * @@ -772,13 +1308,45 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $field * @param $value - * @see Framework::seeInField() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeInField() + * @return \Codeception\Maybe + */ + public function canSeeInField($field, $value) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that an input field or textarea contains value. + * Field is matched either by label or CSS or Xpath + * + * Example: + * + * ``` php + * 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'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see Codeception\Util\Framework::seeInField() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeInField($field, $value) { - $this->scenario->assertion('seeInField', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -788,6 +1356,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that an input field or textarea doesn't contain value. * Field is matched either by label or CSS or Xpath * Example: @@ -804,13 +1376,44 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $field * @param $value - * @see Framework::dontSeeInField() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeInField() + * @return \Codeception\Maybe + */ + public function cantSeeInField($field, $value) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that an input field or textarea doesn't contain value. + * Field is matched either by label or CSS or Xpath + * Example: + * + * ``` php + * 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'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see Codeception\Util\Framework::dontSeeInField() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeInField($field, $value) { - $this->scenario->action('dontSeeInField', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -820,6 +1423,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Submits a form located on page. * Specify the form by it's css or xpath selector. * Fill the form fields values as array. @@ -832,7 +1439,7 @@ class TestGuy extends \Codeception\AbstractGuy * * ``` php * submitForm('#login', ['login' => 'davert', 'password' => '123456']); + * $I->submitForm('#login', array('login' => 'davert', 'password' => '123456')); * * ``` * @@ -851,20 +1458,18 @@ class TestGuy extends \Codeception\AbstractGuy * * ``` php * submitForm('#userForm', ['user' => ['login' => 'Davert', 'password' => '123456', 'agree' => true]]); + * $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); * * ``` * Note, that pricing plan will be set to Paid, as it's selected on page. * * @param $selector * @param $params - * @see Framework::submitForm() + * @see Codeception\Util\Framework::submitForm() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function submitForm($selector, $params) { - $this->scenario->action('submitForm', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('submitForm', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -874,17 +1479,27 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Fills a text field or textarea with value. + * + * Example: + * + * ``` php + * fillField("//input[@type='text']", "Hello World!"); + * ?> + * ``` * * @param $field * @param $value - * @see Framework::fillField() + * @see Codeception\Util\Framework::fillField() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function fillField($field, $value) { - $this->scenario->action('fillField', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('fillField', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -894,6 +1509,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Selects an option in select tag or in radio button group. * * Example: @@ -906,15 +1525,21 @@ class TestGuy extends \Codeception\AbstractGuy * ?> * ``` * + * Can select multiple options if second argument is array: + * + * ``` php + * selectOption('Which OS do you use?', array('Windows','Linux')); + * ?> + * ``` + * * @param $select * @param $option - * @see Framework::selectOption() + * @see Codeception\Util\Framework::selectOption() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function selectOption($select, $option) { - $this->scenario->action('selectOption', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('selectOption', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -924,6 +1549,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Ticks a checkbox. * For radio buttons use `selectOption` method. * @@ -936,13 +1565,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $option - * @see Framework::checkOption() + * @see Codeception\Util\Framework::checkOption() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function checkOption($option) { - $this->scenario->action('checkOption', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('checkOption', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -952,6 +1579,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Unticks a checkbox. * * Example: @@ -963,13 +1594,11 @@ class TestGuy extends \Codeception\AbstractGuy * ``` * * @param $option - * @see Framework::uncheckOption() + * @see Codeception\Util\Framework::uncheckOption() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function uncheckOption($option) { - $this->scenario->action('uncheckOption', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -979,26 +1608,28 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Attaches file from Codeception data directory to upload field. * * Example: * * ``` php * attachFile('prices.xls'); + * // file is stored in 'tests/_data/prices.xls' + * $I->attachFile('input[@type="file"]', 'prices.xls'); * ?> * ``` * * @param $field * @param $filename - * @see Framework::attachFile() + * @see Codeception\Util\Framework::attachFile() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function attachFile($field, $filename) { - $this->scenario->action('attachFile', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('attachFile', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1008,6 +1639,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This 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. * @@ -1015,13 +1650,11 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $uri * @param $params - * @see Framework::sendAjaxGetRequest() + * @see Codeception\Util\Framework::sendAjaxGetRequest() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function sendAjaxGetRequest($uri, $params = null) { - $this->scenario->action('sendAjaxGetRequest', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1031,6 +1664,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This 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. @@ -1042,20 +1679,18 @@ class TestGuy extends \Codeception\AbstractGuy * * ``` php * sendAjaxPostRequest('/updateSettings', ['notifications' => true]; // POST - * $I->sendAjaxGetRequest('/updateSettings', ['notifications' => true]; // GET + * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST + * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET * * ``` * * @param $uri * @param $params - * @see Framework::sendAjaxPostRequest() + * @see Codeception\Util\Framework::sendAjaxPostRequest() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function sendAjaxPostRequest($uri, $params = null) { - $this->scenario->action('sendAjaxPostRequest', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1065,23 +1700,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- * - * @see Framework::formatResponse() - * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! - */ - public function formatResponse($response) { - $this->scenario->action('formatResponse', func_get_args()); - if ($this->scenario->running()) { - $result = $this->scenario->runStep(); - return new Maybe($result); - } - return new Maybe(); - } - - - /** * Finds and returns text contents of element. * Element is searched by CSS selector, XPath or matcher by regex. * @@ -1097,13 +1719,11 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $cssOrXPathOrRegex * @return mixed - * @see Framework::grabTextFrom() + * @see Codeception\Util\Framework::grabTextFrom() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabTextFrom($cssOrXPathOrRegex) { - $this->scenario->action('grabTextFrom', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1113,6 +1733,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Finds and returns field and returns it's value. * Searches by field name, then by CSS, then by XPath * @@ -1128,13 +1752,11 @@ class TestGuy extends \Codeception\AbstractGuy * * @param $field * @return mixed - * @see Framework::grabValueFrom() + * @see Codeception\Util\Framework::grabValueFrom() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function grabValueFrom($field) { - $this->scenario->action('grabValueFrom', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1144,47 +1766,50 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if element exists on a page, matching it by CSS or XPath * * ``` php * seeElement('.error'); - * $I->seeElement(//form/input[1]); + * $I->seeElement('//form/input[1]'); * ?> * ``` * @param $selector - * @see Framework::seeElement() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeElement() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ - public function seeElement($selector) { - $this->scenario->assertion('seeElement', func_get_args()); + public function canSeeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); } return new Maybe(); } - - /** - * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if element exists on a page, matching it by CSS or XPath * * ``` php * dontSeeElement('.error'); - * $I->dontSeeElement(//form/input[1]); + * $I->seeElement('.error'); + * $I->seeElement('//form/input[1]'); * ?> * ``` * @param $selector - * @see Framework::dontSeeElement() + * @see Codeception\Util\Framework::seeElement() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ - public function dontSeeElement($selector) { - $this->scenario->action('dontSeeElement', func_get_args()); + public function seeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1194,6 +1819,67 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * + * Example: + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * ?> + * ``` + * @param $selector + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeElement() + * @return \Codeception\Maybe + */ + public function cantSeeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath + * + * Example: + * + * ``` php + * dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * ?> + * ``` + * @param $selector + * @see Codeception\Util\Framework::dontSeeElement() + * @return \Codeception\Maybe + */ + public function dontSeeElement($selector) { + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if option is selected in select field. * * ``` php @@ -1205,13 +1891,39 @@ class TestGuy extends \Codeception\AbstractGuy * @param $selector * @param $optionText * @return mixed - * @see Framework::seeOptionIsSelected() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeOptionIsSelected() + * @return \Codeception\Maybe + */ + public function canSeeOptionIsSelected($select, $optionText) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if option is selected in select field. + * + * ``` php + * seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * @return mixed + * @see Codeception\Util\Framework::seeOptionIsSelected() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeOptionIsSelected($select, $optionText) { - $this->scenario->assertion('seeOptionIsSelected', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1221,6 +1933,10 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks if option is not selected in select field. * * ``` php @@ -1232,13 +1948,39 @@ class TestGuy extends \Codeception\AbstractGuy * @param $selector * @param $optionText * @return mixed - * @see Framework::dontSeeOptionIsSelected() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeOptionIsSelected() + * @return \Codeception\Maybe + */ + public function cantSeeOptionIsSelected($select, $optionText) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks if option is not selected in select field. + * + * ``` php + * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * @return mixed + * @see Codeception\Util\Framework::dontSeeOptionIsSelected() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function dontSeeOptionIsSelected($select, $optionText) { - $this->scenario->action('dontSeeOptionIsSelected', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1248,14 +1990,34 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Asserts that current page has 404 response status code. - * @see Framework::seePageNotFound() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seePageNotFound() + * @return \Codeception\Maybe + */ + public function canSeePageNotFound() { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Asserts that current page has 404 response status code. + * @see Codeception\Util\Framework::seePageNotFound() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seePageNotFound() { - $this->scenario->assertion('seePageNotFound', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); @@ -1265,17 +2027,138 @@ class TestGuy extends \Codeception\AbstractGuy /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * * Checks that response code is equal to value provided. * * @param $code * @return mixed - * @see Framework::seeResponseCodeIs() + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeResponseCodeIs() + * @return \Codeception\Maybe + */ + public function canSeeResponseCodeIs($code) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that response code is equal to value provided. + * + * @param $code + * @return mixed + * @see Codeception\Util\Framework::seeResponseCodeIs() * @return \Codeception\Maybe - * ! This method is generated. DO NOT EDIT. ! - * ! Documentation taken from corresponding module ! */ public function seeResponseCodeIs($code) { - $this->scenario->assertion('seeResponseCodeIs', func_get_args()); + $this->scenario->addStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title contains text. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::seeInTitle() + * @return \Codeception\Maybe + */ + public function canSeeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title contains text. + * + * ``` php + * seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * @return mixed + * @see Codeception\Util\Framework::seeInTitle() + * @return \Codeception\Maybe + */ + public function seeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + + + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title does not contain text. + * + * @param $title + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see Codeception\Util\Framework::dontSeeInTitle() + * @return \Codeception\Maybe + */ + public function cantSeeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); + if ($this->scenario->running()) { + $result = $this->scenario->runStep(); + return new Maybe($result); + } + return new Maybe(); + } + /** + * This method is generated. + * Documentation taken from corresponding module. + * ---------------------------------------------- + * + * Checks that page title does not contain text. + * + * @param $title + * @return mixed + * @see Codeception\Util\Framework::dontSeeInTitle() + * @return \Codeception\Maybe + */ + public function dontSeeInTitle($title) { + $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); if ($this->scenario->running()) { $result = $this->scenario->runStep(); return new Maybe($result); diff --git a/tests/unit/CodeGuy.php b/tests/unit/CodeGuy.php index adcd618..613c754 100644 --- a/tests/unit/CodeGuy.php +++ b/tests/unit/CodeGuy.php @@ -1,23 +1,26 @@