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