Complex classes like FunctionalTesterActions 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 FunctionalTesterActions, and based on these observations, apply Extract Interface, too.
| 1 | <?php //[STAMP] 1e263f8e989e74be45081a3d5f28abd4 |
||
| 12 | trait FunctionalTesterActions |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @return \Codeception\Scenario |
||
| 16 | */ |
||
| 17 | abstract protected function getScenario(); |
||
| 18 | |||
| 19 | |||
| 20 | /** |
||
| 21 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 22 | * |
||
| 23 | * Get service $serviceName and add it to the lists of persistent services. |
||
| 24 | * If $isPermanent then service becomes persistent between tests |
||
| 25 | * |
||
| 26 | * @param string $serviceName |
||
| 27 | * @param boolean $isPermanent |
||
| 28 | * @see \Codeception\Module\Symfony::persistService() |
||
| 29 | */ |
||
| 30 | public function persistService($serviceName, $isPermanent = null) { |
||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 37 | * |
||
| 38 | * Remove service $serviceName from the lists of persistent services. |
||
| 39 | * |
||
| 40 | * @param string $serviceName |
||
| 41 | * @see \Codeception\Module\Symfony::unpersistService() |
||
| 42 | */ |
||
| 43 | public function unpersistService($serviceName) { |
||
| 46 | |||
| 47 | |||
| 48 | /** |
||
| 49 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 50 | * |
||
| 51 | * Invalidate previously cached routes. |
||
| 52 | * @see \Codeception\Module\Symfony::invalidateCachedRouter() |
||
| 53 | */ |
||
| 54 | public function invalidateCachedRouter() { |
||
| 57 | |||
| 58 | |||
| 59 | /** |
||
| 60 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 61 | * |
||
| 62 | * Opens web page using route name and parameters. |
||
| 63 | * |
||
| 64 | * ``` php |
||
| 65 | * <?php |
||
| 66 | * $I->amOnRoute('posts.create'); |
||
| 67 | * $I->amOnRoute('posts.show', array('id' => 34)); |
||
| 68 | * ?> |
||
| 69 | * ``` |
||
| 70 | * |
||
| 71 | * @param $routeName |
||
| 72 | * @param array $params |
||
| 73 | * @see \Codeception\Module\Symfony::amOnRoute() |
||
| 74 | */ |
||
| 75 | public function amOnRoute($routeName, $params = null) { |
||
| 78 | |||
| 79 | |||
| 80 | /** |
||
| 81 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 82 | * |
||
| 83 | * Checks that current url matches route. |
||
| 84 | * |
||
| 85 | * ``` php |
||
| 86 | * <?php |
||
| 87 | * $I->seeCurrentRouteIs('posts.index'); |
||
| 88 | * $I->seeCurrentRouteIs('posts.show', array('id' => 8)); |
||
| 89 | * ?> |
||
| 90 | * ``` |
||
| 91 | * |
||
| 92 | * @param $routeName |
||
| 93 | * @param array $params |
||
| 94 | * Conditional Assertion: Test won't be stopped on fail |
||
| 95 | * @see \Codeception\Module\Symfony::seeCurrentRouteIs() |
||
| 96 | */ |
||
| 97 | public function canSeeCurrentRouteIs($routeName, $params = null) { |
||
| 100 | /** |
||
| 101 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 102 | * |
||
| 103 | * Checks that current url matches route. |
||
| 104 | * |
||
| 105 | * ``` php |
||
| 106 | * <?php |
||
| 107 | * $I->seeCurrentRouteIs('posts.index'); |
||
| 108 | * $I->seeCurrentRouteIs('posts.show', array('id' => 8)); |
||
| 109 | * ?> |
||
| 110 | * ``` |
||
| 111 | * |
||
| 112 | * @param $routeName |
||
| 113 | * @param array $params |
||
| 114 | * @see \Codeception\Module\Symfony::seeCurrentRouteIs() |
||
| 115 | */ |
||
| 116 | public function seeCurrentRouteIs($routeName, $params = null) { |
||
| 119 | |||
| 120 | |||
| 121 | /** |
||
| 122 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 123 | * |
||
| 124 | * Checks that current url matches route. |
||
| 125 | * Unlike seeCurrentRouteIs, this can matches without exact route parameters |
||
| 126 | * |
||
| 127 | * ``` php |
||
| 128 | * <?php |
||
| 129 | * $I->seeCurrentRouteMatches('my_blog_pages'); |
||
| 130 | * ?> |
||
| 131 | * ``` |
||
| 132 | * |
||
| 133 | * @param $routeName |
||
| 134 | * Conditional Assertion: Test won't be stopped on fail |
||
| 135 | * @see \Codeception\Module\Symfony::seeInCurrentRoute() |
||
| 136 | */ |
||
| 137 | public function canSeeInCurrentRoute($routeName) { |
||
| 140 | /** |
||
| 141 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 142 | * |
||
| 143 | * Checks that current url matches route. |
||
| 144 | * Unlike seeCurrentRouteIs, this can matches without exact route parameters |
||
| 145 | * |
||
| 146 | * ``` php |
||
| 147 | * <?php |
||
| 148 | * $I->seeCurrentRouteMatches('my_blog_pages'); |
||
| 149 | * ?> |
||
| 150 | * ``` |
||
| 151 | * |
||
| 152 | * @param $routeName |
||
| 153 | * @see \Codeception\Module\Symfony::seeInCurrentRoute() |
||
| 154 | */ |
||
| 155 | public function seeInCurrentRoute($routeName) { |
||
| 158 | |||
| 159 | |||
| 160 | /** |
||
| 161 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 162 | * |
||
| 163 | * Checks if any email were sent by last request |
||
| 164 | * |
||
| 165 | * @throws \LogicException |
||
| 166 | * Conditional Assertion: Test won't be stopped on fail |
||
| 167 | * @see \Codeception\Module\Symfony::seeEmailIsSent() |
||
| 168 | */ |
||
| 169 | public function canSeeEmailIsSent() { |
||
| 172 | /** |
||
| 173 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 174 | * |
||
| 175 | * Checks if any email were sent by last request |
||
| 176 | * |
||
| 177 | * @throws \LogicException |
||
| 178 | * @see \Codeception\Module\Symfony::seeEmailIsSent() |
||
| 179 | */ |
||
| 180 | public function seeEmailIsSent() { |
||
| 183 | |||
| 184 | |||
| 185 | /** |
||
| 186 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 187 | * |
||
| 188 | * Grabs a service from Symfony DIC container. |
||
| 189 | * Recommended to use for unit testing. |
||
| 190 | * |
||
| 191 | * ``` php |
||
| 192 | * <?php |
||
| 193 | * $em = $I->grabServiceFromContainer('doctrine'); |
||
| 194 | * ?> |
||
| 195 | * ``` |
||
| 196 | * |
||
| 197 | * @param $service |
||
| 198 | * @return mixed |
||
| 199 | * @part services |
||
| 200 | * @deprecated Use grabService instead |
||
| 201 | * @see \Codeception\Module\Symfony::grabServiceFromContainer() |
||
| 202 | */ |
||
| 203 | public function grabServiceFromContainer($service) { |
||
| 206 | |||
| 207 | |||
| 208 | /** |
||
| 209 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 210 | * |
||
| 211 | * Grabs a service from Symfony DIC container. |
||
| 212 | * Recommended to use for unit testing. |
||
| 213 | * |
||
| 214 | * ``` php |
||
| 215 | * <?php |
||
| 216 | * $em = $I->grabService('doctrine'); |
||
| 217 | * ?> |
||
| 218 | * ``` |
||
| 219 | * |
||
| 220 | * @param $service |
||
| 221 | * @return mixed |
||
| 222 | * @part services |
||
| 223 | * @see \Codeception\Module\Symfony::grabService() |
||
| 224 | */ |
||
| 225 | public function grabService($service) { |
||
| 228 | |||
| 229 | |||
| 230 | /** |
||
| 231 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 232 | * |
||
| 233 | * Reboot client's kernel. |
||
| 234 | * Can be used to manually reboot kernel when 'rebootable_client' => false |
||
| 235 | * |
||
| 236 | * ``` php |
||
| 237 | * <?php |
||
| 238 | * ... |
||
| 239 | * perform some requests |
||
| 240 | * ... |
||
| 241 | * $I->rebootClientKernel(); |
||
| 242 | * ... |
||
| 243 | * perform other requests |
||
| 244 | * ... |
||
| 245 | * |
||
| 246 | * ?> |
||
| 247 | * ``` |
||
| 248 | * |
||
| 249 | * @see \Codeception\Module\Symfony::rebootClientKernel() |
||
| 250 | */ |
||
| 251 | public function rebootClientKernel() { |
||
| 254 | |||
| 255 | |||
| 256 | /** |
||
| 257 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 258 | * |
||
| 259 | * Authenticates user for HTTP_AUTH |
||
| 260 | * |
||
| 261 | * @param $username |
||
| 262 | * @param $password |
||
| 263 | * @see \Codeception\Lib\InnerBrowser::amHttpAuthenticated() |
||
| 264 | */ |
||
| 265 | public function amHttpAuthenticated($username, $password) { |
||
| 268 | |||
| 269 | |||
| 270 | /** |
||
| 271 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 272 | * |
||
| 273 | * Sets the HTTP header to the passed value - which is used on |
||
| 274 | * subsequent HTTP requests through PhpBrowser. |
||
| 275 | * |
||
| 276 | * Example: |
||
| 277 | * ```php |
||
| 278 | * <?php |
||
| 279 | * $I->setHeader('X-Requested-With', 'Codeception'); |
||
| 280 | * $I->amOnPage('test-headers.php'); |
||
| 281 | * ?> |
||
| 282 | * ``` |
||
| 283 | * |
||
| 284 | * @param string $name the name of the request header |
||
| 285 | * @param string $value the value to set it to for subsequent |
||
| 286 | * requests |
||
| 287 | * @see \Codeception\Lib\InnerBrowser::haveHttpHeader() |
||
| 288 | */ |
||
| 289 | public function haveHttpHeader($name, $value) { |
||
| 292 | |||
| 293 | |||
| 294 | /** |
||
| 295 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 296 | * |
||
| 297 | * Deletes the header with the passed name. Subsequent requests |
||
| 298 | * will not have the deleted header in its request. |
||
| 299 | * |
||
| 300 | * Example: |
||
| 301 | * ```php |
||
| 302 | * <?php |
||
| 303 | * $I->haveHttpHeader('X-Requested-With', 'Codeception'); |
||
| 304 | * $I->amOnPage('test-headers.php'); |
||
| 305 | * // ... |
||
| 306 | * $I->deleteHeader('X-Requested-With'); |
||
| 307 | * $I->amOnPage('some-other-page.php'); |
||
| 308 | * ?> |
||
| 309 | * ``` |
||
| 310 | * |
||
| 311 | * @param string $name the name of the header to delete. |
||
| 312 | * @see \Codeception\Lib\InnerBrowser::deleteHeader() |
||
| 313 | */ |
||
| 314 | public function deleteHeader($name) { |
||
| 317 | |||
| 318 | |||
| 319 | /** |
||
| 320 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 321 | * |
||
| 322 | * Opens the page for the given relative URI. |
||
| 323 | * |
||
| 324 | * ``` php |
||
| 325 | * <?php |
||
| 326 | * // opens front page |
||
| 327 | * $I->amOnPage('/'); |
||
| 328 | * // opens /register page |
||
| 329 | * $I->amOnPage('/register'); |
||
| 330 | * ``` |
||
| 331 | * |
||
| 332 | * @param $page |
||
| 333 | * @see \Codeception\Lib\InnerBrowser::amOnPage() |
||
| 334 | */ |
||
| 335 | public function amOnPage($page) { |
||
| 338 | |||
| 339 | |||
| 340 | /** |
||
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 342 | * |
||
| 343 | * Perform a click on a link or a button, given by a locator. |
||
| 344 | * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. |
||
| 345 | * For buttons, the "value" attribute, "name" attribute, and inner text are searched. |
||
| 346 | * For links, the link text is searched. |
||
| 347 | * For images, the "alt" attribute and inner text of any parent links are searched. |
||
| 348 | * |
||
| 349 | * The second parameter is a context (CSS or XPath locator) to narrow the search. |
||
| 350 | * |
||
| 351 | * Note that if the locator matches a button of type `submit`, the form will be submitted. |
||
| 352 | * |
||
| 353 | * ``` php |
||
| 354 | * <?php |
||
| 355 | * // simple link |
||
| 356 | * $I->click('Logout'); |
||
| 357 | * // button of form |
||
| 358 | * $I->click('Submit'); |
||
| 359 | * // CSS button |
||
| 360 | * $I->click('#form input[type=submit]'); |
||
| 361 | * // XPath |
||
| 362 | * $I->click('//form/*[@type=submit]'); |
||
| 363 | * // link in context |
||
| 364 | * $I->click('Logout', '#nav'); |
||
| 365 | * // using strict locator |
||
| 366 | * $I->click(['link' => 'Login']); |
||
| 367 | * ?> |
||
| 368 | * ``` |
||
| 369 | * |
||
| 370 | * @param $link |
||
| 371 | * @param $context |
||
| 372 | * @see \Codeception\Lib\InnerBrowser::click() |
||
| 373 | */ |
||
| 374 | public function click($link, $context = null) { |
||
| 377 | |||
| 378 | |||
| 379 | /** |
||
| 380 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 381 | * |
||
| 382 | * Checks that the current page contains the given string (case insensitive). |
||
| 383 | * |
||
| 384 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
| 385 | * parameter to only search within that element. |
||
| 386 | * |
||
| 387 | * ``` php |
||
| 388 | * <?php |
||
| 389 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 390 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
| 391 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
| 392 | * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 393 | * ``` |
||
| 394 | * |
||
| 395 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 396 | * so `$I->see('strong')` will return true for strings like: |
||
| 397 | * |
||
| 398 | * - `<p>I am Stronger than thou</p>` |
||
| 399 | * - `<script>document.createElement('strong');</script>` |
||
| 400 | * |
||
| 401 | * But will *not* be true for strings like: |
||
| 402 | * |
||
| 403 | * - `<strong>Home</strong>` |
||
| 404 | * - `<div class="strong">Home</strong>` |
||
| 405 | * - `<!-- strong -->` |
||
| 406 | * |
||
| 407 | * For checking the raw source code, use `seeInSource()`. |
||
| 408 | * |
||
| 409 | * @param $text |
||
| 410 | * @param null $selector |
||
| 411 | * Conditional Assertion: Test won't be stopped on fail |
||
| 412 | * @see \Codeception\Lib\InnerBrowser::see() |
||
| 413 | */ |
||
| 414 | public function canSee($text, $selector = null) { |
||
| 417 | /** |
||
| 418 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 419 | * |
||
| 420 | * Checks that the current page contains the given string (case insensitive). |
||
| 421 | * |
||
| 422 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
| 423 | * parameter to only search within that element. |
||
| 424 | * |
||
| 425 | * ``` php |
||
| 426 | * <?php |
||
| 427 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 428 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
| 429 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
| 430 | * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 431 | * ``` |
||
| 432 | * |
||
| 433 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 434 | * so `$I->see('strong')` will return true for strings like: |
||
| 435 | * |
||
| 436 | * - `<p>I am Stronger than thou</p>` |
||
| 437 | * - `<script>document.createElement('strong');</script>` |
||
| 438 | * |
||
| 439 | * But will *not* be true for strings like: |
||
| 440 | * |
||
| 441 | * - `<strong>Home</strong>` |
||
| 442 | * - `<div class="strong">Home</strong>` |
||
| 443 | * - `<!-- strong -->` |
||
| 444 | * |
||
| 445 | * For checking the raw source code, use `seeInSource()`. |
||
| 446 | * |
||
| 447 | * @param $text |
||
| 448 | * @param null $selector |
||
| 449 | * @see \Codeception\Lib\InnerBrowser::see() |
||
| 450 | */ |
||
| 451 | public function see($text, $selector = null) { |
||
| 454 | |||
| 455 | |||
| 456 | /** |
||
| 457 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 458 | * |
||
| 459 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
| 460 | * Give a locator as the second parameter to match a specific region. |
||
| 461 | * |
||
| 462 | * ```php |
||
| 463 | * <?php |
||
| 464 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 465 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 466 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 467 | * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 468 | * ``` |
||
| 469 | * |
||
| 470 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 471 | * so `$I->dontSee('strong')` will fail on strings like: |
||
| 472 | * |
||
| 473 | * - `<p>I am Stronger than thou</p>` |
||
| 474 | * - `<script>document.createElement('strong');</script>` |
||
| 475 | * |
||
| 476 | * But will ignore strings like: |
||
| 477 | * |
||
| 478 | * - `<strong>Home</strong>` |
||
| 479 | * - `<div class="strong">Home</strong>` |
||
| 480 | * - `<!-- strong -->` |
||
| 481 | * |
||
| 482 | * For checking the raw source code, use `seeInSource()`. |
||
| 483 | * |
||
| 484 | * @param $text |
||
| 485 | * @param null $selector |
||
| 486 | * Conditional Assertion: Test won't be stopped on fail |
||
| 487 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
| 488 | */ |
||
| 489 | public function cantSee($text, $selector = null) { |
||
| 492 | /** |
||
| 493 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 494 | * |
||
| 495 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
| 496 | * Give a locator as the second parameter to match a specific region. |
||
| 497 | * |
||
| 498 | * ```php |
||
| 499 | * <?php |
||
| 500 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 501 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 502 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 503 | * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 504 | * ``` |
||
| 505 | * |
||
| 506 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 507 | * so `$I->dontSee('strong')` will fail on strings like: |
||
| 508 | * |
||
| 509 | * - `<p>I am Stronger than thou</p>` |
||
| 510 | * - `<script>document.createElement('strong');</script>` |
||
| 511 | * |
||
| 512 | * But will ignore strings like: |
||
| 513 | * |
||
| 514 | * - `<strong>Home</strong>` |
||
| 515 | * - `<div class="strong">Home</strong>` |
||
| 516 | * - `<!-- strong -->` |
||
| 517 | * |
||
| 518 | * For checking the raw source code, use `seeInSource()`. |
||
| 519 | * |
||
| 520 | * @param $text |
||
| 521 | * @param null $selector |
||
| 522 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
| 523 | */ |
||
| 524 | public function dontSee($text, $selector = null) { |
||
| 527 | |||
| 528 | |||
| 529 | /** |
||
| 530 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 531 | * |
||
| 532 | * Checks that the current page contains the given string in its |
||
| 533 | * raw source code. |
||
| 534 | * |
||
| 535 | * ``` php |
||
| 536 | * <?php |
||
| 537 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
| 538 | * ``` |
||
| 539 | * |
||
| 540 | * @param $raw |
||
| 541 | * Conditional Assertion: Test won't be stopped on fail |
||
| 542 | * @see \Codeception\Lib\InnerBrowser::seeInSource() |
||
| 543 | */ |
||
| 544 | public function canSeeInSource($raw) { |
||
| 547 | /** |
||
| 548 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 549 | * |
||
| 550 | * Checks that the current page contains the given string in its |
||
| 551 | * raw source code. |
||
| 552 | * |
||
| 553 | * ``` php |
||
| 554 | * <?php |
||
| 555 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
| 556 | * ``` |
||
| 557 | * |
||
| 558 | * @param $raw |
||
| 559 | * @see \Codeception\Lib\InnerBrowser::seeInSource() |
||
| 560 | */ |
||
| 561 | public function seeInSource($raw) { |
||
| 564 | |||
| 565 | |||
| 566 | /** |
||
| 567 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 568 | * |
||
| 569 | * Checks that the current page contains the given string in its |
||
| 570 | * raw source code. |
||
| 571 | * |
||
| 572 | * ```php |
||
| 573 | * <?php |
||
| 574 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
| 575 | * ``` |
||
| 576 | * |
||
| 577 | * @param $raw |
||
| 578 | * Conditional Assertion: Test won't be stopped on fail |
||
| 579 | * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() |
||
| 580 | */ |
||
| 581 | public function cantSeeInSource($raw) { |
||
| 584 | /** |
||
| 585 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 586 | * |
||
| 587 | * Checks that the current page contains the given string in its |
||
| 588 | * raw source code. |
||
| 589 | * |
||
| 590 | * ```php |
||
| 591 | * <?php |
||
| 592 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
| 593 | * ``` |
||
| 594 | * |
||
| 595 | * @param $raw |
||
| 596 | * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() |
||
| 597 | */ |
||
| 598 | public function dontSeeInSource($raw) { |
||
| 601 | |||
| 602 | |||
| 603 | /** |
||
| 604 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 605 | * |
||
| 606 | * Checks that there's a link with the specified text. |
||
| 607 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 608 | * |
||
| 609 | * ``` php |
||
| 610 | * <?php |
||
| 611 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 612 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 613 | * ?> |
||
| 614 | * ``` |
||
| 615 | * |
||
| 616 | * @param $text |
||
| 617 | * @param null $url |
||
| 618 | * Conditional Assertion: Test won't be stopped on fail |
||
| 619 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
| 620 | */ |
||
| 621 | public function canSeeLink($text, $url = null) { |
||
| 624 | /** |
||
| 625 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 626 | * |
||
| 627 | * Checks that there's a link with the specified text. |
||
| 628 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 629 | * |
||
| 630 | * ``` php |
||
| 631 | * <?php |
||
| 632 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 633 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 634 | * ?> |
||
| 635 | * ``` |
||
| 636 | * |
||
| 637 | * @param $text |
||
| 638 | * @param null $url |
||
| 639 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
| 640 | */ |
||
| 641 | public function seeLink($text, $url = null) { |
||
| 644 | |||
| 645 | |||
| 646 | /** |
||
| 647 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 648 | * |
||
| 649 | * Checks that the page doesn't contain a link with the given string. |
||
| 650 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 651 | * |
||
| 652 | * ``` php |
||
| 653 | * <?php |
||
| 654 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 655 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 656 | * ?> |
||
| 657 | * ``` |
||
| 658 | * |
||
| 659 | * @param $text |
||
| 660 | * @param null $url |
||
| 661 | * Conditional Assertion: Test won't be stopped on fail |
||
| 662 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
| 663 | */ |
||
| 664 | public function cantSeeLink($text, $url = null) { |
||
| 667 | /** |
||
| 668 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 669 | * |
||
| 670 | * Checks that the page doesn't contain a link with the given string. |
||
| 671 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 672 | * |
||
| 673 | * ``` php |
||
| 674 | * <?php |
||
| 675 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 676 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 677 | * ?> |
||
| 678 | * ``` |
||
| 679 | * |
||
| 680 | * @param $text |
||
| 681 | * @param null $url |
||
| 682 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
| 683 | */ |
||
| 684 | public function dontSeeLink($text, $url = null) { |
||
| 687 | |||
| 688 | |||
| 689 | /** |
||
| 690 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 691 | * |
||
| 692 | * Checks that current URI contains the given string. |
||
| 693 | * |
||
| 694 | * ``` php |
||
| 695 | * <?php |
||
| 696 | * // to match: /home/dashboard |
||
| 697 | * $I->seeInCurrentUrl('home'); |
||
| 698 | * // to match: /users/1 |
||
| 699 | * $I->seeInCurrentUrl('/users/'); |
||
| 700 | * ?> |
||
| 701 | * ``` |
||
| 702 | * |
||
| 703 | * @param $uri |
||
| 704 | * Conditional Assertion: Test won't be stopped on fail |
||
| 705 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
| 706 | */ |
||
| 707 | public function canSeeInCurrentUrl($uri) { |
||
| 710 | /** |
||
| 711 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 712 | * |
||
| 713 | * Checks that current URI contains the given string. |
||
| 714 | * |
||
| 715 | * ``` php |
||
| 716 | * <?php |
||
| 717 | * // to match: /home/dashboard |
||
| 718 | * $I->seeInCurrentUrl('home'); |
||
| 719 | * // to match: /users/1 |
||
| 720 | * $I->seeInCurrentUrl('/users/'); |
||
| 721 | * ?> |
||
| 722 | * ``` |
||
| 723 | * |
||
| 724 | * @param $uri |
||
| 725 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
| 726 | */ |
||
| 727 | public function seeInCurrentUrl($uri) { |
||
| 730 | |||
| 731 | |||
| 732 | /** |
||
| 733 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 734 | * |
||
| 735 | * Checks that the current URI doesn't contain the given string. |
||
| 736 | * |
||
| 737 | * ``` php |
||
| 738 | * <?php |
||
| 739 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 740 | * ?> |
||
| 741 | * ``` |
||
| 742 | * |
||
| 743 | * @param $uri |
||
| 744 | * Conditional Assertion: Test won't be stopped on fail |
||
| 745 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
| 746 | */ |
||
| 747 | public function cantSeeInCurrentUrl($uri) { |
||
| 750 | /** |
||
| 751 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 752 | * |
||
| 753 | * Checks that the current URI doesn't contain the given string. |
||
| 754 | * |
||
| 755 | * ``` php |
||
| 756 | * <?php |
||
| 757 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 758 | * ?> |
||
| 759 | * ``` |
||
| 760 | * |
||
| 761 | * @param $uri |
||
| 762 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
| 763 | */ |
||
| 764 | public function dontSeeInCurrentUrl($uri) { |
||
| 767 | |||
| 768 | |||
| 769 | /** |
||
| 770 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 771 | * |
||
| 772 | * Checks that the current URL is equal to the given string. |
||
| 773 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 774 | * |
||
| 775 | * ``` php |
||
| 776 | * <?php |
||
| 777 | * // to match root url |
||
| 778 | * $I->seeCurrentUrlEquals('/'); |
||
| 779 | * ?> |
||
| 780 | * ``` |
||
| 781 | * |
||
| 782 | * @param $uri |
||
| 783 | * Conditional Assertion: Test won't be stopped on fail |
||
| 784 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
| 785 | */ |
||
| 786 | public function canSeeCurrentUrlEquals($uri) { |
||
| 789 | /** |
||
| 790 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 791 | * |
||
| 792 | * Checks that the current URL is equal to the given string. |
||
| 793 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 794 | * |
||
| 795 | * ``` php |
||
| 796 | * <?php |
||
| 797 | * // to match root url |
||
| 798 | * $I->seeCurrentUrlEquals('/'); |
||
| 799 | * ?> |
||
| 800 | * ``` |
||
| 801 | * |
||
| 802 | * @param $uri |
||
| 803 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
| 804 | */ |
||
| 805 | public function seeCurrentUrlEquals($uri) { |
||
| 808 | |||
| 809 | |||
| 810 | /** |
||
| 811 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 812 | * |
||
| 813 | * Checks that the current URL doesn't equal the given string. |
||
| 814 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 815 | * |
||
| 816 | * ``` php |
||
| 817 | * <?php |
||
| 818 | * // current url is not root |
||
| 819 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 820 | * ?> |
||
| 821 | * ``` |
||
| 822 | * |
||
| 823 | * @param $uri |
||
| 824 | * Conditional Assertion: Test won't be stopped on fail |
||
| 825 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
| 826 | */ |
||
| 827 | public function cantSeeCurrentUrlEquals($uri) { |
||
| 830 | /** |
||
| 831 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 832 | * |
||
| 833 | * Checks that the current URL doesn't equal the given string. |
||
| 834 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 835 | * |
||
| 836 | * ``` php |
||
| 837 | * <?php |
||
| 838 | * // current url is not root |
||
| 839 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 840 | * ?> |
||
| 841 | * ``` |
||
| 842 | * |
||
| 843 | * @param $uri |
||
| 844 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
| 845 | */ |
||
| 846 | public function dontSeeCurrentUrlEquals($uri) { |
||
| 849 | |||
| 850 | |||
| 851 | /** |
||
| 852 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 853 | * |
||
| 854 | * Checks that the current URL matches the given regular expression. |
||
| 855 | * |
||
| 856 | * ``` php |
||
| 857 | * <?php |
||
| 858 | * // to match root url |
||
| 859 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 860 | * ?> |
||
| 861 | * ``` |
||
| 862 | * |
||
| 863 | * @param $uri |
||
| 864 | * Conditional Assertion: Test won't be stopped on fail |
||
| 865 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
| 866 | */ |
||
| 867 | public function canSeeCurrentUrlMatches($uri) { |
||
| 870 | /** |
||
| 871 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 872 | * |
||
| 873 | * Checks that the current URL matches the given regular expression. |
||
| 874 | * |
||
| 875 | * ``` php |
||
| 876 | * <?php |
||
| 877 | * // to match root url |
||
| 878 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 879 | * ?> |
||
| 880 | * ``` |
||
| 881 | * |
||
| 882 | * @param $uri |
||
| 883 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
| 884 | */ |
||
| 885 | public function seeCurrentUrlMatches($uri) { |
||
| 888 | |||
| 889 | |||
| 890 | /** |
||
| 891 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 892 | * |
||
| 893 | * Checks that current url doesn't match the given regular expression. |
||
| 894 | * |
||
| 895 | * ``` php |
||
| 896 | * <?php |
||
| 897 | * // to match root url |
||
| 898 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 899 | * ?> |
||
| 900 | * ``` |
||
| 901 | * |
||
| 902 | * @param $uri |
||
| 903 | * Conditional Assertion: Test won't be stopped on fail |
||
| 904 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
| 905 | */ |
||
| 906 | public function cantSeeCurrentUrlMatches($uri) { |
||
| 909 | /** |
||
| 910 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 911 | * |
||
| 912 | * Checks that current url doesn't match the given regular expression. |
||
| 913 | * |
||
| 914 | * ``` php |
||
| 915 | * <?php |
||
| 916 | * // to match root url |
||
| 917 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 918 | * ?> |
||
| 919 | * ``` |
||
| 920 | * |
||
| 921 | * @param $uri |
||
| 922 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
| 923 | */ |
||
| 924 | public function dontSeeCurrentUrlMatches($uri) { |
||
| 927 | |||
| 928 | |||
| 929 | /** |
||
| 930 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 931 | * |
||
| 932 | * Executes the given regular expression against the current URI and returns the first match. |
||
| 933 | * If no parameters are provided, the full URI is returned. |
||
| 934 | * |
||
| 935 | * ``` php |
||
| 936 | * <?php |
||
| 937 | * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); |
||
| 938 | * $uri = $I->grabFromCurrentUrl(); |
||
| 939 | * ?> |
||
| 940 | * ``` |
||
| 941 | * |
||
| 942 | * @param null $uri |
||
| 943 | * |
||
| 944 | * @return mixed |
||
| 945 | * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() |
||
| 946 | */ |
||
| 947 | public function grabFromCurrentUrl($uri = null) { |
||
| 950 | |||
| 951 | |||
| 952 | /** |
||
| 953 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 954 | * |
||
| 955 | * Checks that the specified checkbox is checked. |
||
| 956 | * |
||
| 957 | * ``` php |
||
| 958 | * <?php |
||
| 959 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 960 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 961 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 962 | * ?> |
||
| 963 | * ``` |
||
| 964 | * |
||
| 965 | * @param $checkbox |
||
| 966 | * Conditional Assertion: Test won't be stopped on fail |
||
| 967 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
| 968 | */ |
||
| 969 | public function canSeeCheckboxIsChecked($checkbox) { |
||
| 972 | /** |
||
| 973 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 974 | * |
||
| 975 | * Checks that the specified checkbox is checked. |
||
| 976 | * |
||
| 977 | * ``` php |
||
| 978 | * <?php |
||
| 979 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 980 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 981 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 982 | * ?> |
||
| 983 | * ``` |
||
| 984 | * |
||
| 985 | * @param $checkbox |
||
| 986 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
| 987 | */ |
||
| 988 | public function seeCheckboxIsChecked($checkbox) { |
||
| 991 | |||
| 992 | |||
| 993 | /** |
||
| 994 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 995 | * |
||
| 996 | * Check that the specified checkbox is unchecked. |
||
| 997 | * |
||
| 998 | * ``` php |
||
| 999 | * <?php |
||
| 1000 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 1001 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 1002 | * ?> |
||
| 1003 | * ``` |
||
| 1004 | * |
||
| 1005 | * @param $checkbox |
||
| 1006 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1007 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
| 1008 | */ |
||
| 1009 | public function cantSeeCheckboxIsChecked($checkbox) { |
||
| 1012 | /** |
||
| 1013 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1014 | * |
||
| 1015 | * Check that the specified checkbox is unchecked. |
||
| 1016 | * |
||
| 1017 | * ``` php |
||
| 1018 | * <?php |
||
| 1019 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 1020 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 1021 | * ?> |
||
| 1022 | * ``` |
||
| 1023 | * |
||
| 1024 | * @param $checkbox |
||
| 1025 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
| 1026 | */ |
||
| 1027 | public function dontSeeCheckboxIsChecked($checkbox) { |
||
| 1030 | |||
| 1031 | |||
| 1032 | /** |
||
| 1033 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1034 | * |
||
| 1035 | * Checks that the given input field or textarea contains the given value. |
||
| 1036 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
| 1037 | * |
||
| 1038 | * ``` php |
||
| 1039 | * <?php |
||
| 1040 | * $I->seeInField('Body','Type your comment here'); |
||
| 1041 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 1042 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 1043 | * $I->seeInField('#searchform input','Search'); |
||
| 1044 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 1045 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 1046 | * ?> |
||
| 1047 | * ``` |
||
| 1048 | * |
||
| 1049 | * @param $field |
||
| 1050 | * @param $value |
||
| 1051 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1052 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
| 1053 | */ |
||
| 1054 | public function canSeeInField($field, $value) { |
||
| 1057 | /** |
||
| 1058 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1059 | * |
||
| 1060 | * Checks that the given input field or textarea contains the given value. |
||
| 1061 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
| 1062 | * |
||
| 1063 | * ``` php |
||
| 1064 | * <?php |
||
| 1065 | * $I->seeInField('Body','Type your comment here'); |
||
| 1066 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 1067 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 1068 | * $I->seeInField('#searchform input','Search'); |
||
| 1069 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 1070 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 1071 | * ?> |
||
| 1072 | * ``` |
||
| 1073 | * |
||
| 1074 | * @param $field |
||
| 1075 | * @param $value |
||
| 1076 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
| 1077 | */ |
||
| 1078 | public function seeInField($field, $value) { |
||
| 1081 | |||
| 1082 | |||
| 1083 | /** |
||
| 1084 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1085 | * |
||
| 1086 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 1087 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 1088 | * |
||
| 1089 | * ``` php |
||
| 1090 | * <?php |
||
| 1091 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 1092 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 1093 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 1094 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 1095 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 1096 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 1097 | * ?> |
||
| 1098 | * ``` |
||
| 1099 | * |
||
| 1100 | * @param $field |
||
| 1101 | * @param $value |
||
| 1102 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1103 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
| 1104 | */ |
||
| 1105 | public function cantSeeInField($field, $value) { |
||
| 1108 | /** |
||
| 1109 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1110 | * |
||
| 1111 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 1112 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 1113 | * |
||
| 1114 | * ``` php |
||
| 1115 | * <?php |
||
| 1116 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 1117 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 1118 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 1119 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 1120 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 1121 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 1122 | * ?> |
||
| 1123 | * ``` |
||
| 1124 | * |
||
| 1125 | * @param $field |
||
| 1126 | * @param $value |
||
| 1127 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
| 1128 | */ |
||
| 1129 | public function dontSeeInField($field, $value) { |
||
| 1132 | |||
| 1133 | |||
| 1134 | /** |
||
| 1135 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1136 | * |
||
| 1137 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 1138 | * passed selector. |
||
| 1139 | * |
||
| 1140 | * ``` php |
||
| 1141 | * <?php |
||
| 1142 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 1143 | * 'input1' => 'value', |
||
| 1144 | * 'input2' => 'other value', |
||
| 1145 | * ]); |
||
| 1146 | * ?> |
||
| 1147 | * ``` |
||
| 1148 | * |
||
| 1149 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 1150 | * array may be passed: |
||
| 1151 | * |
||
| 1152 | * ``` php |
||
| 1153 | * <?php |
||
| 1154 | * $I->seeInFormFields('.form-class', [ |
||
| 1155 | * 'multiselect' => [ |
||
| 1156 | * 'value1', |
||
| 1157 | * 'value2', |
||
| 1158 | * ], |
||
| 1159 | * 'checkbox[]' => [ |
||
| 1160 | * 'a checked value', |
||
| 1161 | * 'another checked value', |
||
| 1162 | * ], |
||
| 1163 | * ]); |
||
| 1164 | * ?> |
||
| 1165 | * ``` |
||
| 1166 | * |
||
| 1167 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1168 | * |
||
| 1169 | * ``` php |
||
| 1170 | * <?php |
||
| 1171 | * $I->seeInFormFields('#form-id', [ |
||
| 1172 | * 'checkbox1' => true, // passes if checked |
||
| 1173 | * 'checkbox2' => false, // passes if unchecked |
||
| 1174 | * ]); |
||
| 1175 | * ?> |
||
| 1176 | * ``` |
||
| 1177 | * |
||
| 1178 | * Pair this with submitForm for quick testing magic. |
||
| 1179 | * |
||
| 1180 | * ``` php |
||
| 1181 | * <?php |
||
| 1182 | * $form = [ |
||
| 1183 | * 'field1' => 'value', |
||
| 1184 | * 'field2' => 'another value', |
||
| 1185 | * 'checkbox1' => true, |
||
| 1186 | * // ... |
||
| 1187 | * ]; |
||
| 1188 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1189 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1190 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1191 | * ?> |
||
| 1192 | * ``` |
||
| 1193 | * |
||
| 1194 | * @param $formSelector |
||
| 1195 | * @param $params |
||
| 1196 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1197 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
| 1198 | */ |
||
| 1199 | public function canSeeInFormFields($formSelector, $params) { |
||
| 1202 | /** |
||
| 1203 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1204 | * |
||
| 1205 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 1206 | * passed selector. |
||
| 1207 | * |
||
| 1208 | * ``` php |
||
| 1209 | * <?php |
||
| 1210 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 1211 | * 'input1' => 'value', |
||
| 1212 | * 'input2' => 'other value', |
||
| 1213 | * ]); |
||
| 1214 | * ?> |
||
| 1215 | * ``` |
||
| 1216 | * |
||
| 1217 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 1218 | * array may be passed: |
||
| 1219 | * |
||
| 1220 | * ``` php |
||
| 1221 | * <?php |
||
| 1222 | * $I->seeInFormFields('.form-class', [ |
||
| 1223 | * 'multiselect' => [ |
||
| 1224 | * 'value1', |
||
| 1225 | * 'value2', |
||
| 1226 | * ], |
||
| 1227 | * 'checkbox[]' => [ |
||
| 1228 | * 'a checked value', |
||
| 1229 | * 'another checked value', |
||
| 1230 | * ], |
||
| 1231 | * ]); |
||
| 1232 | * ?> |
||
| 1233 | * ``` |
||
| 1234 | * |
||
| 1235 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1236 | * |
||
| 1237 | * ``` php |
||
| 1238 | * <?php |
||
| 1239 | * $I->seeInFormFields('#form-id', [ |
||
| 1240 | * 'checkbox1' => true, // passes if checked |
||
| 1241 | * 'checkbox2' => false, // passes if unchecked |
||
| 1242 | * ]); |
||
| 1243 | * ?> |
||
| 1244 | * ``` |
||
| 1245 | * |
||
| 1246 | * Pair this with submitForm for quick testing magic. |
||
| 1247 | * |
||
| 1248 | * ``` php |
||
| 1249 | * <?php |
||
| 1250 | * $form = [ |
||
| 1251 | * 'field1' => 'value', |
||
| 1252 | * 'field2' => 'another value', |
||
| 1253 | * 'checkbox1' => true, |
||
| 1254 | * // ... |
||
| 1255 | * ]; |
||
| 1256 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1257 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1258 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1259 | * ?> |
||
| 1260 | * ``` |
||
| 1261 | * |
||
| 1262 | * @param $formSelector |
||
| 1263 | * @param $params |
||
| 1264 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
| 1265 | */ |
||
| 1266 | public function seeInFormFields($formSelector, $params) { |
||
| 1269 | |||
| 1270 | |||
| 1271 | /** |
||
| 1272 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1273 | * |
||
| 1274 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1275 | * the passed selector. |
||
| 1276 | * |
||
| 1277 | * ``` php |
||
| 1278 | * <?php |
||
| 1279 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1280 | * 'input1' => 'non-existent value', |
||
| 1281 | * 'input2' => 'other non-existent value', |
||
| 1282 | * ]); |
||
| 1283 | * ?> |
||
| 1284 | * ``` |
||
| 1285 | * |
||
| 1286 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1287 | * as the value: |
||
| 1288 | * |
||
| 1289 | * ``` php |
||
| 1290 | * <?php |
||
| 1291 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1292 | * 'fieldName' => [ |
||
| 1293 | * 'This value shouldn\'t be set', |
||
| 1294 | * 'And this value shouldn\'t be set', |
||
| 1295 | * ], |
||
| 1296 | * ]); |
||
| 1297 | * ?> |
||
| 1298 | * ``` |
||
| 1299 | * |
||
| 1300 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1301 | * |
||
| 1302 | * ``` php |
||
| 1303 | * <?php |
||
| 1304 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1305 | * 'checkbox1' => true, // fails if checked |
||
| 1306 | * 'checkbox2' => false, // fails if unchecked |
||
| 1307 | * ]); |
||
| 1308 | * ?> |
||
| 1309 | * ``` |
||
| 1310 | * |
||
| 1311 | * @param $formSelector |
||
| 1312 | * @param $params |
||
| 1313 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1314 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
| 1315 | */ |
||
| 1316 | public function cantSeeInFormFields($formSelector, $params) { |
||
| 1319 | /** |
||
| 1320 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1321 | * |
||
| 1322 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1323 | * the passed selector. |
||
| 1324 | * |
||
| 1325 | * ``` php |
||
| 1326 | * <?php |
||
| 1327 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1328 | * 'input1' => 'non-existent value', |
||
| 1329 | * 'input2' => 'other non-existent value', |
||
| 1330 | * ]); |
||
| 1331 | * ?> |
||
| 1332 | * ``` |
||
| 1333 | * |
||
| 1334 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1335 | * as the value: |
||
| 1336 | * |
||
| 1337 | * ``` php |
||
| 1338 | * <?php |
||
| 1339 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1340 | * 'fieldName' => [ |
||
| 1341 | * 'This value shouldn\'t be set', |
||
| 1342 | * 'And this value shouldn\'t be set', |
||
| 1343 | * ], |
||
| 1344 | * ]); |
||
| 1345 | * ?> |
||
| 1346 | * ``` |
||
| 1347 | * |
||
| 1348 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1349 | * |
||
| 1350 | * ``` php |
||
| 1351 | * <?php |
||
| 1352 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1353 | * 'checkbox1' => true, // fails if checked |
||
| 1354 | * 'checkbox2' => false, // fails if unchecked |
||
| 1355 | * ]); |
||
| 1356 | * ?> |
||
| 1357 | * ``` |
||
| 1358 | * |
||
| 1359 | * @param $formSelector |
||
| 1360 | * @param $params |
||
| 1361 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
| 1362 | */ |
||
| 1363 | public function dontSeeInFormFields($formSelector, $params) { |
||
| 1366 | |||
| 1367 | |||
| 1368 | /** |
||
| 1369 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1370 | * |
||
| 1371 | * Submits the given form on the page, optionally with the given form |
||
| 1372 | * values. Pass the form field's values as an array in the second |
||
| 1373 | * parameter. |
||
| 1374 | * |
||
| 1375 | * Although this function can be used as a short-hand version of |
||
| 1376 | * `fillField()`, `selectOption()`, `click()` etc. it has some important |
||
| 1377 | * differences: |
||
| 1378 | * |
||
| 1379 | * * Only field *names* may be used, not CSS/XPath selectors nor field labels |
||
| 1380 | * * If a field is sent to this function that does *not* exist on the page, |
||
| 1381 | * it will silently be added to the HTTP request. This is helpful for testing |
||
| 1382 | * some types of forms, but be aware that you will *not* get an exception |
||
| 1383 | * like you would if you called `fillField()` or `selectOption()` with |
||
| 1384 | * a missing field. |
||
| 1385 | * |
||
| 1386 | * Fields that are not provided will be filled by their values from the page, |
||
| 1387 | * or from any previous calls to `fillField()`, `selectOption()` etc. |
||
| 1388 | * You don't need to click the 'Submit' button afterwards. |
||
| 1389 | * This command itself triggers the request to form's action. |
||
| 1390 | * |
||
| 1391 | * You can optionally specify which button's value to include |
||
| 1392 | * in the request with the last parameter (as an alternative to |
||
| 1393 | * explicitly setting its value in the second parameter), as |
||
| 1394 | * button values are not otherwise included in the request. |
||
| 1395 | * |
||
| 1396 | * Examples: |
||
| 1397 | * |
||
| 1398 | * ``` php |
||
| 1399 | * <?php |
||
| 1400 | * $I->submitForm('#login', [ |
||
| 1401 | * 'login' => 'davert', |
||
| 1402 | * 'password' => '123456' |
||
| 1403 | * ]); |
||
| 1404 | * // or |
||
| 1405 | * $I->submitForm('#login', [ |
||
| 1406 | * 'login' => 'davert', |
||
| 1407 | * 'password' => '123456' |
||
| 1408 | * ], 'submitButtonName'); |
||
| 1409 | * |
||
| 1410 | * ``` |
||
| 1411 | * |
||
| 1412 | * For example, given this sample "Sign Up" form: |
||
| 1413 | * |
||
| 1414 | * ``` html |
||
| 1415 | * <form action="/sign_up"> |
||
| 1416 | * Login: |
||
| 1417 | * <input type="text" name="user[login]" /><br/> |
||
| 1418 | * Password: |
||
| 1419 | * <input type="password" name="user[password]" /><br/> |
||
| 1420 | * Do you agree to our terms? |
||
| 1421 | * <input type="checkbox" name="user[agree]" /><br/> |
||
| 1422 | * Select pricing plan: |
||
| 1423 | * <select name="plan"> |
||
| 1424 | * <option value="1">Free</option> |
||
| 1425 | * <option value="2" selected="selected">Paid</option> |
||
| 1426 | * </select> |
||
| 1427 | * <input type="submit" name="submitButton" value="Submit" /> |
||
| 1428 | * </form> |
||
| 1429 | * ``` |
||
| 1430 | * |
||
| 1431 | * You could write the following to submit it: |
||
| 1432 | * |
||
| 1433 | * ``` php |
||
| 1434 | * <?php |
||
| 1435 | * $I->submitForm( |
||
| 1436 | * '#userForm', |
||
| 1437 | * [ |
||
| 1438 | * 'user' => [ |
||
| 1439 | * 'login' => 'Davert', |
||
| 1440 | * 'password' => '123456', |
||
| 1441 | * 'agree' => true |
||
| 1442 | * ] |
||
| 1443 | * ], |
||
| 1444 | * 'submitButton' |
||
| 1445 | * ); |
||
| 1446 | * ``` |
||
| 1447 | * Note that "2" will be the submitted value for the "plan" field, as it is |
||
| 1448 | * the selected option. |
||
| 1449 | * |
||
| 1450 | * You can also emulate a JavaScript submission by not specifying any |
||
| 1451 | * buttons in the third parameter to submitForm. |
||
| 1452 | * |
||
| 1453 | * ```php |
||
| 1454 | * <?php |
||
| 1455 | * $I->submitForm( |
||
| 1456 | * '#userForm', |
||
| 1457 | * [ |
||
| 1458 | * 'user' => [ |
||
| 1459 | * 'login' => 'Davert', |
||
| 1460 | * 'password' => '123456', |
||
| 1461 | * 'agree' => true |
||
| 1462 | * ] |
||
| 1463 | * ] |
||
| 1464 | * ); |
||
| 1465 | * ``` |
||
| 1466 | * |
||
| 1467 | * This function works well when paired with `seeInFormFields()` |
||
| 1468 | * for quickly testing CRUD interfaces and form validation logic. |
||
| 1469 | * |
||
| 1470 | * ``` php |
||
| 1471 | * <?php |
||
| 1472 | * $form = [ |
||
| 1473 | * 'field1' => 'value', |
||
| 1474 | * 'field2' => 'another value', |
||
| 1475 | * 'checkbox1' => true, |
||
| 1476 | * // ... |
||
| 1477 | * ]; |
||
| 1478 | * $I->submitForm('#my-form', $form, 'submitButton'); |
||
| 1479 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1480 | * $I->seeInFormFields('#my-form', $form); |
||
| 1481 | * ``` |
||
| 1482 | * |
||
| 1483 | * Parameter values can be set to arrays for multiple input fields |
||
| 1484 | * of the same name, or multi-select combo boxes. For checkboxes, |
||
| 1485 | * you can use either the string value or boolean `true`/`false` which will |
||
| 1486 | * be replaced by the checkbox's value in the DOM. |
||
| 1487 | * |
||
| 1488 | * ``` php |
||
| 1489 | * <?php |
||
| 1490 | * $I->submitForm('#my-form', [ |
||
| 1491 | * 'field1' => 'value', |
||
| 1492 | * 'checkbox' => [ |
||
| 1493 | * 'value of first checkbox', |
||
| 1494 | * 'value of second checkbox', |
||
| 1495 | * ], |
||
| 1496 | * 'otherCheckboxes' => [ |
||
| 1497 | * true, |
||
| 1498 | * false, |
||
| 1499 | * false |
||
| 1500 | * ], |
||
| 1501 | * 'multiselect' => [ |
||
| 1502 | * 'first option value', |
||
| 1503 | * 'second option value' |
||
| 1504 | * ] |
||
| 1505 | * ]); |
||
| 1506 | * ``` |
||
| 1507 | * |
||
| 1508 | * Mixing string and boolean values for a checkbox's value is not supported |
||
| 1509 | * and may produce unexpected results. |
||
| 1510 | * |
||
| 1511 | * Field names ending in `[]` must be passed without the trailing square |
||
| 1512 | * bracket characters, and must contain an array for its value. This allows |
||
| 1513 | * submitting multiple values with the same name, consider: |
||
| 1514 | * |
||
| 1515 | * ```php |
||
| 1516 | * <?php |
||
| 1517 | * // This will NOT work correctly |
||
| 1518 | * $I->submitForm('#my-form', [ |
||
| 1519 | * 'field[]' => 'value', |
||
| 1520 | * 'field[]' => 'another value', // 'field[]' is already a defined key |
||
| 1521 | * ]); |
||
| 1522 | * ``` |
||
| 1523 | * |
||
| 1524 | * The solution is to pass an array value: |
||
| 1525 | * |
||
| 1526 | * ```php |
||
| 1527 | * <?php |
||
| 1528 | * // This way both values are submitted |
||
| 1529 | * $I->submitForm('#my-form', [ |
||
| 1530 | * 'field' => [ |
||
| 1531 | * 'value', |
||
| 1532 | * 'another value', |
||
| 1533 | * ] |
||
| 1534 | * ]); |
||
| 1535 | * ``` |
||
| 1536 | * |
||
| 1537 | * @param $selector |
||
| 1538 | * @param $params |
||
| 1539 | * @param $button |
||
| 1540 | * @see \Codeception\Lib\InnerBrowser::submitForm() |
||
| 1541 | */ |
||
| 1542 | public function submitForm($selector, $params, $button = null) { |
||
| 1545 | |||
| 1546 | |||
| 1547 | /** |
||
| 1548 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1549 | * |
||
| 1550 | * Fills a text field or textarea with the given string. |
||
| 1551 | * |
||
| 1552 | * ``` php |
||
| 1553 | * <?php |
||
| 1554 | * $I->fillField("//input[@type='text']", "Hello World!"); |
||
| 1555 | * $I->fillField(['name' => 'email'], '[email protected]'); |
||
| 1556 | * ?> |
||
| 1557 | * ``` |
||
| 1558 | * |
||
| 1559 | * @param $field |
||
| 1560 | * @param $value |
||
| 1561 | * @see \Codeception\Lib\InnerBrowser::fillField() |
||
| 1562 | */ |
||
| 1563 | public function fillField($field, $value) { |
||
| 1566 | |||
| 1567 | |||
| 1568 | /** |
||
| 1569 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1570 | * |
||
| 1571 | * Selects an option in a select tag or in radio button group. |
||
| 1572 | * |
||
| 1573 | * ``` php |
||
| 1574 | * <?php |
||
| 1575 | * $I->selectOption('form select[name=account]', 'Premium'); |
||
| 1576 | * $I->selectOption('form input[name=payment]', 'Monthly'); |
||
| 1577 | * $I->selectOption('//form/select[@name=account]', 'Monthly'); |
||
| 1578 | * ?> |
||
| 1579 | * ``` |
||
| 1580 | * |
||
| 1581 | * Provide an array for the second argument to select multiple options: |
||
| 1582 | * |
||
| 1583 | * ``` php |
||
| 1584 | * <?php |
||
| 1585 | * $I->selectOption('Which OS do you use?', array('Windows','Linux')); |
||
| 1586 | * ?> |
||
| 1587 | * ``` |
||
| 1588 | * |
||
| 1589 | * Or provide an associative array for the second argument to specifically define which selection method should be used: |
||
| 1590 | * |
||
| 1591 | * ``` php |
||
| 1592 | * <?php |
||
| 1593 | * $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' |
||
| 1594 | * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' |
||
| 1595 | * ?> |
||
| 1596 | * ``` |
||
| 1597 | * |
||
| 1598 | * @param $select |
||
| 1599 | * @param $option |
||
| 1600 | * @see \Codeception\Lib\InnerBrowser::selectOption() |
||
| 1601 | */ |
||
| 1602 | public function selectOption($select, $option) { |
||
| 1605 | |||
| 1606 | |||
| 1607 | /** |
||
| 1608 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1609 | * |
||
| 1610 | * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. |
||
| 1611 | * |
||
| 1612 | * ``` php |
||
| 1613 | * <?php |
||
| 1614 | * $I->checkOption('#agree'); |
||
| 1615 | * ?> |
||
| 1616 | * ``` |
||
| 1617 | * |
||
| 1618 | * @param $option |
||
| 1619 | * @see \Codeception\Lib\InnerBrowser::checkOption() |
||
| 1620 | */ |
||
| 1621 | public function checkOption($option) { |
||
| 1624 | |||
| 1625 | |||
| 1626 | /** |
||
| 1627 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1628 | * |
||
| 1629 | * Unticks a checkbox. |
||
| 1630 | * |
||
| 1631 | * ``` php |
||
| 1632 | * <?php |
||
| 1633 | * $I->uncheckOption('#notify'); |
||
| 1634 | * ?> |
||
| 1635 | * ``` |
||
| 1636 | * |
||
| 1637 | * @param $option |
||
| 1638 | * @see \Codeception\Lib\InnerBrowser::uncheckOption() |
||
| 1639 | */ |
||
| 1640 | public function uncheckOption($option) { |
||
| 1643 | |||
| 1644 | |||
| 1645 | /** |
||
| 1646 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1647 | * |
||
| 1648 | * Attaches a file relative to the Codeception data directory to the given file upload field. |
||
| 1649 | * |
||
| 1650 | * ``` php |
||
| 1651 | * <?php |
||
| 1652 | * // file is stored in 'tests/_data/prices.xls' |
||
| 1653 | * $I->attachFile('input[@type="file"]', 'prices.xls'); |
||
| 1654 | * ?> |
||
| 1655 | * ``` |
||
| 1656 | * |
||
| 1657 | * @param $field |
||
| 1658 | * @param $filename |
||
| 1659 | * @see \Codeception\Lib\InnerBrowser::attachFile() |
||
| 1660 | */ |
||
| 1661 | public function attachFile($field, $filename) { |
||
| 1664 | |||
| 1665 | |||
| 1666 | /** |
||
| 1667 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1668 | * |
||
| 1669 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1670 | * This action sends a GET ajax request with specified params. |
||
| 1671 | * |
||
| 1672 | * See ->sendAjaxPostRequest for examples. |
||
| 1673 | * |
||
| 1674 | * @param $uri |
||
| 1675 | * @param $params |
||
| 1676 | * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() |
||
| 1677 | */ |
||
| 1678 | public function sendAjaxGetRequest($uri, $params = null) { |
||
| 1681 | |||
| 1682 | |||
| 1683 | /** |
||
| 1684 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1685 | * |
||
| 1686 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1687 | * This action sends a POST ajax request with specified params. |
||
| 1688 | * Additional params can be passed as array. |
||
| 1689 | * |
||
| 1690 | * Example: |
||
| 1691 | * |
||
| 1692 | * Imagine that by clicking checkbox you trigger ajax request which updates user settings. |
||
| 1693 | * We emulate that click by running this ajax request manually. |
||
| 1694 | * |
||
| 1695 | * ``` php |
||
| 1696 | * <?php |
||
| 1697 | * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST |
||
| 1698 | * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET |
||
| 1699 | * |
||
| 1700 | * ``` |
||
| 1701 | * |
||
| 1702 | * @param $uri |
||
| 1703 | * @param $params |
||
| 1704 | * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() |
||
| 1705 | */ |
||
| 1706 | public function sendAjaxPostRequest($uri, $params = null) { |
||
| 1709 | |||
| 1710 | |||
| 1711 | /** |
||
| 1712 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1713 | * |
||
| 1714 | * If your page triggers an ajax request, you can perform it manually. |
||
| 1715 | * This action sends an ajax request with specified method and params. |
||
| 1716 | * |
||
| 1717 | * Example: |
||
| 1718 | * |
||
| 1719 | * You need to perform an ajax request specifying the HTTP method. |
||
| 1720 | * |
||
| 1721 | * ``` php |
||
| 1722 | * <?php |
||
| 1723 | * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); |
||
| 1724 | * |
||
| 1725 | * ``` |
||
| 1726 | * |
||
| 1727 | * @param $method |
||
| 1728 | * @param $uri |
||
| 1729 | * @param $params |
||
| 1730 | * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() |
||
| 1731 | */ |
||
| 1732 | public function sendAjaxRequest($method, $uri, $params = null) { |
||
| 1735 | |||
| 1736 | |||
| 1737 | /** |
||
| 1738 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1739 | * |
||
| 1740 | * Finds and returns the text contents of the given element. |
||
| 1741 | * If a fuzzy locator is used, the element is found using CSS, XPath, |
||
| 1742 | * and by matching the full page source by regular expression. |
||
| 1743 | * |
||
| 1744 | * ``` php |
||
| 1745 | * <?php |
||
| 1746 | * $heading = $I->grabTextFrom('h1'); |
||
| 1747 | * $heading = $I->grabTextFrom('descendant-or-self::h1'); |
||
| 1748 | * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex |
||
| 1749 | * ?> |
||
| 1750 | * ``` |
||
| 1751 | * |
||
| 1752 | * @param $cssOrXPathOrRegex |
||
| 1753 | * |
||
| 1754 | * @return mixed |
||
| 1755 | * @see \Codeception\Lib\InnerBrowser::grabTextFrom() |
||
| 1756 | */ |
||
| 1757 | public function grabTextFrom($cssOrXPathOrRegex) { |
||
| 1760 | |||
| 1761 | |||
| 1762 | /** |
||
| 1763 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1764 | * |
||
| 1765 | * Grabs the value of the given attribute value from the given element. |
||
| 1766 | * Fails if element is not found. |
||
| 1767 | * |
||
| 1768 | * ``` php |
||
| 1769 | * <?php |
||
| 1770 | * $I->grabAttributeFrom('#tooltip', 'title'); |
||
| 1771 | * ?> |
||
| 1772 | * ``` |
||
| 1773 | * |
||
| 1774 | * |
||
| 1775 | * @param $cssOrXpath |
||
| 1776 | * @param $attribute |
||
| 1777 | * |
||
| 1778 | * @return mixed |
||
| 1779 | * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() |
||
| 1780 | */ |
||
| 1781 | public function grabAttributeFrom($cssOrXpath, $attribute) { |
||
| 1784 | |||
| 1785 | |||
| 1786 | /** |
||
| 1787 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1788 | * |
||
| 1789 | * Grabs either the text content, or attribute values, of nodes |
||
| 1790 | * matched by $cssOrXpath and returns them as an array. |
||
| 1791 | * |
||
| 1792 | * ```html |
||
| 1793 | * <a href="#first">First</a> |
||
| 1794 | * <a href="#second">Second</a> |
||
| 1795 | * <a href="#third">Third</a> |
||
| 1796 | * ``` |
||
| 1797 | * |
||
| 1798 | * ```php |
||
| 1799 | * <?php |
||
| 1800 | * // would return ['First', 'Second', 'Third'] |
||
| 1801 | * $aLinkText = $I->grabMultiple('a'); |
||
| 1802 | * |
||
| 1803 | * // would return ['#first', '#second', '#third'] |
||
| 1804 | * $aLinks = $I->grabMultiple('a', 'href'); |
||
| 1805 | * ?> |
||
| 1806 | * ``` |
||
| 1807 | * |
||
| 1808 | * @param $cssOrXpath |
||
| 1809 | * @param $attribute |
||
| 1810 | * @return string[] |
||
| 1811 | * @see \Codeception\Lib\InnerBrowser::grabMultiple() |
||
| 1812 | */ |
||
| 1813 | public function grabMultiple($cssOrXpath, $attribute = null) { |
||
| 1816 | |||
| 1817 | |||
| 1818 | /** |
||
| 1819 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1820 | * |
||
| 1821 | * @param $field |
||
| 1822 | * |
||
| 1823 | * @return array|mixed|null|string |
||
| 1824 | * @see \Codeception\Lib\InnerBrowser::grabValueFrom() |
||
| 1825 | */ |
||
| 1826 | public function grabValueFrom($field) { |
||
| 1829 | |||
| 1830 | |||
| 1831 | /** |
||
| 1832 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1833 | * |
||
| 1834 | * Sets a cookie with the given name and value. |
||
| 1835 | * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. |
||
| 1836 | * |
||
| 1837 | * ``` php |
||
| 1838 | * <?php |
||
| 1839 | * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); |
||
| 1840 | * ?> |
||
| 1841 | * ``` |
||
| 1842 | * |
||
| 1843 | * @param $name |
||
| 1844 | * @param $val |
||
| 1845 | * @param array $params |
||
| 1846 | * |
||
| 1847 | * @return mixed |
||
| 1848 | * @see \Codeception\Lib\InnerBrowser::setCookie() |
||
| 1849 | */ |
||
| 1850 | public function setCookie($name, $val, $params = null) { |
||
| 1853 | |||
| 1854 | |||
| 1855 | /** |
||
| 1856 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1857 | * |
||
| 1858 | * Grabs a cookie value. |
||
| 1859 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 1860 | * |
||
| 1861 | * @param $cookie |
||
| 1862 | * |
||
| 1863 | * @param array $params |
||
| 1864 | * @return mixed |
||
| 1865 | * @see \Codeception\Lib\InnerBrowser::grabCookie() |
||
| 1866 | */ |
||
| 1867 | public function grabCookie($cookie, $params = null) { |
||
| 1870 | |||
| 1871 | |||
| 1872 | /** |
||
| 1873 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1874 | * |
||
| 1875 | * Grabs current page source code. |
||
| 1876 | * |
||
| 1877 | * @throws ModuleException if no page was opened. |
||
| 1878 | * |
||
| 1879 | * @return string Current page source code. |
||
| 1880 | * @see \Codeception\Lib\InnerBrowser::grabPageSource() |
||
| 1881 | */ |
||
| 1882 | public function grabPageSource() { |
||
| 1885 | |||
| 1886 | |||
| 1887 | /** |
||
| 1888 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1889 | * |
||
| 1890 | * Checks that a cookie with the given name is set. |
||
| 1891 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1892 | * |
||
| 1893 | * ``` php |
||
| 1894 | * <?php |
||
| 1895 | * $I->seeCookie('PHPSESSID'); |
||
| 1896 | * ?> |
||
| 1897 | * ``` |
||
| 1898 | * |
||
| 1899 | * @param $cookie |
||
| 1900 | * @param array $params |
||
| 1901 | * @return mixed |
||
| 1902 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1903 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
| 1904 | */ |
||
| 1905 | public function canSeeCookie($cookie, $params = null) { |
||
| 1908 | /** |
||
| 1909 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1910 | * |
||
| 1911 | * Checks that a cookie with the given name is set. |
||
| 1912 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1913 | * |
||
| 1914 | * ``` php |
||
| 1915 | * <?php |
||
| 1916 | * $I->seeCookie('PHPSESSID'); |
||
| 1917 | * ?> |
||
| 1918 | * ``` |
||
| 1919 | * |
||
| 1920 | * @param $cookie |
||
| 1921 | * @param array $params |
||
| 1922 | * @return mixed |
||
| 1923 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
| 1924 | */ |
||
| 1925 | public function seeCookie($cookie, $params = null) { |
||
| 1928 | |||
| 1929 | |||
| 1930 | /** |
||
| 1931 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1932 | * |
||
| 1933 | * Checks that there isn't a cookie with the given name. |
||
| 1934 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1935 | * |
||
| 1936 | * @param $cookie |
||
| 1937 | * |
||
| 1938 | * @param array $params |
||
| 1939 | * @return mixed |
||
| 1940 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1941 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
| 1942 | */ |
||
| 1943 | public function cantSeeCookie($cookie, $params = null) { |
||
| 1946 | /** |
||
| 1947 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1948 | * |
||
| 1949 | * Checks that there isn't a cookie with the given name. |
||
| 1950 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 1951 | * |
||
| 1952 | * @param $cookie |
||
| 1953 | * |
||
| 1954 | * @param array $params |
||
| 1955 | * @return mixed |
||
| 1956 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
| 1957 | */ |
||
| 1958 | public function dontSeeCookie($cookie, $params = null) { |
||
| 1961 | |||
| 1962 | |||
| 1963 | /** |
||
| 1964 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1965 | * |
||
| 1966 | * Unsets cookie with the given name. |
||
| 1967 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 1968 | * |
||
| 1969 | * @param $cookie |
||
| 1970 | * |
||
| 1971 | * @param array $params |
||
| 1972 | * @return mixed |
||
| 1973 | * @see \Codeception\Lib\InnerBrowser::resetCookie() |
||
| 1974 | */ |
||
| 1975 | public function resetCookie($name, $params = null) { |
||
| 1978 | |||
| 1979 | |||
| 1980 | /** |
||
| 1981 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1982 | * |
||
| 1983 | * Checks that the given element exists on the page and is visible. |
||
| 1984 | * You can also specify expected attributes of this element. |
||
| 1985 | * |
||
| 1986 | * ``` php |
||
| 1987 | * <?php |
||
| 1988 | * $I->seeElement('.error'); |
||
| 1989 | * $I->seeElement('//form/input[1]'); |
||
| 1990 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1991 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1992 | * |
||
| 1993 | * // strict locator in first arg, attributes in second |
||
| 1994 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1995 | * ?> |
||
| 1996 | * ``` |
||
| 1997 | * |
||
| 1998 | * @param $selector |
||
| 1999 | * @param array $attributes |
||
| 2000 | * @return |
||
| 2001 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2002 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
| 2003 | */ |
||
| 2004 | public function canSeeElement($selector, $attributes = null) { |
||
| 2007 | /** |
||
| 2008 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2009 | * |
||
| 2010 | * Checks that the given element exists on the page and is visible. |
||
| 2011 | * You can also specify expected attributes of this element. |
||
| 2012 | * |
||
| 2013 | * ``` php |
||
| 2014 | * <?php |
||
| 2015 | * $I->seeElement('.error'); |
||
| 2016 | * $I->seeElement('//form/input[1]'); |
||
| 2017 | * $I->seeElement('input', ['name' => 'login']); |
||
| 2018 | * $I->seeElement('input', ['value' => '123456']); |
||
| 2019 | * |
||
| 2020 | * // strict locator in first arg, attributes in second |
||
| 2021 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 2022 | * ?> |
||
| 2023 | * ``` |
||
| 2024 | * |
||
| 2025 | * @param $selector |
||
| 2026 | * @param array $attributes |
||
| 2027 | * @return |
||
| 2028 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
| 2029 | */ |
||
| 2030 | public function seeElement($selector, $attributes = null) { |
||
| 2033 | |||
| 2034 | |||
| 2035 | /** |
||
| 2036 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2037 | * |
||
| 2038 | * Checks that the given element is invisible or not present on the page. |
||
| 2039 | * You can also specify expected attributes of this element. |
||
| 2040 | * |
||
| 2041 | * ``` php |
||
| 2042 | * <?php |
||
| 2043 | * $I->dontSeeElement('.error'); |
||
| 2044 | * $I->dontSeeElement('//form/input[1]'); |
||
| 2045 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 2046 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 2047 | * ?> |
||
| 2048 | * ``` |
||
| 2049 | * |
||
| 2050 | * @param $selector |
||
| 2051 | * @param array $attributes |
||
| 2052 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2053 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
| 2054 | */ |
||
| 2055 | public function cantSeeElement($selector, $attributes = null) { |
||
| 2058 | /** |
||
| 2059 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2060 | * |
||
| 2061 | * Checks that the given element is invisible or not present on the page. |
||
| 2062 | * You can also specify expected attributes of this element. |
||
| 2063 | * |
||
| 2064 | * ``` php |
||
| 2065 | * <?php |
||
| 2066 | * $I->dontSeeElement('.error'); |
||
| 2067 | * $I->dontSeeElement('//form/input[1]'); |
||
| 2068 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 2069 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 2070 | * ?> |
||
| 2071 | * ``` |
||
| 2072 | * |
||
| 2073 | * @param $selector |
||
| 2074 | * @param array $attributes |
||
| 2075 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
| 2076 | */ |
||
| 2077 | public function dontSeeElement($selector, $attributes = null) { |
||
| 2080 | |||
| 2081 | |||
| 2082 | /** |
||
| 2083 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2084 | * |
||
| 2085 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 2086 | * |
||
| 2087 | * ``` php |
||
| 2088 | * <?php |
||
| 2089 | * $I->seeNumberOfElements('tr', 10); |
||
| 2090 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
| 2091 | * ?> |
||
| 2092 | * ``` |
||
| 2093 | * @param $selector |
||
| 2094 | * @param mixed $expected : |
||
| 2095 | * - string: strict number |
||
| 2096 | * - array: range of numbers [0,10] |
||
| 2097 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2098 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
| 2099 | */ |
||
| 2100 | public function canSeeNumberOfElements($selector, $expected) { |
||
| 2103 | /** |
||
| 2104 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2105 | * |
||
| 2106 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 2107 | * |
||
| 2108 | * ``` php |
||
| 2109 | * <?php |
||
| 2110 | * $I->seeNumberOfElements('tr', 10); |
||
| 2111 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
| 2112 | * ?> |
||
| 2113 | * ``` |
||
| 2114 | * @param $selector |
||
| 2115 | * @param mixed $expected : |
||
| 2116 | * - string: strict number |
||
| 2117 | * - array: range of numbers [0,10] |
||
| 2118 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
| 2119 | */ |
||
| 2120 | public function seeNumberOfElements($selector, $expected) { |
||
| 2123 | |||
| 2124 | |||
| 2125 | /** |
||
| 2126 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2127 | * |
||
| 2128 | * Checks that the given option is selected. |
||
| 2129 | * |
||
| 2130 | * ``` php |
||
| 2131 | * <?php |
||
| 2132 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 2133 | * ?> |
||
| 2134 | * ``` |
||
| 2135 | * |
||
| 2136 | * @param $selector |
||
| 2137 | * @param $optionText |
||
| 2138 | * |
||
| 2139 | * @return mixed |
||
| 2140 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2141 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
| 2142 | */ |
||
| 2143 | public function canSeeOptionIsSelected($selector, $optionText) { |
||
| 2146 | /** |
||
| 2147 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2148 | * |
||
| 2149 | * Checks that the given option is selected. |
||
| 2150 | * |
||
| 2151 | * ``` php |
||
| 2152 | * <?php |
||
| 2153 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 2154 | * ?> |
||
| 2155 | * ``` |
||
| 2156 | * |
||
| 2157 | * @param $selector |
||
| 2158 | * @param $optionText |
||
| 2159 | * |
||
| 2160 | * @return mixed |
||
| 2161 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
| 2162 | */ |
||
| 2163 | public function seeOptionIsSelected($selector, $optionText) { |
||
| 2166 | |||
| 2167 | |||
| 2168 | /** |
||
| 2169 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2170 | * |
||
| 2171 | * Checks that the given option is not selected. |
||
| 2172 | * |
||
| 2173 | * ``` php |
||
| 2174 | * <?php |
||
| 2175 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 2176 | * ?> |
||
| 2177 | * ``` |
||
| 2178 | * |
||
| 2179 | * @param $selector |
||
| 2180 | * @param $optionText |
||
| 2181 | * |
||
| 2182 | * @return mixed |
||
| 2183 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2184 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
| 2185 | */ |
||
| 2186 | public function cantSeeOptionIsSelected($selector, $optionText) { |
||
| 2189 | /** |
||
| 2190 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2191 | * |
||
| 2192 | * Checks that the given option is not selected. |
||
| 2193 | * |
||
| 2194 | * ``` php |
||
| 2195 | * <?php |
||
| 2196 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 2197 | * ?> |
||
| 2198 | * ``` |
||
| 2199 | * |
||
| 2200 | * @param $selector |
||
| 2201 | * @param $optionText |
||
| 2202 | * |
||
| 2203 | * @return mixed |
||
| 2204 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
| 2205 | */ |
||
| 2206 | public function dontSeeOptionIsSelected($selector, $optionText) { |
||
| 2209 | |||
| 2210 | |||
| 2211 | /** |
||
| 2212 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2213 | * |
||
| 2214 | * Asserts that current page has 404 response status code. |
||
| 2215 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2216 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
| 2217 | */ |
||
| 2218 | public function canSeePageNotFound() { |
||
| 2221 | /** |
||
| 2222 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2223 | * |
||
| 2224 | * Asserts that current page has 404 response status code. |
||
| 2225 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
| 2226 | */ |
||
| 2227 | public function seePageNotFound() { |
||
| 2230 | |||
| 2231 | |||
| 2232 | /** |
||
| 2233 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2234 | * |
||
| 2235 | * Checks that response code is equal to value provided. |
||
| 2236 | * |
||
| 2237 | * ```php |
||
| 2238 | * <?php |
||
| 2239 | * $I->seeResponseCodeIs(200); |
||
| 2240 | * |
||
| 2241 | * // recommended \Codeception\Util\HttpCode |
||
| 2242 | * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
| 2243 | * ``` |
||
| 2244 | * |
||
| 2245 | * @param $code |
||
| 2246 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2247 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
| 2248 | */ |
||
| 2249 | public function canSeeResponseCodeIs($code) { |
||
| 2252 | /** |
||
| 2253 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2254 | * |
||
| 2255 | * Checks that response code is equal to value provided. |
||
| 2256 | * |
||
| 2257 | * ```php |
||
| 2258 | * <?php |
||
| 2259 | * $I->seeResponseCodeIs(200); |
||
| 2260 | * |
||
| 2261 | * // recommended \Codeception\Util\HttpCode |
||
| 2262 | * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
| 2263 | * ``` |
||
| 2264 | * |
||
| 2265 | * @param $code |
||
| 2266 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
| 2267 | */ |
||
| 2268 | public function seeResponseCodeIs($code) { |
||
| 2271 | |||
| 2272 | |||
| 2273 | /** |
||
| 2274 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2275 | * |
||
| 2276 | * Checks that response code is equal to value provided. |
||
| 2277 | * |
||
| 2278 | * ```php |
||
| 2279 | * <?php |
||
| 2280 | * $I->dontSeeResponseCodeIs(200); |
||
| 2281 | * |
||
| 2282 | * // recommended \Codeception\Util\HttpCode |
||
| 2283 | * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
| 2284 | * ``` |
||
| 2285 | * @param $code |
||
| 2286 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2287 | * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() |
||
| 2288 | */ |
||
| 2289 | public function cantSeeResponseCodeIs($code) { |
||
| 2292 | /** |
||
| 2293 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2294 | * |
||
| 2295 | * Checks that response code is equal to value provided. |
||
| 2296 | * |
||
| 2297 | * ```php |
||
| 2298 | * <?php |
||
| 2299 | * $I->dontSeeResponseCodeIs(200); |
||
| 2300 | * |
||
| 2301 | * // recommended \Codeception\Util\HttpCode |
||
| 2302 | * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
| 2303 | * ``` |
||
| 2304 | * @param $code |
||
| 2305 | * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() |
||
| 2306 | */ |
||
| 2307 | public function dontSeeResponseCodeIs($code) { |
||
| 2310 | |||
| 2311 | |||
| 2312 | /** |
||
| 2313 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2314 | * |
||
| 2315 | * Checks that the page title contains the given string. |
||
| 2316 | * |
||
| 2317 | * ``` php |
||
| 2318 | * <?php |
||
| 2319 | * $I->seeInTitle('Blog - Post #1'); |
||
| 2320 | * ?> |
||
| 2321 | * ``` |
||
| 2322 | * |
||
| 2323 | * @param $title |
||
| 2324 | * |
||
| 2325 | * @return mixed |
||
| 2326 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2327 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
| 2328 | */ |
||
| 2329 | public function canSeeInTitle($title) { |
||
| 2332 | /** |
||
| 2333 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2334 | * |
||
| 2335 | * Checks that the page title contains the given string. |
||
| 2336 | * |
||
| 2337 | * ``` php |
||
| 2338 | * <?php |
||
| 2339 | * $I->seeInTitle('Blog - Post #1'); |
||
| 2340 | * ?> |
||
| 2341 | * ``` |
||
| 2342 | * |
||
| 2343 | * @param $title |
||
| 2344 | * |
||
| 2345 | * @return mixed |
||
| 2346 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
| 2347 | */ |
||
| 2348 | public function seeInTitle($title) { |
||
| 2351 | |||
| 2352 | |||
| 2353 | /** |
||
| 2354 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2355 | * |
||
| 2356 | * Checks that the page title does not contain the given string. |
||
| 2357 | * |
||
| 2358 | * @param $title |
||
| 2359 | * |
||
| 2360 | * @return mixed |
||
| 2361 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2362 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
| 2363 | */ |
||
| 2364 | public function cantSeeInTitle($title) { |
||
| 2367 | /** |
||
| 2368 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2369 | * |
||
| 2370 | * Checks that the page title does not contain the given string. |
||
| 2371 | * |
||
| 2372 | * @param $title |
||
| 2373 | * |
||
| 2374 | * @return mixed |
||
| 2375 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
| 2376 | */ |
||
| 2377 | public function dontSeeInTitle($title) { |
||
| 2380 | |||
| 2381 | |||
| 2382 | /** |
||
| 2383 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2384 | * |
||
| 2385 | * Switch to iframe or frame on the page. |
||
| 2386 | * |
||
| 2387 | * Example: |
||
| 2388 | * ``` html |
||
| 2389 | * <iframe name="another_frame" src="http://example.com"> |
||
| 2390 | * ``` |
||
| 2391 | * |
||
| 2392 | * ``` php |
||
| 2393 | * <?php |
||
| 2394 | * # switch to iframe |
||
| 2395 | * $I->switchToIframe("another_frame"); |
||
| 2396 | * ``` |
||
| 2397 | * |
||
| 2398 | * @param string $name |
||
| 2399 | * @see \Codeception\Lib\InnerBrowser::switchToIframe() |
||
| 2400 | */ |
||
| 2401 | public function switchToIframe($name) { |
||
| 2404 | |||
| 2405 | |||
| 2406 | /** |
||
| 2407 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2408 | * |
||
| 2409 | * Moves back in history. |
||
| 2410 | * |
||
| 2411 | * @param int $numberOfSteps (default value 1) |
||
| 2412 | * @see \Codeception\Lib\InnerBrowser::moveBack() |
||
| 2413 | */ |
||
| 2414 | public function moveBack($numberOfSteps = null) { |
||
| 2417 | |||
| 2418 | |||
| 2419 | /** |
||
| 2420 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2421 | * |
||
| 2422 | * Performs $em->flush(); |
||
| 2423 | * @see \Codeception\Module\Doctrine2::flushToDatabase() |
||
| 2424 | */ |
||
| 2425 | public function flushToDatabase() { |
||
| 2428 | |||
| 2429 | |||
| 2430 | /** |
||
| 2431 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2432 | * |
||
| 2433 | * Adds entity to repository and flushes. You can redefine it's properties with the second parameter. |
||
| 2434 | * |
||
| 2435 | * Example: |
||
| 2436 | * |
||
| 2437 | * ``` php |
||
| 2438 | * <?php |
||
| 2439 | * $I->persistEntity(new \Entity\User, array('name' => 'Miles')); |
||
| 2440 | * $I->persistEntity($user, array('name' => 'Miles')); |
||
| 2441 | * ``` |
||
| 2442 | * |
||
| 2443 | * @param $obj |
||
| 2444 | * @param array $values |
||
| 2445 | * @see \Codeception\Module\Doctrine2::persistEntity() |
||
| 2446 | */ |
||
| 2447 | public function persistEntity($obj, $values = null) { |
||
| 2450 | |||
| 2451 | |||
| 2452 | /** |
||
| 2453 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2454 | * |
||
| 2455 | * Mocks the repository. |
||
| 2456 | * |
||
| 2457 | * With this action you can redefine any method of any repository. |
||
| 2458 | * Please, note: this fake repositories will be accessible through entity manager till the end of test. |
||
| 2459 | * |
||
| 2460 | * Example: |
||
| 2461 | * |
||
| 2462 | * ``` php |
||
| 2463 | * <?php |
||
| 2464 | * |
||
| 2465 | * $I->haveFakeRepository('Entity\User', array('findByUsername' => function($username) { return null; })); |
||
| 2466 | * |
||
| 2467 | * ``` |
||
| 2468 | * |
||
| 2469 | * This creates a stub class for Entity\User repository with redefined method findByUsername, |
||
| 2470 | * which will always return the NULL value. |
||
| 2471 | * |
||
| 2472 | * @param $classname |
||
| 2473 | * @param array $methods |
||
| 2474 | * @see \Codeception\Module\Doctrine2::haveFakeRepository() |
||
| 2475 | */ |
||
| 2476 | public function haveFakeRepository($classname, $methods = null) { |
||
| 2479 | |||
| 2480 | |||
| 2481 | /** |
||
| 2482 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2483 | * |
||
| 2484 | * Persists record into repository. |
||
| 2485 | * This method crates an entity, and sets its properties directly (via reflection). |
||
| 2486 | * Setters of entity won't be executed, but you can create almost any entity and save it to database. |
||
| 2487 | * Returns id using `getId` of newly created entity. |
||
| 2488 | * |
||
| 2489 | * ```php |
||
| 2490 | * $I->haveInRepository('Entity\User', array('name' => 'davert')); |
||
| 2491 | * ``` |
||
| 2492 | * @see \Codeception\Module\Doctrine2::haveInRepository() |
||
| 2493 | */ |
||
| 2494 | public function haveInRepository($entity, $data) { |
||
| 2497 | |||
| 2498 | |||
| 2499 | /** |
||
| 2500 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2501 | * |
||
| 2502 | * Flushes changes to database executes a query defined by array. |
||
| 2503 | * It builds query based on array of parameters. |
||
| 2504 | * You can use entity associations to build complex queries. |
||
| 2505 | * |
||
| 2506 | * Example: |
||
| 2507 | * |
||
| 2508 | * ``` php |
||
| 2509 | * <?php |
||
| 2510 | * $I->seeInRepository('User', array('name' => 'davert')); |
||
| 2511 | * $I->seeInRepository('User', array('name' => 'davert', 'Company' => array('name' => 'Codegyre'))); |
||
| 2512 | * $I->seeInRepository('Client', array('User' => array('Company' => array('name' => 'Codegyre'))); |
||
| 2513 | * ?> |
||
| 2514 | * ``` |
||
| 2515 | * |
||
| 2516 | * Fails if record for given criteria can\'t be found, |
||
| 2517 | * |
||
| 2518 | * @param $entity |
||
| 2519 | * @param array $params |
||
| 2520 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2521 | * @see \Codeception\Module\Doctrine2::seeInRepository() |
||
| 2522 | */ |
||
| 2523 | public function canSeeInRepository($entity, $params = null) { |
||
| 2526 | /** |
||
| 2527 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2528 | * |
||
| 2529 | * Flushes changes to database executes a query defined by array. |
||
| 2530 | * It builds query based on array of parameters. |
||
| 2531 | * You can use entity associations to build complex queries. |
||
| 2532 | * |
||
| 2533 | * Example: |
||
| 2534 | * |
||
| 2535 | * ``` php |
||
| 2536 | * <?php |
||
| 2537 | * $I->seeInRepository('User', array('name' => 'davert')); |
||
| 2538 | * $I->seeInRepository('User', array('name' => 'davert', 'Company' => array('name' => 'Codegyre'))); |
||
| 2539 | * $I->seeInRepository('Client', array('User' => array('Company' => array('name' => 'Codegyre'))); |
||
| 2540 | * ?> |
||
| 2541 | * ``` |
||
| 2542 | * |
||
| 2543 | * Fails if record for given criteria can\'t be found, |
||
| 2544 | * |
||
| 2545 | * @param $entity |
||
| 2546 | * @param array $params |
||
| 2547 | * @see \Codeception\Module\Doctrine2::seeInRepository() |
||
| 2548 | */ |
||
| 2549 | public function seeInRepository($entity, $params = null) { |
||
| 2552 | |||
| 2553 | |||
| 2554 | /** |
||
| 2555 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2556 | * |
||
| 2557 | * Flushes changes to database and performs ->findOneBy() call for current repository. |
||
| 2558 | * |
||
| 2559 | * @param $entity |
||
| 2560 | * @param array $params |
||
| 2561 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2562 | * @see \Codeception\Module\Doctrine2::dontSeeInRepository() |
||
| 2563 | */ |
||
| 2564 | public function cantSeeInRepository($entity, $params = null) { |
||
| 2567 | /** |
||
| 2568 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2569 | * |
||
| 2570 | * Flushes changes to database and performs ->findOneBy() call for current repository. |
||
| 2571 | * |
||
| 2572 | * @param $entity |
||
| 2573 | * @param array $params |
||
| 2574 | * @see \Codeception\Module\Doctrine2::dontSeeInRepository() |
||
| 2575 | */ |
||
| 2576 | public function dontSeeInRepository($entity, $params = null) { |
||
| 2579 | |||
| 2580 | |||
| 2581 | /** |
||
| 2582 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2583 | * |
||
| 2584 | * Selects field value from repository. |
||
| 2585 | * It builds query based on array of parameters. |
||
| 2586 | * You can use entity associations to build complex queries. |
||
| 2587 | * |
||
| 2588 | * Example: |
||
| 2589 | * |
||
| 2590 | * ``` php |
||
| 2591 | * <?php |
||
| 2592 | * $email = $I->grabFromRepository('User', 'email', array('name' => 'davert')); |
||
| 2593 | * ?> |
||
| 2594 | * ``` |
||
| 2595 | * |
||
| 2596 | * @version 1.1 |
||
| 2597 | * @param $entity |
||
| 2598 | * @param $field |
||
| 2599 | * @param array $params |
||
| 2600 | * @return array |
||
| 2601 | * @see \Codeception\Module\Doctrine2::grabFromRepository() |
||
| 2602 | */ |
||
| 2603 | public function grabFromRepository($entity, $field, $params = null) { |
||
| 2606 | |||
| 2607 | |||
| 2608 | /** |
||
| 2609 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2610 | * |
||
| 2611 | * Selects entities from repository. |
||
| 2612 | * It builds query based on array of parameters. |
||
| 2613 | * You can use entity associations to build complex queries. |
||
| 2614 | * |
||
| 2615 | * Example: |
||
| 2616 | * |
||
| 2617 | * ``` php |
||
| 2618 | * <?php |
||
| 2619 | * $users = $I->grabEntitiesFromRepository('User', array('name' => 'davert')); |
||
| 2620 | * ?> |
||
| 2621 | * ``` |
||
| 2622 | * |
||
| 2623 | * @version 1.1 |
||
| 2624 | * @param $entity |
||
| 2625 | * @param array $params |
||
| 2626 | * @return array |
||
| 2627 | * @see \Codeception\Module\Doctrine2::grabEntitiesFromRepository() |
||
| 2628 | */ |
||
| 2629 | public function grabEntitiesFromRepository($entity, $params = null) { |
||
| 2632 | |||
| 2633 | |||
| 2634 | /** |
||
| 2635 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2636 | * |
||
| 2637 | * Selects a single entity from repository. |
||
| 2638 | * It builds query based on array of parameters. |
||
| 2639 | * You can use entity associations to build complex queries. |
||
| 2640 | * |
||
| 2641 | * Example: |
||
| 2642 | * |
||
| 2643 | * ``` php |
||
| 2644 | * <?php |
||
| 2645 | * $user = $I->grabEntityFromRepository('User', array('id' => '1234')); |
||
| 2646 | * ?> |
||
| 2647 | * ``` |
||
| 2648 | * |
||
| 2649 | * @version 1.1 |
||
| 2650 | * @param $entity |
||
| 2651 | * @param array $params |
||
| 2652 | * @return array |
||
| 2653 | * @see \Codeception\Module\Doctrine2::grabEntityFromRepository() |
||
| 2654 | */ |
||
| 2655 | public function grabEntityFromRepository($entity, $params = null) { |
||
| 2658 | |||
| 2659 | |||
| 2660 | /** |
||
| 2661 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2662 | * |
||
| 2663 | * |
||
| 2664 | * @see \AppBundle\Helper\FunctionalHelper::followRedirects() |
||
| 2665 | */ |
||
| 2666 | public function followRedirects($followRedirects = null) { |
||
| 2669 | } |
||
| 2670 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.