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