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