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] f8d9a48692b0b1aed8c4444232e06bbd |
||
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 | * ``` |
||
243 | * |
||
244 | * Note that the search is done after stripping all HTML tags from the body, |
||
245 | * so `$I->see('strong')` will return true for strings like: |
||
246 | * |
||
247 | * - `<p>I am Stronger than thou</p>` |
||
248 | * - `<script>document.createElement('strong');</script>` |
||
249 | * |
||
250 | * But will *not* be true for strings like: |
||
251 | * |
||
252 | * - `<strong>Home</strong>` |
||
253 | * - `<div class="strong">Home</strong>` |
||
254 | * - `<!-- strong -->` |
||
255 | * |
||
256 | * For checking the raw source code, use `seeInSource()`. |
||
257 | * |
||
258 | * @param $text |
||
259 | * @param null $selector |
||
260 | * Conditional Assertion: Test won't be stopped on fail |
||
261 | * @see \Codeception\Lib\InnerBrowser::see() |
||
262 | */ |
||
263 | public function canSee($text, $selector = null) { |
||
266 | /** |
||
267 | * [!] Method is generated. Documentation taken from corresponding module. |
||
268 | * |
||
269 | * Checks that the current page contains the given string (case insensitive). |
||
270 | * |
||
271 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
272 | * parameter to only search within that element. |
||
273 | * |
||
274 | * ``` php |
||
275 | * <?php |
||
276 | * $I->see('Logout'); // I can suppose user is logged in |
||
277 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
278 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
279 | * ``` |
||
280 | * |
||
281 | * Note that the search is done after stripping all HTML tags from the body, |
||
282 | * so `$I->see('strong')` will return true for strings like: |
||
283 | * |
||
284 | * - `<p>I am Stronger than thou</p>` |
||
285 | * - `<script>document.createElement('strong');</script>` |
||
286 | * |
||
287 | * But will *not* be true for strings like: |
||
288 | * |
||
289 | * - `<strong>Home</strong>` |
||
290 | * - `<div class="strong">Home</strong>` |
||
291 | * - `<!-- strong -->` |
||
292 | * |
||
293 | * For checking the raw source code, use `seeInSource()`. |
||
294 | * |
||
295 | * @param $text |
||
296 | * @param null $selector |
||
297 | * @see \Codeception\Lib\InnerBrowser::see() |
||
298 | */ |
||
299 | public function see($text, $selector = null) { |
||
302 | |||
303 | |||
304 | /** |
||
305 | * [!] Method is generated. Documentation taken from corresponding module. |
||
306 | * |
||
307 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
308 | * Give a locator as the second parameter to match a specific region. |
||
309 | * |
||
310 | * ```php |
||
311 | * <?php |
||
312 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
313 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
314 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
315 | * ``` |
||
316 | * |
||
317 | * Note that the search is done after stripping all HTML tags from the body, |
||
318 | * so `$I->dontSee('strong')` will fail on strings like: |
||
319 | * |
||
320 | * - `<p>I am Stronger than thou</p>` |
||
321 | * - `<script>document.createElement('strong');</script>` |
||
322 | * |
||
323 | * But will ignore strings like: |
||
324 | * |
||
325 | * - `<strong>Home</strong>` |
||
326 | * - `<div class="strong">Home</strong>` |
||
327 | * - `<!-- strong -->` |
||
328 | * |
||
329 | * For checking the raw source code, use `seeInSource()`. |
||
330 | * |
||
331 | * @param $text |
||
332 | * @param null $selector |
||
333 | * Conditional Assertion: Test won't be stopped on fail |
||
334 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
335 | */ |
||
336 | public function cantSee($text, $selector = null) { |
||
339 | /** |
||
340 | * [!] Method is generated. Documentation taken from corresponding module. |
||
341 | * |
||
342 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
343 | * Give a locator as the second parameter to match a specific region. |
||
344 | * |
||
345 | * ```php |
||
346 | * <?php |
||
347 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
348 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
349 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
350 | * ``` |
||
351 | * |
||
352 | * Note that the search is done after stripping all HTML tags from the body, |
||
353 | * so `$I->dontSee('strong')` will fail on strings like: |
||
354 | * |
||
355 | * - `<p>I am Stronger than thou</p>` |
||
356 | * - `<script>document.createElement('strong');</script>` |
||
357 | * |
||
358 | * But will ignore strings like: |
||
359 | * |
||
360 | * - `<strong>Home</strong>` |
||
361 | * - `<div class="strong">Home</strong>` |
||
362 | * - `<!-- strong -->` |
||
363 | * |
||
364 | * For checking the raw source code, use `seeInSource()`. |
||
365 | * |
||
366 | * @param $text |
||
367 | * @param null $selector |
||
368 | * @see \Codeception\Lib\InnerBrowser::dontSee() |
||
369 | */ |
||
370 | public function dontSee($text, $selector = null) { |
||
373 | |||
374 | |||
375 | /** |
||
376 | * [!] Method is generated. Documentation taken from corresponding module. |
||
377 | * |
||
378 | * Checks that the current page contains the given string in its |
||
379 | * raw source code. |
||
380 | * |
||
381 | * ``` php |
||
382 | * <?php |
||
383 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
384 | * ``` |
||
385 | * |
||
386 | * @param $raw |
||
387 | * Conditional Assertion: Test won't be stopped on fail |
||
388 | * @see \Codeception\Lib\InnerBrowser::seeInSource() |
||
389 | */ |
||
390 | public function canSeeInSource($raw) { |
||
393 | /** |
||
394 | * [!] Method is generated. Documentation taken from corresponding module. |
||
395 | * |
||
396 | * Checks that the current page contains the given string in its |
||
397 | * raw source code. |
||
398 | * |
||
399 | * ``` php |
||
400 | * <?php |
||
401 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
402 | * ``` |
||
403 | * |
||
404 | * @param $raw |
||
405 | * @see \Codeception\Lib\InnerBrowser::seeInSource() |
||
406 | */ |
||
407 | public function seeInSource($raw) { |
||
410 | |||
411 | |||
412 | /** |
||
413 | * [!] Method is generated. Documentation taken from corresponding module. |
||
414 | * |
||
415 | * Checks that the current page contains the given string in its |
||
416 | * raw source code. |
||
417 | * |
||
418 | * ```php |
||
419 | * <?php |
||
420 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
421 | * ``` |
||
422 | * |
||
423 | * @param $raw |
||
424 | * Conditional Assertion: Test won't be stopped on fail |
||
425 | * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() |
||
426 | */ |
||
427 | public function cantSeeInSource($raw) { |
||
430 | /** |
||
431 | * [!] Method is generated. Documentation taken from corresponding module. |
||
432 | * |
||
433 | * Checks that the current page contains the given string in its |
||
434 | * raw source code. |
||
435 | * |
||
436 | * ```php |
||
437 | * <?php |
||
438 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
439 | * ``` |
||
440 | * |
||
441 | * @param $raw |
||
442 | * @see \Codeception\Lib\InnerBrowser::dontSeeInSource() |
||
443 | */ |
||
444 | public function dontSeeInSource($raw) { |
||
447 | |||
448 | |||
449 | /** |
||
450 | * [!] Method is generated. Documentation taken from corresponding module. |
||
451 | * |
||
452 | * Checks that there's a link with the specified text. |
||
453 | * Give a full URL as the second parameter to match links with that exact URL. |
||
454 | * |
||
455 | * ``` php |
||
456 | * <?php |
||
457 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
458 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
459 | * ?> |
||
460 | * ``` |
||
461 | * |
||
462 | * @param $text |
||
463 | * @param null $url |
||
464 | * Conditional Assertion: Test won't be stopped on fail |
||
465 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
466 | */ |
||
467 | public function canSeeLink($text, $url = null) { |
||
470 | /** |
||
471 | * [!] Method is generated. Documentation taken from corresponding module. |
||
472 | * |
||
473 | * Checks that there's a link with the specified text. |
||
474 | * Give a full URL as the second parameter to match links with that exact URL. |
||
475 | * |
||
476 | * ``` php |
||
477 | * <?php |
||
478 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
479 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
480 | * ?> |
||
481 | * ``` |
||
482 | * |
||
483 | * @param $text |
||
484 | * @param null $url |
||
485 | * @see \Codeception\Lib\InnerBrowser::seeLink() |
||
486 | */ |
||
487 | public function seeLink($text, $url = null) { |
||
490 | |||
491 | |||
492 | /** |
||
493 | * [!] Method is generated. Documentation taken from corresponding module. |
||
494 | * |
||
495 | * Checks that the page doesn't contain a link with the given string. |
||
496 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
497 | * |
||
498 | * ``` php |
||
499 | * <?php |
||
500 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
501 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
502 | * ?> |
||
503 | * ``` |
||
504 | * |
||
505 | * @param $text |
||
506 | * @param null $url |
||
507 | * Conditional Assertion: Test won't be stopped on fail |
||
508 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
509 | */ |
||
510 | public function cantSeeLink($text, $url = null) { |
||
513 | /** |
||
514 | * [!] Method is generated. Documentation taken from corresponding module. |
||
515 | * |
||
516 | * Checks that the page doesn't contain a link with the given string. |
||
517 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
518 | * |
||
519 | * ``` php |
||
520 | * <?php |
||
521 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
522 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
523 | * ?> |
||
524 | * ``` |
||
525 | * |
||
526 | * @param $text |
||
527 | * @param null $url |
||
528 | * @see \Codeception\Lib\InnerBrowser::dontSeeLink() |
||
529 | */ |
||
530 | public function dontSeeLink($text, $url = null) { |
||
533 | |||
534 | |||
535 | /** |
||
536 | * [!] Method is generated. Documentation taken from corresponding module. |
||
537 | * |
||
538 | * Checks that current URI contains the given string. |
||
539 | * |
||
540 | * ``` php |
||
541 | * <?php |
||
542 | * // to match: /home/dashboard |
||
543 | * $I->seeInCurrentUrl('home'); |
||
544 | * // to match: /users/1 |
||
545 | * $I->seeInCurrentUrl('/users/'); |
||
546 | * ?> |
||
547 | * ``` |
||
548 | * |
||
549 | * @param $uri |
||
550 | * Conditional Assertion: Test won't be stopped on fail |
||
551 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
552 | */ |
||
553 | public function canSeeInCurrentUrl($uri) { |
||
556 | /** |
||
557 | * [!] Method is generated. Documentation taken from corresponding module. |
||
558 | * |
||
559 | * Checks that current URI contains the given string. |
||
560 | * |
||
561 | * ``` php |
||
562 | * <?php |
||
563 | * // to match: /home/dashboard |
||
564 | * $I->seeInCurrentUrl('home'); |
||
565 | * // to match: /users/1 |
||
566 | * $I->seeInCurrentUrl('/users/'); |
||
567 | * ?> |
||
568 | * ``` |
||
569 | * |
||
570 | * @param $uri |
||
571 | * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl() |
||
572 | */ |
||
573 | public function seeInCurrentUrl($uri) { |
||
576 | |||
577 | |||
578 | /** |
||
579 | * [!] Method is generated. Documentation taken from corresponding module. |
||
580 | * |
||
581 | * Checks that the current URI doesn't contain the given string. |
||
582 | * |
||
583 | * ``` php |
||
584 | * <?php |
||
585 | * $I->dontSeeInCurrentUrl('/users/'); |
||
586 | * ?> |
||
587 | * ``` |
||
588 | * |
||
589 | * @param $uri |
||
590 | * Conditional Assertion: Test won't be stopped on fail |
||
591 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
592 | */ |
||
593 | public function cantSeeInCurrentUrl($uri) { |
||
596 | /** |
||
597 | * [!] Method is generated. Documentation taken from corresponding module. |
||
598 | * |
||
599 | * Checks that the current URI doesn't contain the given string. |
||
600 | * |
||
601 | * ``` php |
||
602 | * <?php |
||
603 | * $I->dontSeeInCurrentUrl('/users/'); |
||
604 | * ?> |
||
605 | * ``` |
||
606 | * |
||
607 | * @param $uri |
||
608 | * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl() |
||
609 | */ |
||
610 | public function dontSeeInCurrentUrl($uri) { |
||
613 | |||
614 | |||
615 | /** |
||
616 | * [!] Method is generated. Documentation taken from corresponding module. |
||
617 | * |
||
618 | * Checks that the current URL is equal to the given string. |
||
619 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
620 | * |
||
621 | * ``` php |
||
622 | * <?php |
||
623 | * // to match root url |
||
624 | * $I->seeCurrentUrlEquals('/'); |
||
625 | * ?> |
||
626 | * ``` |
||
627 | * |
||
628 | * @param $uri |
||
629 | * Conditional Assertion: Test won't be stopped on fail |
||
630 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
631 | */ |
||
632 | public function canSeeCurrentUrlEquals($uri) { |
||
635 | /** |
||
636 | * [!] Method is generated. Documentation taken from corresponding module. |
||
637 | * |
||
638 | * Checks that the current URL is equal to the given string. |
||
639 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
640 | * |
||
641 | * ``` php |
||
642 | * <?php |
||
643 | * // to match root url |
||
644 | * $I->seeCurrentUrlEquals('/'); |
||
645 | * ?> |
||
646 | * ``` |
||
647 | * |
||
648 | * @param $uri |
||
649 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals() |
||
650 | */ |
||
651 | public function seeCurrentUrlEquals($uri) { |
||
654 | |||
655 | |||
656 | /** |
||
657 | * [!] Method is generated. Documentation taken from corresponding module. |
||
658 | * |
||
659 | * Checks that the current URL doesn't equal the given string. |
||
660 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
661 | * |
||
662 | * ``` php |
||
663 | * <?php |
||
664 | * // current url is not root |
||
665 | * $I->dontSeeCurrentUrlEquals('/'); |
||
666 | * ?> |
||
667 | * ``` |
||
668 | * |
||
669 | * @param $uri |
||
670 | * Conditional Assertion: Test won't be stopped on fail |
||
671 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
672 | */ |
||
673 | public function cantSeeCurrentUrlEquals($uri) { |
||
676 | /** |
||
677 | * [!] Method is generated. Documentation taken from corresponding module. |
||
678 | * |
||
679 | * Checks that the current URL doesn't equal the given string. |
||
680 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
681 | * |
||
682 | * ``` php |
||
683 | * <?php |
||
684 | * // current url is not root |
||
685 | * $I->dontSeeCurrentUrlEquals('/'); |
||
686 | * ?> |
||
687 | * ``` |
||
688 | * |
||
689 | * @param $uri |
||
690 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals() |
||
691 | */ |
||
692 | public function dontSeeCurrentUrlEquals($uri) { |
||
695 | |||
696 | |||
697 | /** |
||
698 | * [!] Method is generated. Documentation taken from corresponding module. |
||
699 | * |
||
700 | * Checks that the current URL matches the given regular expression. |
||
701 | * |
||
702 | * ``` php |
||
703 | * <?php |
||
704 | * // to match root url |
||
705 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
706 | * ?> |
||
707 | * ``` |
||
708 | * |
||
709 | * @param $uri |
||
710 | * Conditional Assertion: Test won't be stopped on fail |
||
711 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
712 | */ |
||
713 | public function canSeeCurrentUrlMatches($uri) { |
||
716 | /** |
||
717 | * [!] Method is generated. Documentation taken from corresponding module. |
||
718 | * |
||
719 | * Checks that the current URL matches the given regular expression. |
||
720 | * |
||
721 | * ``` php |
||
722 | * <?php |
||
723 | * // to match root url |
||
724 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
725 | * ?> |
||
726 | * ``` |
||
727 | * |
||
728 | * @param $uri |
||
729 | * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches() |
||
730 | */ |
||
731 | public function seeCurrentUrlMatches($uri) { |
||
734 | |||
735 | |||
736 | /** |
||
737 | * [!] Method is generated. Documentation taken from corresponding module. |
||
738 | * |
||
739 | * Checks that current url doesn't match the given regular expression. |
||
740 | * |
||
741 | * ``` php |
||
742 | * <?php |
||
743 | * // to match root url |
||
744 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
745 | * ?> |
||
746 | * ``` |
||
747 | * |
||
748 | * @param $uri |
||
749 | * Conditional Assertion: Test won't be stopped on fail |
||
750 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
751 | */ |
||
752 | public function cantSeeCurrentUrlMatches($uri) { |
||
755 | /** |
||
756 | * [!] Method is generated. Documentation taken from corresponding module. |
||
757 | * |
||
758 | * Checks that current url doesn't match the given regular expression. |
||
759 | * |
||
760 | * ``` php |
||
761 | * <?php |
||
762 | * // to match root url |
||
763 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
764 | * ?> |
||
765 | * ``` |
||
766 | * |
||
767 | * @param $uri |
||
768 | * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches() |
||
769 | */ |
||
770 | public function dontSeeCurrentUrlMatches($uri) { |
||
773 | |||
774 | |||
775 | /** |
||
776 | * [!] Method is generated. Documentation taken from corresponding module. |
||
777 | * |
||
778 | * Executes the given regular expression against the current URI and returns the first match. |
||
779 | * If no parameters are provided, the full URI is returned. |
||
780 | * |
||
781 | * ``` php |
||
782 | * <?php |
||
783 | * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); |
||
784 | * $uri = $I->grabFromCurrentUrl(); |
||
785 | * ?> |
||
786 | * ``` |
||
787 | * |
||
788 | * @param null $uri |
||
789 | * |
||
790 | * @return mixed |
||
791 | * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl() |
||
792 | */ |
||
793 | public function grabFromCurrentUrl($uri = null) { |
||
796 | |||
797 | |||
798 | /** |
||
799 | * [!] Method is generated. Documentation taken from corresponding module. |
||
800 | * |
||
801 | * Checks that the specified checkbox is checked. |
||
802 | * |
||
803 | * ``` php |
||
804 | * <?php |
||
805 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
806 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
807 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
808 | * ?> |
||
809 | * ``` |
||
810 | * |
||
811 | * @param $checkbox |
||
812 | * Conditional Assertion: Test won't be stopped on fail |
||
813 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
814 | */ |
||
815 | public function canSeeCheckboxIsChecked($checkbox) { |
||
818 | /** |
||
819 | * [!] Method is generated. Documentation taken from corresponding module. |
||
820 | * |
||
821 | * Checks that the specified checkbox is checked. |
||
822 | * |
||
823 | * ``` php |
||
824 | * <?php |
||
825 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
826 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
827 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
828 | * ?> |
||
829 | * ``` |
||
830 | * |
||
831 | * @param $checkbox |
||
832 | * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked() |
||
833 | */ |
||
834 | public function seeCheckboxIsChecked($checkbox) { |
||
837 | |||
838 | |||
839 | /** |
||
840 | * [!] Method is generated. Documentation taken from corresponding module. |
||
841 | * |
||
842 | * Check that the specified checkbox is unchecked. |
||
843 | * |
||
844 | * ``` php |
||
845 | * <?php |
||
846 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
847 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
848 | * ?> |
||
849 | * ``` |
||
850 | * |
||
851 | * @param $checkbox |
||
852 | * Conditional Assertion: Test won't be stopped on fail |
||
853 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
854 | */ |
||
855 | public function cantSeeCheckboxIsChecked($checkbox) { |
||
858 | /** |
||
859 | * [!] Method is generated. Documentation taken from corresponding module. |
||
860 | * |
||
861 | * Check that the specified checkbox is unchecked. |
||
862 | * |
||
863 | * ``` php |
||
864 | * <?php |
||
865 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
866 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
867 | * ?> |
||
868 | * ``` |
||
869 | * |
||
870 | * @param $checkbox |
||
871 | * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked() |
||
872 | */ |
||
873 | public function dontSeeCheckboxIsChecked($checkbox) { |
||
876 | |||
877 | |||
878 | /** |
||
879 | * [!] Method is generated. Documentation taken from corresponding module. |
||
880 | * |
||
881 | * Checks that the given input field or textarea contains the given value. |
||
882 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
883 | * |
||
884 | * ``` php |
||
885 | * <?php |
||
886 | * $I->seeInField('Body','Type your comment here'); |
||
887 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
888 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
889 | * $I->seeInField('#searchform input','Search'); |
||
890 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
891 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
892 | * ?> |
||
893 | * ``` |
||
894 | * |
||
895 | * @param $field |
||
896 | * @param $value |
||
897 | * Conditional Assertion: Test won't be stopped on fail |
||
898 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
899 | */ |
||
900 | public function canSeeInField($field, $value) { |
||
903 | /** |
||
904 | * [!] Method is generated. Documentation taken from corresponding module. |
||
905 | * |
||
906 | * Checks that the given input field or textarea contains the given value. |
||
907 | * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. |
||
908 | * |
||
909 | * ``` php |
||
910 | * <?php |
||
911 | * $I->seeInField('Body','Type your comment here'); |
||
912 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
913 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
914 | * $I->seeInField('#searchform input','Search'); |
||
915 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
916 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
917 | * ?> |
||
918 | * ``` |
||
919 | * |
||
920 | * @param $field |
||
921 | * @param $value |
||
922 | * @see \Codeception\Lib\InnerBrowser::seeInField() |
||
923 | */ |
||
924 | public function seeInField($field, $value) { |
||
927 | |||
928 | |||
929 | /** |
||
930 | * [!] Method is generated. Documentation taken from corresponding module. |
||
931 | * |
||
932 | * Checks that an input field or textarea doesn't contain the given value. |
||
933 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
934 | * |
||
935 | * ``` php |
||
936 | * <?php |
||
937 | * $I->dontSeeInField('Body','Type your comment here'); |
||
938 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
939 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
940 | * $I->dontSeeInField('#searchform input','Search'); |
||
941 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
942 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
943 | * ?> |
||
944 | * ``` |
||
945 | * |
||
946 | * @param $field |
||
947 | * @param $value |
||
948 | * Conditional Assertion: Test won't be stopped on fail |
||
949 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
950 | */ |
||
951 | public function cantSeeInField($field, $value) { |
||
954 | /** |
||
955 | * [!] Method is generated. Documentation taken from corresponding module. |
||
956 | * |
||
957 | * Checks that an input field or textarea doesn't contain the given value. |
||
958 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
959 | * |
||
960 | * ``` php |
||
961 | * <?php |
||
962 | * $I->dontSeeInField('Body','Type your comment here'); |
||
963 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
964 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
965 | * $I->dontSeeInField('#searchform input','Search'); |
||
966 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
967 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
968 | * ?> |
||
969 | * ``` |
||
970 | * |
||
971 | * @param $field |
||
972 | * @param $value |
||
973 | * @see \Codeception\Lib\InnerBrowser::dontSeeInField() |
||
974 | */ |
||
975 | public function dontSeeInField($field, $value) { |
||
978 | |||
979 | |||
980 | /** |
||
981 | * [!] Method is generated. Documentation taken from corresponding module. |
||
982 | * |
||
983 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
984 | * passed selector. |
||
985 | * |
||
986 | * ``` php |
||
987 | * <?php |
||
988 | * $I->seeInFormFields('form[name=myform]', [ |
||
989 | * 'input1' => 'value', |
||
990 | * 'input2' => 'other value', |
||
991 | * ]); |
||
992 | * ?> |
||
993 | * ``` |
||
994 | * |
||
995 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
996 | * array may be passed: |
||
997 | * |
||
998 | * ``` php |
||
999 | * <?php |
||
1000 | * $I->seeInFormFields('.form-class', [ |
||
1001 | * 'multiselect' => [ |
||
1002 | * 'value1', |
||
1003 | * 'value2', |
||
1004 | * ], |
||
1005 | * 'checkbox[]' => [ |
||
1006 | * 'a checked value', |
||
1007 | * 'another checked value', |
||
1008 | * ], |
||
1009 | * ]); |
||
1010 | * ?> |
||
1011 | * ``` |
||
1012 | * |
||
1013 | * Additionally, checkbox values can be checked with a boolean. |
||
1014 | * |
||
1015 | * ``` php |
||
1016 | * <?php |
||
1017 | * $I->seeInFormFields('#form-id', [ |
||
1018 | * 'checkbox1' => true, // passes if checked |
||
1019 | * 'checkbox2' => false, // passes if unchecked |
||
1020 | * ]); |
||
1021 | * ?> |
||
1022 | * ``` |
||
1023 | * |
||
1024 | * Pair this with submitForm for quick testing magic. |
||
1025 | * |
||
1026 | * ``` php |
||
1027 | * <?php |
||
1028 | * $form = [ |
||
1029 | * 'field1' => 'value', |
||
1030 | * 'field2' => 'another value', |
||
1031 | * 'checkbox1' => true, |
||
1032 | * // ... |
||
1033 | * ]; |
||
1034 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
1035 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
1036 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
1037 | * ?> |
||
1038 | * ``` |
||
1039 | * |
||
1040 | * @param $formSelector |
||
1041 | * @param $params |
||
1042 | * Conditional Assertion: Test won't be stopped on fail |
||
1043 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
1044 | */ |
||
1045 | public function canSeeInFormFields($formSelector, $params) { |
||
1048 | /** |
||
1049 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1050 | * |
||
1051 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
1052 | * passed selector. |
||
1053 | * |
||
1054 | * ``` php |
||
1055 | * <?php |
||
1056 | * $I->seeInFormFields('form[name=myform]', [ |
||
1057 | * 'input1' => 'value', |
||
1058 | * 'input2' => 'other value', |
||
1059 | * ]); |
||
1060 | * ?> |
||
1061 | * ``` |
||
1062 | * |
||
1063 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
1064 | * array may be passed: |
||
1065 | * |
||
1066 | * ``` php |
||
1067 | * <?php |
||
1068 | * $I->seeInFormFields('.form-class', [ |
||
1069 | * 'multiselect' => [ |
||
1070 | * 'value1', |
||
1071 | * 'value2', |
||
1072 | * ], |
||
1073 | * 'checkbox[]' => [ |
||
1074 | * 'a checked value', |
||
1075 | * 'another checked value', |
||
1076 | * ], |
||
1077 | * ]); |
||
1078 | * ?> |
||
1079 | * ``` |
||
1080 | * |
||
1081 | * Additionally, checkbox values can be checked with a boolean. |
||
1082 | * |
||
1083 | * ``` php |
||
1084 | * <?php |
||
1085 | * $I->seeInFormFields('#form-id', [ |
||
1086 | * 'checkbox1' => true, // passes if checked |
||
1087 | * 'checkbox2' => false, // passes if unchecked |
||
1088 | * ]); |
||
1089 | * ?> |
||
1090 | * ``` |
||
1091 | * |
||
1092 | * Pair this with submitForm for quick testing magic. |
||
1093 | * |
||
1094 | * ``` php |
||
1095 | * <?php |
||
1096 | * $form = [ |
||
1097 | * 'field1' => 'value', |
||
1098 | * 'field2' => 'another value', |
||
1099 | * 'checkbox1' => true, |
||
1100 | * // ... |
||
1101 | * ]; |
||
1102 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
1103 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
1104 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
1105 | * ?> |
||
1106 | * ``` |
||
1107 | * |
||
1108 | * @param $formSelector |
||
1109 | * @param $params |
||
1110 | * @see \Codeception\Lib\InnerBrowser::seeInFormFields() |
||
1111 | */ |
||
1112 | public function seeInFormFields($formSelector, $params) { |
||
1115 | |||
1116 | |||
1117 | /** |
||
1118 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1119 | * |
||
1120 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
1121 | * the passed selector. |
||
1122 | * |
||
1123 | * ``` php |
||
1124 | * <?php |
||
1125 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
1126 | * 'input1' => 'non-existent value', |
||
1127 | * 'input2' => 'other non-existent value', |
||
1128 | * ]); |
||
1129 | * ?> |
||
1130 | * ``` |
||
1131 | * |
||
1132 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
1133 | * as the value: |
||
1134 | * |
||
1135 | * ``` php |
||
1136 | * <?php |
||
1137 | * $I->dontSeeInFormFields('.form-class', [ |
||
1138 | * 'fieldName' => [ |
||
1139 | * 'This value shouldn\'t be set', |
||
1140 | * 'And this value shouldn\'t be set', |
||
1141 | * ], |
||
1142 | * ]); |
||
1143 | * ?> |
||
1144 | * ``` |
||
1145 | * |
||
1146 | * Additionally, checkbox values can be checked with a boolean. |
||
1147 | * |
||
1148 | * ``` php |
||
1149 | * <?php |
||
1150 | * $I->dontSeeInFormFields('#form-id', [ |
||
1151 | * 'checkbox1' => true, // fails if checked |
||
1152 | * 'checkbox2' => false, // fails if unchecked |
||
1153 | * ]); |
||
1154 | * ?> |
||
1155 | * ``` |
||
1156 | * |
||
1157 | * @param $formSelector |
||
1158 | * @param $params |
||
1159 | * Conditional Assertion: Test won't be stopped on fail |
||
1160 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
1161 | */ |
||
1162 | public function cantSeeInFormFields($formSelector, $params) { |
||
1165 | /** |
||
1166 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1167 | * |
||
1168 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
1169 | * the passed selector. |
||
1170 | * |
||
1171 | * ``` php |
||
1172 | * <?php |
||
1173 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
1174 | * 'input1' => 'non-existent value', |
||
1175 | * 'input2' => 'other non-existent value', |
||
1176 | * ]); |
||
1177 | * ?> |
||
1178 | * ``` |
||
1179 | * |
||
1180 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
1181 | * as the value: |
||
1182 | * |
||
1183 | * ``` php |
||
1184 | * <?php |
||
1185 | * $I->dontSeeInFormFields('.form-class', [ |
||
1186 | * 'fieldName' => [ |
||
1187 | * 'This value shouldn\'t be set', |
||
1188 | * 'And this value shouldn\'t be set', |
||
1189 | * ], |
||
1190 | * ]); |
||
1191 | * ?> |
||
1192 | * ``` |
||
1193 | * |
||
1194 | * Additionally, checkbox values can be checked with a boolean. |
||
1195 | * |
||
1196 | * ``` php |
||
1197 | * <?php |
||
1198 | * $I->dontSeeInFormFields('#form-id', [ |
||
1199 | * 'checkbox1' => true, // fails if checked |
||
1200 | * 'checkbox2' => false, // fails if unchecked |
||
1201 | * ]); |
||
1202 | * ?> |
||
1203 | * ``` |
||
1204 | * |
||
1205 | * @param $formSelector |
||
1206 | * @param $params |
||
1207 | * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields() |
||
1208 | */ |
||
1209 | public function dontSeeInFormFields($formSelector, $params) { |
||
1212 | |||
1213 | |||
1214 | /** |
||
1215 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1216 | * |
||
1217 | * Submits the given form on the page, optionally with the given form |
||
1218 | * values. Pass the form field's values as an array in the second |
||
1219 | * parameter. |
||
1220 | * |
||
1221 | * Although this function can be used as a short-hand version of |
||
1222 | * `fillField()`, `selectOption()`, `click()` etc. it has some important |
||
1223 | * differences: |
||
1224 | * |
||
1225 | * * Only field *names* may be used, not CSS/XPath selectors nor field labels |
||
1226 | * * If a field is sent to this function that does *not* exist on the page, |
||
1227 | * it will silently be added to the HTTP request. This is helpful for testing |
||
1228 | * some types of forms, but be aware that you will *not* get an exception |
||
1229 | * like you would if you called `fillField()` or `selectOption()` with |
||
1230 | * a missing field. |
||
1231 | * |
||
1232 | * Fields that are not provided will be filled by their values from the page, |
||
1233 | * or from any previous calls to `fillField()`, `selectOption()` etc. |
||
1234 | * You don't need to click the 'Submit' button afterwards. |
||
1235 | * This command itself triggers the request to form's action. |
||
1236 | * |
||
1237 | * You can optionally specify which button's value to include |
||
1238 | * in the request with the last parameter (as an alternative to |
||
1239 | * explicitly setting its value in the second parameter), as |
||
1240 | * button values are not otherwise included in the request. |
||
1241 | * |
||
1242 | * Examples: |
||
1243 | * |
||
1244 | * ``` php |
||
1245 | * <?php |
||
1246 | * $I->submitForm('#login', [ |
||
1247 | * 'login' => 'davert', |
||
1248 | * 'password' => '123456' |
||
1249 | * ]); |
||
1250 | * // or |
||
1251 | * $I->submitForm('#login', [ |
||
1252 | * 'login' => 'davert', |
||
1253 | * 'password' => '123456' |
||
1254 | * ], 'submitButtonName'); |
||
1255 | * |
||
1256 | * ``` |
||
1257 | * |
||
1258 | * For example, given this sample "Sign Up" form: |
||
1259 | * |
||
1260 | * ``` html |
||
1261 | * <form action="/sign_up"> |
||
1262 | * Login: |
||
1263 | * <input type="text" name="user[login]" /><br/> |
||
1264 | * Password: |
||
1265 | * <input type="password" name="user[password]" /><br/> |
||
1266 | * Do you agree to our terms? |
||
1267 | * <input type="checkbox" name="user[agree]" /><br/> |
||
1268 | * Select pricing plan: |
||
1269 | * <select name="plan"> |
||
1270 | * <option value="1">Free</option> |
||
1271 | * <option value="2" selected="selected">Paid</option> |
||
1272 | * </select> |
||
1273 | * <input type="submit" name="submitButton" value="Submit" /> |
||
1274 | * </form> |
||
1275 | * ``` |
||
1276 | * |
||
1277 | * You could write the following to submit it: |
||
1278 | * |
||
1279 | * ``` php |
||
1280 | * <?php |
||
1281 | * $I->submitForm( |
||
1282 | * '#userForm', |
||
1283 | * [ |
||
1284 | * 'user' => [ |
||
1285 | * 'login' => 'Davert', |
||
1286 | * 'password' => '123456', |
||
1287 | * 'agree' => true |
||
1288 | * ] |
||
1289 | * ], |
||
1290 | * 'submitButton' |
||
1291 | * ); |
||
1292 | * ``` |
||
1293 | * Note that "2" will be the submitted value for the "plan" field, as it is |
||
1294 | * the selected option. |
||
1295 | * |
||
1296 | * You can also emulate a JavaScript submission by not specifying any |
||
1297 | * buttons in the third parameter to submitForm. |
||
1298 | * |
||
1299 | * ```php |
||
1300 | * <?php |
||
1301 | * $I->submitForm( |
||
1302 | * '#userForm', |
||
1303 | * [ |
||
1304 | * 'user' => [ |
||
1305 | * 'login' => 'Davert', |
||
1306 | * 'password' => '123456', |
||
1307 | * 'agree' => true |
||
1308 | * ] |
||
1309 | * ] |
||
1310 | * ); |
||
1311 | * ``` |
||
1312 | * |
||
1313 | * This function works well when paired with `seeInFormFields()` |
||
1314 | * for quickly testing CRUD interfaces and form validation logic. |
||
1315 | * |
||
1316 | * ``` php |
||
1317 | * <?php |
||
1318 | * $form = [ |
||
1319 | * 'field1' => 'value', |
||
1320 | * 'field2' => 'another value', |
||
1321 | * 'checkbox1' => true, |
||
1322 | * // ... |
||
1323 | * ]; |
||
1324 | * $I->submitForm('#my-form', $form, 'submitButton'); |
||
1325 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
1326 | * $I->seeInFormFields('#my-form', $form); |
||
1327 | * ``` |
||
1328 | * |
||
1329 | * Parameter values can be set to arrays for multiple input fields |
||
1330 | * of the same name, or multi-select combo boxes. For checkboxes, |
||
1331 | * you can use either the string value or boolean `true`/`false` which will |
||
1332 | * be replaced by the checkbox's value in the DOM. |
||
1333 | * |
||
1334 | * ``` php |
||
1335 | * <?php |
||
1336 | * $I->submitForm('#my-form', [ |
||
1337 | * 'field1' => 'value', |
||
1338 | * 'checkbox' => [ |
||
1339 | * 'value of first checkbox', |
||
1340 | * 'value of second checkbox', |
||
1341 | * ], |
||
1342 | * 'otherCheckboxes' => [ |
||
1343 | * true, |
||
1344 | * false, |
||
1345 | * false |
||
1346 | * ], |
||
1347 | * 'multiselect' => [ |
||
1348 | * 'first option value', |
||
1349 | * 'second option value' |
||
1350 | * ] |
||
1351 | * ]); |
||
1352 | * ``` |
||
1353 | * |
||
1354 | * Mixing string and boolean values for a checkbox's value is not supported |
||
1355 | * and may produce unexpected results. |
||
1356 | * |
||
1357 | * Field names ending in `[]` must be passed without the trailing square |
||
1358 | * bracket characters, and must contain an array for its value. This allows |
||
1359 | * submitting multiple values with the same name, consider: |
||
1360 | * |
||
1361 | * ```php |
||
1362 | * <?php |
||
1363 | * // This will NOT work correctly |
||
1364 | * $I->submitForm('#my-form', [ |
||
1365 | * 'field[]' => 'value', |
||
1366 | * 'field[]' => 'another value', // 'field[]' is already a defined key |
||
1367 | * ]); |
||
1368 | * ``` |
||
1369 | * |
||
1370 | * The solution is to pass an array value: |
||
1371 | * |
||
1372 | * ```php |
||
1373 | * <?php |
||
1374 | * // This way both values are submitted |
||
1375 | * $I->submitForm('#my-form', [ |
||
1376 | * 'field' => [ |
||
1377 | * 'value', |
||
1378 | * 'another value', |
||
1379 | * ] |
||
1380 | * ]); |
||
1381 | * ``` |
||
1382 | * |
||
1383 | * @param $selector |
||
1384 | * @param $params |
||
1385 | * @param $button |
||
1386 | * @see \Codeception\Lib\InnerBrowser::submitForm() |
||
1387 | */ |
||
1388 | public function submitForm($selector, $params, $button = null) { |
||
1391 | |||
1392 | |||
1393 | /** |
||
1394 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1395 | * |
||
1396 | * Fills a text field or textarea with the given string. |
||
1397 | * |
||
1398 | * ``` php |
||
1399 | * <?php |
||
1400 | * $I->fillField("//input[@type='text']", "Hello World!"); |
||
1401 | * $I->fillField(['name' => 'email'], '[email protected]'); |
||
1402 | * ?> |
||
1403 | * ``` |
||
1404 | * |
||
1405 | * @param $field |
||
1406 | * @param $value |
||
1407 | * @see \Codeception\Lib\InnerBrowser::fillField() |
||
1408 | */ |
||
1409 | public function fillField($field, $value) { |
||
1412 | |||
1413 | |||
1414 | /** |
||
1415 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1416 | * |
||
1417 | * Selects an option in a select tag or in radio button group. |
||
1418 | * |
||
1419 | * ``` php |
||
1420 | * <?php |
||
1421 | * $I->selectOption('form select[name=account]', 'Premium'); |
||
1422 | * $I->selectOption('form input[name=payment]', 'Monthly'); |
||
1423 | * $I->selectOption('//form/select[@name=account]', 'Monthly'); |
||
1424 | * ?> |
||
1425 | * ``` |
||
1426 | * |
||
1427 | * Provide an array for the second argument to select multiple options: |
||
1428 | * |
||
1429 | * ``` php |
||
1430 | * <?php |
||
1431 | * $I->selectOption('Which OS do you use?', array('Windows','Linux')); |
||
1432 | * ?> |
||
1433 | * ``` |
||
1434 | * |
||
1435 | * Or provide an associative array for the second argument to specifically define which selection method should be used: |
||
1436 | * |
||
1437 | * ``` php |
||
1438 | * <?php |
||
1439 | * $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' |
||
1440 | * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' |
||
1441 | * ?> |
||
1442 | + ``` |
||
1443 | * |
||
1444 | * @param $select |
||
1445 | * @param $option |
||
1446 | * @see \Codeception\Lib\InnerBrowser::selectOption() |
||
1447 | */ |
||
1448 | public function selectOption($select, $option) { |
||
1451 | |||
1452 | |||
1453 | /** |
||
1454 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1455 | * |
||
1456 | * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. |
||
1457 | * |
||
1458 | * ``` php |
||
1459 | * <?php |
||
1460 | * $I->checkOption('#agree'); |
||
1461 | * ?> |
||
1462 | * ``` |
||
1463 | * |
||
1464 | * @param $option |
||
1465 | * @see \Codeception\Lib\InnerBrowser::checkOption() |
||
1466 | */ |
||
1467 | public function checkOption($option) { |
||
1470 | |||
1471 | |||
1472 | /** |
||
1473 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1474 | * |
||
1475 | * Unticks a checkbox. |
||
1476 | * |
||
1477 | * ``` php |
||
1478 | * <?php |
||
1479 | * $I->uncheckOption('#notify'); |
||
1480 | * ?> |
||
1481 | * ``` |
||
1482 | * |
||
1483 | * @param $option |
||
1484 | * @see \Codeception\Lib\InnerBrowser::uncheckOption() |
||
1485 | */ |
||
1486 | public function uncheckOption($option) { |
||
1489 | |||
1490 | |||
1491 | /** |
||
1492 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1493 | * |
||
1494 | * Attaches a file relative to the Codeception data directory to the given file upload field. |
||
1495 | * |
||
1496 | * ``` php |
||
1497 | * <?php |
||
1498 | * // file is stored in 'tests/_data/prices.xls' |
||
1499 | * $I->attachFile('input[@type="file"]', 'prices.xls'); |
||
1500 | * ?> |
||
1501 | * ``` |
||
1502 | * |
||
1503 | * @param $field |
||
1504 | * @param $filename |
||
1505 | * @see \Codeception\Lib\InnerBrowser::attachFile() |
||
1506 | */ |
||
1507 | public function attachFile($field, $filename) { |
||
1510 | |||
1511 | |||
1512 | /** |
||
1513 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1514 | * |
||
1515 | * If your page triggers an ajax request, you can perform it manually. |
||
1516 | * This action sends a GET ajax request with specified params. |
||
1517 | * |
||
1518 | * See ->sendAjaxPostRequest for examples. |
||
1519 | * |
||
1520 | * @param $uri |
||
1521 | * @param $params |
||
1522 | * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest() |
||
1523 | */ |
||
1524 | public function sendAjaxGetRequest($uri, $params = null) { |
||
1527 | |||
1528 | |||
1529 | /** |
||
1530 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1531 | * |
||
1532 | * If your page triggers an ajax request, you can perform it manually. |
||
1533 | * This action sends a POST ajax request with specified params. |
||
1534 | * Additional params can be passed as array. |
||
1535 | * |
||
1536 | * Example: |
||
1537 | * |
||
1538 | * Imagine that by clicking checkbox you trigger ajax request which updates user settings. |
||
1539 | * We emulate that click by running this ajax request manually. |
||
1540 | * |
||
1541 | * ``` php |
||
1542 | * <?php |
||
1543 | * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST |
||
1544 | * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET |
||
1545 | * |
||
1546 | * ``` |
||
1547 | * |
||
1548 | * @param $uri |
||
1549 | * @param $params |
||
1550 | * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest() |
||
1551 | */ |
||
1552 | public function sendAjaxPostRequest($uri, $params = null) { |
||
1555 | |||
1556 | |||
1557 | /** |
||
1558 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1559 | * |
||
1560 | * If your page triggers an ajax request, you can perform it manually. |
||
1561 | * This action sends an ajax request with specified method and params. |
||
1562 | * |
||
1563 | * Example: |
||
1564 | * |
||
1565 | * You need to perform an ajax request specifying the HTTP method. |
||
1566 | * |
||
1567 | * ``` php |
||
1568 | * <?php |
||
1569 | * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title')); |
||
1570 | * |
||
1571 | * ``` |
||
1572 | * |
||
1573 | * @param $method |
||
1574 | * @param $uri |
||
1575 | * @param $params |
||
1576 | * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest() |
||
1577 | */ |
||
1578 | public function sendAjaxRequest($method, $uri, $params = null) { |
||
1581 | |||
1582 | |||
1583 | /** |
||
1584 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1585 | * |
||
1586 | * Finds and returns the text contents of the given element. |
||
1587 | * If a fuzzy locator is used, the element is found using CSS, XPath, |
||
1588 | * and by matching the full page source by regular expression. |
||
1589 | * |
||
1590 | * ``` php |
||
1591 | * <?php |
||
1592 | * $heading = $I->grabTextFrom('h1'); |
||
1593 | * $heading = $I->grabTextFrom('descendant-or-self::h1'); |
||
1594 | * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex |
||
1595 | * ?> |
||
1596 | * ``` |
||
1597 | * |
||
1598 | * @param $cssOrXPathOrRegex |
||
1599 | * |
||
1600 | * @return mixed |
||
1601 | * @see \Codeception\Lib\InnerBrowser::grabTextFrom() |
||
1602 | */ |
||
1603 | public function grabTextFrom($cssOrXPathOrRegex) { |
||
1606 | |||
1607 | |||
1608 | /** |
||
1609 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1610 | * |
||
1611 | * Grabs the value of the given attribute value from the given element. |
||
1612 | * Fails if element is not found. |
||
1613 | * |
||
1614 | * ``` php |
||
1615 | * <?php |
||
1616 | * $I->grabAttributeFrom('#tooltip', 'title'); |
||
1617 | * ?> |
||
1618 | * ``` |
||
1619 | * |
||
1620 | * |
||
1621 | * @param $cssOrXpath |
||
1622 | * @param $attribute |
||
1623 | * |
||
1624 | * @return mixed |
||
1625 | * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom() |
||
1626 | */ |
||
1627 | public function grabAttributeFrom($cssOrXpath, $attribute) { |
||
1630 | |||
1631 | |||
1632 | /** |
||
1633 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1634 | * |
||
1635 | * Grabs either the text content, or attribute values, of nodes |
||
1636 | * matched by $cssOrXpath and returns them as an array. |
||
1637 | * |
||
1638 | * ```html |
||
1639 | * <a href="#first">First</a> |
||
1640 | * <a href="#second">Second</a> |
||
1641 | * <a href="#third">Third</a> |
||
1642 | * ``` |
||
1643 | * |
||
1644 | * ```php |
||
1645 | * <?php |
||
1646 | * // would return ['First', 'Second', 'Third'] |
||
1647 | * $aLinkText = $I->grabMultiple('a'); |
||
1648 | * |
||
1649 | * // would return ['#first', '#second', '#third'] |
||
1650 | * $aLinks = $I->grabMultiple('a', 'href'); |
||
1651 | * ?> |
||
1652 | * ``` |
||
1653 | * |
||
1654 | * @param $cssOrXpath |
||
1655 | * @param $attribute |
||
1656 | * @return string[] |
||
1657 | * @see \Codeception\Lib\InnerBrowser::grabMultiple() |
||
1658 | */ |
||
1659 | public function grabMultiple($cssOrXpath, $attribute = null) { |
||
1662 | |||
1663 | |||
1664 | /** |
||
1665 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1666 | * |
||
1667 | * @param $field |
||
1668 | * |
||
1669 | * @return array|mixed|null|string |
||
1670 | * @see \Codeception\Lib\InnerBrowser::grabValueFrom() |
||
1671 | */ |
||
1672 | public function grabValueFrom($field) { |
||
1675 | |||
1676 | |||
1677 | /** |
||
1678 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1679 | * |
||
1680 | * Sets a cookie with the given name and value. |
||
1681 | * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. |
||
1682 | * |
||
1683 | * ``` php |
||
1684 | * <?php |
||
1685 | * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); |
||
1686 | * ?> |
||
1687 | * ``` |
||
1688 | * |
||
1689 | * @param $name |
||
1690 | * @param $val |
||
1691 | * @param array $params |
||
1692 | * |
||
1693 | * @return mixed |
||
1694 | * @see \Codeception\Lib\InnerBrowser::setCookie() |
||
1695 | */ |
||
1696 | public function setCookie($name, $val, $params = null) { |
||
1699 | |||
1700 | |||
1701 | /** |
||
1702 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1703 | * |
||
1704 | * Grabs a cookie value. |
||
1705 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
1706 | * |
||
1707 | * @param $cookie |
||
1708 | * |
||
1709 | * @param array $params |
||
1710 | * @return mixed |
||
1711 | * @see \Codeception\Lib\InnerBrowser::grabCookie() |
||
1712 | */ |
||
1713 | public function grabCookie($cookie, $params = null) { |
||
1716 | |||
1717 | |||
1718 | /** |
||
1719 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1720 | * |
||
1721 | * Checks that a cookie with the given name is set. |
||
1722 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
1723 | * |
||
1724 | * ``` php |
||
1725 | * <?php |
||
1726 | * $I->seeCookie('PHPSESSID'); |
||
1727 | * ?> |
||
1728 | * ``` |
||
1729 | * |
||
1730 | * @param $cookie |
||
1731 | * @param array $params |
||
1732 | * @return mixed |
||
1733 | * Conditional Assertion: Test won't be stopped on fail |
||
1734 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
1735 | */ |
||
1736 | public function canSeeCookie($cookie, $params = null) { |
||
1739 | /** |
||
1740 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1741 | * |
||
1742 | * Checks that a cookie with the given name is set. |
||
1743 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
1744 | * |
||
1745 | * ``` php |
||
1746 | * <?php |
||
1747 | * $I->seeCookie('PHPSESSID'); |
||
1748 | * ?> |
||
1749 | * ``` |
||
1750 | * |
||
1751 | * @param $cookie |
||
1752 | * @param array $params |
||
1753 | * @return mixed |
||
1754 | * @see \Codeception\Lib\InnerBrowser::seeCookie() |
||
1755 | */ |
||
1756 | public function seeCookie($cookie, $params = null) { |
||
1759 | |||
1760 | |||
1761 | /** |
||
1762 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1763 | * |
||
1764 | * Checks that there isn't a cookie with the given name. |
||
1765 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
1766 | * |
||
1767 | * @param $cookie |
||
1768 | * |
||
1769 | * @param array $params |
||
1770 | * @return mixed |
||
1771 | * Conditional Assertion: Test won't be stopped on fail |
||
1772 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
1773 | */ |
||
1774 | public function cantSeeCookie($cookie, $params = null) { |
||
1777 | /** |
||
1778 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1779 | * |
||
1780 | * Checks that there isn't a cookie with the given name. |
||
1781 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
1782 | * |
||
1783 | * @param $cookie |
||
1784 | * |
||
1785 | * @param array $params |
||
1786 | * @return mixed |
||
1787 | * @see \Codeception\Lib\InnerBrowser::dontSeeCookie() |
||
1788 | */ |
||
1789 | public function dontSeeCookie($cookie, $params = null) { |
||
1792 | |||
1793 | |||
1794 | /** |
||
1795 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1796 | * |
||
1797 | * Unsets cookie with the given name. |
||
1798 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
1799 | * |
||
1800 | * @param $cookie |
||
1801 | * |
||
1802 | * @param array $params |
||
1803 | * @return mixed |
||
1804 | * @see \Codeception\Lib\InnerBrowser::resetCookie() |
||
1805 | */ |
||
1806 | public function resetCookie($name, $params = null) { |
||
1809 | |||
1810 | |||
1811 | /** |
||
1812 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1813 | * |
||
1814 | * Checks that the given element exists on the page and is visible. |
||
1815 | * You can also specify expected attributes of this element. |
||
1816 | * |
||
1817 | * ``` php |
||
1818 | * <?php |
||
1819 | * $I->seeElement('.error'); |
||
1820 | * $I->seeElement('//form/input[1]'); |
||
1821 | * $I->seeElement('input', ['name' => 'login']); |
||
1822 | * $I->seeElement('input', ['value' => '123456']); |
||
1823 | * |
||
1824 | * // strict locator in first arg, attributes in second |
||
1825 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
1826 | * ?> |
||
1827 | * ``` |
||
1828 | * |
||
1829 | * @param $selector |
||
1830 | * @param array $attributes |
||
1831 | * @return |
||
1832 | * Conditional Assertion: Test won't be stopped on fail |
||
1833 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
1834 | */ |
||
1835 | public function canSeeElement($selector, $attributes = null) { |
||
1838 | /** |
||
1839 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1840 | * |
||
1841 | * Checks that the given element exists on the page and is visible. |
||
1842 | * You can also specify expected attributes of this element. |
||
1843 | * |
||
1844 | * ``` php |
||
1845 | * <?php |
||
1846 | * $I->seeElement('.error'); |
||
1847 | * $I->seeElement('//form/input[1]'); |
||
1848 | * $I->seeElement('input', ['name' => 'login']); |
||
1849 | * $I->seeElement('input', ['value' => '123456']); |
||
1850 | * |
||
1851 | * // strict locator in first arg, attributes in second |
||
1852 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
1853 | * ?> |
||
1854 | * ``` |
||
1855 | * |
||
1856 | * @param $selector |
||
1857 | * @param array $attributes |
||
1858 | * @return |
||
1859 | * @see \Codeception\Lib\InnerBrowser::seeElement() |
||
1860 | */ |
||
1861 | public function seeElement($selector, $attributes = null) { |
||
1864 | |||
1865 | |||
1866 | /** |
||
1867 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1868 | * |
||
1869 | * Checks that the given element is invisible or not present on the page. |
||
1870 | * You can also specify expected attributes of this element. |
||
1871 | * |
||
1872 | * ``` php |
||
1873 | * <?php |
||
1874 | * $I->dontSeeElement('.error'); |
||
1875 | * $I->dontSeeElement('//form/input[1]'); |
||
1876 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
1877 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
1878 | * ?> |
||
1879 | * ``` |
||
1880 | * |
||
1881 | * @param $selector |
||
1882 | * @param array $attributes |
||
1883 | * Conditional Assertion: Test won't be stopped on fail |
||
1884 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
1885 | */ |
||
1886 | public function cantSeeElement($selector, $attributes = null) { |
||
1889 | /** |
||
1890 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1891 | * |
||
1892 | * Checks that the given element is invisible or not present on the page. |
||
1893 | * You can also specify expected attributes of this element. |
||
1894 | * |
||
1895 | * ``` php |
||
1896 | * <?php |
||
1897 | * $I->dontSeeElement('.error'); |
||
1898 | * $I->dontSeeElement('//form/input[1]'); |
||
1899 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
1900 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
1901 | * ?> |
||
1902 | * ``` |
||
1903 | * |
||
1904 | * @param $selector |
||
1905 | * @param array $attributes |
||
1906 | * @see \Codeception\Lib\InnerBrowser::dontSeeElement() |
||
1907 | */ |
||
1908 | public function dontSeeElement($selector, $attributes = null) { |
||
1911 | |||
1912 | |||
1913 | /** |
||
1914 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1915 | * |
||
1916 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
1917 | * |
||
1918 | * ``` php |
||
1919 | * <?php |
||
1920 | * $I->seeNumberOfElements('tr', 10); |
||
1921 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
1922 | * ?> |
||
1923 | * ``` |
||
1924 | * @param $selector |
||
1925 | * @param mixed $expected : |
||
1926 | * - string: strict number |
||
1927 | * - array: range of numbers [0,10] |
||
1928 | * Conditional Assertion: Test won't be stopped on fail |
||
1929 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
1930 | */ |
||
1931 | public function canSeeNumberOfElements($selector, $expected) { |
||
1934 | /** |
||
1935 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1936 | * |
||
1937 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
1938 | * |
||
1939 | * ``` php |
||
1940 | * <?php |
||
1941 | * $I->seeNumberOfElements('tr', 10); |
||
1942 | * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements |
||
1943 | * ?> |
||
1944 | * ``` |
||
1945 | * @param $selector |
||
1946 | * @param mixed $expected : |
||
1947 | * - string: strict number |
||
1948 | * - array: range of numbers [0,10] |
||
1949 | * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements() |
||
1950 | */ |
||
1951 | public function seeNumberOfElements($selector, $expected) { |
||
1954 | |||
1955 | |||
1956 | /** |
||
1957 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1958 | * |
||
1959 | * Checks that the given option is selected. |
||
1960 | * |
||
1961 | * ``` php |
||
1962 | * <?php |
||
1963 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
1964 | * ?> |
||
1965 | * ``` |
||
1966 | * |
||
1967 | * @param $selector |
||
1968 | * @param $optionText |
||
1969 | * |
||
1970 | * @return mixed |
||
1971 | * Conditional Assertion: Test won't be stopped on fail |
||
1972 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
1973 | */ |
||
1974 | public function canSeeOptionIsSelected($selector, $optionText) { |
||
1977 | /** |
||
1978 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1979 | * |
||
1980 | * Checks that the given option is selected. |
||
1981 | * |
||
1982 | * ``` php |
||
1983 | * <?php |
||
1984 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
1985 | * ?> |
||
1986 | * ``` |
||
1987 | * |
||
1988 | * @param $selector |
||
1989 | * @param $optionText |
||
1990 | * |
||
1991 | * @return mixed |
||
1992 | * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected() |
||
1993 | */ |
||
1994 | public function seeOptionIsSelected($selector, $optionText) { |
||
1997 | |||
1998 | |||
1999 | /** |
||
2000 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2001 | * |
||
2002 | * Checks that the given option is not selected. |
||
2003 | * |
||
2004 | * ``` php |
||
2005 | * <?php |
||
2006 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
2007 | * ?> |
||
2008 | * ``` |
||
2009 | * |
||
2010 | * @param $selector |
||
2011 | * @param $optionText |
||
2012 | * |
||
2013 | * @return mixed |
||
2014 | * Conditional Assertion: Test won't be stopped on fail |
||
2015 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
2016 | */ |
||
2017 | public function cantSeeOptionIsSelected($selector, $optionText) { |
||
2020 | /** |
||
2021 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2022 | * |
||
2023 | * Checks that the given option is not selected. |
||
2024 | * |
||
2025 | * ``` php |
||
2026 | * <?php |
||
2027 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
2028 | * ?> |
||
2029 | * ``` |
||
2030 | * |
||
2031 | * @param $selector |
||
2032 | * @param $optionText |
||
2033 | * |
||
2034 | * @return mixed |
||
2035 | * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected() |
||
2036 | */ |
||
2037 | public function dontSeeOptionIsSelected($selector, $optionText) { |
||
2040 | |||
2041 | |||
2042 | /** |
||
2043 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2044 | * |
||
2045 | * Asserts that current page has 404 response status code. |
||
2046 | * Conditional Assertion: Test won't be stopped on fail |
||
2047 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
2048 | */ |
||
2049 | public function canSeePageNotFound() { |
||
2052 | /** |
||
2053 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2054 | * |
||
2055 | * Asserts that current page has 404 response status code. |
||
2056 | * @see \Codeception\Lib\InnerBrowser::seePageNotFound() |
||
2057 | */ |
||
2058 | public function seePageNotFound() { |
||
2061 | |||
2062 | |||
2063 | /** |
||
2064 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2065 | * |
||
2066 | * Checks that response code is equal to value provided. |
||
2067 | * |
||
2068 | * ```php |
||
2069 | * <?php |
||
2070 | * $I->seeResponseCodeIs(200); |
||
2071 | * |
||
2072 | * // recommended \Codeception\Util\HttpCode |
||
2073 | * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
2074 | * ``` |
||
2075 | * |
||
2076 | * @param $code |
||
2077 | * Conditional Assertion: Test won't be stopped on fail |
||
2078 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
2079 | */ |
||
2080 | public function canSeeResponseCodeIs($code) { |
||
2083 | /** |
||
2084 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2085 | * |
||
2086 | * Checks that response code is equal to value provided. |
||
2087 | * |
||
2088 | * ```php |
||
2089 | * <?php |
||
2090 | * $I->seeResponseCodeIs(200); |
||
2091 | * |
||
2092 | * // recommended \Codeception\Util\HttpCode |
||
2093 | * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
2094 | * ``` |
||
2095 | * |
||
2096 | * @param $code |
||
2097 | * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs() |
||
2098 | */ |
||
2099 | public function seeResponseCodeIs($code) { |
||
2102 | |||
2103 | |||
2104 | /** |
||
2105 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2106 | * |
||
2107 | * Checks that response code is equal to value provided. |
||
2108 | * |
||
2109 | * ```php |
||
2110 | * <?php |
||
2111 | * $I->dontSeeResponseCodeIs(200); |
||
2112 | * |
||
2113 | * // recommended \Codeception\Util\HttpCode |
||
2114 | * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
2115 | * ``` |
||
2116 | * @param $code |
||
2117 | * Conditional Assertion: Test won't be stopped on fail |
||
2118 | * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() |
||
2119 | */ |
||
2120 | public function cantSeeResponseCodeIs($code) { |
||
2123 | /** |
||
2124 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2125 | * |
||
2126 | * Checks that response code is equal to value provided. |
||
2127 | * |
||
2128 | * ```php |
||
2129 | * <?php |
||
2130 | * $I->dontSeeResponseCodeIs(200); |
||
2131 | * |
||
2132 | * // recommended \Codeception\Util\HttpCode |
||
2133 | * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK); |
||
2134 | * ``` |
||
2135 | * @param $code |
||
2136 | * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs() |
||
2137 | */ |
||
2138 | public function dontSeeResponseCodeIs($code) { |
||
2141 | |||
2142 | |||
2143 | /** |
||
2144 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2145 | * |
||
2146 | * Checks that the page title contains the given string. |
||
2147 | * |
||
2148 | * ``` php |
||
2149 | * <?php |
||
2150 | * $I->seeInTitle('Blog - Post #1'); |
||
2151 | * ?> |
||
2152 | * ``` |
||
2153 | * |
||
2154 | * @param $title |
||
2155 | * |
||
2156 | * @return mixed |
||
2157 | * Conditional Assertion: Test won't be stopped on fail |
||
2158 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
2159 | */ |
||
2160 | public function canSeeInTitle($title) { |
||
2163 | /** |
||
2164 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2165 | * |
||
2166 | * Checks that the page title contains the given string. |
||
2167 | * |
||
2168 | * ``` php |
||
2169 | * <?php |
||
2170 | * $I->seeInTitle('Blog - Post #1'); |
||
2171 | * ?> |
||
2172 | * ``` |
||
2173 | * |
||
2174 | * @param $title |
||
2175 | * |
||
2176 | * @return mixed |
||
2177 | * @see \Codeception\Lib\InnerBrowser::seeInTitle() |
||
2178 | */ |
||
2179 | public function seeInTitle($title) { |
||
2182 | |||
2183 | |||
2184 | /** |
||
2185 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2186 | * |
||
2187 | * Checks that the page title does not contain the given string. |
||
2188 | * |
||
2189 | * @param $title |
||
2190 | * |
||
2191 | * @return mixed |
||
2192 | * Conditional Assertion: Test won't be stopped on fail |
||
2193 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
2194 | */ |
||
2195 | public function cantSeeInTitle($title) { |
||
2198 | /** |
||
2199 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2200 | * |
||
2201 | * Checks that the page title does not contain the given string. |
||
2202 | * |
||
2203 | * @param $title |
||
2204 | * |
||
2205 | * @return mixed |
||
2206 | * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle() |
||
2207 | */ |
||
2208 | public function dontSeeInTitle($title) { |
||
2211 | |||
2212 | |||
2213 | /** |
||
2214 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2215 | * |
||
2216 | * Switch to iframe or frame on the page. |
||
2217 | * |
||
2218 | * Example: |
||
2219 | * ``` html |
||
2220 | * <iframe name="another_frame" src="http://example.com"> |
||
2221 | * ``` |
||
2222 | * |
||
2223 | * ``` php |
||
2224 | * <?php |
||
2225 | * # switch to iframe |
||
2226 | * $I->switchToIframe("another_frame"); |
||
2227 | * ``` |
||
2228 | * |
||
2229 | * @param string $name |
||
2230 | * @see \Codeception\Lib\InnerBrowser::switchToIframe() |
||
2231 | */ |
||
2232 | public function switchToIframe($name) { |
||
2235 | |||
2236 | |||
2237 | /** |
||
2238 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2239 | * |
||
2240 | * Moves back in history. |
||
2241 | * |
||
2242 | * @param int $numberOfSteps (default value 1) |
||
2243 | * @see \Codeception\Lib\InnerBrowser::moveBack() |
||
2244 | */ |
||
2245 | public function moveBack($numberOfSteps = null) { |
||
2248 | } |
||
2249 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.