diff options
author | Olivier Paroz <github@oparoz.com> | 2015-08-11 03:34:03 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-08-11 03:34:03 +0300 |
commit | b84508a0b687b91b623c6f81ea99e5fe40daa846 (patch) | |
tree | fdc2ffb7294a715d6f0a20d35fc135030d905aa6 /tests/_support | |
parent | a8b1af48860f359435fa451fa9c765c420b3dd33 (diff) |
1st acceptance and api tests
Diffstat (limited to 'tests/_support')
-rw-r--r-- | tests/_support/AcceptanceTester.php | 26 | ||||
-rw-r--r-- | tests/_support/ApiTester.php | 26 | ||||
-rw-r--r-- | tests/_support/Helper/Acceptance.php | 9 | ||||
-rw-r--r-- | tests/_support/Helper/Api.php | 9 | ||||
-rw-r--r-- | tests/_support/Page/Acceptance/Login.php | 52 | ||||
-rw-r--r-- | tests/_support/Page/Files.php | 27 | ||||
-rw-r--r-- | tests/_support/Page/Gallery.php | 27 | ||||
-rw-r--r-- | tests/_support/Page/Login.php | 27 | ||||
-rw-r--r-- | tests/_support/_generated/AcceptanceTesterActions.php | 2513 | ||||
-rw-r--r-- | tests/_support/_generated/ApiTesterActions.php | 1191 | ||||
-rw-r--r-- | tests/_support/_generated/FunctionalTesterActions.php | 2 | ||||
-rw-r--r-- | tests/_support/_generated/IntegrationTesterActions.php | 334 | ||||
-rw-r--r-- | tests/_support/_generated/UnitTesterActions.php | 2 |
13 files changed, 4241 insertions, 4 deletions
diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php new file mode 100644 index 00000000..bfa59cbb --- /dev/null +++ b/tests/_support/AcceptanceTester.php @@ -0,0 +1,26 @@ +<?php + + +/** + * Inherited Methods + * @method void wantToTest($text) + * @method void wantTo($text) + * @method void execute($callable) + * @method void expectTo($prediction) + * @method void expect($prediction) + * @method void amGoingTo($argumentation) + * @method void am($role) + * @method void lookForwardTo($achieveValue) + * @method void comment($description) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) + * + * @SuppressWarnings(PHPMD) +*/ +class AcceptanceTester extends \Codeception\Actor +{ + use _generated\AcceptanceTesterActions; + + /** + * Define custom actions here + */ +} diff --git a/tests/_support/ApiTester.php b/tests/_support/ApiTester.php new file mode 100644 index 00000000..b7cec20a --- /dev/null +++ b/tests/_support/ApiTester.php @@ -0,0 +1,26 @@ +<?php + + +/** + * Inherited Methods + * @method void wantToTest($text) + * @method void wantTo($text) + * @method void execute($callable) + * @method void expectTo($prediction) + * @method void expect($prediction) + * @method void amGoingTo($argumentation) + * @method void am($role) + * @method void lookForwardTo($achieveValue) + * @method void comment($description) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) + * + * @SuppressWarnings(PHPMD) +*/ +class ApiTester extends \Codeception\Actor +{ + use _generated\ApiTesterActions; + + /** + * Define custom actions here + */ +} diff --git a/tests/_support/Helper/Acceptance.php b/tests/_support/Helper/Acceptance.php new file mode 100644 index 00000000..dde20823 --- /dev/null +++ b/tests/_support/Helper/Acceptance.php @@ -0,0 +1,9 @@ +<?php +namespace Helper; +// here you can define custom actions +// all public methods declared in helper class will be available in $I + +class Acceptance extends \Codeception\Module +{ + +} diff --git a/tests/_support/Helper/Api.php b/tests/_support/Helper/Api.php new file mode 100644 index 00000000..8f685e44 --- /dev/null +++ b/tests/_support/Helper/Api.php @@ -0,0 +1,9 @@ +<?php +namespace Helper; +// here you can define custom actions +// all public methods declared in helper class will be available in $I + +class Api extends \Codeception\Module +{ + +} diff --git a/tests/_support/Page/Acceptance/Login.php b/tests/_support/Page/Acceptance/Login.php new file mode 100644 index 00000000..8d3f1e3a --- /dev/null +++ b/tests/_support/Page/Acceptance/Login.php @@ -0,0 +1,52 @@ +<?php +namespace Page\Acceptance; + +use Page\Login as LoginPage; +use Page\Files as FilesPage; + +class Login { + // include url of current page + public static $URL = ''; + + /** + * Declare UI map for this page here. CSS or XPath allowed. + * public static $usernameField = '#username'; + * public static $formSubmitButton = "#mainForm input[type=submit]"; + */ + + /** + * Basic route example for your current URL + * You can append any additional parameter to URL + * and use it in tests like: Page\Edit::route('/123-post'); + */ + public static function route($param) { + return static::$URL . $param; + } + + /** + * @var \AcceptanceTester; + */ + protected $acceptanceTester; + + public function __construct(\AcceptanceTester $I) { + $this->acceptanceTester = $I; + } + + public function login($name, $password) { + $I = $this->acceptanceTester; + + $I->amOnPage(LoginPage::$URL); + $I->fillField(LoginPage::$usernameField, $name); + $I->fillField(LoginPage::$passwordField, $password); + $I->click(LoginPage::$loginButton); + + return $this; + } + + public function confirmLogin() { + $I = $this->acceptanceTester; + + $I->seeElement(FilesPage::$contentDiv); + $I->seeCurrentUrlEquals(FilesPage::$URL); + } +} diff --git a/tests/_support/Page/Files.php b/tests/_support/Page/Files.php new file mode 100644 index 00000000..ec665a2e --- /dev/null +++ b/tests/_support/Page/Files.php @@ -0,0 +1,27 @@ +<?php +namespace Page; + +class Files +{ + // include url of current page + public static $URL = '/index.php/apps/files/'; + public static $contentDiv = '#content.app-files'; + + /** + * Declare UI map for this page here. CSS or XPath allowed. + * public static $usernameField = '#username'; + * public static $formSubmitButton = "#mainForm input[type=submit]"; + */ + + /** + * Basic route example for your current URL + * You can append any additional parameter to URL + * and use it in tests like: Page\Edit::route('/123-post'); + */ + public static function route($param) + { + return static::$URL.$param; + } + + +} diff --git a/tests/_support/Page/Gallery.php b/tests/_support/Page/Gallery.php new file mode 100644 index 00000000..8f32dc42 --- /dev/null +++ b/tests/_support/Page/Gallery.php @@ -0,0 +1,27 @@ +<?php +namespace Page; + +class Gallery +{ + // include url of current page + public static $URL = '/index.php/apps/gallery/'; + public static $contentDiv = '#content.app-gallery'; + + /** + * Declare UI map for this page here. CSS or XPath allowed. + * public static $usernameField = '#username'; + * public static $formSubmitButton = "#mainForm input[type=submit]"; + */ + + /** + * Basic route example for your current URL + * You can append any additional parameter to URL + * and use it in tests like: Page\Edit::route('/123-post'); + */ + public static function route($param) + { + return static::$URL.$param; + } + + +} diff --git a/tests/_support/Page/Login.php b/tests/_support/Page/Login.php new file mode 100644 index 00000000..f53a549b --- /dev/null +++ b/tests/_support/Page/Login.php @@ -0,0 +1,27 @@ +<?php +namespace Page; + +class Login { + // include url of current page + public static $URL = '/'; + public static $usernameField = '#user'; + public static $passwordField = '#password '; + public static $loginButton = '#submit'; + + /** + * Declare UI map for this page here. CSS or XPath allowed. + * public static $usernameField = '#username'; + * public static $formSubmitButton = "#mainForm input[type=submit]"; + */ + + /** + * Basic route example for your current URL + * You can append any additional parameter to URL + * and use it in tests like: Page\Edit::route('/123-post'); + */ + public static function route($param) { + return static::$URL . $param; + } + + +} diff --git a/tests/_support/_generated/AcceptanceTesterActions.php b/tests/_support/_generated/AcceptanceTesterActions.php new file mode 100644 index 00000000..4f792175 --- /dev/null +++ b/tests/_support/_generated/AcceptanceTesterActions.php @@ -0,0 +1,2513 @@ +<?php //[STAMP] b26c38bab7c419b33355ba5a5052a7fc +namespace _generated; + +// This class was automatically generated by build task +// You should not change it manually as it will be overwritten on next build +// @codingStandardsIgnoreFile + +use Helper\Acceptance; +use Codeception\Module\WebDriver; + +trait AcceptanceTesterActions +{ + /** + * @return \Codeception\Scenario + */ + abstract protected function getScenario(); + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Changes the subdomain for the 'url' configuration parameter. + * Does not open a page; use `amOnPage` for that. + * + * ``` php + * <?php + * // If config is: 'http://mysite.com' + * // or config is: 'http://www.mysite.com' + * // or config is: 'http://company.mysite.com' + * + * $I->amOnSubdomain('user'); + * $I->amOnPage('/'); + * // moves to http://user.mysite.com/ + * ?> + * ``` + * + * @param $subdomain + * + * @return mixed + * @see \Codeception\Module\WebDriver::amOnSubdomain() + */ + public function amOnSubdomain($subdomain) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Takes a screenshot of the current window and saves it to `tests/_output/debug`. + * + * ``` php + * <?php + * $I->amOnPage('/user/edit'); + * $I->makeScreenshot('edit_page'); + * // saved to: tests/_output/debug/edit_page.png + * ?> + * ``` + * + * @param $name + * @see \Codeception\Module\WebDriver::makeScreenshot() + */ + public function makeScreenshot($name) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('makeScreenshot', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Resize the current window. + * + * ``` php + * <?php + * $I->resizeWindow(800, 600); + * + * ``` + * + * @param int $width + * @param int $height + * @see \Codeception\Module\WebDriver::resizeWindow() + */ + public function resizeWindow($width, $height) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('resizeWindow', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a cookie with the given name is set. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * ``` php + * <?php + * $I->seeCookie('PHPSESSID'); + * ?> + * ``` + * + * @param $cookie + * @param array $params + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeCookie() + */ + public function canSeeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a cookie with the given name is set. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * ``` php + * <?php + * $I->seeCookie('PHPSESSID'); + * ?> + * ``` + * + * @param $cookie + * @param array $params + * @return mixed + * @see \Codeception\Module\WebDriver::seeCookie() + */ + public function seeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there isn't a cookie with the given name. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeCookie() + */ + public function cantSeeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there isn't a cookie with the given name. + * You can set additional cookie params like `domain`, `path` as array passed in last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Module\WebDriver::dontSeeCookie() + */ + public function dontSeeCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets a cookie with the given name and value. + * You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument. + * + * ``` php + * <?php + * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); + * ?> + * ``` + * + * @param $name + * @param $val + * @param array $params + * + * @return mixed + * @see \Codeception\Module\WebDriver::setCookie() + */ + public function setCookie($cookie, $value, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unsets cookie with the given name. + * You can set additional cookie params like `domain`, `path` in array passed as last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Module\WebDriver::resetCookie() + */ + public function resetCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs a cookie value. + * You can set additional cookie params like `domain`, `path` in array passed as last argument. + * + * @param $cookie + * + * @param array $params + * @return mixed + * @see \Codeception\Module\WebDriver::grabCookie() + */ + public function grabCookie($cookie, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Open web page at the given absolute URL and sets its hostname as the base host. + * + * ``` php + * <?php + * $I->amOnUrl('http://codeception.com'); + * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart + * ?> + * ``` + * @see \Codeception\Module\WebDriver::amOnUrl() + */ + public function amOnUrl($url) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opens the page for the given relative URI. + * + * ``` php + * <?php + * // opens front page + * $I->amOnPage('/'); + * // opens /register page + * $I->amOnPage('/register'); + * ?> + * ``` + * + * @param $page + * @see \Codeception\Module\WebDriver::amOnPage() + */ + public function amOnPage($page) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. + * + * ``` php + * <?php + * $I->see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up','h1'); // I can suppose it's a signup page + * $I->see('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::see() + */ + public function canSee($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page contains the given string. + * Specify a locator as the second parameter to match a specific region. + * + * ``` php + * <?php + * $I->see('Logout'); // I can suppose user is logged in + * $I->see('Sign Up','h1'); // I can suppose it's a signup page + * $I->see('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * @see \Codeception\Module\WebDriver::see() + */ + public function see($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page doesn't contain the text specified. + * Give a locator as the second parameter to match a specific region. + * + * ```php + * <?php + * $I->dontSee('Login'); // I can suppose user is already logged in + * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page + * $I->dontSee('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSee() + */ + public function cantSee($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current page doesn't contain the text specified. + * Give a locator as the second parameter to match a specific region. + * + * ```php + * <?php + * $I->dontSee('Login'); // I can suppose user is already logged in + * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page + * $I->dontSee('Sign Up','//body/h1'); // with XPath + * ?> + * ``` + * + * @param $text + * @param null $selector + * @see \Codeception\Module\WebDriver::dontSee() + */ + public function dontSee($text, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page source contains the given string. + * + * ```php + * <?php + * $I->seeInPageSource('<link rel="apple-touch-icon"'); + * ``` + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeInPageSource() + */ + public function canSeeInPageSource($text) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPageSource', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page source contains the given string. + * + * ```php + * <?php + * $I->seeInPageSource('<link rel="apple-touch-icon"'); + * ``` + * + * @param $text + * @see \Codeception\Module\WebDriver::seeInPageSource() + */ + public function seeInPageSource($text) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPageSource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page source doesn't contain the given string. + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeInPageSource() + */ + public function cantSeeInPageSource($text) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPageSource', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page source doesn't contain the given string. + * + * @param $text + * @see \Codeception\Module\WebDriver::dontSeeInPageSource() + */ + public function dontSeeInPageSource($text) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInPageSource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Perform a click on a link or a button, given by a locator. + * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. + * For buttons, the "value" attribute, "name" attribute, and inner text are searched. + * For links, the link text is searched. + * For images, the "alt" attribute and inner text of any parent links are searched. + * + * The second parameter is a context (CSS or XPath locator) to narrow the search. + * + * Note that if the locator matches a button of type `submit`, the form will be submitted. + * + * ``` php + * <?php + * // simple link + * $I->click('Logout'); + * // button of form + * $I->click('Submit'); + * // CSS button + * $I->click('#form input[type=submit]'); + * // XPath + * $I->click('//form/*[@type=submit]'); + * // link in context + * $I->click('Logout', '#nav'); + * // using strict locator + * $I->click(['link' => 'Login']); + * ?> + * ``` + * + * @param $link + * @param $context + * @see \Codeception\Module\WebDriver::click() + */ + public function click($link, $context = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. + * + * ``` php + * <?php + * $I->seeLink('Logout'); // matches <a href="#">Logout</a> + * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeLink() + */ + public function canSeeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there's a link with the specified text. + * Give a full URL as the second parameter to match links with that exact URL. + * + * ``` php + * <?php + * $I->seeLink('Logout'); // matches <a href="#">Logout</a> + * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Module\WebDriver::seeLink() + */ + public function seeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. + * + * ``` php + * <?php + * $I->dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeLink() + */ + public function cantSeeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page doesn't contain a link with the given string. + * If the second parameter is given, only links with a matching "href" attribute will be checked. + * + * ``` php + * <?php + * $I->dontSeeLink('Logout'); // I suppose user is not logged in + * $I->dontSeeLink('Checkout now', '/store/cart.php'); + * ?> + * ``` + * + * @param $text + * @param null $url + * @see \Codeception\Module\WebDriver::dontSeeLink() + */ + public function dontSeeLink($text, $url = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current URI contains the given string. + * + * ``` php + * <?php + * // to match: /home/dashboard + * $I->seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeInCurrentUrl() + */ + public function canSeeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current URI contains the given string. + * + * ``` php + * <?php + * // to match: /home/dashboard + * $I->seeInCurrentUrl('home'); + * // to match: /users/1 + * $I->seeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Module\WebDriver::seeInCurrentUrl() + */ + public function seeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * <?php + * // to match root url + * $I->seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() + */ + public function canSeeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL is equal to the given string. + * Unlike `seeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * <?php + * // to match root url + * $I->seeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() + */ + public function seeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL matches the given regular expression. + * + * ``` php + * <?php + * // to match root url + * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() + */ + public function canSeeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL matches the given regular expression. + * + * ``` php + * <?php + * // to match root url + * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() + */ + public function seeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URI doesn't contain the given string. + * + * ``` php + * <?php + * $I->dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() + */ + public function cantSeeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URI doesn't contain the given string. + * + * ``` php + * <?php + * $I->dontSeeInCurrentUrl('/users/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() + */ + public function dontSeeInCurrentUrl($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * <?php + * // current url is not root + * $I->dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() + */ + public function cantSeeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the current URL doesn't equal the given string. + * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. + * + * ``` php + * <?php + * // current url is not root + * $I->dontSeeCurrentUrlEquals('/'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() + */ + public function dontSeeCurrentUrlEquals($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url doesn't match the given regular expression. + * + * ``` php + * <?php + * // to match root url + * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() + */ + public function cantSeeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that current url doesn't match the given regular expression. + * + * ``` php + * <?php + * // to match root url + * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); + * ?> + * ``` + * + * @param $uri + * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() + */ + public function dontSeeCurrentUrlMatches($uri) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Executes the given regular expression against the current URI and returns the first match. + * If no parameters are provided, the full URI is returned. + * + * ``` php + * <?php + * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); + * $uri = $I->grabFromCurrentUrl(); + * ?> + * ``` + * + * @param null $uri + * + * @internal param $url + * @return mixed + * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() + */ + public function grabFromCurrentUrl($uri = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the specified checkbox is checked. + * + * ``` php + * <?php + * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. + * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); + * ?> + * ``` + * + * @param $checkbox + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() + */ + public function canSeeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the specified checkbox is checked. + * + * ``` php + * <?php + * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. + * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); + * ?> + * ``` + * + * @param $checkbox + * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() + */ + public function seeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check that the specified checkbox is unchecked. + * + * ``` php + * <?php + * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. + * ?> + * ``` + * + * @param $checkbox + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() + */ + public function cantSeeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Check that the specified checkbox is unchecked. + * + * ``` php + * <?php + * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms + * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. + * ?> + * ``` + * + * @param $checkbox + * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() + */ + public function dontSeeCheckboxIsChecked($checkbox) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * + * ``` php + * <?php + * $I->seeInField('Body','Type your comment here'); + * $I->seeInField('form textarea[name=body]','Type your comment here'); + * $I->seeInField('form input[type=hidden]','hidden_value'); + * $I->seeInField('#searchform input','Search'); + * $I->seeInField('//form/*[@name=search]','Search'); + * $I->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeInField() + */ + public function canSeeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given input field or textarea contains the given value. + * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. + * + * ``` php + * <?php + * $I->seeInField('Body','Type your comment here'); + * $I->seeInField('form textarea[name=body]','Type your comment here'); + * $I->seeInField('form input[type=hidden]','hidden_value'); + * $I->seeInField('#searchform input','Search'); + * $I->seeInField('//form/*[@name=search]','Search'); + * $I->seeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Module\WebDriver::seeInField() + */ + public function seeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. + * + * ``` php + * <?php + * $I->dontSeeInField('Body','Type your comment here'); + * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); + * $I->dontSeeInField('form input[type=hidden]','hidden_value'); + * $I->dontSeeInField('#searchform input','Search'); + * $I->dontSeeInField('//form/*[@name=search]','Search'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeInField() + */ + public function cantSeeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that an input field or textarea doesn't contain the given value. + * For fuzzy locators, the field is matched by label text, CSS and XPath. + * + * ``` php + * <?php + * $I->dontSeeInField('Body','Type your comment here'); + * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); + * $I->dontSeeInField('form input[type=hidden]','hidden_value'); + * $I->dontSeeInField('#searchform input','Search'); + * $I->dontSeeInField('//form/*[@name=search]','Search'); + * $I->dontSeeInField(['name' => 'search'], 'Search'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Module\WebDriver::dontSeeInField() + */ + public function dontSeeInField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are set on the form matched with the + * passed selector. + * + * ``` php + * <?php + * $I->seeInFormFields('form[name=myform]', [ + * 'input1' => 'value', + * 'input2' => 'other value', + * ]); + * ?> + * ``` + * + * For multi-select elements, or to check values of multiple elements with the same name, an + * array may be passed: + * + * ``` php + * <?php + * $I->seeInFormFields('.form-class', [ + * 'multiselect' => [ + * 'value1', + * 'value2', + * ], + * 'checkbox[]' => [ + * 'a checked value', + * 'another checked value', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * <?php + * $I->seeInFormFields('#form-id', [ + * 'checkbox1' => true, // passes if checked + * 'checkbox2' => false, // passes if unchecked + * ]); + * ?> + * ``` + * + * Pair this with submitForm for quick testing magic. + * + * ``` php + * <?php + * $form = [ + * 'field1' => 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeInFormFields() + */ + public function canSeeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are set on the form matched with the + * passed selector. + * + * ``` php + * <?php + * $I->seeInFormFields('form[name=myform]', [ + * 'input1' => 'value', + * 'input2' => 'other value', + * ]); + * ?> + * ``` + * + * For multi-select elements, or to check values of multiple elements with the same name, an + * array may be passed: + * + * ``` php + * <?php + * $I->seeInFormFields('.form-class', [ + * 'multiselect' => [ + * 'value1', + * 'value2', + * ], + * 'checkbox[]' => [ + * 'a checked value', + * 'another checked value', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * <?php + * $I->seeInFormFields('#form-id', [ + * 'checkbox1' => true, // passes if checked + * 'checkbox2' => false, // passes if unchecked + * ]); + * ?> + * ``` + * + * Pair this with submitForm for quick testing magic. + * + * ``` php + * <?php + * $form = [ + * 'field1' => 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * @see \Codeception\Module\WebDriver::seeInFormFields() + */ + public function seeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are not set on the form matched with + * the passed selector. + * + * ``` php + * <?php + * $I->dontSeeInFormFields('form[name=myform]', [ + * 'input1' => 'non-existent value', + * 'input2' => 'other non-existent value', + * ]); + * ?> + * ``` + * + * To check that an element hasn't been assigned any one of many values, an array can be passed + * as the value: + * + * ``` php + * <?php + * $I->dontSeeInFormFields('.form-class', [ + * 'fieldName' => [ + * 'This value shouldn\'t be set', + * 'And this value shouldn\'t be set', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * <?php + * $I->dontSeeInFormFields('#form-id', [ + * 'checkbox1' => true, // fails if checked + * 'checkbox2' => false, // fails if unchecked + * ]); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeInFormFields() + */ + public function cantSeeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if the array of form parameters (name => value) are not set on the form matched with + * the passed selector. + * + * ``` php + * <?php + * $I->dontSeeInFormFields('form[name=myform]', [ + * 'input1' => 'non-existent value', + * 'input2' => 'other non-existent value', + * ]); + * ?> + * ``` + * + * To check that an element hasn't been assigned any one of many values, an array can be passed + * as the value: + * + * ``` php + * <?php + * $I->dontSeeInFormFields('.form-class', [ + * 'fieldName' => [ + * 'This value shouldn\'t be set', + * 'And this value shouldn\'t be set', + * ], + * ]); + * ?> + * ``` + * + * Additionally, checkbox values can be checked with a boolean. + * + * ``` php + * <?php + * $I->dontSeeInFormFields('#form-id', [ + * 'checkbox1' => true, // fails if checked + * 'checkbox2' => false, // fails if unchecked + * ]); + * ?> + * ``` + * + * @param $formSelector + * @param $params + * @see \Codeception\Module\WebDriver::dontSeeInFormFields() + */ + public function dontSeeInFormFields($formSelector, $params) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Selects an option in a select tag or in radio button group. + * + * ``` php + * <?php + * $I->selectOption('form select[name=account]', 'Premium'); + * $I->selectOption('form input[name=payment]', 'Monthly'); + * $I->selectOption('//form/select[@name=account]', 'Monthly'); + * ?> + * ``` + * + * Provide an array for the second argument to select multiple options: + * + * ``` php + * <?php + * $I->selectOption('Which OS do you use?', array('Windows','Linux')); + * ?> + * ``` + * + * @param $select + * @param $option + * @see \Codeception\Module\WebDriver::selectOption() + */ + public function selectOption($select, $option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\WebDriver::unselectOption() + */ + public function unselectOption($select, $option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('unselectOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. + * + * ``` php + * <?php + * $I->checkOption('#agree'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Module\WebDriver::checkOption() + */ + public function checkOption($option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Unticks a checkbox. + * + * ``` php + * <?php + * $I->uncheckOption('#notify'); + * ?> + * ``` + * + * @param $option + * @see \Codeception\Module\WebDriver::uncheckOption() + */ + public function uncheckOption($option) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fills a text field or textarea with the given string. + * + * ``` php + * <?php + * $I->fillField("//input[@type='text']", "Hello World!"); + * $I->fillField(['name' => 'email'], 'jon@mail.com'); + * ?> + * ``` + * + * @param $field + * @param $value + * @see \Codeception\Module\WebDriver::fillField() + */ + public function fillField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Attaches a file relative to the Codeception data directory to the given file upload field. + * + * ``` php + * <?php + * // file is stored in 'tests/_data/prices.xls' + * $I->attachFile('input[@type="file"]', 'prices.xls'); + * ?> + * ``` + * + * @param $field + * @param $filename + * @see \Codeception\Module\WebDriver::attachFile() + */ + public function attachFile($field, $filename) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs all visible text from the current page. + * + * @return string + * @see \Codeception\Module\WebDriver::getVisibleText() + */ + public function getVisibleText() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('getVisibleText', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds and returns the text contents of the given element. + * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. + * + * ``` php + * <?php + * $heading = $I->grabTextFrom('h1'); + * $heading = $I->grabTextFrom('descendant-or-self::h1'); + * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex + * ?> + * ``` + * + * @param $cssOrXPathOrRegex + * + * @return mixed + * @see \Codeception\Module\WebDriver::grabTextFrom() + */ + public function grabTextFrom($cssOrXPathOrRegex) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Grabs the value of the given attribute value from the given element. + * Fails if element is not found. + * + * ``` php + * <?php + * $I->grabAttributeFrom('#tooltip', 'title'); + * ?> + * ``` + * + * + * @param $cssOrXpath + * @param $attribute + * @internal param $element + * @return mixed + * @see \Codeception\Module\WebDriver::grabAttributeFrom() + */ + public function grabAttributeFrom($cssOrXpath, $attribute) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds the value for the given form field. + * If a fuzzy locator is used, the field is found by field name, CSS, and XPath. + * + * ``` php + * <?php + * $name = $I->grabValueFrom('Name'); + * $name = $I->grabValueFrom('input[name=username]'); + * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); + * $name = $I->grabValueFrom(['name' => 'username']); + * ?> + * ``` + * + * @param $field + * + * @return mixed + * @see \Codeception\Module\WebDriver::grabValueFrom() + */ + public function grabValueFrom($field) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\WebDriver::grabMultiple() + */ + public function grabMultiple($cssOrXpath, $attribute = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. + * + * ``` php + * <?php + * $I->seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @return + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeElement() + */ + public function canSeeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page and is visible. + * You can also specify expected attributes of this element. + * + * ``` php + * <?php + * $I->seeElement('.error'); + * $I->seeElement('//form/input[1]'); + * $I->seeElement('input', ['name' => 'login']); + * $I->seeElement('input', ['value' => '123456']); + * + * // strict locator in first arg, attributes in second + * $I->seeElement(['css' => 'form input'], ['name' => 'login']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @return + * @see \Codeception\Module\WebDriver::seeElement() + */ + public function seeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. + * + * ``` php + * <?php + * $I->dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeElement() + */ + public function cantSeeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element is invisible or not present on the page. + * You can also specify expected attributes of this element. + * + * ``` php + * <?php + * $I->dontSeeElement('.error'); + * $I->dontSeeElement('//form/input[1]'); + * $I->dontSeeElement('input', ['name' => 'login']); + * $I->dontSeeElement('input', ['value' => '123456']); + * ?> + * ``` + * + * @param $selector + * @param array $attributes + * @see \Codeception\Module\WebDriver::dontSeeElement() + */ + public function dontSeeElement($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page, even it is invisible. + * + * ``` php + * <?php + * $I->seeElementInDOM('//form/input[type=hidden]'); + * ?> + * ``` + * + * @param $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeElementInDOM() + */ + public function canSeeElementInDOM($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given element exists on the page, even it is invisible. + * + * ``` php + * <?php + * $I->seeElementInDOM('//form/input[type=hidden]'); + * ?> + * ``` + * + * @param $selector + * @see \Codeception\Module\WebDriver::seeElementInDOM() + */ + public function seeElementInDOM($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite of `seeElementInDOM`. + * + * @param $selector + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() + */ + public function cantSeeElementInDOM($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite of `seeElementInDOM`. + * + * @param $selector + * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() + */ + public function dontSeeElementInDOM($selector, $attributes = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElementInDOM', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there are a certain number of elements matched by the given locator on the page. + * + * ``` php + * <?php + * $I->seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * ?> + * ``` + * @param $selector + * @param mixed $expected : + * - string: strict number + * - array: range of numbers [0,10] + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeNumberOfElements() + */ + public function canSeeNumberOfElements($selector, $expected) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that there are a certain number of elements matched by the given locator on the page. + * + * ``` php + * <?php + * $I->seeNumberOfElements('tr', 10); + * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements + * ?> + * ``` + * @param $selector + * @param mixed $expected : + * - string: strict number + * - array: range of numbers [0,10] + * @see \Codeception\Module\WebDriver::seeNumberOfElements() + */ + public function seeNumberOfElements($selector, $expected) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is selected. + * + * ``` php + * <?php + * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeOptionIsSelected() + */ + public function canSeeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is selected. + * + * ``` php + * <?php + * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Module\WebDriver::seeOptionIsSelected() + */ + public function seeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is not selected. + * + * ``` php + * <?php + * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() + */ + public function cantSeeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the given option is not selected. + * + * ``` php + * <?php + * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); + * ?> + * ``` + * + * @param $selector + * @param $optionText + * + * @return mixed + * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() + */ + public function dontSeeOptionIsSelected($selector, $optionText) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title contains the given string. + * + * ``` php + * <?php + * $I->seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeInTitle() + */ + public function canSeeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title contains the given string. + * + * ``` php + * <?php + * $I->seeInTitle('Blog - Post #1'); + * ?> + * ``` + * + * @param $title + * + * @return mixed + * @see \Codeception\Module\WebDriver::seeInTitle() + */ + public function seeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title does not contain the given string. + * + * @param $title + * + * @return mixed + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::dontSeeInTitle() + */ + public function cantSeeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the page title does not contain the given string. + * + * @param $title + * + * @return mixed + * @see \Codeception\Module\WebDriver::dontSeeInTitle() + */ + public function dontSeeInTitle($title) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. + * Don't confuse popups with modal windows, as created by [various libraries](http://jster.net/category/windows-modals-popups). + * @see \Codeception\Module\WebDriver::acceptPopup() + */ + public function acceptPopup() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('acceptPopup', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Dismisses the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`. + * @see \Codeception\Module\WebDriver::cancelPopup() + */ + public function cancelPopup() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('cancelPopup', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. + * + * @param $text + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\WebDriver::seeInPopup() + */ + public function canSeeInPopup($text) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. + * + * @param $text + * @see \Codeception\Module\WebDriver::seeInPopup() + */ + public function seeInPopup($text) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. + * + * @param $keys + * @see \Codeception\Module\WebDriver::typeInPopup() + */ + public function typeInPopup($keys) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('typeInPopup', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Reloads the current page. + * @see \Codeception\Module\WebDriver::reloadPage() + */ + public function reloadPage() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('reloadPage', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Moves back in history. + * @see \Codeception\Module\WebDriver::moveBack() + */ + public function moveBack() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Moves forward in history. + * @see \Codeception\Module\WebDriver::moveForward() + */ + public function moveForward() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('moveForward', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Submits the given form on the page, optionally with the given form + * values. Give the form fields values as an array. Note that hidden fields + * can't be accessed. + * + * Skipped fields will be filled by their values from the page. + * You don't need to click the 'Submit' button afterwards. + * This command itself triggers the request to form's action. + * + * You can optionally specify what button's value to include + * in the request with the last parameter as an alternative to + * explicitly setting its value in the second parameter, as + * button values are not otherwise included in the request. + * + * Examples: + * + * ``` php + * <?php + * $I->submitForm('#login', [ + * 'login' => 'davert', + * 'password' => '123456' + * ]); + * // or + * $I->submitForm('#login', [ + * 'login' => 'davert', + * 'password' => '123456' + * ], 'submitButtonName'); + * + * ``` + * + * For example, given this sample "Sign Up" form: + * + * ``` html + * <form action="/sign_up"> + * Login: + * <input type="text" name="user[login]" /><br/> + * Password: + * <input type="password" name="user[password]" /><br/> + * Do you agree to our terms? + * <input type="checkbox" name="user[agree]" /><br/> + * Select pricing plan: + * <select name="plan"> + * <option value="1">Free</option> + * <option value="2" selected="selected">Paid</option> + * </select> + * <input type="submit" name="submitButton" value="Submit" /> + * </form> + * ``` + * + * You could write the following to submit it: + * + * ``` php + * <?php + * $I->submitForm( + * '#userForm', + * [ + * 'user[login]' => 'Davert', + * 'user[password]' => '123456', + * 'user[agree]' => true + * ], + * 'submitButton' + * ); + * ``` + * Note that "2" will be the submitted value for the "plan" field, as it is + * the selected option. + * + * Also note that this differs from PhpBrowser, in that + * ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment. + * Named array keys *must* be included in the name as above. + * + * Pair this with seeInFormFields for quick testing magic. + * + * ``` php + * <?php + * $form = [ + * 'field1' => 'value', + * 'field2' => 'another value', + * 'checkbox1' => true, + * // ... + * ]; + * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * // $I->amOnPage('/path/to/form-page') may be needed + * $I->seeInFormFields('//form[@id=my-form]', $form); + * ?> + * ``` + * + * Parameter values must be set to arrays for multiple input fields + * of the same name, or multi-select combo boxes. For checkboxes, + * either the string value can be used, or boolean values which will + * be replaced by the checkbox's value in the DOM. + * + * ``` php + * <?php + * $I->submitForm('#my-form', [ + * 'field1' => 'value', + * 'checkbox' => [ + * 'value of first checkbox', + * 'value of second checkbox, + * ], + * 'otherCheckboxes' => [ + * true, + * false, + * false + * ], + * 'multiselect' => [ + * 'first option value', + * 'second option value' + * ] + * ]); + * ?> + * ``` + * + * Mixing string and boolean values for a checkbox's value is not supported + * and may produce unexpected results. + * + * Field names ending in "[]" must be passed without the trailing square + * bracket characters, and must contain an array for its value. This allows + * submitting multiple values with the same name, consider: + * + * ```php + * $I->submitForm('#my-form', [ + * 'field[]' => 'value', + * 'field[]' => 'another value', // 'field[]' is already a defined key + * ]); + * ``` + * + * The solution is to pass an array value: + * + * ```php + * // this way both values are submitted + * $I->submitForm('#my-form', [ + * 'field' => [ + * 'value', + * 'another value', + * ] + * ]); + * ``` + * @param $selector + * @param $params + * @param $button + * @see \Codeception\Module\WebDriver::submitForm() + */ + public function submitForm($selector, $params, $button = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Waits up to $timeout seconds for the given element to change. + * Element "change" is determined by a callback function which is called repeatedly until the return value evaluates to true. + * + * ``` php + * <?php + * use \Facebook\WebDriver\WebDriverElement + * $I->waitForElementChange('#menu', function(WebDriverElement $el) { + * return $el->isDisplayed(); + * }, 100); + * ?> + * ``` + * + * @param $element + * @param \Closure $callback + * @param int $timeout seconds + * @throws \Codeception\Exception\ElementNotFound + * @see \Codeception\Module\WebDriver::waitForElementChange() + */ + public function waitForElementChange($element, $callback, $timeout = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementChange', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Waits up to $timeout seconds for an element to appear on the page. + * If the element doesn't appear, a timeout exception is thrown. + * + * ``` php + * <?php + * $I->waitForElement('#agree_button', 30); // secs + * $I->click('#agree_button'); + * ?> + * ``` + * + * @param $element + * @param int $timeout seconds + * @throws \Exception + * @see \Codeception\Module\WebDriver::waitForElement() + */ + public function waitForElement($element, $timeout = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Waits up to $timeout seconds for the given element to be visible on the page. + * If element doesn't appear, a timeout exception is thrown. + * + * ``` php + * <?php + * $I->waitForElementVisible('#agree_button', 30); // secs + * $I->click('#agree_button'); + * ?> + * ``` + * + * @param $element + * @param int $timeout seconds + * @throws \Exception + * @see \Codeception\Module\WebDriver::waitForElementVisible() + */ + public function waitForElementVisible($element, $timeout = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Waits up to $timeout seconds for the given element to become invisible. + * If element stays visible, a timeout exception is thrown. + * + * ``` php + * <?php + * $I->waitForElementNotVisible('#agree_button', 30); // secs + * ?> + * ``` + * + * @param $element + * @param int $timeout seconds + * @throws \Exception + * @see \Codeception\Module\WebDriver::waitForElementNotVisible() + */ + public function waitForElementNotVisible($element, $timeout = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Waits up to $timeout seconds for the given string to appear on the page. + * Can also be passed a selector to search in. + * If the given text doesn't appear, a timeout exception is thrown. + * + * ``` php + * <?php + * $I->waitForText('foo', 30); // secs + * $I->waitForText('foo', 30, '.title'); // secs + * ?> + * ``` + * + * @param string $text + * @param int $timeout seconds + * @param null $selector + * @throws \Exception + * @see \Codeception\Module\WebDriver::waitForText() + */ + public function waitForText($text, $timeout = null, $selector = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForText', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Wait for $timeout seconds. + * + * @param int $timeout secs + * @throws \Codeception\Exception\TestRuntimeException + * @see \Codeception\Module\WebDriver::wait() + */ + public function wait($timeout) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('wait', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Low-level API method. + * If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly: + * + * ``` php + * $I->executeInSelenium(function(\Facebook\WebDriver\RemoteWebDriver $webdriver) { + * $webdriver->get('http://google.com'); + * }); + * ``` + * + * This runs in the context of the [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). + * Try not to use this command on a regular basis. + * If Codeception lacks a feature you need, please implement it and submit a patch. + * + * @param callable $function + * @see \Codeception\Module\WebDriver::executeInSelenium() + */ + public function executeInSelenium($function) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInSelenium', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Switch to another window identified by name. + * + * The window can only be identified by name. If the $name parameter is blank, the parent window will be used. + * + * Example: + * ``` html + * <input type="button" value="Open window" onclick="window.open('http://example.com', 'another_window')"> + * ``` + * + * ``` php + * <?php + * $I->click("Open window"); + * # switch to another window + * $I->switchToWindow("another_window"); + * # switch to parent window + * $I->switchToWindow(); + * ?> + * ``` + * + * If the window has no name, the only way to access it is via the `executeInSelenium()` method, like so: + * + * ``` php + * <?php + * $I->executeInSelenium(function (\Facebook\WebDriver\RemoteWebDriver $webdriver) { + * $handles=$webdriver->getWindowHandles(); + * $last_window = end($handles); + * $webdriver->switchTo()->window($last_window); + * }); + * ?> + * ``` + * + * @param string|null $name + * @see \Codeception\Module\WebDriver::switchToWindow() + */ + public function switchToWindow($name = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToWindow', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Switch to another frame on the page. + * + * Example: + * ``` html + * <iframe name="another_frame" src="http://example.com"> + * + * ``` + * + * ``` php + * <?php + * # switch to iframe + * $I->switchToIFrame("another_frame"); + * # switch to parent page + * $I->switchToIFrame(); + * + * ``` + * + * @param string|null $name + * @see \Codeception\Module\WebDriver::switchToIFrame() + */ + public function switchToIFrame($name = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToIFrame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Executes JavaScript and waits up to $timeout seconds for it to return true. + * + * In this example we will wait up to 60 seconds for all jQuery AJAX requests to finish. + * + * ``` php + * <?php + * $I->waitForJS("return $.active == 0;", 60); + * ?> + * ``` + * + * @param string $script + * @param int $timeout seconds + * @see \Codeception\Module\WebDriver::waitForJS() + */ + public function waitForJS($script, $timeout = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForJS', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Executes custom JavaScript. + * + * This example uses jQuery to get a value and assigns that value to a PHP variable: + * + * ```php + * <?php + * $myVar = $I->executeJS('return $("#myField").val()'); + * ?> + * ``` + * + * @param $script + * @return mixed + * @see \Codeception\Module\WebDriver::executeJS() + */ + public function executeJS($script) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('executeJS', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Maximizes the current window. + * @see \Codeception\Module\WebDriver::maximizeWindow() + */ + public function maximizeWindow() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('maximizeWindow', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Performs a simple mouse drag-and-drop operation. + * + * ``` php + * <?php + * $I->dragAndDrop('#drag', '#drop'); + * ?> + * ``` + * + * @param string $source (CSS ID or XPath) + * @param string $target (CSS ID or XPath) + * @see \Codeception\Module\WebDriver::dragAndDrop() + */ + public function dragAndDrop($source, $target) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('dragAndDrop', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Move mouse over the first element matched by the given locator. + * If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. + * Otherwise, the mouse is moved to the center of the element. + * + * ``` php + * <?php + * $I->moveMouseOver(['css' => '.checkout'], 20, 50); + * ?> + * ``` + * + * @param string $cssOrXPath css or xpath of the web element + * @param int $offsetX + * @param int $offsetY + * + * @throws \Codeception\Exception\ElementNotFound + * @see \Codeception\Module\WebDriver::moveMouseOver() + */ + public function moveMouseOver($cssOrXPath, $offsetX = null, $offsetY = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('moveMouseOver', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Performs contextual click with the right mouse button on an element. + * + * @param $cssOrXPath + * @throws \Codeception\Exception\ElementNotFound + * @see \Codeception\Module\WebDriver::clickWithRightButton() + */ + public function clickWithRightButton($cssOrXPath) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('clickWithRightButton', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Pauses test execution in debug mode. + * To proceed test press "ENTER" in console. + * + * This method is useful while writing tests, since it allows you to inspect the current page in the middle of a test case. + * @see \Codeception\Module\WebDriver::pauseExecution() + */ + public function pauseExecution() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('pauseExecution', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Performs a double-click on an element matched by CSS or XPath. + * + * @param $cssOrXPath + * @throws \Codeception\Exception\ElementNotFound + * @see \Codeception\Module\WebDriver::doubleClick() + */ + public function doubleClick($cssOrXPath) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('doubleClick', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Presses the given key on the given element. + * To specify a character and modifier (e.g. ctrl, alt, shift, meta), pass an array for $char with + * the modifier as the first element and the character as the second. + * For special keys use key constants from WebDriverKeys class. + * + * ``` php + * <?php + * // <input id="page" value="old" /> + * $I->pressKey('#page','a'); // => olda + * $I->pressKey('#page',array('ctrl','a'),'new'); //=> new + * $I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x + * $I->pressKey('descendant-or-self::*[@id='page']','u'); //=> oldu + * $I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DELETE); //=>'' + * ?> + * ``` + * + * @param $element + * @param $char Can be char or array with modifier. You can provide several chars. + * @throws \Codeception\Exception\ElementNotFound + * @see \Codeception\Module\WebDriver::pressKey() + */ + public function pressKey($element, $char) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('pressKey', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Append the given text to the given element. + * Can also add a selection to a select box. + * + * ``` php + * <?php + * $I->appendField('#mySelectbox', 'SelectValue'); + * $I->appendField('#myTextField', 'appended'); + * ?> + * ``` + * + * @param string $field + * @param string $value + * @throws \Codeception\Exception\ElementNotFound + * @see \Codeception\Module\WebDriver::appendField() + */ + public function appendField($field, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('appendField', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Saves current cookies into named snapshot in order to restore them in other tests + * This is useful to save session state between tests. + * For example, if user needs log in to site for each test this scenario can be executed once + * while other tests can just restore saved cookies. + * + * ``` php + * <?php + * // inside AcceptanceTester class: + * + * public function login() + * { + * // if snapshot exists - skipping login + * if ($I->loadSessionSnapshot('login')) return; + * + * // logging in + * $I->amOnPage('/login'); + * $I->fillField('name', 'jon'); + * $I->fillField('password', '123345'); + * $I->click('Login'); + * + * // saving snapshot + * $I->saveSessionSnapshot('login'); + * } + * ?> + * ``` + * + * @param $name + * @return mixed + * @see \Codeception\Module\WebDriver::saveSessionSnapshot() + */ + public function saveSessionSnapshot($name) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('saveSessionSnapshot', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Loads cookies from saved snapshot. + * + * @param $name + * @see saveSessionSnapshot + * @return mixed + * @see \Codeception\Module\WebDriver::loadSessionSnapshot() + */ + public function loadSessionSnapshot($name) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('loadSessionSnapshot', func_get_args())); + } +} diff --git a/tests/_support/_generated/ApiTesterActions.php b/tests/_support/_generated/ApiTesterActions.php new file mode 100644 index 00000000..d3542abf --- /dev/null +++ b/tests/_support/_generated/ApiTesterActions.php @@ -0,0 +1,1191 @@ +<?php //[STAMP] 781c53126251e1f558363cc28624c404 +namespace _generated; + +// This class was automatically generated by build task +// You should not change it manually as it will be overwritten on next build +// @codingStandardsIgnoreFile + +use Helper\Api; +use Codeception\Module\REST; + +trait ApiTesterActions +{ + /** + * @return \Codeception\Scenario + */ + abstract protected function getScenario(); + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sets HTTP header + * + * @param $name + * @param $value + * @part json + * @part xml + * @see \Codeception\Module\REST::haveHttpHeader() + */ + public function haveHttpHeader($name, $value) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks over the given HTTP header and (optionally) + * its value, asserting that are there + * + * @param $name + * @param $value + * @part json + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeHttpHeader() + */ + public function canSeeHttpHeader($name, $value = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeader', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks over the given HTTP header and (optionally) + * its value, asserting that are there + * + * @param $name + * @param $value + * @part json + * @part xml + * @see \Codeception\Module\REST::seeHttpHeader() + */ + public function seeHttpHeader($name, $value = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeHttpHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks over the given HTTP header and (optionally) + * its value, asserting that are not there + * + * @param $name + * @param $value + * @part json + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeHttpHeader() + */ + public function cantSeeHttpHeader($name, $value = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeHttpHeader', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks over the given HTTP header and (optionally) + * its value, asserting that are not there + * + * @param $name + * @param $value + * @part json + * @part xml + * @see \Codeception\Module\REST::dontSeeHttpHeader() + */ + public function dontSeeHttpHeader($name, $value = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeHttpHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that http response header is received only once. + * HTTP RFC2616 allows multiple response headers with the same name. + * You can check that you didn't accidentally sent the same header twice. + * + * ``` php + * <?php + * $I->seeHttpHeaderOnce('Cache-Control'); + * ?>> + * ``` + * + * @param $name + * @part json + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeHttpHeaderOnce() + */ + public function canSeeHttpHeaderOnce($name) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeHttpHeaderOnce', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that http response header is received only once. + * HTTP RFC2616 allows multiple response headers with the same name. + * You can check that you didn't accidentally sent the same header twice. + * + * ``` php + * <?php + * $I->seeHttpHeaderOnce('Cache-Control'); + * ?>> + * ``` + * + * @param $name + * @part json + * @part xml + * @see \Codeception\Module\REST::seeHttpHeaderOnce() + */ + public function seeHttpHeaderOnce($name) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeHttpHeaderOnce', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns the value of the specified header name + * + * @param $name + * @param Boolean $first Whether to return the first value or all header values + * + * @return string|array The first header value if $first is true, an array of values otherwise + * @part json + * @part xml + * @see \Codeception\Module\REST::grabHttpHeader() + */ + public function grabHttpHeader($name, $first = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabHttpHeader', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Adds HTTP authentication via username/password. + * + * @param $username + * @param $password + * @part json + * @part xml + * @see \Codeception\Module\REST::amHttpAuthenticated() + */ + public function amHttpAuthenticated($username, $password) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Adds Digest authentication via username/password. + * + * @param $username + * @param $password + * @part json + * @part xml + * @see \Codeception\Module\REST::amDigestAuthenticated() + */ + public function amDigestAuthenticated($username, $password) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amDigestAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Adds Bearer authentication via access token. + * + * @param $accessToken + * @part json + * @part xml + * @see \Codeception\Module\REST::amBearerAuthenticated() + */ + public function amBearerAuthenticated($accessToken) { + return $this->getScenario()->runStep(new \Codeception\Step\Condition('amBearerAuthenticated', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends a POST request to given uri. + * + * Parameters and files (as array of filenames) can be provided. + * + * @param $url + * @param array|\JsonSerializable $params + * @param array $files + * @part json + * @part xml + * @see \Codeception\Module\REST::sendPOST() + */ + public function sendPOST($url, $params = null, $files = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPOST', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends a HEAD request to given uri. + * + * @param $url + * @param array $params + * @part json + * @part xml + * @see \Codeception\Module\REST::sendHEAD() + */ + public function sendHEAD($url, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendHEAD', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends an OPTIONS request to given uri. + * + * @param $url + * @param array $params + * @part json + * @part xml + * @see \Codeception\Module\REST::sendOPTIONS() + */ + public function sendOPTIONS($url, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendOPTIONS', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends a GET request to given uri. + * + * @param $url + * @param array $params + * @part json + * @part xml + * @see \Codeception\Module\REST::sendGET() + */ + public function sendGET($url, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendGET', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends PUT request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + * @see \Codeception\Module\REST::sendPUT() + */ + public function sendPUT($url, $params = null, $files = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPUT', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends PATCH request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + * @see \Codeception\Module\REST::sendPATCH() + */ + public function sendPATCH($url, $params = null, $files = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPATCH', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends DELETE request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + * @see \Codeception\Module\REST::sendDELETE() + */ + public function sendDELETE($url, $params = null, $files = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendDELETE', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends LINK request to given uri. + * + * @param $url + * @param array $linkEntries (entry is array with keys "uri" and "link-param") + * + * @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4 + * + * @author samva.ua@gmail.com + * @part json + * @part xml + * @see \Codeception\Module\REST::sendLINK() + */ + public function sendLINK($url, $linkEntries) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendLINK', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends UNLINK request to given uri. + * + * @param $url + * @param array $linkEntries (entry is array with keys "uri" and "link-param") + * @link http://tools.ietf.org/html/rfc2068#section-19.6.2.4 + * @author samva.ua@gmail.com + * @part json + * @part xml + * @see \Codeception\Module\REST::sendUNLINK() + */ + public function sendUNLINK($url, $linkEntries) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendUNLINK', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response was valid JSON. + * This is done with json_last_error function. + * + * @part json + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseIsJson() + */ + public function canSeeResponseIsJson() { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsJson', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response was valid JSON. + * This is done with json_last_error function. + * + * @part json + * @see \Codeception\Module\REST::seeResponseIsJson() + */ + public function seeResponseIsJson() { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsJson', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether the last response contains text. + * + * @param $text + * @part json + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseContains() + */ + public function canSeeResponseContains($text) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContains', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether the last response contains text. + * + * @param $text + * @part json + * @part xml + * @see \Codeception\Module\REST::seeResponseContains() + */ + public function seeResponseContains($text) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response do not contain text. + * + * @param $text + * @part json + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseContains() + */ + public function cantSeeResponseContains($text) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContains', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response do not contain text. + * + * @param $text + * @part json + * @part xml + * @see \Codeception\Module\REST::dontSeeResponseContains() + */ + public function dontSeeResponseContains($text) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether the last JSON response contains provided array. + * The response is converted to array with json_decode($response, true) + * Thus, JSON is represented by associative array. + * This method matches that response array contains provided array. + * + * Examples: + * + * ``` php + * <?php + * // response: {name: john, email: john@gmail.com} + * $I->seeResponseContainsJson(array('name' => 'john')); + * + * // response {user: john, profile: { email: john@gmail.com }} + * $I->seeResponseContainsJson(array('email' => 'john@gmail.com')); + * + * ?> + * ``` + * + * This method recursively checks if one array can be found inside of another. + * + * @param array $json + * @part json + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseContainsJson() + */ + public function canSeeResponseContainsJson($json = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseContainsJson', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether the last JSON response contains provided array. + * The response is converted to array with json_decode($response, true) + * Thus, JSON is represented by associative array. + * This method matches that response array contains provided array. + * + * Examples: + * + * ``` php + * <?php + * // response: {name: john, email: john@gmail.com} + * $I->seeResponseContainsJson(array('name' => 'john')); + * + * // response {user: john, profile: { email: john@gmail.com }} + * $I->seeResponseContainsJson(array('email' => 'john@gmail.com')); + * + * ?> + * ``` + * + * This method recursively checks if one array can be found inside of another. + * + * @param array $json + * @part json + * @see \Codeception\Module\REST::seeResponseContainsJson() + */ + public function seeResponseContainsJson($json = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseContainsJson', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns current response so that it can be used in next scenario steps. + * + * Example: + * + * ``` php + * <?php + * $user_id = $I->grabResponse(); + * $I->sendPUT('/user', array('id' => $user_id, 'name' => 'davert')); + * ?> + * ``` + * + * @version 1.1 + * @return string + * @part json + * @part xml + * @see \Codeception\Module\REST::grabResponse() + */ + public function grabResponse() { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabResponse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Returns data from the current JSON response using [JSONPath](http://goessner.net/articles/JsonPath/) as selector. + * JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * Even for a single value an array is returned. + * + * This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * + * Example: + * + * ``` php + * <?php + * // match the first `user.id` in json + * $firstUser = $I->grabDataFromJsonResponse('$..users[0].id'); + * $I->sendPUT('/user', array('id' => $firstUser[0], 'name' => 'davert')); + * ?> + * ``` + * + * @param $jsonPath + * @return array + * @version 2.0.9 + * @throws \Exception + * @part json + * @see \Codeception\Module\REST::grabDataFromResponseByJsonPath() + */ + public function grabDataFromResponseByJsonPath($jsonPath) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabDataFromResponseByJsonPath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches the xpath provided. + * JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath. + * This assertion allows you to check the structure of response json. + * * + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * <?php + * // at least one book in store has author + * $I->seeResponseJsonMatchesXpath('//store/book/author'); + * // first book in store has author + * $I->seeResponseJsonMatchesXpath('//store/book[1]/author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesXpath('/store//price'); + * ?> + * ``` + * @part json + * @version 2.0.9 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseJsonMatchesXpath() + */ + public function canSeeResponseJsonMatchesXpath($xpath) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesXpath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches the xpath provided. + * JSON is not supposed to be checked against XPath, yet it can be converted to xml and used with XPath. + * This assertion allows you to check the structure of response json. + * * + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * <?php + * // at least one book in store has author + * $I->seeResponseJsonMatchesXpath('//store/book/author'); + * // first book in store has author + * $I->seeResponseJsonMatchesXpath('//store/book[1]/author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesXpath('/store//price'); + * ?> + * ``` + * @part json + * @version 2.0.9 + * @see \Codeception\Module\REST::seeResponseJsonMatchesXpath() + */ + public function seeResponseJsonMatchesXpath($xpath) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesXpath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/). + * JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * This assertion allows you to check the structure of response json. + * + * This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * <?php + * // at least one book in store has author + * $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author'); + * // first book in store has author + * $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesJsonPath('$.store..price'); + * ?> + * ``` + * + * @part json + * @version 2.0.9 + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath() + */ + public function canSeeResponseJsonMatchesJsonPath($jsonPath) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseJsonMatchesJsonPath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if json structure in response matches [JsonPath](http://goessner.net/articles/JsonPath/). + * JsonPath is XPath equivalent for querying Json structures. Try your JsonPath expressions [online](http://jsonpath.curiousconcept.com/). + * This assertion allows you to check the structure of response json. + * + * This method **require [`flow/jsonpath` > 0.2](https://github.com/FlowCommunications/JSONPath/) library to be installed**. + * + * ```json + * { "store": { + * "book": [ + * { "category": "reference", + * "author": "Nigel Rees", + * "title": "Sayings of the Century", + * "price": 8.95 + * }, + * { "category": "fiction", + * "author": "Evelyn Waugh", + * "title": "Sword of Honour", + * "price": 12.99 + * } + * ], + * "bicycle": { + * "color": "red", + * "price": 19.95 + * } + * } + * } + * ``` + * + * ```php + * <?php + * // at least one book in store has author + * $I->seeResponseJsonMatchesJsonPath('$.store.book[*].author'); + * // first book in store has author + * $I->seeResponseJsonMatchesJsonPath('$.store.book[0].author'); + * // at least one item in store has price + * $I->seeResponseJsonMatchesJsonPath('$.store..price'); + * ?> + * ``` + * + * @part json + * @version 2.0.9 + * @see \Codeception\Module\REST::seeResponseJsonMatchesJsonPath() + */ + public function seeResponseJsonMatchesJsonPath($jsonPath) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseJsonMatchesJsonPath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite to seeResponseJsonMatchesJsonPath + * + * @param array $jsonPath + * @part json + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath() + */ + public function cantSeeResponseJsonMatchesJsonPath($jsonPath) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseJsonMatchesJsonPath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite to seeResponseJsonMatchesJsonPath + * + * @param array $jsonPath + * @part json + * @see \Codeception\Module\REST::dontSeeResponseJsonMatchesJsonPath() + */ + public function dontSeeResponseJsonMatchesJsonPath($jsonPath) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseJsonMatchesJsonPath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite to seeResponseContainsJson + * + * @part json + * @param array $json + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseContainsJson() + */ + public function cantSeeResponseContainsJson($json = null) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseContainsJson', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Opposite to seeResponseContainsJson + * + * @part json + * @param array $json + * @see \Codeception\Module\REST::dontSeeResponseContainsJson() + */ + public function dontSeeResponseContainsJson($json = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseContainsJson', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if response is exactly the same as provided. + * + * @part json + * @part xml + * @param $response + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseEquals() + */ + public function canSeeResponseEquals($response) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if response is exactly the same as provided. + * + * @part json + * @part xml + * @param $response + * @see \Codeception\Module\REST::seeResponseEquals() + */ + public function seeResponseEquals($response) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks response code equals to provided value. + * + * @part json + * @part xml + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseCodeIs() + */ + public function canSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks response code equals to provided value. + * + * @part json + * @part xml + * @param $code + * @see \Codeception\Module\REST::seeResponseCodeIs() + */ + public function seeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is not equal to provided value. + * + * @part json + * @part xml + * @param $code + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeResponseCodeIs() + */ + public function cantSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that response code is not equal to provided value. + * + * @part json + * @part xml + * @param $code + * @see \Codeception\Module\REST::dontSeeResponseCodeIs() + */ + public function dontSeeResponseCodeIs($code) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response was valid XML. + * This is done with libxml_get_last_error function. + * + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeResponseIsXml() + */ + public function canSeeResponseIsXml() { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseIsXml', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks whether last response was valid XML. + * This is done with libxml_get_last_error function. + * + * @part xml + * @see \Codeception\Module\REST::seeResponseIsXml() + */ + public function seeResponseIsXml() { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseIsXml', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks wheather XML response matches XPath + * + * ```php + * <?php + * $I->seeXmlResponseMatchesXpath('//root/user[@id=1]'); + * ``` + * @part xml + * @param $xpath + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeXmlResponseMatchesXpath() + */ + public function canSeeXmlResponseMatchesXpath($xpath) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseMatchesXpath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks wheather XML response matches XPath + * + * ```php + * <?php + * $I->seeXmlResponseMatchesXpath('//root/user[@id=1]'); + * ``` + * @part xml + * @param $xpath + * @see \Codeception\Module\REST::seeXmlResponseMatchesXpath() + */ + public function seeXmlResponseMatchesXpath($xpath) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseMatchesXpath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks wheather XML response does not match XPath + * + * ```php + * <?php + * $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]'); + * ``` + * @part xml + * @param $xpath + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeXmlResponseMatchesXpath() + */ + public function cantSeeXmlResponseMatchesXpath($xpath) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseMatchesXpath', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks wheather XML response does not match XPath + * + * ```php + * <?php + * $I->dontSeeXmlResponseMatchesXpath('//root/user[@id=1]'); + * ``` + * @part xml + * @param $xpath + * @see \Codeception\Module\REST::dontSeeXmlResponseMatchesXpath() + */ + public function dontSeeXmlResponseMatchesXpath($xpath) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeXmlResponseMatchesXpath', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds and returns text contents of element. + * Element is matched by either CSS or XPath + * + * @param $cssOrXPath + * @return string + * @part xml + * @see \Codeception\Module\REST::grabTextContentFromXmlElement() + */ + public function grabTextContentFromXmlElement($cssOrXPath) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextContentFromXmlElement', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Finds and returns attribute of element. + * Element is matched by either CSS or XPath + * + * @param $cssOrXPath + * @param $attribute + * @return string + * @part xml + * @see \Codeception\Module\REST::grabAttributeFrom() + */ + public function grabAttributeFrom($cssOrXPath, $attribute) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response equals provided XML. + * Comparison is done by canonicalizing both xml`s. + * + * Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * @param $xml + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeXmlResponseEquals() + */ + public function canSeeXmlResponseEquals($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response equals provided XML. + * Comparison is done by canonicalizing both xml`s. + * + * Parameters can be passed either as DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * @param $xml + * @part xml + * @see \Codeception\Module\REST::seeXmlResponseEquals() + */ + public function seeXmlResponseEquals($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response does not equal to provided XML. + * Comparison is done by canonicalizing both xml`s. + * + * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * @param $xml + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeXmlResponseEquals() + */ + public function cantSeeXmlResponseEquals($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseEquals', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response does not equal to provided XML. + * Comparison is done by canonicalizing both xml`s. + * + * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * @param $xml + * @part xml + * @see \Codeception\Module\REST::dontSeeXmlResponseEquals() + */ + public function dontSeeXmlResponseEquals($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeXmlResponseEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response includes provided XML. + * Comparison is done by canonicalizing both xml`s. + * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * Example: + * + * ``` php + * <?php + * $I->seeXmlResponseIncludes("<result>1</result>"); + * ?> + * ``` + * + * @param $xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::seeXmlResponseIncludes() + */ + public function canSeeXmlResponseIncludes($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeXmlResponseIncludes', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response includes provided XML. + * Comparison is done by canonicalizing both xml`s. + * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * Example: + * + * ``` php + * <?php + * $I->seeXmlResponseIncludes("<result>1</result>"); + * ?> + * ``` + * + * @param $xml + * @see \Codeception\Module\REST::seeXmlResponseIncludes() + */ + public function seeXmlResponseIncludes($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeXmlResponseIncludes', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response does not include provided XML. + * Comparison is done by canonicalizing both xml`s. + * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * @param $xml + * @part xml + * Conditional Assertion: Test won't be stopped on fail + * @see \Codeception\Module\REST::dontSeeXmlResponseIncludes() + */ + public function cantSeeXmlResponseIncludes($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeXmlResponseIncludes', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks XML response does not include provided XML. + * Comparison is done by canonicalizing both xml`s. + * Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes). + * + * @param $xml + * @part xml + * @see \Codeception\Module\REST::dontSeeXmlResponseIncludes() + */ + public function dontSeeXmlResponseIncludes($xml) { + return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeXmlResponseIncludes', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param $path + * @throws ModuleException + * @deprecated + * @see \Codeception\Module\REST::grabDataFromJsonResponse() + */ + public function grabDataFromJsonResponse($path) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabDataFromJsonResponse', func_get_args())); + } +} diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php index b173aff6..3bf06e76 100644 --- a/tests/_support/_generated/FunctionalTesterActions.php +++ b/tests/_support/_generated/FunctionalTesterActions.php @@ -1,4 +1,4 @@ -<?php //[STAMP] a07099654f5bd84fd862472e6a030b65 +<?php //[STAMP] f541d027b7d3040ac7f6f9758b0efa72 namespace _generated; // This class was automatically generated by build task diff --git a/tests/_support/_generated/IntegrationTesterActions.php b/tests/_support/_generated/IntegrationTesterActions.php index bf674453..c0438fbf 100644 --- a/tests/_support/_generated/IntegrationTesterActions.php +++ b/tests/_support/_generated/IntegrationTesterActions.php @@ -1,11 +1,12 @@ -<?php //[STAMP] 45011971cfb225d39d739baf8ae90231 +<?php //[STAMP] 89e6b7ecd22f7d5f545f625be99d16a4 namespace _generated; // This class was automatically generated by build task // You should not change it manually as it will be overwritten on next build // @codingStandardsIgnoreFile -use Helper\Integration; +use Codeception\Module\Asserts; +use Helper\Unit; trait IntegrationTesterActions { @@ -15,4 +16,333 @@ trait IntegrationTesterActions abstract protected function getScenario(); + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are equal. + * + * @param $expected + * @param $actual + * @param string $message + * + * @return mixed + * @see \Codeception\Module\Asserts::assertEquals() + */ + public function assertEquals($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not equal + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEquals() + */ + public function assertNotEquals($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are same + * + * @param $expected + * @param $actual + * @param string $message + * + * @return mixed + * @see \Codeception\Module\Asserts::assertSame() + */ + public function assertSame($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not same + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotSame() + */ + public function assertNotSame($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is greater than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThan() + */ + public function assertGreaterThan($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @deprecated + * @see \Codeception\Module\Asserts::assertGreaterThen() + */ + public function assertGreaterThen($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is greater or equal than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() + */ + public function assertGreaterThanOrEqual($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @deprecated + * @see \Codeception\Module\Asserts::assertGreaterThenOrEqual() + */ + public function assertGreaterThenOrEqual($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is less than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThan() + */ + public function assertLessThan($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is less or equal than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThanOrEqual() + */ + public function assertLessThanOrEqual($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack contains needle + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertContains() + */ + public function assertContains($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack doesn't contain needle. + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertNotContains() + */ + public function assertNotContains($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string match with pattern + * + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertRegExp() + */ + public function assertRegExp($pattern, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string not match with pattern + * + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertNotRegExp() + */ + public function assertNotRegExp($pattern, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertEmpty() + */ + public function assertEmpty($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEmpty() + */ + public function assertNotEmpty($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNull() + */ + public function assertNull($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotNull() + */ + public function assertNotNull($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is positive. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertTrue() + */ + public function assertTrue($condition, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is negative. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertFalse() + */ + public function assertFalse($condition, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file exists + * + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileExists() + */ + public function assertFileExists($filename, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file doesn't exists + * + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileNotExists() + */ + public function assertFileNotExists($filename, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fails the test with message. + * + * @param $message + * @see \Codeception\Module\Asserts::fail() + */ + public function fail($message) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); + } } diff --git a/tests/_support/_generated/UnitTesterActions.php b/tests/_support/_generated/UnitTesterActions.php index 0c066a7e..142c450b 100644 --- a/tests/_support/_generated/UnitTesterActions.php +++ b/tests/_support/_generated/UnitTesterActions.php @@ -1,4 +1,4 @@ -<?php //[STAMP] f0237876407d9a8a0491dbbedcdcbf19 +<?php //[STAMP] 89e6b7ecd22f7d5f545f625be99d16a4 namespace _generated; // This class was automatically generated by build task |