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] c9db43c4264c3c0840a555055176acf4 |
||
| 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) { |
||
| 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) { |
||
| 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) { |
||
| 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) { |
||
| 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) { |
||
| 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) { |
||
| 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 | * |
||
| 169 | * @param $page |
||
| 170 | * @see \Codeception\Lib\InnerBrowser::amOnPage() |
||
| 171 | */ |
||
| 172 | public function amOnPage($page) { |
||
| 175 | |||
| 176 | |||
| 177 | /** |
||
| 178 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 179 | * |
||
| 180 | * Perform a click on a link or a button, given by a locator. |
||
| 181 | * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. |
||
| 182 | * For buttons, the "value" attribute, "name" attribute, and inner text are searched. |
||
| 183 | * For links, the link text is searched. |
||
| 184 | * For images, the "alt" attribute and inner text of any parent links are searched. |
||
| 185 | * |
||
| 186 | * The second parameter is a context (CSS or XPath locator) to narrow the search. |
||
| 187 | * |
||
| 188 | * Note that if the locator matches a button of type `submit`, the form will be submitted. |
||
| 189 | * |
||
| 190 | * ``` php |
||
| 191 | * <?php |
||
| 192 | * // simple link |
||
| 193 | * $I->click('Logout'); |
||
| 194 | * // button of form |
||
| 195 | * $I->click('Submit'); |
||
| 196 | * // CSS button |
||
| 197 | * $I->click('#form input[type=submit]'); |
||
| 198 | * // XPath |
||
| 199 | * $I->click('//form/*[@type=submit]'); |
||
| 200 | * // link in context |
||
| 201 | * $I->click('Logout', '#nav'); |
||
| 202 | * // using strict locator |
||
| 203 | * $I->click(['link' => 'Login']); |
||
| 204 | * ?> |
||
| 205 | * ``` |
||
| 206 | * |
||
| 207 | * @param $link |
||
| 208 | * @param $context |
||
| 209 | * @see \Codeception\Lib\InnerBrowser::click() |
||
| 210 | */ |
||
| 211 | public function click($link, $context = null) { |
||
| 214 | |||
| 215 | |||
| 216 | /** |
||
| 217 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 218 | * |
||
| 219 | * Checks that the current page contains the given string. |
||
| 220 | * Specify a locator as the second parameter to match a specific region. |
||
| 221 | * |
||
| 222 | * ``` php |
||
| 223 | * <?php |
||
| 224 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 225 | * $I->see('Sign Up','h1'); // I can suppose it's a signup page |
||
| 226 | * $I->see('Sign Up','//body/h1'); // with XPath |
||
| 227 | * ?> |
||
| 228 | * ``` |
||
| 229 | * |
||
| 230 | * @param $text |
||
| 231 | * @param null $selector |
||
| 232 | * Conditional Assertion: Test won't be stopped on fail |
||
| 233 | * @see \Codeception\Lib\InnerBrowser::see() |
||
| 234 | */ |
||
| 235 | public function canSee($text, $selector = null) { |
||
| 238 | /** |
||
| 239 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 240 | * |
||
| 241 | * Checks that the current page contains the given string. |
||
| 242 | * Specify a locator as the second parameter to match a specific region. |
||
| 243 | * |
||
| 244 | * ``` php |
||
| 245 | * <?php |
||
| 246 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 247 | * $I->see('Sign Up','h1'); // I can suppose it's a signup page |
||
| 248 | * $I->see('Sign Up','//body/h1'); // with XPath |
||
| 249 | * ?> |
||
| 250 | * ``` |
||
| 251 | * |
||
| 252 | * @param $text |
||
| 253 | * @param null $selector |
||
| 254 | * @see \Codeception\Lib\InnerBrowser::see() |
||
| 255 | */ |
||
| 256 | public function see($text, $selector = null) { |
||
| 259 | |||
| 260 | |||
| 261 | /** |
||
| 262 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 263 | * |
||
| 264 | * Checks that the current page doesn't contain the text specified. |
||
| 265 | * Give a locator as the second parameter to match a specific region. |
||
| 266 | * |
||
| 267 | * ```php |
||
| 268 | * <?php |
||
| 269 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 270 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 271 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 272 | * ?> |
||
| 273 | * ``` |
||
| 274 | * |
||
| 275 | * @param $text |
||
| 276 | * @param null $selector |
||
| 277 | * Conditional Assertion: Test won't be stopped on fail |
||
| 278 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
| 279 | */ |
||
| 280 | public function cantSee($text, $selector = null) { |
||
| 283 | /** |
||
| 284 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 285 | * |
||
| 286 | * Checks that the current page doesn't contain the text specified. |
||
| 287 | * Give a locator as the second parameter to match a specific region. |
||
| 288 | * |
||
| 289 | * ```php |
||
| 290 | * <?php |
||
| 291 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 292 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 293 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 294 | * ?> |
||
| 295 | * ``` |
||
| 296 | * |
||
| 297 | * @param $text |
||
| 298 | * @param null $selector |
||
| 299 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
| 300 | */ |
||
| 301 | public function dontSee($text, $selector = null) { |
||
| 304 | |||
| 305 | |||
| 306 | /** |
||
| 307 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 308 | * |
||
| 309 | * Checks that there's a link with the specified text. |
||
| 310 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 311 | * |
||
| 312 | * ``` php |
||
| 313 | * <?php |
||
| 314 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 315 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 316 | * ?> |
||
| 317 | * ``` |
||
| 318 | * |
||
| 319 | * @param $text |
||
| 320 | * @param null $url |
||
| 321 | * Conditional Assertion: Test won't be stopped on fail |
||
| 322 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
| 323 | */ |
||
| 324 | public function canSeeLink($text, $url = null) { |
||
| 327 | /** |
||
| 328 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 329 | * |
||
| 330 | * Checks that there's a link with the specified text. |
||
| 331 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 332 | * |
||
| 333 | * ``` php |
||
| 334 | * <?php |
||
| 335 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 336 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 337 | * ?> |
||
| 338 | * ``` |
||
| 339 | * |
||
| 340 | * @param $text |
||
| 341 | * @param null $url |
||
| 342 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
| 343 | */ |
||
| 344 | public function seeLink($text, $url = null) { |
||
| 347 | |||
| 348 | |||
| 349 | /** |
||
| 350 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 351 | * |
||
| 352 | * Checks that the page doesn't contain a link with the given string. |
||
| 353 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 354 | * |
||
| 355 | * ``` php |
||
| 356 | * <?php |
||
| 357 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 358 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 359 | * ?> |
||
| 360 | * ``` |
||
| 361 | * |
||
| 362 | * @param $text |
||
| 363 | * @param null $url |
||
| 364 | * Conditional Assertion: Test won't be stopped on fail |
||
| 365 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
| 366 | */ |
||
| 367 | public function cantSeeLink($text, $url = null) { |
||
| 370 | /** |
||
| 371 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 372 | * |
||
| 373 | * Checks that the page doesn't contain a link with the given string. |
||
| 374 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 375 | * |
||
| 376 | * ``` php |
||
| 377 | * <?php |
||
| 378 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 379 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 380 | * ?> |
||
| 381 | * ``` |
||
| 382 | * |
||
| 383 | * @param $text |
||
| 384 | * @param null $url |
||
| 385 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
| 386 | */ |
||
| 387 | public function dontSeeLink($text, $url = null) { |
||
| 390 | |||
| 391 | |||
| 392 | /** |
||
| 393 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 394 | * |
||
| 395 | * Checks that current URI contains the given string. |
||
| 396 | * |
||
| 397 | * ``` php |
||
| 398 | * <?php |
||
| 399 | * // to match: /home/dashboard |
||
| 400 | * $I->seeInCurrentUrl('home'); |
||
| 401 | * // to match: /users/1 |
||
| 402 | * $I->seeInCurrentUrl('/users/'); |
||
| 403 | * ?> |
||
| 404 | * ``` |
||
| 405 | * |
||
| 406 | * @param $uri |
||
| 407 | * Conditional Assertion: Test won't be stopped on fail |
||
| 408 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
| 409 | */ |
||
| 410 | public function canSeeInCurrentUrl($uri) { |
||
| 413 | /** |
||
| 414 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 415 | * |
||
| 416 | * Checks that current URI contains the given string. |
||
| 417 | * |
||
| 418 | * ``` php |
||
| 419 | * <?php |
||
| 420 | * // to match: /home/dashboard |
||
| 421 | * $I->seeInCurrentUrl('home'); |
||
| 422 | * // to match: /users/1 |
||
| 423 | * $I->seeInCurrentUrl('/users/'); |
||
| 424 | * ?> |
||
| 425 | * ``` |
||
| 426 | * |
||
| 427 | * @param $uri |
||
| 428 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
| 429 | */ |
||
| 430 | public function seeInCurrentUrl($uri) { |
||
| 433 | |||
| 434 | |||
| 435 | /** |
||
| 436 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 437 | * |
||
| 438 | * Checks that the current URI doesn't contain the given string. |
||
| 439 | * |
||
| 440 | * ``` php |
||
| 441 | * <?php |
||
| 442 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 443 | * ?> |
||
| 444 | * ``` |
||
| 445 | * |
||
| 446 | * @param $uri |
||
| 447 | * Conditional Assertion: Test won't be stopped on fail |
||
| 448 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
| 449 | */ |
||
| 450 | public function cantSeeInCurrentUrl($uri) { |
||
| 453 | /** |
||
| 454 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 455 | * |
||
| 456 | * Checks that the current URI doesn't contain the given string. |
||
| 457 | * |
||
| 458 | * ``` php |
||
| 459 | * <?php |
||
| 460 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 461 | * ?> |
||
| 462 | * ``` |
||
| 463 | * |
||
| 464 | * @param $uri |
||
| 465 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
| 466 | */ |
||
| 467 | public function dontSeeInCurrentUrl($uri) { |
||
| 470 | |||
| 471 | |||
| 472 | /** |
||
| 473 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 474 | * |
||
| 475 | * Checks that the current URL is equal to the given string. |
||
| 476 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 477 | * |
||
| 478 | * ``` php |
||
| 479 | * <?php |
||
| 480 | * // to match root url |
||
| 481 | * $I->seeCurrentUrlEquals('/'); |
||
| 482 | * ?> |
||
| 483 | * ``` |
||
| 484 | * |
||
| 485 | * @param $uri |
||
| 486 | * Conditional Assertion: Test won't be stopped on fail |
||
| 487 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
| 488 | */ |
||
| 489 | public function canSeeCurrentUrlEquals($uri) { |
||
| 492 | /** |
||
| 493 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 494 | * |
||
| 495 | * Checks that the current URL is equal to the given string. |
||
| 496 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 497 | * |
||
| 498 | * ``` php |
||
| 499 | * <?php |
||
| 500 | * // to match root url |
||
| 501 | * $I->seeCurrentUrlEquals('/'); |
||
| 502 | * ?> |
||
| 503 | * ``` |
||
| 504 | * |
||
| 505 | * @param $uri |
||
| 506 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
| 507 | */ |
||
| 508 | public function seeCurrentUrlEquals($uri) { |
||
| 511 | |||
| 512 | |||
| 513 | /** |
||
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 515 | * |
||
| 516 | * Checks that the current URL doesn't equal the given string. |
||
| 517 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 518 | * |
||
| 519 | * ``` php |
||
| 520 | * <?php |
||
| 521 | * // current url is not root |
||
| 522 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 523 | * ?> |
||
| 524 | * ``` |
||
| 525 | * |
||
| 526 | * @param $uri |
||
| 527 | * Conditional Assertion: Test won't be stopped on fail |
||
| 528 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
| 529 | */ |
||
| 530 | public function cantSeeCurrentUrlEquals($uri) { |
||
| 533 | /** |
||
| 534 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 535 | * |
||
| 536 | * Checks that the current URL doesn't equal the given string. |
||
| 537 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 538 | * |
||
| 539 | * ``` php |
||
| 540 | * <?php |
||
| 541 | * // current url is not root |
||
| 542 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 543 | * ?> |
||
| 544 | * ``` |
||
| 545 | * |
||
| 546 | * @param $uri |
||
| 547 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
| 548 | */ |
||
| 549 | public function dontSeeCurrentUrlEquals($uri) { |
||
| 552 | |||
| 553 | |||
| 554 | /** |
||
| 555 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 556 | * |
||
| 557 | * Checks that the current URL matches the given regular expression. |
||
| 558 | * |
||
| 559 | * ``` php |
||
| 560 | * <?php |
||
| 561 | * // to match root url |
||
| 562 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 563 | * ?> |
||
| 564 | * ``` |
||
| 565 | * |
||
| 566 | * @param $uri |
||
| 567 | * Conditional Assertion: Test won't be stopped on fail |
||
| 568 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
| 569 | */ |
||
| 570 | public function canSeeCurrentUrlMatches($uri) { |
||
| 573 | /** |
||
| 574 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 575 | * |
||
| 576 | * Checks that the current URL matches the given regular expression. |
||
| 577 | * |
||
| 578 | * ``` php |
||
| 579 | * <?php |
||
| 580 | * // to match root url |
||
| 581 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 582 | * ?> |
||
| 583 | * ``` |
||
| 584 | * |
||
| 585 | * @param $uri |
||
| 586 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
| 587 | */ |
||
| 588 | public function seeCurrentUrlMatches($uri) { |
||
| 591 | |||
| 592 | |||
| 593 | /** |
||
| 594 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 595 | * |
||
| 596 | * Checks that current url doesn't match the given regular expression. |
||
| 597 | * |
||
| 598 | * ``` php |
||
| 599 | * <?php |
||
| 600 | * // to match root url |
||
| 601 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 602 | * ?> |
||
| 603 | * ``` |
||
| 604 | * |
||
| 605 | * @param $uri |
||
| 606 | * Conditional Assertion: Test won't be stopped on fail |
||
| 607 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
| 608 | */ |
||
| 609 | public function cantSeeCurrentUrlMatches($uri) { |
||
| 612 | /** |
||
| 613 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 614 | * |
||
| 615 | * Checks that current url doesn't match the given regular expression. |
||
| 616 | * |
||
| 617 | * ``` php |
||
| 618 | * <?php |
||
| 619 | * // to match root url |
||
| 620 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 621 | * ?> |
||
| 622 | * ``` |
||
| 623 | * |
||
| 624 | * @param $uri |
||
| 625 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
| 626 | */ |
||
| 627 | public function dontSeeCurrentUrlMatches($uri) { |
||
| 630 | |||
| 631 | |||
| 632 | /** |
||
| 633 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 634 | * |
||
| 635 | * Executes the given regular expression against the current URI and returns the first match. |
||
| 636 | * If no parameters are provided, the full URI is returned. |
||
| 637 | * |
||
| 638 | * ``` php |
||
| 639 | * <?php |
||
| 640 | * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); |
||
| 641 | * $uri = $I->grabFromCurrentUrl(); |
||
| 642 | * ?> |
||
| 643 | * ``` |
||
| 644 | * |
||
| 645 | * @param null $uri |
||
| 646 | * |
||
| 647 | * @internal param $url |
||
| 648 | * @return mixed |
||
| 649 | * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() |
||
| 650 | */ |
||
| 651 | public function grabFromCurrentUrl($uri = null) { |
||
| 654 | |||
| 655 | |||
| 656 | /** |
||
| 657 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 658 | * |
||
| 659 | * Checks that the specified checkbox is checked. |
||
| 660 | * |
||
| 661 | * ``` php |
||
| 662 | * <?php |
||
| 663 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 664 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 665 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 666 | * ?> |
||
| 667 | * ``` |
||
| 668 | * |
||
| 669 | * @param $checkbox |
||
| 670 | * Conditional Assertion: Test won't be stopped on fail |
||
| 671 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
| 672 | */ |
||
| 673 | public function canSeeCheckboxIsChecked($checkbox) { |
||
| 676 | /** |
||
| 677 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 678 | * |
||
| 679 | * Checks that the specified checkbox is checked. |
||
| 680 | * |
||
| 681 | * ``` php |
||
| 682 | * <?php |
||
| 683 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 684 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 685 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 686 | * ?> |
||
| 687 | * ``` |
||
| 688 | * |
||
| 689 | * @param $checkbox |
||
| 690 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
| 691 | */ |
||
| 692 | public function seeCheckboxIsChecked($checkbox) { |
||
| 695 | |||
| 696 | |||
| 697 | /** |
||
| 698 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 699 | * |
||
| 700 | * Check that the specified checkbox is unchecked. |
||
| 701 | * |
||
| 702 | * ``` php |
||
| 703 | * <?php |
||
| 704 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 705 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 706 | * ?> |
||
| 707 | * ``` |
||
| 708 | * |
||
| 709 | * @param $checkbox |
||
| 710 | * Conditional Assertion: Test won't be stopped on fail |
||
| 711 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
| 712 | */ |
||
| 713 | public function cantSeeCheckboxIsChecked($checkbox) { |
||
| 716 | /** |
||
| 717 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 718 | * |
||
| 719 | * Check that the specified checkbox is unchecked. |
||
| 720 | * |
||
| 721 | * ``` php |
||
| 722 | * <?php |
||
| 723 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 724 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 725 | * ?> |
||
| 726 | * ``` |
||
| 727 | * |
||
| 728 | * @param $checkbox |
||
| 729 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
| 730 | */ |
||
| 731 | public function dontSeeCheckboxIsChecked($checkbox) { |
||
| 734 | |||
| 735 | |||
| 736 | /** |
||
| 737 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 738 | * |
||
| 739 | * Checks that the given input field or textarea contains the given value. |
||
| 740 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
| 741 | * |
||
| 742 | * ``` php |
||
| 743 | * <?php |
||
| 744 | * $I->seeInField('Body','Type your comment here'); |
||
| 745 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 746 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 747 | * $I->seeInField('#searchform input','Search'); |
||
| 748 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 749 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 750 | * ?> |
||
| 751 | * ``` |
||
| 752 | * |
||
| 753 | * @param $field |
||
| 754 | * @param $value |
||
| 755 | * Conditional Assertion: Test won't be stopped on fail |
||
| 756 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
| 757 | */ |
||
| 758 | public function canSeeInField($field, $value) { |
||
| 761 | /** |
||
| 762 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 763 | * |
||
| 764 | * Checks that the given input field or textarea contains the given value. |
||
| 765 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
| 766 | * |
||
| 767 | * ``` php |
||
| 768 | * <?php |
||
| 769 | * $I->seeInField('Body','Type your comment here'); |
||
| 770 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 771 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 772 | * $I->seeInField('#searchform input','Search'); |
||
| 773 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 774 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 775 | * ?> |
||
| 776 | * ``` |
||
| 777 | * |
||
| 778 | * @param $field |
||
| 779 | * @param $value |
||
| 780 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
| 781 | */ |
||
| 782 | public function seeInField($field, $value) { |
||
| 785 | |||
| 786 | |||
| 787 | /** |
||
| 788 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 789 | * |
||
| 790 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 791 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 792 | * |
||
| 793 | * ``` php |
||
| 794 | * <?php |
||
| 795 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 796 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 797 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 798 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 799 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 800 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 801 | * ?> |
||
| 802 | * ``` |
||
| 803 | * |
||
| 804 | * @param $field |
||
| 805 | * @param $value |
||
| 806 | * Conditional Assertion: Test won't be stopped on fail |
||
| 807 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
| 808 | */ |
||
| 809 | public function cantSeeInField($field, $value) { |
||
| 812 | /** |
||
| 813 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 814 | * |
||
| 815 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 816 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 817 | * |
||
| 818 | * ``` php |
||
| 819 | * <?php |
||
| 820 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 821 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 822 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 823 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 824 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 825 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 826 | * ?> |
||
| 827 | * ``` |
||
| 828 | * |
||
| 829 | * @param $field |
||
| 830 | * @param $value |
||
| 831 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
| 832 | */ |
||
| 833 | public function dontSeeInField($field, $value) { |
||
| 836 | |||
| 837 | |||
| 838 | /** |
||
| 839 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 840 | * |
||
| 841 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 842 | * passed selector. |
||
| 843 | * |
||
| 844 | * ``` php |
||
| 845 | * <?php |
||
| 846 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 847 | * 'input1' => 'value', |
||
| 848 | * 'input2' => 'other value', |
||
| 849 | * ]); |
||
| 850 | * ?> |
||
| 851 | * ``` |
||
| 852 | * |
||
| 853 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 854 | * array may be passed: |
||
| 855 | * |
||
| 856 | * ``` php |
||
| 857 | * <?php |
||
| 858 | * $I->seeInFormFields('.form-class', [ |
||
| 859 | * 'multiselect' => [ |
||
| 860 | * 'value1', |
||
| 861 | * 'value2', |
||
| 862 | * ], |
||
| 863 | * 'checkbox[]' => [ |
||
| 864 | * 'a checked value', |
||
| 865 | * 'another checked value', |
||
| 866 | * ], |
||
| 867 | * ]); |
||
| 868 | * ?> |
||
| 869 | * ``` |
||
| 870 | * |
||
| 871 | * Additionally, checkbox values can be checked with a boolean. |
||
| 872 | * |
||
| 873 | * ``` php |
||
| 874 | * <?php |
||
| 875 | * $I->seeInFormFields('#form-id', [ |
||
| 876 | * 'checkbox1' => true, // passes if checked |
||
| 877 | * 'checkbox2' => false, // passes if unchecked |
||
| 878 | * ]); |
||
| 879 | * ?> |
||
| 880 | * ``` |
||
| 881 | * |
||
| 882 | * Pair this with submitForm for quick testing magic. |
||
| 883 | * |
||
| 884 | * ``` php |
||
| 885 | * <?php |
||
| 886 | * $form = [ |
||
| 887 | * 'field1' => 'value', |
||
| 888 | * 'field2' => 'another value', |
||
| 889 | * 'checkbox1' => true, |
||
| 890 | * // ... |
||
| 891 | * ]; |
||
| 892 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 893 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 894 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 895 | * ?> |
||
| 896 | * ``` |
||
| 897 | * |
||
| 898 | * @param $formSelector |
||
| 899 | * @param $params |
||
| 900 | * Conditional Assertion: Test won't be stopped on fail |
||
| 901 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
| 902 | */ |
||
| 903 | public function canSeeInFormFields($formSelector, $params) { |
||
| 906 | /** |
||
| 907 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 908 | * |
||
| 909 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 910 | * passed selector. |
||
| 911 | * |
||
| 912 | * ``` php |
||
| 913 | * <?php |
||
| 914 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 915 | * 'input1' => 'value', |
||
| 916 | * 'input2' => 'other value', |
||
| 917 | * ]); |
||
| 918 | * ?> |
||
| 919 | * ``` |
||
| 920 | * |
||
| 921 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 922 | * array may be passed: |
||
| 923 | * |
||
| 924 | * ``` php |
||
| 925 | * <?php |
||
| 926 | * $I->seeInFormFields('.form-class', [ |
||
| 927 | * 'multiselect' => [ |
||
| 928 | * 'value1', |
||
| 929 | * 'value2', |
||
| 930 | * ], |
||
| 931 | * 'checkbox[]' => [ |
||
| 932 | * 'a checked value', |
||
| 933 | * 'another checked value', |
||
| 934 | * ], |
||
| 935 | * ]); |
||
| 936 | * ?> |
||
| 937 | * ``` |
||
| 938 | * |
||
| 939 | * Additionally, checkbox values can be checked with a boolean. |
||
| 940 | * |
||
| 941 | * ``` php |
||
| 942 | * <?php |
||
| 943 | * $I->seeInFormFields('#form-id', [ |
||
| 944 | * 'checkbox1' => true, // passes if checked |
||
| 945 | * 'checkbox2' => false, // passes if unchecked |
||
| 946 | * ]); |
||
| 947 | * ?> |
||
| 948 | * ``` |
||
| 949 | * |
||
| 950 | * Pair this with submitForm for quick testing magic. |
||
| 951 | * |
||
| 952 | * ``` php |
||
| 953 | * <?php |
||
| 954 | * $form = [ |
||
| 955 | * 'field1' => 'value', |
||
| 956 | * 'field2' => 'another value', |
||
| 957 | * 'checkbox1' => true, |
||
| 958 | * // ... |
||
| 959 | * ]; |
||
| 960 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 961 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 962 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 963 | * ?> |
||
| 964 | * ``` |
||
| 965 | * |
||
| 966 | * @param $formSelector |
||
| 967 | * @param $params |
||
| 968 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
| 969 | */ |
||
| 970 | public function seeInFormFields($formSelector, $params) { |
||
| 973 | |||
| 974 | |||
| 975 | /** |
||
| 976 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 977 | * |
||
| 978 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 979 | * the passed selector. |
||
| 980 | * |
||
| 981 | * ``` php |
||
| 982 | * <?php |
||
| 983 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 984 | * 'input1' => 'non-existent value', |
||
| 985 | * 'input2' => 'other non-existent value', |
||
| 986 | * ]); |
||
| 987 | * ?> |
||
| 988 | * ``` |
||
| 989 | * |
||
| 990 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 991 | * as the value: |
||
| 992 | * |
||
| 993 | * ``` php |
||
| 994 | * <?php |
||
| 995 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 996 | * 'fieldName' => [ |
||
| 997 | * 'This value shouldn\'t be set', |
||
| 998 | * 'And this value shouldn\'t be set', |
||
| 999 | * ], |
||
| 1000 | * ]); |
||
| 1001 | * ?> |
||
| 1002 | * ``` |
||
| 1003 | * |
||
| 1004 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1005 | * |
||
| 1006 | * ``` php |
||
| 1007 | * <?php |
||
| 1008 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1009 | * 'checkbox1' => true, // fails if checked |
||
| 1010 | * 'checkbox2' => false, // fails if unchecked |
||
| 1011 | * ]); |
||
| 1012 | * ?> |
||
| 1013 | * ``` |
||
| 1014 | * |
||
| 1015 | * @param $formSelector |
||
| 1016 | * @param $params |
||
| 1017 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1018 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
| 1019 | */ |
||
| 1020 | public function cantSeeInFormFields($formSelector, $params) { |
||
| 1023 | /** |
||
| 1024 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1025 | * |
||
| 1026 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1027 | * the passed selector. |
||
| 1028 | * |
||
| 1029 | * ``` php |
||
| 1030 | * <?php |
||
| 1031 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1032 | * 'input1' => 'non-existent value', |
||
| 1033 | * 'input2' => 'other non-existent value', |
||
| 1034 | * ]); |
||
| 1035 | * ?> |
||
| 1036 | * ``` |
||
| 1037 | * |
||
| 1038 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1039 | * as the value: |
||
| 1040 | * |
||
| 1041 | * ``` php |
||
| 1042 | * <?php |
||
| 1043 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1044 | * 'fieldName' => [ |
||
| 1045 | * 'This value shouldn\'t be set', |
||
| 1046 | * 'And this value shouldn\'t be set', |
||
| 1047 | * ], |
||
| 1048 | * ]); |
||
| 1049 | * ?> |
||
| 1050 | * ``` |
||
| 1051 | * |
||
| 1052 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1053 | * |
||
| 1054 | * ``` php |
||
| 1055 | * <?php |
||
| 1056 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1057 | * 'checkbox1' => true, // fails if checked |
||
| 1058 | * 'checkbox2' => false, // fails if unchecked |
||
| 1059 | * ]); |
||
| 1060 | * ?> |
||
| 1061 | * ``` |
||
| 1062 | * |
||
| 1063 | * @param $formSelector |
||
| 1064 | * @param $params |
||
| 1065 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
| 1066 | */ |
||
| 1067 | public function dontSeeInFormFields($formSelector, $params) { |
||
| 1070 | |||
| 1071 | |||
| 1072 | /** |
||
| 1073 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1074 | * |
||
| 1075 | * Submits the given form on the page, optionally with the given form |
||
| 1076 | * values. Give the form fields values as an array. |
||
| 1077 | * |
||
| 1078 | * Skipped fields will be filled by their values from the page. |
||
| 1079 | * You don't need to click the 'Submit' button afterwards. |
||
| 1080 | * This command itself triggers the request to form's action. |
||
| 1081 | * |
||
| 1082 | * You can optionally specify what button's value to include |
||
| 1083 | * in the request with the last parameter as an alternative to |
||
| 1084 | * explicitly setting its value in the second parameter, as |
||
| 1085 | * button values are not otherwise included in the request. |
||
| 1086 | * |
||
| 1087 | * Examples: |
||
| 1088 | * |
||
| 1089 | * ``` php |
||
| 1090 | * <?php |
||
| 1091 | * $I->submitForm('#login', [ |
||
| 1092 | * 'login' => 'davert', |
||
| 1093 | * 'password' => '123456' |
||
| 1094 | * ]); |
||
| 1095 | * // or |
||
| 1096 | * $I->submitForm('#login', [ |
||
| 1097 | * 'login' => 'davert', |
||
| 1098 | * 'password' => '123456' |
||
| 1099 | * ], 'submitButtonName'); |
||
| 1100 | * |
||
| 1101 | * ``` |
||
| 1102 | * |
||
| 1103 | * For example, given this sample "Sign Up" form: |
||
| 1104 | * |
||
| 1105 | * ``` html |
||
| 1106 | * <form action="/sign_up"> |
||
| 1107 | * Login: |
||
| 1108 | * <input type="text" name="user[login]" /><br/> |
||
| 1109 | * Password: |
||
| 1110 | * <input type="password" name="user[password]" /><br/> |
||
| 1111 | * Do you agree to our terms? |
||
| 1112 | * <input type="checkbox" name="user[agree]" /><br/> |
||
| 1113 | * Select pricing plan: |
||
| 1114 | * <select name="plan"> |
||
| 1115 | * <option value="1">Free</option> |
||
| 1116 | * <option value="2" selected="selected">Paid</option> |
||
| 1117 | * </select> |
||
| 1118 | * <input type="submit" name="submitButton" value="Submit" /> |
||
| 1119 | * </form> |
||
| 1120 | * ``` |
||
| 1121 | * |
||
| 1122 | * You could write the following to submit it: |
||
| 1123 | * |
||
| 1124 | * ``` php |
||
| 1125 | * <?php |
||
| 1126 | * $I->submitForm( |
||
| 1127 | * '#userForm', |
||
| 1128 | * [ |
||
| 1129 | * 'user' => [ |
||
| 1130 | * 'login' => 'Davert', |
||
| 1131 | * 'password' => '123456', |
||
| 1132 | * 'agree' => true |
||
| 1133 | * ] |
||
| 1134 | * ], |
||
| 1135 | * 'submitButton' |
||
| 1136 | * ); |
||
| 1137 | * ``` |
||
| 1138 | * Note that "2" will be the submitted value for the "plan" field, as it is |
||
| 1139 | * the selected option. |
||
| 1140 | * |
||
| 1141 | * You can also emulate a JavaScript submission by not specifying any |
||
| 1142 | * buttons in the third parameter to submitForm. |
||
| 1143 | * |
||
| 1144 | * ```php |
||
| 1145 | * <?php |
||
| 1146 | * $I->submitForm( |
||
| 1147 | * '#userForm', |
||
| 1148 | * [ |
||
| 1149 | * 'user' => [ |
||
| 1150 | * 'login' => 'Davert', |
||
| 1151 | * 'password' => '123456', |
||
| 1152 | * 'agree' => true |
||
| 1153 | * ] |
||
| 1154 | * ] |
||
| 1155 | * ); |
||
| 1156 | * ``` |
||
| 1157 | * |
||
| 1158 | * Pair this with seeInFormFields for quick testing magic. |
||
| 1159 | * |
||
| 1160 | * ``` php |
||
| 1161 | * <?php |
||
| 1162 | * $form = [ |
||
| 1163 | * 'field1' => 'value', |
||
| 1164 | * 'field2' => 'another value', |
||
| 1165 | * 'checkbox1' => true, |
||
| 1166 | * // ... |
||
| 1167 | * ]; |
||
| 1168 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1169 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1170 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1171 | * ?> |
||
| 1172 | * ``` |
||
| 1173 | * |
||
| 1174 | * Parameter values can be set to arrays for multiple input fields |
||
| 1175 | * of the same name, or multi-select combo boxes. For checkboxes, |
||
| 1176 | * either the string value can be used, or boolean values which will |
||
| 1177 | * be replaced by the checkbox's value in the DOM. |
||
| 1178 | * |
||
| 1179 | * ``` php |
||
| 1180 | * <?php |
||
| 1181 | * $I->submitForm('#my-form', [ |
||
| 1182 | * 'field1' => 'value', |
||
| 1183 | * 'checkbox' => [ |
||
| 1184 | * 'value of first checkbox', |
||
| 1185 | * 'value of second checkbox, |
||
| 1186 | * ], |
||
| 1187 | * 'otherCheckboxes' => [ |
||
| 1188 | * true, |
||
| 1189 | * false, |
||
| 1190 | * false |
||
| 1191 | * ], |
||
| 1192 | * 'multiselect' => [ |
||
| 1193 | * 'first option value', |
||
| 1194 | * 'second option value' |
||
| 1195 | * ] |
||
| 1196 | * ]); |
||
| 1197 | * ?> |
||
| 1198 | * ``` |
||
| 1199 | * |
||
| 1200 | * Mixing string and boolean values for a checkbox's value is not supported |
||
| 1201 | * and may produce unexpected results. |
||
| 1202 | * |
||
| 1203 | * Field names ending in "[]" must be passed without the trailing square |
||
| 1204 | * bracket characters, and must contain an array for its value. This allows |
||
| 1205 | * submitting multiple values with the same name, consider: |
||
| 1206 | * |
||
| 1207 | * ```php |
||
| 1208 | * $I->submitForm('#my-form', [ |
||
| 1209 | * 'field[]' => 'value', |
||
| 1210 | * 'field[]' => 'another value', // 'field[]' is already a defined key |
||
| 1211 | * ]); |
||
| 1212 | * ``` |
||
| 1213 | * |
||
| 1214 | * The solution is to pass an array value: |
||
| 1215 | * |
||
| 1216 | * ```php |
||
| 1217 | * // this way both values are submitted |
||
| 1218 | * $I->submitForm('#my-form', [ |
||
| 1219 | * 'field' => [ |
||
| 1220 | * 'value', |
||
| 1221 | * 'another value', |
||
| 1222 | * ] |
||
| 1223 | * ]); |
||
| 1224 | * ``` |
||
| 1225 | * |
||
| 1226 | * @param $selector |
||
| 1227 | * @param $params |
||
| 1228 | * @param $button |
||
| 1229 | * @see \Codeception\Lib\InnerBrowser::submitForm() |
||
| 1230 | */ |
||
| 1231 | public function submitForm($selector, $params, $button = null) { |
||
| 1234 | |||
| 1235 | |||
| 1236 | /** |
||
| 1237 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1238 | * |
||
| 1239 | * Fills a text field or textarea with the given string. |
||
| 1240 | * |
||
| 1241 | * ``` php |
||
| 1242 | * <?php |
||
| 1243 | * $I->fillField("//input[@type='text']", "Hello World!"); |
||
| 1244 | * $I->fillField(['name' => 'email'], '[email protected]'); |
||
| 1245 | * ?> |
||
| 1246 | * ``` |
||
| 1247 | * |
||
| 1248 | * @param $field |
||
| 1249 | * @param $value |
||
| 1250 | * @see \Codeception\Lib\InnerBrowser::fillField() |
||
| 1251 | */ |
||
| 1252 | public function fillField($field, $value) { |
||
| 1255 | |||
| 1256 | |||
| 1257 | /** |
||
| 1258 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1259 | * |
||
| 1260 | * Selects an option in a select tag or in radio button group. |
||
| 1261 | * |
||
| 1262 | * ``` php |
||
| 1263 | * <?php |
||
| 1264 | * $I->selectOption('form select[name=account]', 'Premium'); |
||
| 1265 | * $I->selectOption('form input[name=payment]', 'Monthly'); |
||
| 1266 | * $I->selectOption('//form/select[@name=account]', 'Monthly'); |
||
| 1267 | * ?> |
||
| 1268 | * ``` |
||
| 1269 | * |
||
| 1270 | * Provide an array for the second argument to select multiple options: |
||
| 1271 | * |
||
| 1272 | * ``` php |
||
| 1273 | * <?php |
||
| 1274 | * $I->selectOption('Which OS do you use?', array('Windows','Linux')); |
||
| 1275 | * ?> |
||
| 1276 | * ``` |
||
| 1277 | * |
||
| 1278 | * @param $select |
||
| 1279 | * @param $option |
||
| 1280 | * @see \Codeception\Lib\InnerBrowser::selectOption() |
||
| 1281 | */ |
||
| 1282 | public function selectOption($select, $option) { |
||
| 1285 | |||
| 1286 | |||
| 1287 | /** |
||
| 1288 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1289 | * |
||
| 1290 | * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. |
||
| 1291 | * |
||
| 1292 | * ``` php |
||
| 1293 | * <?php |
||
| 1294 | * $I->checkOption('#agree'); |
||
| 1295 | * ?> |
||
| 1296 | * ``` |
||
| 1297 | * |
||
| 1298 | * @param $option |
||
| 1299 | * @see \Codeception\Lib\InnerBrowser::checkOption() |
||
| 1300 | */ |
||
| 1301 | public function checkOption($option) { |
||
| 1304 | |||
| 1305 | |||
| 1306 | /** |
||
| 1307 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1308 | * |
||
| 1309 | * Unticks a checkbox. |
||
| 1310 | * |
||
| 1311 | * ``` php |
||
| 1312 | * <?php |
||
| 1313 | * $I->uncheckOption('#notify'); |
||
| 1314 | * ?> |
||
| 1315 | * ``` |
||
| 1316 | * |
||
| 1317 | * @param $option |
||
| 1318 | * @see \Codeception\Lib\InnerBrowser::uncheckOption() |
||
| 1319 | */ |
||
| 1320 | public function uncheckOption($option) { |
||
| 1323 | |||
| 1324 | |||
| 1325 | /** |
||
| 1326 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1327 | * |
||
| 1328 | * Attaches a file relative to the Codeception data directory to the given file upload field. |
||
| 1329 | * |
||
| 1330 | * ``` php |
||
| 1331 | * <?php |
||
| 1332 | * // file is stored in 'tests/_data/prices.xls' |
||
| 1333 | * $I->attachFile('input[@type="file"]', 'prices.xls'); |
||
| 1334 | * ?> |
||
| 1335 | * ``` |
||
| 1336 | * |
||
| 1337 | * @param $field |
||
| 1338 | * @param $filename |
||
| 1339 | * @see \Codeception\Lib\InnerBrowser::attachFile() |
||
| 1340 | */ |
||
| 1341 | public function attachFile($field, $filename) { |
||
| 1344 | |||
| 1345 | |||
| 1346 | /** |
||
| 1347 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1348 | * |
||
| 1349 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1350 | * This action sends a GET ajax request with specified params. |
||
| 1351 | * |
||
| 1352 | * See ->sendAjaxPostRequest for examples. |
||
| 1353 | * |
||
| 1354 | * @param $uri |
||
| 1355 | * @param $params |
||
| 1356 | * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() |
||
| 1357 | */ |
||
| 1358 | public function sendAjaxGetRequest($uri, $params = null) { |
||
| 1361 | |||
| 1362 | |||
| 1363 | /** |
||
| 1364 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1365 | * |
||
| 1366 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1367 | * This action sends a POST ajax request with specified params. |
||
| 1368 | * Additional params can be passed as array. |
||
| 1369 | * |
||
| 1370 | * Example: |
||
| 1371 | * |
||
| 1372 | * Imagine that by clicking checkbox you trigger ajax request which updates user settings. |
||
| 1373 | * We emulate that click by running this ajax request manually. |
||
| 1374 | * |
||
| 1375 | * ``` php |
||
| 1376 | * <?php |
||
| 1377 | * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST |
||
| 1378 | * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET |
||
| 1379 | * |
||
| 1380 | * ``` |
||
| 1381 | * |
||
| 1382 | * @param $uri |
||
| 1383 | * @param $params |
||
| 1384 | * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() |
||
| 1385 | */ |
||
| 1386 | public function sendAjaxPostRequest($uri, $params = null) { |
||
| 1389 | |||
| 1390 | |||
| 1391 | /** |
||
| 1392 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1393 | * |
||
| 1394 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1395 | * This action sends an ajax request with specified method and params. |
||
| 1396 | * |
||
| 1397 | * Example: |
||
| 1398 | * |
||
| 1399 | * You need to perform an ajax request specifying the HTTP method. |
||
| 1400 | * |
||
| 1401 | * ``` php |
||
| 1402 | * <?php |
||
| 1403 | * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); |
||
| 1404 | * |
||
| 1405 | * ``` |
||
| 1406 | * |
||
| 1407 | * @param $method |
||
| 1408 | * @param $uri |
||
| 1409 | * @param $params |
||
| 1410 | * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() |
||
| 1411 | */ |
||
| 1412 | public function sendAjaxRequest($method, $uri, $params = null) { |
||
| 1415 | |||
| 1416 | |||
| 1417 | /** |
||
| 1418 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1419 | * |
||
| 1420 | * Finds and returns the text contents of the given element. |
||
| 1421 | * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression. |
||
| 1422 | * |
||
| 1423 | * ``` php |
||
| 1424 | * <?php |
||
| 1425 | * $heading = $I->grabTextFrom('h1'); |
||
| 1426 | * $heading = $I->grabTextFrom('descendant-or-self::h1'); |
||
| 1427 | * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex |
||
| 1428 | * ?> |
||
| 1429 | * ``` |
||
| 1430 | * |
||
| 1431 | * @param $cssOrXPathOrRegex |
||
| 1432 | * |
||
| 1433 | * @return mixed |
||
| 1434 | * @see \Codeception\Lib\InnerBrowser::grabTextFrom() |
||
| 1435 | */ |
||
| 1436 | public function grabTextFrom($cssOrXPathOrRegex) { |
||
| 1439 | |||
| 1440 | |||
| 1441 | /** |
||
| 1442 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1443 | * |
||
| 1444 | * Grabs the value of the given attribute value from the given element. |
||
| 1445 | * Fails if element is not found. |
||
| 1446 | * |
||
| 1447 | * ``` php |
||
| 1448 | * <?php |
||
| 1449 | * $I->grabAttributeFrom('#tooltip', 'title'); |
||
| 1450 | * ?> |
||
| 1451 | * ``` |
||
| 1452 | * |
||
| 1453 | * |
||
| 1454 | * @param $cssOrXpath |
||
| 1455 | * @param $attribute |
||
| 1456 | * @internal param $element |
||
| 1457 | * @return mixed |
||
| 1458 | * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() |
||
| 1459 | */ |
||
| 1460 | public function grabAttributeFrom($cssOrXpath, $attribute) { |
||
| 1463 | |||
| 1464 | |||
| 1465 | /** |
||
| 1466 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1467 | * |
||
| 1468 | * |
||
| 1469 | * @see \Codeception\Lib\InnerBrowser::grabMultiple() |
||
| 1470 | */ |
||
| 1471 | public function grabMultiple($cssOrXpath, $attribute = null) { |
||
| 1474 | |||
| 1475 | |||
| 1476 | /** |
||
| 1477 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1478 | * |
||
| 1479 | * @param $field |
||
| 1480 | * |
||
| 1481 | * @return array|mixed|null|string |
||
| 1482 | * @see \Codeception\Lib\InnerBrowser::grabValueFrom() |
||
| 1483 | */ |
||
| 1484 | public function grabValueFrom($field) { |
||
| 1487 | |||
| 1488 | |||
| 1489 | /** |
||
| 1490 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1491 | * |
||
| 1492 | * Sets a cookie with the given name and value. |
||
| 1493 | * You can set additional cookie params like `domain`, `path`, `expire`, `secure` in array passed as last argument. |
||
| 1494 | * |
||
| 1495 | * ``` php |
||
| 1496 | * <?php |
||
| 1497 | * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); |
||
| 1498 | * ?> |
||
| 1499 | * ``` |
||
| 1500 | * |
||
| 1501 | * @param $name |
||
| 1502 | * @param $val |
||
| 1503 | * @param array $params |
||
| 1504 | * |
||
| 1505 | * @return mixed |
||
| 1506 | * @see \Codeception\Lib\InnerBrowser::setCookie() |
||
| 1507 | */ |
||
| 1508 | public function setCookie($name, $val, $params = null) { |
||
| 1511 | |||
| 1512 | |||
| 1513 | /** |
||
| 1514 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1515 | * |
||
| 1516 | * Grabs a cookie value. |
||
| 1517 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 1518 | * |
||
| 1519 | * @param $cookie |
||
| 1520 | * |
||
| 1521 | * @param array $params |
||
| 1522 | * @return mixed |
||
| 1523 | * @see \Codeception\Lib\InnerBrowser::grabCookie() |
||
| 1524 | */ |
||
| 1525 | public function grabCookie($cookie, $params = null) { |
||
| 1528 | |||
| 1529 | |||
| 1530 | /** |
||
| 1531 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1532 | * |
||
| 1533 | * Checks that a cookie with the given name is set. |
||
| 1534 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1535 | * |
||
| 1536 | * ``` php |
||
| 1537 | * <?php |
||
| 1538 | * $I->seeCookie('PHPSESSID'); |
||
| 1539 | * ?> |
||
| 1540 | * ``` |
||
| 1541 | * |
||
| 1542 | * @param $cookie |
||
| 1543 | * @param array $params |
||
| 1544 | * @return mixed |
||
| 1545 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1546 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
| 1547 | */ |
||
| 1548 | public function canSeeCookie($cookie, $params = null) { |
||
| 1551 | /** |
||
| 1552 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1553 | * |
||
| 1554 | * Checks that a cookie with the given name is set. |
||
| 1555 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1556 | * |
||
| 1557 | * ``` php |
||
| 1558 | * <?php |
||
| 1559 | * $I->seeCookie('PHPSESSID'); |
||
| 1560 | * ?> |
||
| 1561 | * ``` |
||
| 1562 | * |
||
| 1563 | * @param $cookie |
||
| 1564 | * @param array $params |
||
| 1565 | * @return mixed |
||
| 1566 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
| 1567 | */ |
||
| 1568 | public function seeCookie($cookie, $params = null) { |
||
| 1571 | |||
| 1572 | |||
| 1573 | /** |
||
| 1574 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1575 | * |
||
| 1576 | * Checks that there isn't a cookie with the given name. |
||
| 1577 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1578 | * |
||
| 1579 | * @param $cookie |
||
| 1580 | * |
||
| 1581 | * @param array $params |
||
| 1582 | * @return mixed |
||
| 1583 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1584 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
| 1585 | */ |
||
| 1586 | public function cantSeeCookie($cookie, $params = null) { |
||
| 1589 | /** |
||
| 1590 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1591 | * |
||
| 1592 | * Checks that there isn't a cookie with the given name. |
||
| 1593 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1594 | * |
||
| 1595 | * @param $cookie |
||
| 1596 | * |
||
| 1597 | * @param array $params |
||
| 1598 | * @return mixed |
||
| 1599 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
| 1600 | */ |
||
| 1601 | public function dontSeeCookie($cookie, $params = null) { |
||
| 1604 | |||
| 1605 | |||
| 1606 | /** |
||
| 1607 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1608 | * |
||
| 1609 | * Unsets cookie with the given name. |
||
| 1610 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 1611 | * |
||
| 1612 | * @param $cookie |
||
| 1613 | * |
||
| 1614 | * @param array $params |
||
| 1615 | * @return mixed |
||
| 1616 | * @see \Codeception\Lib\InnerBrowser::resetCookie() |
||
| 1617 | */ |
||
| 1618 | public function resetCookie($name, $params = null) { |
||
| 1621 | |||
| 1622 | |||
| 1623 | /** |
||
| 1624 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1625 | * |
||
| 1626 | * Checks that the given element exists on the page and is visible. |
||
| 1627 | * You can also specify expected attributes of this element. |
||
| 1628 | * |
||
| 1629 | * ``` php |
||
| 1630 | * <?php |
||
| 1631 | * $I->seeElement('.error'); |
||
| 1632 | * $I->seeElement('//form/input[1]'); |
||
| 1633 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1634 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1635 | * |
||
| 1636 | * // strict locator in first arg, attributes in second |
||
| 1637 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1638 | * ?> |
||
| 1639 | * ``` |
||
| 1640 | * |
||
| 1641 | * @param $selector |
||
| 1642 | * @param array $attributes |
||
| 1643 | * @return |
||
| 1644 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1645 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
| 1646 | */ |
||
| 1647 | public function canSeeElement($selector, $attributes = null) { |
||
| 1650 | /** |
||
| 1651 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1652 | * |
||
| 1653 | * Checks that the given element exists on the page and is visible. |
||
| 1654 | * You can also specify expected attributes of this element. |
||
| 1655 | * |
||
| 1656 | * ``` php |
||
| 1657 | * <?php |
||
| 1658 | * $I->seeElement('.error'); |
||
| 1659 | * $I->seeElement('//form/input[1]'); |
||
| 1660 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1661 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1662 | * |
||
| 1663 | * // strict locator in first arg, attributes in second |
||
| 1664 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1665 | * ?> |
||
| 1666 | * ``` |
||
| 1667 | * |
||
| 1668 | * @param $selector |
||
| 1669 | * @param array $attributes |
||
| 1670 | * @return |
||
| 1671 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
| 1672 | */ |
||
| 1673 | public function seeElement($selector, $attributes = null) { |
||
| 1676 | |||
| 1677 | |||
| 1678 | /** |
||
| 1679 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1680 | * |
||
| 1681 | * Checks that the given element is invisible or not present on the page. |
||
| 1682 | * You can also specify expected attributes of this element. |
||
| 1683 | * |
||
| 1684 | * ``` php |
||
| 1685 | * <?php |
||
| 1686 | * $I->dontSeeElement('.error'); |
||
| 1687 | * $I->dontSeeElement('//form/input[1]'); |
||
| 1688 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 1689 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 1690 | * ?> |
||
| 1691 | * ``` |
||
| 1692 | * |
||
| 1693 | * @param $selector |
||
| 1694 | * @param array $attributes |
||
| 1695 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1696 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
| 1697 | */ |
||
| 1698 | public function cantSeeElement($selector, $attributes = null) { |
||
| 1701 | /** |
||
| 1702 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1703 | * |
||
| 1704 | * Checks that the given element is invisible or not present on the page. |
||
| 1705 | * You can also specify expected attributes of this element. |
||
| 1706 | * |
||
| 1707 | * ``` php |
||
| 1708 | * <?php |
||
| 1709 | * $I->dontSeeElement('.error'); |
||
| 1710 | * $I->dontSeeElement('//form/input[1]'); |
||
| 1711 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 1712 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 1713 | * ?> |
||
| 1714 | * ``` |
||
| 1715 | * |
||
| 1716 | * @param $selector |
||
| 1717 | * @param array $attributes |
||
| 1718 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
| 1719 | */ |
||
| 1720 | public function dontSeeElement($selector, $attributes = null) { |
||
| 1723 | |||
| 1724 | |||
| 1725 | /** |
||
| 1726 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1727 | * |
||
| 1728 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 1729 | * |
||
| 1730 | * ``` php |
||
| 1731 | * <?php |
||
| 1732 | * $I->seeNumberOfElements('tr', 10); |
||
| 1733 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
| 1734 | * ?> |
||
| 1735 | * ``` |
||
| 1736 | * @param $selector |
||
| 1737 | * @param mixed $expected : |
||
| 1738 | * - string: strict number |
||
| 1739 | * - array: range of numbers [0,10] |
||
| 1740 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1741 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
| 1742 | */ |
||
| 1743 | public function canSeeNumberOfElements($selector, $expected) { |
||
| 1746 | /** |
||
| 1747 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1748 | * |
||
| 1749 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 1750 | * |
||
| 1751 | * ``` php |
||
| 1752 | * <?php |
||
| 1753 | * $I->seeNumberOfElements('tr', 10); |
||
| 1754 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
| 1755 | * ?> |
||
| 1756 | * ``` |
||
| 1757 | * @param $selector |
||
| 1758 | * @param mixed $expected : |
||
| 1759 | * - string: strict number |
||
| 1760 | * - array: range of numbers [0,10] |
||
| 1761 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
| 1762 | */ |
||
| 1763 | public function seeNumberOfElements($selector, $expected) { |
||
| 1766 | |||
| 1767 | |||
| 1768 | /** |
||
| 1769 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1770 | * |
||
| 1771 | * Checks that the given option is selected. |
||
| 1772 | * |
||
| 1773 | * ``` php |
||
| 1774 | * <?php |
||
| 1775 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1776 | * ?> |
||
| 1777 | * ``` |
||
| 1778 | * |
||
| 1779 | * @param $selector |
||
| 1780 | * @param $optionText |
||
| 1781 | * |
||
| 1782 | * @return mixed |
||
| 1783 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1784 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
| 1785 | */ |
||
| 1786 | public function canSeeOptionIsSelected($selector, $optionText) { |
||
| 1789 | /** |
||
| 1790 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1791 | * |
||
| 1792 | * Checks that the given option is selected. |
||
| 1793 | * |
||
| 1794 | * ``` php |
||
| 1795 | * <?php |
||
| 1796 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1797 | * ?> |
||
| 1798 | * ``` |
||
| 1799 | * |
||
| 1800 | * @param $selector |
||
| 1801 | * @param $optionText |
||
| 1802 | * |
||
| 1803 | * @return mixed |
||
| 1804 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
| 1805 | */ |
||
| 1806 | public function seeOptionIsSelected($selector, $optionText) { |
||
| 1809 | |||
| 1810 | |||
| 1811 | /** |
||
| 1812 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1813 | * |
||
| 1814 | * Checks that the given option is not selected. |
||
| 1815 | * |
||
| 1816 | * ``` php |
||
| 1817 | * <?php |
||
| 1818 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1819 | * ?> |
||
| 1820 | * ``` |
||
| 1821 | * |
||
| 1822 | * @param $selector |
||
| 1823 | * @param $optionText |
||
| 1824 | * |
||
| 1825 | * @return mixed |
||
| 1826 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1827 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
| 1828 | */ |
||
| 1829 | public function cantSeeOptionIsSelected($selector, $optionText) { |
||
| 1832 | /** |
||
| 1833 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1834 | * |
||
| 1835 | * Checks that the given option is not selected. |
||
| 1836 | * |
||
| 1837 | * ``` php |
||
| 1838 | * <?php |
||
| 1839 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1840 | * ?> |
||
| 1841 | * ``` |
||
| 1842 | * |
||
| 1843 | * @param $selector |
||
| 1844 | * @param $optionText |
||
| 1845 | * |
||
| 1846 | * @return mixed |
||
| 1847 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
| 1848 | */ |
||
| 1849 | public function dontSeeOptionIsSelected($selector, $optionText) { |
||
| 1852 | |||
| 1853 | |||
| 1854 | /** |
||
| 1855 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1856 | * |
||
| 1857 | * Asserts that current page has 404 response status code. |
||
| 1858 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1859 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
| 1860 | */ |
||
| 1861 | public function canSeePageNotFound() { |
||
| 1864 | /** |
||
| 1865 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1866 | * |
||
| 1867 | * Asserts that current page has 404 response status code. |
||
| 1868 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
| 1869 | */ |
||
| 1870 | public function seePageNotFound() { |
||
| 1873 | |||
| 1874 | |||
| 1875 | /** |
||
| 1876 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1877 | * |
||
| 1878 | * Checks that response code is equal to value provided. |
||
| 1879 | * |
||
| 1880 | * @param $code |
||
| 1881 | * |
||
| 1882 | * @return mixed |
||
| 1883 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1884 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
| 1885 | */ |
||
| 1886 | public function canSeeResponseCodeIs($code) { |
||
| 1889 | /** |
||
| 1890 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1891 | * |
||
| 1892 | * Checks that response code is equal to value provided. |
||
| 1893 | * |
||
| 1894 | * @param $code |
||
| 1895 | * |
||
| 1896 | * @return mixed |
||
| 1897 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
| 1898 | */ |
||
| 1899 | public function seeResponseCodeIs($code) { |
||
| 1902 | |||
| 1903 | |||
| 1904 | /** |
||
| 1905 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1906 | * |
||
| 1907 | * Checks that the page title contains the given string. |
||
| 1908 | * |
||
| 1909 | * ``` php |
||
| 1910 | * <?php |
||
| 1911 | * $I->seeInTitle('Blog - Post #1'); |
||
| 1912 | * ?> |
||
| 1913 | * ``` |
||
| 1914 | * |
||
| 1915 | * @param $title |
||
| 1916 | * |
||
| 1917 | * @return mixed |
||
| 1918 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1919 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
| 1920 | */ |
||
| 1921 | public function canSeeInTitle($title) { |
||
| 1924 | /** |
||
| 1925 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1926 | * |
||
| 1927 | * Checks that the page title contains the given string. |
||
| 1928 | * |
||
| 1929 | * ``` php |
||
| 1930 | * <?php |
||
| 1931 | * $I->seeInTitle('Blog - Post #1'); |
||
| 1932 | * ?> |
||
| 1933 | * ``` |
||
| 1934 | * |
||
| 1935 | * @param $title |
||
| 1936 | * |
||
| 1937 | * @return mixed |
||
| 1938 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
| 1939 | */ |
||
| 1940 | public function seeInTitle($title) { |
||
| 1943 | |||
| 1944 | |||
| 1945 | /** |
||
| 1946 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1947 | * |
||
| 1948 | * Checks that the page title does not contain the given string. |
||
| 1949 | * |
||
| 1950 | * @param $title |
||
| 1951 | * |
||
| 1952 | * @return mixed |
||
| 1953 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1954 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
| 1955 | */ |
||
| 1956 | public function cantSeeInTitle($title) { |
||
| 1959 | /** |
||
| 1960 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1961 | * |
||
| 1962 | * Checks that the page title does not contain the given string. |
||
| 1963 | * |
||
| 1964 | * @param $title |
||
| 1965 | * |
||
| 1966 | * @return mixed |
||
| 1967 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
| 1968 | */ |
||
| 1969 | public function dontSeeInTitle($title) { |
||
| 1972 | } |
||
| 1973 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.