Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like AcceptanceTesterActions often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AcceptanceTesterActions, and based on these observations, apply Extract Interface, too.
| 1 | <?php //[STAMP] 2bc213619448ae5aceba90bc932d188b |
||
| 11 | trait AcceptanceTesterActions |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @return \Codeception\Scenario |
||
| 15 | */ |
||
| 16 | abstract protected function getScenario(); |
||
| 17 | |||
| 18 | |||
| 19 | /** |
||
| 20 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 21 | * |
||
| 22 | * Sets the HTTP header to the passed value - which is used on |
||
| 23 | * subsequent HTTP requests through PhpBrowser. |
||
| 24 | * |
||
| 25 | * Example: |
||
| 26 | * ```php |
||
| 27 | * <?php |
||
| 28 | * $I->setHeader('X-Requested-With', 'Codeception'); |
||
| 29 | * $I->amOnPage('test-headers.php'); |
||
| 30 | * ?> |
||
| 31 | * ``` |
||
| 32 | * |
||
| 33 | * @param string $name the name of the request header |
||
| 34 | * @param string $value the value to set it to for subsequent |
||
| 35 | * requests |
||
| 36 | * @see \Codeception\Module\PhpBrowser::setHeader() |
||
| 37 | */ |
||
| 38 | public function setHeader($name, $value) { |
||
| 39 | return $this->getScenario()->runStep(new \Codeception\Step\Action('setHeader', func_get_args())); |
||
| 40 | } |
||
| 41 | |||
| 42 | |||
| 43 | /** |
||
| 44 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 45 | * |
||
| 46 | * Deletes the header with the passed name. Subsequent requests |
||
| 47 | * will not have the deleted header in its request. |
||
| 48 | * |
||
| 49 | * Example: |
||
| 50 | * ```php |
||
| 51 | * <?php |
||
| 52 | * $I->setHeader('X-Requested-With', 'Codeception'); |
||
| 53 | * $I->amOnPage('test-headers.php'); |
||
| 54 | * // ... |
||
| 55 | * $I->deleteHeader('X-Requested-With'); |
||
| 56 | * $I->amOnPage('some-other-page.php'); |
||
| 57 | * ?> |
||
| 58 | * ``` |
||
| 59 | * |
||
| 60 | * @param string $name the name of the header to delete. |
||
| 61 | * @see \Codeception\Module\PhpBrowser::deleteHeader() |
||
| 62 | */ |
||
| 63 | public function deleteHeader($name) { |
||
| 64 | return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args())); |
||
| 65 | } |
||
| 66 | |||
| 67 | |||
| 68 | /** |
||
| 69 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 70 | * |
||
| 71 | * Authenticates user for HTTP_AUTH |
||
| 72 | * |
||
| 73 | * @param $username |
||
| 74 | * @param $password |
||
| 75 | * @see \Codeception\Module\PhpBrowser::amHttpAuthenticated() |
||
| 76 | */ |
||
| 77 | public function amHttpAuthenticated($username, $password) { |
||
| 78 | return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args())); |
||
| 79 | } |
||
| 80 | |||
| 81 | |||
| 82 | /** |
||
| 83 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 84 | * |
||
| 85 | * Open web page at the given absolute URL and sets its hostname as the base host. |
||
| 86 | * |
||
| 87 | * ``` php |
||
| 88 | * <?php |
||
| 89 | * $I->amOnUrl('http://codeception.com'); |
||
| 90 | * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart |
||
| 91 | * ?> |
||
| 92 | * ``` |
||
| 93 | * @see \Codeception\Module\PhpBrowser::amOnUrl() |
||
| 94 | */ |
||
| 95 | public function amOnUrl($url) { |
||
| 96 | return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); |
||
| 97 | } |
||
| 98 | |||
| 99 | |||
| 100 | /** |
||
| 101 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 102 | * |
||
| 103 | * Changes the subdomain for the 'url' configuration parameter. |
||
| 104 | * Does not open a page; use `amOnPage` for that. |
||
| 105 | * |
||
| 106 | * ``` php |
||
| 107 | * <?php |
||
| 108 | * // If config is: 'http://mysite.com' |
||
| 109 | * // or config is: 'http://www.mysite.com' |
||
| 110 | * // or config is: 'http://company.mysite.com' |
||
| 111 | * |
||
| 112 | * $I->amOnSubdomain('user'); |
||
| 113 | * $I->amOnPage('/'); |
||
| 114 | * // moves to http://user.mysite.com/ |
||
| 115 | * ?> |
||
| 116 | * ``` |
||
| 117 | * |
||
| 118 | * @param $subdomain |
||
| 119 | * |
||
| 120 | * @return mixed |
||
| 121 | * @see \Codeception\Module\PhpBrowser::amOnSubdomain() |
||
| 122 | */ |
||
| 123 | public function amOnSubdomain($subdomain) { |
||
| 124 | return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); |
||
| 125 | } |
||
| 126 | |||
| 127 | |||
| 128 | /** |
||
| 129 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 130 | * |
||
| 131 | * Low-level API method. |
||
| 132 | * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly |
||
| 133 | * |
||
| 134 | * Example: |
||
| 135 | * |
||
| 136 | * ``` php |
||
| 137 | * <?php |
||
| 138 | * $I->executeInGuzzle(function (\GuzzleHttp\Client $client) { |
||
| 139 | * $client->get('/get', ['query' => ['foo' => 'bar']]); |
||
| 140 | * }); |
||
| 141 | * ?> |
||
| 142 | * ``` |
||
| 143 | * |
||
| 144 | * It is not recommended to use this command on a regular basis. |
||
| 145 | * If Codeception lacks important Guzzle Client methods, implement them and submit patches. |
||
| 146 | * |
||
| 147 | * @param callable $function |
||
| 148 | * @see \Codeception\Module\PhpBrowser::executeInGuzzle() |
||
| 149 | */ |
||
| 150 | public function executeInGuzzle($function) { |
||
| 151 | return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInGuzzle', func_get_args())); |
||
| 152 | } |
||
| 153 | |||
| 154 | |||
| 155 | /** |
||
| 156 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 157 | * |
||
| 158 | * Opens the page for the given relative URI. |
||
| 159 | * |
||
| 160 | * ``` php |
||
| 161 | * <?php |
||
| 162 | * // opens front page |
||
| 163 | * $I->amOnPage('/'); |
||
| 164 | * // opens /register page |
||
| 165 | * $I->amOnPage('/register'); |
||
| 166 | * ``` |
||
| 167 | * |
||
| 168 | * @param $page |
||
| 169 | * @see \Codeception\Lib\InnerBrowser::amOnPage() |
||
| 170 | */ |
||
| 171 | public function amOnPage($page) { |
||
| 172 | return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); |
||
| 173 | } |
||
| 174 | |||
| 175 | |||
| 176 | /** |
||
| 177 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 178 | * |
||
| 179 | * Perform a click on a link or a button, given by a locator. |
||
| 180 | * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. |
||
| 181 | * For buttons, the "value" attribute, "name" attribute, and inner text are searched. |
||
| 182 | * For links, the link text is searched. |
||
| 183 | * For images, the "alt" attribute and inner text of any parent links are searched. |
||
| 184 | * |
||
| 185 | * The second parameter is a context (CSS or XPath locator) to narrow the search. |
||
| 186 | * |
||
| 187 | * Note that if the locator matches a button of type `submit`, the form will be submitted. |
||
| 188 | * |
||
| 189 | * ``` php |
||
| 190 | * <?php |
||
| 191 | * // simple link |
||
| 192 | * $I->click('Logout'); |
||
| 193 | * // button of form |
||
| 194 | * $I->click('Submit'); |
||
| 195 | * // CSS button |
||
| 196 | * $I->click('#form input[type=submit]'); |
||
| 197 | * // XPath |
||
| 198 | * $I->click('//form/*[@type=submit]'); |
||
| 199 | * // link in context |
||
| 200 | * $I->click('Logout', '#nav'); |
||
| 201 | * // using strict locator |
||
| 202 | * $I->click(['link' => 'Login']); |
||
| 203 | * ?> |
||
| 204 | * ``` |
||
| 205 | * |
||
| 206 | * @param $link |
||
| 207 | * @param $context |
||
| 208 | * @see \Codeception\Lib\InnerBrowser::click() |
||
| 209 | */ |
||
| 210 | public function click($link, $context = null) { |
||
| 211 | return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); |
||
| 212 | } |
||
| 213 | |||
| 214 | |||
| 215 | /** |
||
| 216 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 217 | * |
||
| 218 | * Checks that the current page contains the given string (case insensitive). |
||
| 219 | * |
||
| 220 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
| 221 | * parameter to only search within that element. |
||
| 222 | * |
||
| 223 | * ``` php |
||
| 224 | * <?php |
||
| 225 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 226 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
| 227 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
| 228 | * ``` |
||
| 229 | * |
||
| 230 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 231 | * so `$I->see('strong')` will return true for strings like: |
||
| 232 | * |
||
| 233 | * - `<p>I am Stronger than thou</p>` |
||
| 234 | * - `<script>document.createElement('strong');</script>` |
||
| 235 | * |
||
| 236 | * But will *not* be true for strings like: |
||
| 237 | * |
||
| 238 | * - `<strong>Home</strong>` |
||
| 239 | * - `<div class="strong">Home</strong>` |
||
| 240 | * - `<!-- strong -->` |
||
| 241 | * |
||
| 242 | * For checking the raw source code, use `seeInSource()`. |
||
| 243 | * |
||
| 244 | * @param $text |
||
| 245 | * @param null $selector |
||
| 246 | * Conditional Assertion: Test won't be stopped on fail |
||
| 247 | * @see \Codeception\Lib\InnerBrowser::see() |
||
| 248 | */ |
||
| 249 | public function canSee($text, $selector = null) { |
||
| 250 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); |
||
| 251 | } |
||
| 252 | /** |
||
| 253 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 254 | * |
||
| 255 | * Checks that the current page contains the given string (case insensitive). |
||
| 256 | * |
||
| 257 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
| 258 | * parameter to only search within that element. |
||
| 259 | * |
||
| 260 | * ``` php |
||
| 261 | * <?php |
||
| 262 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 263 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
| 264 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
| 265 | * ``` |
||
| 266 | * |
||
| 267 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 268 | * so `$I->see('strong')` will return true for strings like: |
||
| 269 | * |
||
| 270 | * - `<p>I am Stronger than thou</p>` |
||
| 271 | * - `<script>document.createElement('strong');</script>` |
||
| 272 | * |
||
| 273 | * But will *not* be true for strings like: |
||
| 274 | * |
||
| 275 | * - `<strong>Home</strong>` |
||
| 276 | * - `<div class="strong">Home</strong>` |
||
| 277 | * - `<!-- strong -->` |
||
| 278 | * |
||
| 279 | * For checking the raw source code, use `seeInSource()`. |
||
| 280 | * |
||
| 281 | * @param $text |
||
| 282 | * @param null $selector |
||
| 283 | * @see \Codeception\Lib\InnerBrowser::see() |
||
| 284 | */ |
||
| 285 | public function see($text, $selector = null) { |
||
| 286 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args())); |
||
| 287 | } |
||
| 288 | |||
| 289 | |||
| 290 | /** |
||
| 291 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 292 | * |
||
| 293 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
| 294 | * Give a locator as the second parameter to match a specific region. |
||
| 295 | * |
||
| 296 | * ```php |
||
| 297 | * <?php |
||
| 298 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 299 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 300 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 301 | * ``` |
||
| 302 | * |
||
| 303 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 304 | * so `$I->dontSee('strong')` will fail on strings like: |
||
| 305 | * |
||
| 306 | * - `<p>I am Stronger than thou</p>` |
||
| 307 | * - `<script>document.createElement('strong');</script>` |
||
| 308 | * |
||
| 309 | * But will ignore strings like: |
||
| 310 | * |
||
| 311 | * - `<strong>Home</strong>` |
||
| 312 | * - `<div class="strong">Home</strong>` |
||
| 313 | * - `<!-- strong -->` |
||
| 314 | * |
||
| 315 | * For checking the raw source code, use `seeInSource()`. |
||
| 316 | * |
||
| 317 | * @param $text |
||
| 318 | * @param null $selector |
||
| 319 | * Conditional Assertion: Test won't be stopped on fail |
||
| 320 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
| 321 | */ |
||
| 322 | public function cantSee($text, $selector = null) { |
||
| 323 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); |
||
| 324 | } |
||
| 325 | /** |
||
| 326 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 327 | * |
||
| 328 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
| 329 | * Give a locator as the second parameter to match a specific region. |
||
| 330 | * |
||
| 331 | * ```php |
||
| 332 | * <?php |
||
| 333 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 334 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 335 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 336 | * ``` |
||
| 337 | * |
||
| 338 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 339 | * so `$I->dontSee('strong')` will fail on strings like: |
||
| 340 | * |
||
| 341 | * - `<p>I am Stronger than thou</p>` |
||
| 342 | * - `<script>document.createElement('strong');</script>` |
||
| 343 | * |
||
| 344 | * But will ignore strings like: |
||
| 345 | * |
||
| 346 | * - `<strong>Home</strong>` |
||
| 347 | * - `<div class="strong">Home</strong>` |
||
| 348 | * - `<!-- strong -->` |
||
| 349 | * |
||
| 350 | * For checking the raw source code, use `seeInSource()`. |
||
| 351 | * |
||
| 352 | * @param $text |
||
| 353 | * @param null $selector |
||
| 354 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
| 355 | */ |
||
| 356 | public function dontSee($text, $selector = null) { |
||
| 357 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); |
||
| 358 | } |
||
| 359 | |||
| 360 | |||
| 361 | /** |
||
| 362 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 363 | * |
||
| 364 | * Checks that the current page contains the given string in its |
||
| 365 | * raw source code. |
||
| 366 | * |
||
| 367 | * ``` php |
||
| 368 | * <?php |
||
| 369 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
| 370 | * ``` |
||
| 371 | * |
||
| 372 | * @param $raw |
||
| 373 | * Conditional Assertion: Test won't be stopped on fail |
||
| 374 | * @see \Codeception\Lib\InnerBrowser::seeInSource() |
||
| 375 | */ |
||
| 376 | public function canSeeInSource($raw) { |
||
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args())); |
||
| 378 | } |
||
| 379 | /** |
||
| 380 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 381 | * |
||
| 382 | * Checks that the current page contains the given string in its |
||
| 383 | * raw source code. |
||
| 384 | * |
||
| 385 | * ``` php |
||
| 386 | * <?php |
||
| 387 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
| 388 | * ``` |
||
| 389 | * |
||
| 390 | * @param $raw |
||
| 391 | * @see \Codeception\Lib\InnerBrowser::seeInSource() |
||
| 392 | */ |
||
| 393 | public function seeInSource($raw) { |
||
| 394 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args())); |
||
| 395 | } |
||
| 396 | |||
| 397 | |||
| 398 | /** |
||
| 399 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 400 | * |
||
| 401 | * Checks that the current page contains the given string in its |
||
| 402 | * raw source code. |
||
| 403 | * |
||
| 404 | * ```php |
||
| 405 | * <?php |
||
| 406 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
| 407 | * ``` |
||
| 408 | * |
||
| 409 | * @param $raw |
||
| 410 | * Conditional Assertion: Test won't be stopped on fail |
||
| 411 | * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() |
||
| 412 | */ |
||
| 413 | public function cantSeeInSource($raw) { |
||
| 414 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args())); |
||
| 415 | } |
||
| 416 | /** |
||
| 417 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 418 | * |
||
| 419 | * Checks that the current page contains the given string in its |
||
| 420 | * raw source code. |
||
| 421 | * |
||
| 422 | * ```php |
||
| 423 | * <?php |
||
| 424 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
| 425 | * ``` |
||
| 426 | * |
||
| 427 | * @param $raw |
||
| 428 | * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() |
||
| 429 | */ |
||
| 430 | public function dontSeeInSource($raw) { |
||
| 431 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args())); |
||
| 432 | } |
||
| 433 | |||
| 434 | |||
| 435 | /** |
||
| 436 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 437 | * |
||
| 438 | * Checks that there's a link with the specified text. |
||
| 439 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 440 | * |
||
| 441 | * ``` php |
||
| 442 | * <?php |
||
| 443 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 444 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 445 | * ?> |
||
| 446 | * ``` |
||
| 447 | * |
||
| 448 | * @param $text |
||
| 449 | * @param null $url |
||
| 450 | * Conditional Assertion: Test won't be stopped on fail |
||
| 451 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
| 452 | */ |
||
| 453 | public function canSeeLink($text, $url = null) { |
||
| 454 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); |
||
| 455 | } |
||
| 456 | /** |
||
| 457 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 458 | * |
||
| 459 | * Checks that there's a link with the specified text. |
||
| 460 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 461 | * |
||
| 462 | * ``` php |
||
| 463 | * <?php |
||
| 464 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 465 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 466 | * ?> |
||
| 467 | * ``` |
||
| 468 | * |
||
| 469 | * @param $text |
||
| 470 | * @param null $url |
||
| 471 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
| 472 | */ |
||
| 473 | public function seeLink($text, $url = null) { |
||
| 474 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); |
||
| 475 | } |
||
| 476 | |||
| 477 | |||
| 478 | /** |
||
| 479 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 480 | * |
||
| 481 | * Checks that the page doesn't contain a link with the given string. |
||
| 482 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 483 | * |
||
| 484 | * ``` php |
||
| 485 | * <?php |
||
| 486 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 487 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 488 | * ?> |
||
| 489 | * ``` |
||
| 490 | * |
||
| 491 | * @param $text |
||
| 492 | * @param null $url |
||
| 493 | * Conditional Assertion: Test won't be stopped on fail |
||
| 494 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
| 495 | */ |
||
| 496 | public function cantSeeLink($text, $url = null) { |
||
| 497 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); |
||
| 498 | } |
||
| 499 | /** |
||
| 500 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 501 | * |
||
| 502 | * Checks that the page doesn't contain a link with the given string. |
||
| 503 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 504 | * |
||
| 505 | * ``` php |
||
| 506 | * <?php |
||
| 507 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 508 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 509 | * ?> |
||
| 510 | * ``` |
||
| 511 | * |
||
| 512 | * @param $text |
||
| 513 | * @param null $url |
||
| 514 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
| 515 | */ |
||
| 516 | public function dontSeeLink($text, $url = null) { |
||
| 517 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); |
||
| 518 | } |
||
| 519 | |||
| 520 | |||
| 521 | /** |
||
| 522 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 523 | * |
||
| 524 | * Checks that current URI contains the given string. |
||
| 525 | * |
||
| 526 | * ``` php |
||
| 527 | * <?php |
||
| 528 | * // to match: /home/dashboard |
||
| 529 | * $I->seeInCurrentUrl('home'); |
||
| 530 | * // to match: /users/1 |
||
| 531 | * $I->seeInCurrentUrl('/users/'); |
||
| 532 | * ?> |
||
| 533 | * ``` |
||
| 534 | * |
||
| 535 | * @param $uri |
||
| 536 | * Conditional Assertion: Test won't be stopped on fail |
||
| 537 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
| 538 | */ |
||
| 539 | public function canSeeInCurrentUrl($uri) { |
||
| 540 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); |
||
| 541 | } |
||
| 542 | /** |
||
| 543 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 544 | * |
||
| 545 | * Checks that current URI contains the given string. |
||
| 546 | * |
||
| 547 | * ``` php |
||
| 548 | * <?php |
||
| 549 | * // to match: /home/dashboard |
||
| 550 | * $I->seeInCurrentUrl('home'); |
||
| 551 | * // to match: /users/1 |
||
| 552 | * $I->seeInCurrentUrl('/users/'); |
||
| 553 | * ?> |
||
| 554 | * ``` |
||
| 555 | * |
||
| 556 | * @param $uri |
||
| 557 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
| 558 | */ |
||
| 559 | public function seeInCurrentUrl($uri) { |
||
| 560 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); |
||
| 561 | } |
||
| 562 | |||
| 563 | |||
| 564 | /** |
||
| 565 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 566 | * |
||
| 567 | * Checks that the current URI doesn't contain the given string. |
||
| 568 | * |
||
| 569 | * ``` php |
||
| 570 | * <?php |
||
| 571 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 572 | * ?> |
||
| 573 | * ``` |
||
| 574 | * |
||
| 575 | * @param $uri |
||
| 576 | * Conditional Assertion: Test won't be stopped on fail |
||
| 577 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
| 578 | */ |
||
| 579 | public function cantSeeInCurrentUrl($uri) { |
||
| 580 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); |
||
| 581 | } |
||
| 582 | /** |
||
| 583 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 584 | * |
||
| 585 | * Checks that the current URI doesn't contain the given string. |
||
| 586 | * |
||
| 587 | * ``` php |
||
| 588 | * <?php |
||
| 589 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 590 | * ?> |
||
| 591 | * ``` |
||
| 592 | * |
||
| 593 | * @param $uri |
||
| 594 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
| 595 | */ |
||
| 596 | public function dontSeeInCurrentUrl($uri) { |
||
| 597 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); |
||
| 598 | } |
||
| 599 | |||
| 600 | |||
| 601 | /** |
||
| 602 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 603 | * |
||
| 604 | * Checks that the current URL is equal to the given string. |
||
| 605 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 606 | * |
||
| 607 | * ``` php |
||
| 608 | * <?php |
||
| 609 | * // to match root url |
||
| 610 | * $I->seeCurrentUrlEquals('/'); |
||
| 611 | * ?> |
||
| 612 | * ``` |
||
| 613 | * |
||
| 614 | * @param $uri |
||
| 615 | * Conditional Assertion: Test won't be stopped on fail |
||
| 616 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
| 617 | */ |
||
| 618 | public function canSeeCurrentUrlEquals($uri) { |
||
| 619 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); |
||
| 620 | } |
||
| 621 | /** |
||
| 622 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 623 | * |
||
| 624 | * Checks that the current URL is equal to the given string. |
||
| 625 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 626 | * |
||
| 627 | * ``` php |
||
| 628 | * <?php |
||
| 629 | * // to match root url |
||
| 630 | * $I->seeCurrentUrlEquals('/'); |
||
| 631 | * ?> |
||
| 632 | * ``` |
||
| 633 | * |
||
| 634 | * @param $uri |
||
| 635 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
| 636 | */ |
||
| 637 | public function seeCurrentUrlEquals($uri) { |
||
| 638 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); |
||
| 639 | } |
||
| 640 | |||
| 641 | |||
| 642 | /** |
||
| 643 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 644 | * |
||
| 645 | * Checks that the current URL doesn't equal the given string. |
||
| 646 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 647 | * |
||
| 648 | * ``` php |
||
| 649 | * <?php |
||
| 650 | * // current url is not root |
||
| 651 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 652 | * ?> |
||
| 653 | * ``` |
||
| 654 | * |
||
| 655 | * @param $uri |
||
| 656 | * Conditional Assertion: Test won't be stopped on fail |
||
| 657 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
| 658 | */ |
||
| 659 | public function cantSeeCurrentUrlEquals($uri) { |
||
| 660 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); |
||
| 661 | } |
||
| 662 | /** |
||
| 663 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 664 | * |
||
| 665 | * Checks that the current URL doesn't equal the given string. |
||
| 666 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 667 | * |
||
| 668 | * ``` php |
||
| 669 | * <?php |
||
| 670 | * // current url is not root |
||
| 671 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 672 | * ?> |
||
| 673 | * ``` |
||
| 674 | * |
||
| 675 | * @param $uri |
||
| 676 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
| 677 | */ |
||
| 678 | public function dontSeeCurrentUrlEquals($uri) { |
||
| 679 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); |
||
| 680 | } |
||
| 681 | |||
| 682 | |||
| 683 | /** |
||
| 684 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 685 | * |
||
| 686 | * Checks that the current URL matches the given regular expression. |
||
| 687 | * |
||
| 688 | * ``` php |
||
| 689 | * <?php |
||
| 690 | * // to match root url |
||
| 691 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 692 | * ?> |
||
| 693 | * ``` |
||
| 694 | * |
||
| 695 | * @param $uri |
||
| 696 | * Conditional Assertion: Test won't be stopped on fail |
||
| 697 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
| 698 | */ |
||
| 699 | public function canSeeCurrentUrlMatches($uri) { |
||
| 700 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); |
||
| 701 | } |
||
| 702 | /** |
||
| 703 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 704 | * |
||
| 705 | * Checks that the current URL matches the given regular expression. |
||
| 706 | * |
||
| 707 | * ``` php |
||
| 708 | * <?php |
||
| 709 | * // to match root url |
||
| 710 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 711 | * ?> |
||
| 712 | * ``` |
||
| 713 | * |
||
| 714 | * @param $uri |
||
| 715 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
| 716 | */ |
||
| 717 | public function seeCurrentUrlMatches($uri) { |
||
| 718 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); |
||
| 719 | } |
||
| 720 | |||
| 721 | |||
| 722 | /** |
||
| 723 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 724 | * |
||
| 725 | * Checks that current url doesn't match the given regular expression. |
||
| 726 | * |
||
| 727 | * ``` php |
||
| 728 | * <?php |
||
| 729 | * // to match root url |
||
| 730 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 731 | * ?> |
||
| 732 | * ``` |
||
| 733 | * |
||
| 734 | * @param $uri |
||
| 735 | * Conditional Assertion: Test won't be stopped on fail |
||
| 736 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
| 737 | */ |
||
| 738 | public function cantSeeCurrentUrlMatches($uri) { |
||
| 739 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); |
||
| 740 | } |
||
| 741 | /** |
||
| 742 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 743 | * |
||
| 744 | * Checks that current url doesn't match the given regular expression. |
||
| 745 | * |
||
| 746 | * ``` php |
||
| 747 | * <?php |
||
| 748 | * // to match root url |
||
| 749 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 750 | * ?> |
||
| 751 | * ``` |
||
| 752 | * |
||
| 753 | * @param $uri |
||
| 754 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
| 755 | */ |
||
| 756 | public function dontSeeCurrentUrlMatches($uri) { |
||
| 757 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); |
||
| 758 | } |
||
| 759 | |||
| 760 | |||
| 761 | /** |
||
| 762 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 763 | * |
||
| 764 | * Executes the given regular expression against the current URI and returns the first match. |
||
| 765 | * If no parameters are provided, the full URI is returned. |
||
| 766 | * |
||
| 767 | * ``` php |
||
| 768 | * <?php |
||
| 769 | * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); |
||
| 770 | * $uri = $I->grabFromCurrentUrl(); |
||
| 771 | * ?> |
||
| 772 | * ``` |
||
| 773 | * |
||
| 774 | * @param null $uri |
||
| 775 | * |
||
| 776 | * @return mixed |
||
| 777 | * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() |
||
| 778 | */ |
||
| 779 | public function grabFromCurrentUrl($uri = null) { |
||
| 780 | return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); |
||
| 781 | } |
||
| 782 | |||
| 783 | |||
| 784 | /** |
||
| 785 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 786 | * |
||
| 787 | * Checks that the specified checkbox is checked. |
||
| 788 | * |
||
| 789 | * ``` php |
||
| 790 | * <?php |
||
| 791 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 792 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 793 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 794 | * ?> |
||
| 795 | * ``` |
||
| 796 | * |
||
| 797 | * @param $checkbox |
||
| 798 | * Conditional Assertion: Test won't be stopped on fail |
||
| 799 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
| 800 | */ |
||
| 801 | public function canSeeCheckboxIsChecked($checkbox) { |
||
| 802 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); |
||
| 803 | } |
||
| 804 | /** |
||
| 805 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 806 | * |
||
| 807 | * Checks that the specified checkbox is checked. |
||
| 808 | * |
||
| 809 | * ``` php |
||
| 810 | * <?php |
||
| 811 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 812 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 813 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 814 | * ?> |
||
| 815 | * ``` |
||
| 816 | * |
||
| 817 | * @param $checkbox |
||
| 818 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
| 819 | */ |
||
| 820 | public function seeCheckboxIsChecked($checkbox) { |
||
| 821 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); |
||
| 822 | } |
||
| 823 | |||
| 824 | |||
| 825 | /** |
||
| 826 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 827 | * |
||
| 828 | * Check that the specified checkbox is unchecked. |
||
| 829 | * |
||
| 830 | * ``` php |
||
| 831 | * <?php |
||
| 832 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 833 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 834 | * ?> |
||
| 835 | * ``` |
||
| 836 | * |
||
| 837 | * @param $checkbox |
||
| 838 | * Conditional Assertion: Test won't be stopped on fail |
||
| 839 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
| 840 | */ |
||
| 841 | public function cantSeeCheckboxIsChecked($checkbox) { |
||
| 842 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); |
||
| 843 | } |
||
| 844 | /** |
||
| 845 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 846 | * |
||
| 847 | * Check that the specified checkbox is unchecked. |
||
| 848 | * |
||
| 849 | * ``` php |
||
| 850 | * <?php |
||
| 851 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 852 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 853 | * ?> |
||
| 854 | * ``` |
||
| 855 | * |
||
| 856 | * @param $checkbox |
||
| 857 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
| 858 | */ |
||
| 859 | public function dontSeeCheckboxIsChecked($checkbox) { |
||
| 860 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); |
||
| 861 | } |
||
| 862 | |||
| 863 | |||
| 864 | /** |
||
| 865 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 866 | * |
||
| 867 | * Checks that the given input field or textarea contains the given value. |
||
| 868 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
| 869 | * |
||
| 870 | * ``` php |
||
| 871 | * <?php |
||
| 872 | * $I->seeInField('Body','Type your comment here'); |
||
| 873 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 874 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 875 | * $I->seeInField('#searchform input','Search'); |
||
| 876 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 877 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 878 | * ?> |
||
| 879 | * ``` |
||
| 880 | * |
||
| 881 | * @param $field |
||
| 882 | * @param $value |
||
| 883 | * Conditional Assertion: Test won't be stopped on fail |
||
| 884 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
| 885 | */ |
||
| 886 | public function canSeeInField($field, $value) { |
||
| 887 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); |
||
| 888 | } |
||
| 889 | /** |
||
| 890 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 891 | * |
||
| 892 | * Checks that the given input field or textarea contains the given value. |
||
| 893 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
| 894 | * |
||
| 895 | * ``` php |
||
| 896 | * <?php |
||
| 897 | * $I->seeInField('Body','Type your comment here'); |
||
| 898 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 899 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 900 | * $I->seeInField('#searchform input','Search'); |
||
| 901 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 902 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 903 | * ?> |
||
| 904 | * ``` |
||
| 905 | * |
||
| 906 | * @param $field |
||
| 907 | * @param $value |
||
| 908 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
| 909 | */ |
||
| 910 | public function seeInField($field, $value) { |
||
| 911 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); |
||
| 912 | } |
||
| 913 | |||
| 914 | |||
| 915 | /** |
||
| 916 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 917 | * |
||
| 918 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 919 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 920 | * |
||
| 921 | * ``` php |
||
| 922 | * <?php |
||
| 923 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 924 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 925 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 926 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 927 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 928 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 929 | * ?> |
||
| 930 | * ``` |
||
| 931 | * |
||
| 932 | * @param $field |
||
| 933 | * @param $value |
||
| 934 | * Conditional Assertion: Test won't be stopped on fail |
||
| 935 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
| 936 | */ |
||
| 937 | public function cantSeeInField($field, $value) { |
||
| 938 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); |
||
| 939 | } |
||
| 940 | /** |
||
| 941 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 942 | * |
||
| 943 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 944 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 945 | * |
||
| 946 | * ``` php |
||
| 947 | * <?php |
||
| 948 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 949 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 950 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 951 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 952 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 953 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 954 | * ?> |
||
| 955 | * ``` |
||
| 956 | * |
||
| 957 | * @param $field |
||
| 958 | * @param $value |
||
| 959 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
| 960 | */ |
||
| 961 | public function dontSeeInField($field, $value) { |
||
| 962 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); |
||
| 963 | } |
||
| 964 | |||
| 965 | |||
| 966 | /** |
||
| 967 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 968 | * |
||
| 969 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 970 | * passed selector. |
||
| 971 | * |
||
| 972 | * ``` php |
||
| 973 | * <?php |
||
| 974 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 975 | * 'input1' => 'value', |
||
| 976 | * 'input2' => 'other value', |
||
| 977 | * ]); |
||
| 978 | * ?> |
||
| 979 | * ``` |
||
| 980 | * |
||
| 981 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 982 | * array may be passed: |
||
| 983 | * |
||
| 984 | * ``` php |
||
| 985 | * <?php |
||
| 986 | * $I->seeInFormFields('.form-class', [ |
||
| 987 | * 'multiselect' => [ |
||
| 988 | * 'value1', |
||
| 989 | * 'value2', |
||
| 990 | * ], |
||
| 991 | * 'checkbox[]' => [ |
||
| 992 | * 'a checked value', |
||
| 993 | * 'another checked value', |
||
| 994 | * ], |
||
| 995 | * ]); |
||
| 996 | * ?> |
||
| 997 | * ``` |
||
| 998 | * |
||
| 999 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1000 | * |
||
| 1001 | * ``` php |
||
| 1002 | * <?php |
||
| 1003 | * $I->seeInFormFields('#form-id', [ |
||
| 1004 | * 'checkbox1' => true, // passes if checked |
||
| 1005 | * 'checkbox2' => false, // passes if unchecked |
||
| 1006 | * ]); |
||
| 1007 | * ?> |
||
| 1008 | * ``` |
||
| 1009 | * |
||
| 1010 | * Pair this with submitForm for quick testing magic. |
||
| 1011 | * |
||
| 1012 | * ``` php |
||
| 1013 | * <?php |
||
| 1014 | * $form = [ |
||
| 1015 | * 'field1' => 'value', |
||
| 1016 | * 'field2' => 'another value', |
||
| 1017 | * 'checkbox1' => true, |
||
| 1018 | * // ... |
||
| 1019 | * ]; |
||
| 1020 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1021 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1022 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1023 | * ?> |
||
| 1024 | * ``` |
||
| 1025 | * |
||
| 1026 | * @param $formSelector |
||
| 1027 | * @param $params |
||
| 1028 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1029 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
| 1030 | */ |
||
| 1031 | public function canSeeInFormFields($formSelector, $params) { |
||
| 1032 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); |
||
| 1033 | } |
||
| 1034 | /** |
||
| 1035 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1036 | * |
||
| 1037 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 1038 | * passed selector. |
||
| 1039 | * |
||
| 1040 | * ``` php |
||
| 1041 | * <?php |
||
| 1042 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 1043 | * 'input1' => 'value', |
||
| 1044 | * 'input2' => 'other value', |
||
| 1045 | * ]); |
||
| 1046 | * ?> |
||
| 1047 | * ``` |
||
| 1048 | * |
||
| 1049 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 1050 | * array may be passed: |
||
| 1051 | * |
||
| 1052 | * ``` php |
||
| 1053 | * <?php |
||
| 1054 | * $I->seeInFormFields('.form-class', [ |
||
| 1055 | * 'multiselect' => [ |
||
| 1056 | * 'value1', |
||
| 1057 | * 'value2', |
||
| 1058 | * ], |
||
| 1059 | * 'checkbox[]' => [ |
||
| 1060 | * 'a checked value', |
||
| 1061 | * 'another checked value', |
||
| 1062 | * ], |
||
| 1063 | * ]); |
||
| 1064 | * ?> |
||
| 1065 | * ``` |
||
| 1066 | * |
||
| 1067 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1068 | * |
||
| 1069 | * ``` php |
||
| 1070 | * <?php |
||
| 1071 | * $I->seeInFormFields('#form-id', [ |
||
| 1072 | * 'checkbox1' => true, // passes if checked |
||
| 1073 | * 'checkbox2' => false, // passes if unchecked |
||
| 1074 | * ]); |
||
| 1075 | * ?> |
||
| 1076 | * ``` |
||
| 1077 | * |
||
| 1078 | * Pair this with submitForm for quick testing magic. |
||
| 1079 | * |
||
| 1080 | * ``` php |
||
| 1081 | * <?php |
||
| 1082 | * $form = [ |
||
| 1083 | * 'field1' => 'value', |
||
| 1084 | * 'field2' => 'another value', |
||
| 1085 | * 'checkbox1' => true, |
||
| 1086 | * // ... |
||
| 1087 | * ]; |
||
| 1088 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1089 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1090 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1091 | * ?> |
||
| 1092 | * ``` |
||
| 1093 | * |
||
| 1094 | * @param $formSelector |
||
| 1095 | * @param $params |
||
| 1096 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
| 1097 | */ |
||
| 1098 | public function seeInFormFields($formSelector, $params) { |
||
| 1099 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); |
||
| 1100 | } |
||
| 1101 | |||
| 1102 | |||
| 1103 | /** |
||
| 1104 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1105 | * |
||
| 1106 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1107 | * the passed selector. |
||
| 1108 | * |
||
| 1109 | * ``` php |
||
| 1110 | * <?php |
||
| 1111 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1112 | * 'input1' => 'non-existent value', |
||
| 1113 | * 'input2' => 'other non-existent value', |
||
| 1114 | * ]); |
||
| 1115 | * ?> |
||
| 1116 | * ``` |
||
| 1117 | * |
||
| 1118 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1119 | * as the value: |
||
| 1120 | * |
||
| 1121 | * ``` php |
||
| 1122 | * <?php |
||
| 1123 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1124 | * 'fieldName' => [ |
||
| 1125 | * 'This value shouldn\'t be set', |
||
| 1126 | * 'And this value shouldn\'t be set', |
||
| 1127 | * ], |
||
| 1128 | * ]); |
||
| 1129 | * ?> |
||
| 1130 | * ``` |
||
| 1131 | * |
||
| 1132 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1133 | * |
||
| 1134 | * ``` php |
||
| 1135 | * <?php |
||
| 1136 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1137 | * 'checkbox1' => true, // fails if checked |
||
| 1138 | * 'checkbox2' => false, // fails if unchecked |
||
| 1139 | * ]); |
||
| 1140 | * ?> |
||
| 1141 | * ``` |
||
| 1142 | * |
||
| 1143 | * @param $formSelector |
||
| 1144 | * @param $params |
||
| 1145 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1146 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
| 1147 | */ |
||
| 1148 | public function cantSeeInFormFields($formSelector, $params) { |
||
| 1149 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); |
||
| 1150 | } |
||
| 1151 | /** |
||
| 1152 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1153 | * |
||
| 1154 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1155 | * the passed selector. |
||
| 1156 | * |
||
| 1157 | * ``` php |
||
| 1158 | * <?php |
||
| 1159 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1160 | * 'input1' => 'non-existent value', |
||
| 1161 | * 'input2' => 'other non-existent value', |
||
| 1162 | * ]); |
||
| 1163 | * ?> |
||
| 1164 | * ``` |
||
| 1165 | * |
||
| 1166 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1167 | * as the value: |
||
| 1168 | * |
||
| 1169 | * ``` php |
||
| 1170 | * <?php |
||
| 1171 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1172 | * 'fieldName' => [ |
||
| 1173 | * 'This value shouldn\'t be set', |
||
| 1174 | * 'And this value shouldn\'t be set', |
||
| 1175 | * ], |
||
| 1176 | * ]); |
||
| 1177 | * ?> |
||
| 1178 | * ``` |
||
| 1179 | * |
||
| 1180 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1181 | * |
||
| 1182 | * ``` php |
||
| 1183 | * <?php |
||
| 1184 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1185 | * 'checkbox1' => true, // fails if checked |
||
| 1186 | * 'checkbox2' => false, // fails if unchecked |
||
| 1187 | * ]); |
||
| 1188 | * ?> |
||
| 1189 | * ``` |
||
| 1190 | * |
||
| 1191 | * @param $formSelector |
||
| 1192 | * @param $params |
||
| 1193 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
| 1194 | */ |
||
| 1195 | public function dontSeeInFormFields($formSelector, $params) { |
||
| 1196 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args())); |
||
| 1197 | } |
||
| 1198 | |||
| 1199 | |||
| 1200 | /** |
||
| 1201 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1202 | * |
||
| 1203 | * Submits the given form on the page, optionally with the given form |
||
| 1204 | * values. Give the form fields values as an array. |
||
| 1205 | * |
||
| 1206 | * Although this function can be used as a short-hand version of |
||
| 1207 | * `fillField()`, `selectOption()`, `click()` etc. it has some important |
||
| 1208 | * differences: |
||
| 1209 | * |
||
| 1210 | * * Only field *names* may be used, not CSS/XPath selectors nor field labels |
||
| 1211 | * * If a field is sent to this function that does *not* exist on the page, |
||
| 1212 | * it will silently be added to the HTTP request. This is helpful for testing |
||
| 1213 | * some types of forms, but be aware that you will *not* get an exception |
||
| 1214 | * like you would if you called `fillField()` or `selectOption()` with |
||
| 1215 | * a missing field. |
||
| 1216 | * |
||
| 1217 | * Fields that are not provided will be filled by their values from the page, |
||
| 1218 | * or from any previous calls to `fillField()`, `selectOption()` etc. |
||
| 1219 | * You don't need to click the 'Submit' button afterwards. |
||
| 1220 | * This command itself triggers the request to form's action. |
||
| 1221 | * |
||
| 1222 | * You can optionally specify which button's value to include |
||
| 1223 | * in the request with the last parameter (as an alternative to |
||
| 1224 | * explicitly setting its value in the second parameter), as |
||
| 1225 | * button values are not otherwise included in the request. |
||
| 1226 | * |
||
| 1227 | * Examples: |
||
| 1228 | * |
||
| 1229 | * ``` php |
||
| 1230 | * <?php |
||
| 1231 | * $I->submitForm('#login', [ |
||
| 1232 | * 'login' => 'davert', |
||
| 1233 | * 'password' => '123456' |
||
| 1234 | * ]); |
||
| 1235 | * // or |
||
| 1236 | * $I->submitForm('#login', [ |
||
| 1237 | * 'login' => 'davert', |
||
| 1238 | * 'password' => '123456' |
||
| 1239 | * ], 'submitButtonName'); |
||
| 1240 | * |
||
| 1241 | * ``` |
||
| 1242 | * |
||
| 1243 | * For example, given this sample "Sign Up" form: |
||
| 1244 | * |
||
| 1245 | * ``` html |
||
| 1246 | * <form action="/sign_up"> |
||
| 1247 | * Login: |
||
| 1248 | * <input type="text" name="user[login]" /><br/> |
||
| 1249 | * Password: |
||
| 1250 | * <input type="password" name="user[password]" /><br/> |
||
| 1251 | * Do you agree to our terms? |
||
| 1252 | * <input type="checkbox" name="user[agree]" /><br/> |
||
| 1253 | * Select pricing plan: |
||
| 1254 | * <select name="plan"> |
||
| 1255 | * <option value="1">Free</option> |
||
| 1256 | * <option value="2" selected="selected">Paid</option> |
||
| 1257 | * </select> |
||
| 1258 | * <input type="submit" name="submitButton" value="Submit" /> |
||
| 1259 | * </form> |
||
| 1260 | * ``` |
||
| 1261 | * |
||
| 1262 | * You could write the following to submit it: |
||
| 1263 | * |
||
| 1264 | * ``` php |
||
| 1265 | * <?php |
||
| 1266 | * $I->submitForm( |
||
| 1267 | * '#userForm', |
||
| 1268 | * [ |
||
| 1269 | * 'user' => [ |
||
| 1270 | * 'login' => 'Davert', |
||
| 1271 | * 'password' => '123456', |
||
| 1272 | * 'agree' => true |
||
| 1273 | * ] |
||
| 1274 | * ], |
||
| 1275 | * 'submitButton' |
||
| 1276 | * ); |
||
| 1277 | * ``` |
||
| 1278 | * Note that "2" will be the submitted value for the "plan" field, as it is |
||
| 1279 | * the selected option. |
||
| 1280 | * |
||
| 1281 | * You can also emulate a JavaScript submission by not specifying any |
||
| 1282 | * buttons in the third parameter to submitForm. |
||
| 1283 | * |
||
| 1284 | * ```php |
||
| 1285 | * <?php |
||
| 1286 | * $I->submitForm( |
||
| 1287 | * '#userForm', |
||
| 1288 | * [ |
||
| 1289 | * 'user' => [ |
||
| 1290 | * 'login' => 'Davert', |
||
| 1291 | * 'password' => '123456', |
||
| 1292 | * 'agree' => true |
||
| 1293 | * ] |
||
| 1294 | * ] |
||
| 1295 | * ); |
||
| 1296 | * ``` |
||
| 1297 | * |
||
| 1298 | * This function works well when paired with `seeInFormFields()` |
||
| 1299 | * for quickly testing CRUD interfaces and form validation logic. |
||
| 1300 | * |
||
| 1301 | * ``` php |
||
| 1302 | * <?php |
||
| 1303 | * $form = [ |
||
| 1304 | * 'field1' => 'value', |
||
| 1305 | * 'field2' => 'another value', |
||
| 1306 | * 'checkbox1' => true, |
||
| 1307 | * // ... |
||
| 1308 | * ]; |
||
| 1309 | * $I->submitForm('#my-form', $form, 'submitButton'); |
||
| 1310 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1311 | * $I->seeInFormFields('#my-form', $form); |
||
| 1312 | * ``` |
||
| 1313 | * |
||
| 1314 | * Parameter values can be set to arrays for multiple input fields |
||
| 1315 | * of the same name, or multi-select combo boxes. For checkboxes, |
||
| 1316 | * you can use either the string value or boolean `true`/`false` which will |
||
| 1317 | * be replaced by the checkbox's value in the DOM. |
||
| 1318 | * |
||
| 1319 | * ``` php |
||
| 1320 | * <?php |
||
| 1321 | * $I->submitForm('#my-form', [ |
||
| 1322 | * 'field1' => 'value', |
||
| 1323 | * 'checkbox' => [ |
||
| 1324 | * 'value of first checkbox', |
||
| 1325 | * 'value of second checkbox', |
||
| 1326 | * ], |
||
| 1327 | * 'otherCheckboxes' => [ |
||
| 1328 | * true, |
||
| 1329 | * false, |
||
| 1330 | * false |
||
| 1331 | * ], |
||
| 1332 | * 'multiselect' => [ |
||
| 1333 | * 'first option value', |
||
| 1334 | * 'second option value' |
||
| 1335 | * ] |
||
| 1336 | * ]); |
||
| 1337 | * ``` |
||
| 1338 | * |
||
| 1339 | * Mixing string and boolean values for a checkbox's value is not supported |
||
| 1340 | * and may produce unexpected results. |
||
| 1341 | * |
||
| 1342 | * Field names ending in `[]` must be passed without the trailing square |
||
| 1343 | * bracket characters, and must contain an array for its value. This allows |
||
| 1344 | * submitting multiple values with the same name, consider: |
||
| 1345 | * |
||
| 1346 | * ```php |
||
| 1347 | * <?php |
||
| 1348 | * // This will NOT work correctly |
||
| 1349 | * $I->submitForm('#my-form', [ |
||
| 1350 | * 'field[]' => 'value', |
||
| 1351 | * 'field[]' => 'another value', // 'field[]' is already a defined key |
||
| 1352 | * ]); |
||
| 1353 | * ``` |
||
| 1354 | * |
||
| 1355 | * The solution is to pass an array value: |
||
| 1356 | * |
||
| 1357 | * ```php |
||
| 1358 | * <?php |
||
| 1359 | * // This way both values are submitted |
||
| 1360 | * $I->submitForm('#my-form', [ |
||
| 1361 | * 'field' => [ |
||
| 1362 | * 'value', |
||
| 1363 | * 'another value', |
||
| 1364 | * ] |
||
| 1365 | * ]); |
||
| 1366 | * ``` |
||
| 1367 | * |
||
| 1368 | * @param $selector |
||
| 1369 | * @param $params |
||
| 1370 | * @param $button |
||
| 1371 | * @see \Codeception\Lib\InnerBrowser::submitForm() |
||
| 1372 | */ |
||
| 1373 | public function submitForm($selector, $params, $button = null) { |
||
| 1374 | return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); |
||
| 1375 | } |
||
| 1376 | |||
| 1377 | |||
| 1378 | /** |
||
| 1379 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1380 | * |
||
| 1381 | * Fills a text field or textarea with the given string. |
||
| 1382 | * |
||
| 1383 | * ``` php |
||
| 1384 | * <?php |
||
| 1385 | * $I->fillField("//input[@type='text']", "Hello World!"); |
||
| 1386 | * $I->fillField(['name' => 'email'], '[email protected]'); |
||
| 1387 | * ?> |
||
| 1388 | * ``` |
||
| 1389 | * |
||
| 1390 | * @param $field |
||
| 1391 | * @param $value |
||
| 1392 | * @see \Codeception\Lib\InnerBrowser::fillField() |
||
| 1393 | */ |
||
| 1394 | public function fillField($field, $value) { |
||
| 1395 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args())); |
||
| 1396 | } |
||
| 1397 | |||
| 1398 | |||
| 1399 | /** |
||
| 1400 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1401 | * |
||
| 1402 | * Selects an option in a select tag or in radio button group. |
||
| 1403 | * |
||
| 1404 | * ``` php |
||
| 1405 | * <?php |
||
| 1406 | * $I->selectOption('form select[name=account]', 'Premium'); |
||
| 1407 | * $I->selectOption('form input[name=payment]', 'Monthly'); |
||
| 1408 | * $I->selectOption('//form/select[@name=account]', 'Monthly'); |
||
| 1409 | * ?> |
||
| 1410 | * ``` |
||
| 1411 | * |
||
| 1412 | * Provide an array for the second argument to select multiple options: |
||
| 1413 | * |
||
| 1414 | * ``` php |
||
| 1415 | * <?php |
||
| 1416 | * $I->selectOption('Which OS do you use?', array('Windows','Linux')); |
||
| 1417 | * ?> |
||
| 1418 | * ``` |
||
| 1419 | * |
||
| 1420 | * @param $select |
||
| 1421 | * @param $option |
||
| 1422 | * @see \Codeception\Lib\InnerBrowser::selectOption() |
||
| 1423 | */ |
||
| 1424 | public function selectOption($select, $option) { |
||
| 1425 | return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); |
||
| 1426 | } |
||
| 1427 | |||
| 1428 | |||
| 1429 | /** |
||
| 1430 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1431 | * |
||
| 1432 | * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. |
||
| 1433 | * |
||
| 1434 | * ``` php |
||
| 1435 | * <?php |
||
| 1436 | * $I->checkOption('#agree'); |
||
| 1437 | * ?> |
||
| 1438 | * ``` |
||
| 1439 | * |
||
| 1440 | * @param $option |
||
| 1441 | * @see \Codeception\Lib\InnerBrowser::checkOption() |
||
| 1442 | */ |
||
| 1443 | public function checkOption($option) { |
||
| 1444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); |
||
| 1445 | } |
||
| 1446 | |||
| 1447 | |||
| 1448 | /** |
||
| 1449 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1450 | * |
||
| 1451 | * Unticks a checkbox. |
||
| 1452 | * |
||
| 1453 | * ``` php |
||
| 1454 | * <?php |
||
| 1455 | * $I->uncheckOption('#notify'); |
||
| 1456 | * ?> |
||
| 1457 | * ``` |
||
| 1458 | * |
||
| 1459 | * @param $option |
||
| 1460 | * @see \Codeception\Lib\InnerBrowser::uncheckOption() |
||
| 1461 | */ |
||
| 1462 | public function uncheckOption($option) { |
||
| 1463 | return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); |
||
| 1464 | } |
||
| 1465 | |||
| 1466 | |||
| 1467 | /** |
||
| 1468 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1469 | * |
||
| 1470 | * Attaches a file relative to the Codeception data directory to the given file upload field. |
||
| 1471 | * |
||
| 1472 | * ``` php |
||
| 1473 | * <?php |
||
| 1474 | * // file is stored in 'tests/_data/prices.xls' |
||
| 1475 | * $I->attachFile('input[@type="file"]', 'prices.xls'); |
||
| 1476 | * ?> |
||
| 1477 | * ``` |
||
| 1478 | * |
||
| 1479 | * @param $field |
||
| 1480 | * @param $filename |
||
| 1481 | * @see \Codeception\Lib\InnerBrowser::attachFile() |
||
| 1482 | */ |
||
| 1483 | public function attachFile($field, $filename) { |
||
| 1484 | return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); |
||
| 1485 | } |
||
| 1486 | |||
| 1487 | |||
| 1488 | /** |
||
| 1489 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1490 | * |
||
| 1491 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1492 | * This action sends a GET ajax request with specified params. |
||
| 1493 | * |
||
| 1494 | * See ->sendAjaxPostRequest for examples. |
||
| 1495 | * |
||
| 1496 | * @param $uri |
||
| 1497 | * @param $params |
||
| 1498 | * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() |
||
| 1499 | */ |
||
| 1500 | public function sendAjaxGetRequest($uri, $params = null) { |
||
| 1501 | return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args())); |
||
| 1502 | } |
||
| 1503 | |||
| 1504 | |||
| 1505 | /** |
||
| 1506 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1507 | * |
||
| 1508 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1509 | * This action sends a POST ajax request with specified params. |
||
| 1510 | * Additional params can be passed as array. |
||
| 1511 | * |
||
| 1512 | * Example: |
||
| 1513 | * |
||
| 1514 | * Imagine that by clicking checkbox you trigger ajax request which updates user settings. |
||
| 1515 | * We emulate that click by running this ajax request manually. |
||
| 1516 | * |
||
| 1517 | * ``` php |
||
| 1518 | * <?php |
||
| 1519 | * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST |
||
| 1520 | * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET |
||
| 1521 | * |
||
| 1522 | * ``` |
||
| 1523 | * |
||
| 1524 | * @param $uri |
||
| 1525 | * @param $params |
||
| 1526 | * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() |
||
| 1527 | */ |
||
| 1528 | public function sendAjaxPostRequest($uri, $params = null) { |
||
| 1529 | return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args())); |
||
| 1530 | } |
||
| 1531 | |||
| 1532 | |||
| 1533 | /** |
||
| 1534 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1535 | * |
||
| 1536 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1537 | * This action sends an ajax request with specified method and params. |
||
| 1538 | * |
||
| 1539 | * Example: |
||
| 1540 | * |
||
| 1541 | * You need to perform an ajax request specifying the HTTP method. |
||
| 1542 | * |
||
| 1543 | * ``` php |
||
| 1544 | * <?php |
||
| 1545 | * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); |
||
| 1546 | * |
||
| 1547 | * ``` |
||
| 1548 | * |
||
| 1549 | * @param $method |
||
| 1550 | * @param $uri |
||
| 1551 | * @param $params |
||
| 1552 | * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() |
||
| 1553 | */ |
||
| 1554 | public function sendAjaxRequest($method, $uri, $params = null) { |
||
| 1555 | return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args())); |
||
| 1556 | } |
||
| 1557 | |||
| 1558 | |||
| 1559 | /** |
||
| 1560 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1561 | * |
||
| 1562 | * Finds and returns the text contents of the given element. |
||
| 1563 | * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. |
||
| 1564 | * |
||
| 1565 | * ``` php |
||
| 1566 | * <?php |
||
| 1567 | * $heading = $I->grabTextFrom('h1'); |
||
| 1568 | * $heading = $I->grabTextFrom('descendant-or-self::h1'); |
||
| 1569 | * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex |
||
| 1570 | * ?> |
||
| 1571 | * ``` |
||
| 1572 | * |
||
| 1573 | * @param $cssOrXPathOrRegex |
||
| 1574 | * |
||
| 1575 | * @return mixed |
||
| 1576 | * @see \Codeception\Lib\InnerBrowser::grabTextFrom() |
||
| 1577 | */ |
||
| 1578 | public function grabTextFrom($cssOrXPathOrRegex) { |
||
| 1579 | return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); |
||
| 1580 | } |
||
| 1581 | |||
| 1582 | |||
| 1583 | /** |
||
| 1584 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1585 | * |
||
| 1586 | * Grabs the value of the given attribute value from the given element. |
||
| 1587 | * Fails if element is not found. |
||
| 1588 | * |
||
| 1589 | * ``` php |
||
| 1590 | * <?php |
||
| 1591 | * $I->grabAttributeFrom('#tooltip', 'title'); |
||
| 1592 | * ?> |
||
| 1593 | * ``` |
||
| 1594 | * |
||
| 1595 | * |
||
| 1596 | * @param $cssOrXpath |
||
| 1597 | * @param $attribute |
||
| 1598 | * |
||
| 1599 | * @return mixed |
||
| 1600 | * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() |
||
| 1601 | */ |
||
| 1602 | public function grabAttributeFrom($cssOrXpath, $attribute) { |
||
| 1603 | return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); |
||
| 1604 | } |
||
| 1605 | |||
| 1606 | |||
| 1607 | /** |
||
| 1608 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1609 | * |
||
| 1610 | * Grabs either the text content, or attribute values, of nodes |
||
| 1611 | * matched by $cssOrXpath and returns them as an array. |
||
| 1612 | * |
||
| 1613 | * ```html |
||
| 1614 | * <a href="#first">First</a> |
||
| 1615 | * <a href="#second">Second</a> |
||
| 1616 | * <a href="#third">Third</a> |
||
| 1617 | * ``` |
||
| 1618 | * |
||
| 1619 | * ```php |
||
| 1620 | * <?php |
||
| 1621 | * // would return ['First', 'Second', 'Third'] |
||
| 1622 | * $aLinkText = $I->grabMultiple('a'); |
||
| 1623 | * |
||
| 1624 | * // would return ['#first', '#second', '#third'] |
||
| 1625 | * $aLinks = $I->grabMultiple('a', 'href'); |
||
| 1626 | * ?> |
||
| 1627 | * ``` |
||
| 1628 | * |
||
| 1629 | * @param $cssOrXpath |
||
| 1630 | * @param $attribute |
||
| 1631 | * @return string[] |
||
| 1632 | * @see \Codeception\Lib\InnerBrowser::grabMultiple() |
||
| 1633 | */ |
||
| 1634 | public function grabMultiple($cssOrXpath, $attribute = null) { |
||
| 1635 | return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args())); |
||
| 1636 | } |
||
| 1637 | |||
| 1638 | |||
| 1639 | /** |
||
| 1640 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1641 | * |
||
| 1642 | * @param $field |
||
| 1643 | * |
||
| 1644 | * @return array|mixed|null|string |
||
| 1645 | * @see \Codeception\Lib\InnerBrowser::grabValueFrom() |
||
| 1646 | */ |
||
| 1647 | public function grabValueFrom($field) { |
||
| 1648 | return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); |
||
| 1649 | } |
||
| 1650 | |||
| 1651 | |||
| 1652 | /** |
||
| 1653 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1654 | * |
||
| 1655 | * Sets a cookie with the given name and value. |
||
| 1656 | * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. |
||
| 1657 | * |
||
| 1658 | * ``` php |
||
| 1659 | * <?php |
||
| 1660 | * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); |
||
| 1661 | * ?> |
||
| 1662 | * ``` |
||
| 1663 | * |
||
| 1664 | * @param $name |
||
| 1665 | * @param $val |
||
| 1666 | * @param array $params |
||
| 1667 | * |
||
| 1668 | * @return mixed |
||
| 1669 | * @see \Codeception\Lib\InnerBrowser::setCookie() |
||
| 1670 | */ |
||
| 1671 | public function setCookie($name, $val, $params = null) { |
||
| 1672 | return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); |
||
| 1673 | } |
||
| 1674 | |||
| 1675 | |||
| 1676 | /** |
||
| 1677 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1678 | * |
||
| 1679 | * Grabs a cookie value. |
||
| 1680 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 1681 | * |
||
| 1682 | * @param $cookie |
||
| 1683 | * |
||
| 1684 | * @param array $params |
||
| 1685 | * @return mixed |
||
| 1686 | * @see \Codeception\Lib\InnerBrowser::grabCookie() |
||
| 1687 | */ |
||
| 1688 | public function grabCookie($cookie, $params = null) { |
||
| 1689 | return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); |
||
| 1690 | } |
||
| 1691 | |||
| 1692 | |||
| 1693 | /** |
||
| 1694 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1695 | * |
||
| 1696 | * Checks that a cookie with the given name is set. |
||
| 1697 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1698 | * |
||
| 1699 | * ``` php |
||
| 1700 | * <?php |
||
| 1701 | * $I->seeCookie('PHPSESSID'); |
||
| 1702 | * ?> |
||
| 1703 | * ``` |
||
| 1704 | * |
||
| 1705 | * @param $cookie |
||
| 1706 | * @param array $params |
||
| 1707 | * @return mixed |
||
| 1708 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1709 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
| 1710 | */ |
||
| 1711 | public function canSeeCookie($cookie, $params = null) { |
||
| 1712 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); |
||
| 1713 | } |
||
| 1714 | /** |
||
| 1715 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1716 | * |
||
| 1717 | * Checks that a cookie with the given name is set. |
||
| 1718 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1719 | * |
||
| 1720 | * ``` php |
||
| 1721 | * <?php |
||
| 1722 | * $I->seeCookie('PHPSESSID'); |
||
| 1723 | * ?> |
||
| 1724 | * ``` |
||
| 1725 | * |
||
| 1726 | * @param $cookie |
||
| 1727 | * @param array $params |
||
| 1728 | * @return mixed |
||
| 1729 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
| 1730 | */ |
||
| 1731 | public function seeCookie($cookie, $params = null) { |
||
| 1732 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); |
||
| 1733 | } |
||
| 1734 | |||
| 1735 | |||
| 1736 | /** |
||
| 1737 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1738 | * |
||
| 1739 | * Checks that there isn't a cookie with the given name. |
||
| 1740 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1741 | * |
||
| 1742 | * @param $cookie |
||
| 1743 | * |
||
| 1744 | * @param array $params |
||
| 1745 | * @return mixed |
||
| 1746 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1747 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
| 1748 | */ |
||
| 1749 | public function cantSeeCookie($cookie, $params = null) { |
||
| 1750 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); |
||
| 1751 | } |
||
| 1752 | /** |
||
| 1753 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1754 | * |
||
| 1755 | * Checks that there isn't a cookie with the given name. |
||
| 1756 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1757 | * |
||
| 1758 | * @param $cookie |
||
| 1759 | * |
||
| 1760 | * @param array $params |
||
| 1761 | * @return mixed |
||
| 1762 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
| 1763 | */ |
||
| 1764 | public function dontSeeCookie($cookie, $params = null) { |
||
| 1765 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); |
||
| 1766 | } |
||
| 1767 | |||
| 1768 | |||
| 1769 | /** |
||
| 1770 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1771 | * |
||
| 1772 | * Unsets cookie with the given name. |
||
| 1773 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 1774 | * |
||
| 1775 | * @param $cookie |
||
| 1776 | * |
||
| 1777 | * @param array $params |
||
| 1778 | * @return mixed |
||
| 1779 | * @see \Codeception\Lib\InnerBrowser::resetCookie() |
||
| 1780 | */ |
||
| 1781 | public function resetCookie($name, $params = null) { |
||
| 1782 | return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); |
||
| 1783 | } |
||
| 1784 | |||
| 1785 | |||
| 1786 | /** |
||
| 1787 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1788 | * |
||
| 1789 | * Checks that the given element exists on the page and is visible. |
||
| 1790 | * You can also specify expected attributes of this element. |
||
| 1791 | * |
||
| 1792 | * ``` php |
||
| 1793 | * <?php |
||
| 1794 | * $I->seeElement('.error'); |
||
| 1795 | * $I->seeElement('//form/input[1]'); |
||
| 1796 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1797 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1798 | * |
||
| 1799 | * // strict locator in first arg, attributes in second |
||
| 1800 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1801 | * ?> |
||
| 1802 | * ``` |
||
| 1803 | * |
||
| 1804 | * @param $selector |
||
| 1805 | * @param array $attributes |
||
| 1806 | * @return |
||
| 1807 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1808 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
| 1809 | */ |
||
| 1810 | public function canSeeElement($selector, $attributes = null) { |
||
| 1811 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); |
||
| 1812 | } |
||
| 1813 | /** |
||
| 1814 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1815 | * |
||
| 1816 | * Checks that the given element exists on the page and is visible. |
||
| 1817 | * You can also specify expected attributes of this element. |
||
| 1818 | * |
||
| 1819 | * ``` php |
||
| 1820 | * <?php |
||
| 1821 | * $I->seeElement('.error'); |
||
| 1822 | * $I->seeElement('//form/input[1]'); |
||
| 1823 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1824 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1825 | * |
||
| 1826 | * // strict locator in first arg, attributes in second |
||
| 1827 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1828 | * ?> |
||
| 1829 | * ``` |
||
| 1830 | * |
||
| 1831 | * @param $selector |
||
| 1832 | * @param array $attributes |
||
| 1833 | * @return |
||
| 1834 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
| 1835 | */ |
||
| 1836 | public function seeElement($selector, $attributes = null) { |
||
| 1837 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); |
||
| 1838 | } |
||
| 1839 | |||
| 1840 | |||
| 1841 | /** |
||
| 1842 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1843 | * |
||
| 1844 | * Checks that the given element is invisible or not present on the page. |
||
| 1845 | * You can also specify expected attributes of this element. |
||
| 1846 | * |
||
| 1847 | * ``` php |
||
| 1848 | * <?php |
||
| 1849 | * $I->dontSeeElement('.error'); |
||
| 1850 | * $I->dontSeeElement('//form/input[1]'); |
||
| 1851 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 1852 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 1853 | * ?> |
||
| 1854 | * ``` |
||
| 1855 | * |
||
| 1856 | * @param $selector |
||
| 1857 | * @param array $attributes |
||
| 1858 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1859 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
| 1860 | */ |
||
| 1861 | public function cantSeeElement($selector, $attributes = null) { |
||
| 1862 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); |
||
| 1863 | } |
||
| 1864 | /** |
||
| 1865 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1866 | * |
||
| 1867 | * Checks that the given element is invisible or not present on the page. |
||
| 1868 | * You can also specify expected attributes of this element. |
||
| 1869 | * |
||
| 1870 | * ``` php |
||
| 1871 | * <?php |
||
| 1872 | * $I->dontSeeElement('.error'); |
||
| 1873 | * $I->dontSeeElement('//form/input[1]'); |
||
| 1874 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 1875 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 1876 | * ?> |
||
| 1877 | * ``` |
||
| 1878 | * |
||
| 1879 | * @param $selector |
||
| 1880 | * @param array $attributes |
||
| 1881 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
| 1882 | */ |
||
| 1883 | public function dontSeeElement($selector, $attributes = null) { |
||
| 1884 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); |
||
| 1885 | } |
||
| 1886 | |||
| 1887 | |||
| 1888 | /** |
||
| 1889 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1890 | * |
||
| 1891 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 1892 | * |
||
| 1893 | * ``` php |
||
| 1894 | * <?php |
||
| 1895 | * $I->seeNumberOfElements('tr', 10); |
||
| 1896 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
| 1897 | * ?> |
||
| 1898 | * ``` |
||
| 1899 | * @param $selector |
||
| 1900 | * @param mixed $expected : |
||
| 1901 | * - string: strict number |
||
| 1902 | * - array: range of numbers [0,10] |
||
| 1903 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1904 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
| 1905 | */ |
||
| 1906 | public function canSeeNumberOfElements($selector, $expected) { |
||
| 1907 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); |
||
| 1908 | } |
||
| 1909 | /** |
||
| 1910 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1911 | * |
||
| 1912 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 1913 | * |
||
| 1914 | * ``` php |
||
| 1915 | * <?php |
||
| 1916 | * $I->seeNumberOfElements('tr', 10); |
||
| 1917 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
| 1918 | * ?> |
||
| 1919 | * ``` |
||
| 1920 | * @param $selector |
||
| 1921 | * @param mixed $expected : |
||
| 1922 | * - string: strict number |
||
| 1923 | * - array: range of numbers [0,10] |
||
| 1924 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
| 1925 | */ |
||
| 1926 | public function seeNumberOfElements($selector, $expected) { |
||
| 1927 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); |
||
| 1928 | } |
||
| 1929 | |||
| 1930 | |||
| 1931 | /** |
||
| 1932 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1933 | * |
||
| 1934 | * Checks that the given option is selected. |
||
| 1935 | * |
||
| 1936 | * ``` php |
||
| 1937 | * <?php |
||
| 1938 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1939 | * ?> |
||
| 1940 | * ``` |
||
| 1941 | * |
||
| 1942 | * @param $selector |
||
| 1943 | * @param $optionText |
||
| 1944 | * |
||
| 1945 | * @return mixed |
||
| 1946 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1947 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
| 1948 | */ |
||
| 1949 | public function canSeeOptionIsSelected($selector, $optionText) { |
||
| 1950 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); |
||
| 1951 | } |
||
| 1952 | /** |
||
| 1953 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1954 | * |
||
| 1955 | * Checks that the given option is selected. |
||
| 1956 | * |
||
| 1957 | * ``` php |
||
| 1958 | * <?php |
||
| 1959 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1960 | * ?> |
||
| 1961 | * ``` |
||
| 1962 | * |
||
| 1963 | * @param $selector |
||
| 1964 | * @param $optionText |
||
| 1965 | * |
||
| 1966 | * @return mixed |
||
| 1967 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
| 1968 | */ |
||
| 1969 | public function seeOptionIsSelected($selector, $optionText) { |
||
| 1970 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); |
||
| 1971 | } |
||
| 1972 | |||
| 1973 | |||
| 1974 | /** |
||
| 1975 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1976 | * |
||
| 1977 | * Checks that the given option is not selected. |
||
| 1978 | * |
||
| 1979 | * ``` php |
||
| 1980 | * <?php |
||
| 1981 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1982 | * ?> |
||
| 1983 | * ``` |
||
| 1984 | * |
||
| 1985 | * @param $selector |
||
| 1986 | * @param $optionText |
||
| 1987 | * |
||
| 1988 | * @return mixed |
||
| 1989 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1990 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
| 1991 | */ |
||
| 1992 | public function cantSeeOptionIsSelected($selector, $optionText) { |
||
| 1993 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); |
||
| 1994 | } |
||
| 1995 | /** |
||
| 1996 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1997 | * |
||
| 1998 | * Checks that the given option is not selected. |
||
| 1999 | * |
||
| 2000 | * ``` php |
||
| 2001 | * <?php |
||
| 2002 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 2003 | * ?> |
||
| 2004 | * ``` |
||
| 2005 | * |
||
| 2006 | * @param $selector |
||
| 2007 | * @param $optionText |
||
| 2008 | * |
||
| 2009 | * @return mixed |
||
| 2010 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
| 2011 | */ |
||
| 2012 | public function dontSeeOptionIsSelected($selector, $optionText) { |
||
| 2013 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); |
||
| 2014 | } |
||
| 2015 | |||
| 2016 | |||
| 2017 | /** |
||
| 2018 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2019 | * |
||
| 2020 | * Asserts that current page has 404 response status code. |
||
| 2021 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2022 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
| 2023 | */ |
||
| 2024 | public function canSeePageNotFound() { |
||
| 2025 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args())); |
||
| 2026 | } |
||
| 2027 | /** |
||
| 2028 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2029 | * |
||
| 2030 | * Asserts that current page has 404 response status code. |
||
| 2031 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
| 2032 | */ |
||
| 2033 | public function seePageNotFound() { |
||
| 2034 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args())); |
||
| 2035 | } |
||
| 2036 | |||
| 2037 | |||
| 2038 | /** |
||
| 2039 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2040 | * |
||
| 2041 | * Checks that response code is equal to value provided. |
||
| 2042 | * |
||
| 2043 | * @param $code |
||
| 2044 | * |
||
| 2045 | * @return mixed |
||
| 2046 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2047 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
| 2048 | */ |
||
| 2049 | public function canSeeResponseCodeIs($code) { |
||
| 2050 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args())); |
||
| 2051 | } |
||
| 2052 | /** |
||
| 2053 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2054 | * |
||
| 2055 | * Checks that response code is equal to value provided. |
||
| 2056 | * |
||
| 2057 | * @param $code |
||
| 2058 | * |
||
| 2059 | * @return mixed |
||
| 2060 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
| 2061 | */ |
||
| 2062 | public function seeResponseCodeIs($code) { |
||
| 2063 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args())); |
||
| 2064 | } |
||
| 2065 | |||
| 2066 | |||
| 2067 | /** |
||
| 2068 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2069 | * |
||
| 2070 | * Checks that the page title contains the given string. |
||
| 2071 | * |
||
| 2072 | * ``` php |
||
| 2073 | * <?php |
||
| 2074 | * $I->seeInTitle('Blog - Post #1'); |
||
| 2075 | * ?> |
||
| 2076 | * ``` |
||
| 2077 | * |
||
| 2078 | * @param $title |
||
| 2079 | * |
||
| 2080 | * @return mixed |
||
| 2081 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2082 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
| 2083 | */ |
||
| 2084 | public function canSeeInTitle($title) { |
||
| 2085 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); |
||
| 2086 | } |
||
| 2087 | /** |
||
| 2088 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2089 | * |
||
| 2090 | * Checks that the page title contains the given string. |
||
| 2091 | * |
||
| 2092 | * ``` php |
||
| 2093 | * <?php |
||
| 2094 | * $I->seeInTitle('Blog - Post #1'); |
||
| 2095 | * ?> |
||
| 2096 | * ``` |
||
| 2097 | * |
||
| 2098 | * @param $title |
||
| 2099 | * |
||
| 2100 | * @return mixed |
||
| 2101 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
| 2102 | */ |
||
| 2103 | public function seeInTitle($title) { |
||
| 2104 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); |
||
| 2105 | } |
||
| 2106 | |||
| 2107 | |||
| 2108 | /** |
||
| 2109 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2110 | * |
||
| 2111 | * Checks that the page title does not contain the given string. |
||
| 2112 | * |
||
| 2113 | * @param $title |
||
| 2114 | * |
||
| 2115 | * @return mixed |
||
| 2116 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2117 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
| 2118 | */ |
||
| 2119 | public function cantSeeInTitle($title) { |
||
| 2120 | return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); |
||
| 2121 | } |
||
| 2122 | /** |
||
| 2123 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2124 | * |
||
| 2125 | * Checks that the page title does not contain the given string. |
||
| 2126 | * |
||
| 2127 | * @param $title |
||
| 2128 | * |
||
| 2129 | * @return mixed |
||
| 2130 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
| 2131 | */ |
||
| 2132 | public function dontSeeInTitle($title) { |
||
| 2133 | return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); |
||
| 2134 | } |
||
| 2135 | |||
| 2136 | |||
| 2137 | /** |
||
| 2138 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2139 | * |
||
| 2140 | * Switch to iframe or frame on the page. |
||
| 2141 | * |
||
| 2142 | * Example: |
||
| 2143 | * ``` html |
||
| 2144 | * <iframe name="another_frame" src="http://example.com"> |
||
| 2145 | * ``` |
||
| 2146 | * |
||
| 2147 | * ``` php |
||
| 2148 | * <?php |
||
| 2149 | * # switch to iframe |
||
| 2150 | * $I->switchToIframe("another_frame"); |
||
| 2151 | * ``` |
||
| 2152 | * |
||
| 2153 | * @param string $name |
||
| 2154 | * @see \Codeception\Lib\InnerBrowser::switchToIframe() |
||
| 2155 | */ |
||
| 2156 | public function switchToIframe($name) { |
||
| 2157 | return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToIframe', func_get_args())); |
||
| 2158 | } |
||
| 2159 | |||
| 2160 | |||
| 2161 | /** |
||
| 2162 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2163 | * |
||
| 2164 | * Moves back in history. |
||
| 2165 | * |
||
| 2166 | * @param int $numberOfSteps (default value 1) |
||
| 2167 | * @see \Codeception\Lib\InnerBrowser::moveBack() |
||
| 2168 | */ |
||
| 2169 | public function moveBack($numberOfSteps = null) { |
||
| 2170 | return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args())); |
||
| 2171 | } |
||
| 2172 | } |
||
| 2173 |