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] 7d481331d6129f83c830cf2d60e26a08 |
||
6 | trait AcceptanceTesterActions |
||
7 | { |
||
8 | /** |
||
9 | * @return \Codeception\Scenario |
||
10 | */ |
||
11 | abstract protected function getScenario(); |
||
12 | |||
13 | /** |
||
14 | * [!] Method is generated. Documentation taken from corresponding module. |
||
15 | * |
||
16 | * Print out latest Selenium Logs in debug mode |
||
17 | * |
||
18 | * @param TestInterface $test |
||
19 | * @see \Codeception\Module\WebDriver::debugWebDriverLogs() |
||
20 | */ |
||
21 | public function debugWebDriverLogs($test = null) { |
||
24 | |||
25 | /** |
||
26 | * [!] Method is generated. Documentation taken from corresponding module. |
||
27 | * |
||
28 | * Changes the subdomain for the 'url' configuration parameter. |
||
29 | * Does not open a page; use `amOnPage` for that. |
||
30 | * |
||
31 | * ``` php |
||
32 | * <?php |
||
33 | * // If config is: 'http://mysite.com' |
||
34 | * // or config is: 'http://www.mysite.com' |
||
35 | * // or config is: 'http://company.mysite.com' |
||
36 | * |
||
37 | * $I->amOnSubdomain('user'); |
||
38 | * $I->amOnPage('/'); |
||
39 | * // moves to http://user.mysite.com/ |
||
40 | * ?> |
||
41 | * ``` |
||
42 | * |
||
43 | * @param $subdomain |
||
44 | * |
||
45 | * @return mixed |
||
46 | * @see \Codeception\Module\WebDriver::amOnSubdomain() |
||
47 | */ |
||
48 | public function amOnSubdomain($subdomain) { |
||
51 | |||
52 | /** |
||
53 | * [!] Method is generated. Documentation taken from corresponding module. |
||
54 | * |
||
55 | * Takes a screenshot of the current window and saves it to `tests/_output/debug`. |
||
56 | * |
||
57 | * ``` php |
||
58 | * <?php |
||
59 | * $I->amOnPage('/user/edit'); |
||
60 | * $I->makeScreenshot('edit_page'); |
||
61 | * // saved to: tests/_output/debug/edit_page.png |
||
62 | * $I->makeScreenshot(); |
||
63 | * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png |
||
64 | * ``` |
||
65 | * |
||
66 | * @param $name |
||
67 | * @see \Codeception\Module\WebDriver::makeScreenshot() |
||
68 | */ |
||
69 | public function makeScreenshot($name = null) { |
||
72 | |||
73 | /** |
||
74 | * [!] Method is generated. Documentation taken from corresponding module. |
||
75 | * |
||
76 | * Resize the current window. |
||
77 | * |
||
78 | * ``` php |
||
79 | * <?php |
||
80 | * $I->resizeWindow(800, 600); |
||
81 | * |
||
82 | * ``` |
||
83 | * |
||
84 | * @param int $width |
||
85 | * @param int $height |
||
86 | * @see \Codeception\Module\WebDriver::resizeWindow() |
||
87 | */ |
||
88 | public function resizeWindow($width, $height) { |
||
91 | |||
92 | /** |
||
93 | * [!] Method is generated. Documentation taken from corresponding module. |
||
94 | * |
||
95 | * Checks that a cookie with the given name is set. |
||
96 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
97 | * |
||
98 | * ``` php |
||
99 | * <?php |
||
100 | * $I->seeCookie('PHPSESSID'); |
||
101 | * ?> |
||
102 | * ``` |
||
103 | * |
||
104 | * @param $cookie |
||
105 | * @param array $params |
||
106 | * @return mixed |
||
107 | * Conditional Assertion: Test won't be stopped on fail |
||
108 | * @see \Codeception\Module\WebDriver::seeCookie() |
||
109 | */ |
||
110 | public function canSeeCookie($cookie, $params = null) { |
||
113 | /** |
||
114 | * [!] Method is generated. Documentation taken from corresponding module. |
||
115 | * |
||
116 | * Checks that a cookie with the given name is set. |
||
117 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
118 | * |
||
119 | * ``` php |
||
120 | * <?php |
||
121 | * $I->seeCookie('PHPSESSID'); |
||
122 | * ?> |
||
123 | * ``` |
||
124 | * |
||
125 | * @param $cookie |
||
126 | * @param array $params |
||
127 | * @return mixed |
||
128 | * @see \Codeception\Module\WebDriver::seeCookie() |
||
129 | */ |
||
130 | public function seeCookie($cookie, $params = null) { |
||
133 | |||
134 | /** |
||
135 | * [!] Method is generated. Documentation taken from corresponding module. |
||
136 | * |
||
137 | * Checks that there isn't a cookie with the given name. |
||
138 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
139 | * |
||
140 | * @param $cookie |
||
141 | * |
||
142 | * @param array $params |
||
143 | * @return mixed |
||
144 | * Conditional Assertion: Test won't be stopped on fail |
||
145 | * @see \Codeception\Module\WebDriver::dontSeeCookie() |
||
146 | */ |
||
147 | public function cantSeeCookie($cookie, $params = null) { |
||
150 | /** |
||
151 | * [!] Method is generated. Documentation taken from corresponding module. |
||
152 | * |
||
153 | * Checks that there isn't a cookie with the given name. |
||
154 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
155 | * |
||
156 | * @param $cookie |
||
157 | * |
||
158 | * @param array $params |
||
159 | * @return mixed |
||
160 | * @see \Codeception\Module\WebDriver::dontSeeCookie() |
||
161 | */ |
||
162 | public function dontSeeCookie($cookie, $params = null) { |
||
165 | |||
166 | /** |
||
167 | * [!] Method is generated. Documentation taken from corresponding module. |
||
168 | * |
||
169 | * Sets a cookie with the given name and value. |
||
170 | * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. |
||
171 | * |
||
172 | * ``` php |
||
173 | * <?php |
||
174 | * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); |
||
175 | * ?> |
||
176 | * ``` |
||
177 | * |
||
178 | * @param $name |
||
179 | * @param $val |
||
180 | * @param array $params |
||
181 | * |
||
182 | * @return mixed |
||
183 | * @see \Codeception\Module\WebDriver::setCookie() |
||
184 | */ |
||
185 | public function setCookie($cookie, $value, $params = null) { |
||
188 | |||
189 | /** |
||
190 | * [!] Method is generated. Documentation taken from corresponding module. |
||
191 | * |
||
192 | * Unsets cookie with the given name. |
||
193 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
194 | * |
||
195 | * @param $cookie |
||
196 | * |
||
197 | * @param array $params |
||
198 | * @return mixed |
||
199 | * @see \Codeception\Module\WebDriver::resetCookie() |
||
200 | */ |
||
201 | public function resetCookie($cookie, $params = null) { |
||
204 | |||
205 | /** |
||
206 | * [!] Method is generated. Documentation taken from corresponding module. |
||
207 | * |
||
208 | * Grabs a cookie value. |
||
209 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
210 | * |
||
211 | * @param $cookie |
||
212 | * |
||
213 | * @param array $params |
||
214 | * @return mixed |
||
215 | * @see \Codeception\Module\WebDriver::grabCookie() |
||
216 | */ |
||
217 | public function grabCookie($cookie, $params = null) { |
||
220 | |||
221 | /** |
||
222 | * [!] Method is generated. Documentation taken from corresponding module. |
||
223 | * |
||
224 | * Grabs current page source code. |
||
225 | * |
||
226 | * @throws ModuleException if no page was opened. |
||
227 | * |
||
228 | * @return string Current page source code. |
||
229 | * @see \Codeception\Module\WebDriver::grabPageSource() |
||
230 | */ |
||
231 | public function grabPageSource() { |
||
234 | |||
235 | /** |
||
236 | * [!] Method is generated. Documentation taken from corresponding module. |
||
237 | * |
||
238 | * Open web page at the given absolute URL and sets its hostname as the base host. |
||
239 | * |
||
240 | * ``` php |
||
241 | * <?php |
||
242 | * $I->amOnUrl('http://codeception.com'); |
||
243 | * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart |
||
244 | * ?> |
||
245 | * ``` |
||
246 | * @see \Codeception\Module\WebDriver::amOnUrl() |
||
247 | */ |
||
248 | public function amOnUrl($url) { |
||
251 | |||
252 | /** |
||
253 | * [!] Method is generated. Documentation taken from corresponding module. |
||
254 | * |
||
255 | * Opens the page for the given relative URI. |
||
256 | * |
||
257 | * ``` php |
||
258 | * <?php |
||
259 | * // opens front page |
||
260 | * $I->amOnPage('/'); |
||
261 | * // opens /register page |
||
262 | * $I->amOnPage('/register'); |
||
263 | * ``` |
||
264 | * |
||
265 | * @param string $page |
||
266 | * @see \Codeception\Module\WebDriver::amOnPage() |
||
267 | */ |
||
268 | public function amOnPage($page) { |
||
271 | |||
272 | /** |
||
273 | * [!] Method is generated. Documentation taken from corresponding module. |
||
274 | * |
||
275 | * Checks that the current page contains the given string (case insensitive). |
||
276 | * |
||
277 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
278 | * parameter to only search within that element. |
||
279 | * |
||
280 | * ``` php |
||
281 | * <?php |
||
282 | * $I->see('Logout'); // I can suppose user is logged in |
||
283 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
284 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
285 | * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
286 | * ``` |
||
287 | * |
||
288 | * Note that the search is done after stripping all HTML tags from the body, |
||
289 | * so `$I->see('strong')` will return true for strings like: |
||
290 | * |
||
291 | * - `<p>I am Stronger than thou</p>` |
||
292 | * - `<script>document.createElement('strong');</script>` |
||
293 | * |
||
294 | * But will *not* be true for strings like: |
||
295 | * |
||
296 | * - `<strong>Home</strong>` |
||
297 | * - `<div class="strong">Home</strong>` |
||
298 | * - `<!-- strong -->` |
||
299 | * |
||
300 | * For checking the raw source code, use `seeInSource()`. |
||
301 | * |
||
302 | * @param string $text |
||
303 | * @param string $selector optional |
||
304 | * Conditional Assertion: Test won't be stopped on fail |
||
305 | * @see \Codeception\Module\WebDriver::see() |
||
306 | */ |
||
307 | public function canSee($text, $selector = null) { |
||
310 | /** |
||
311 | * [!] Method is generated. Documentation taken from corresponding module. |
||
312 | * |
||
313 | * Checks that the current page contains the given string (case insensitive). |
||
314 | * |
||
315 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
316 | * parameter to only search within that element. |
||
317 | * |
||
318 | * ``` php |
||
319 | * <?php |
||
320 | * $I->see('Logout'); // I can suppose user is logged in |
||
321 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
322 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
323 | * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
324 | * ``` |
||
325 | * |
||
326 | * Note that the search is done after stripping all HTML tags from the body, |
||
327 | * so `$I->see('strong')` will return true for strings like: |
||
328 | * |
||
329 | * - `<p>I am Stronger than thou</p>` |
||
330 | * - `<script>document.createElement('strong');</script>` |
||
331 | * |
||
332 | * But will *not* be true for strings like: |
||
333 | * |
||
334 | * - `<strong>Home</strong>` |
||
335 | * - `<div class="strong">Home</strong>` |
||
336 | * - `<!-- strong -->` |
||
337 | * |
||
338 | * For checking the raw source code, use `seeInSource()`. |
||
339 | * |
||
340 | * @param string $text |
||
341 | * @param string $selector optional |
||
342 | * @see \Codeception\Module\WebDriver::see() |
||
343 | */ |
||
344 | public function see($text, $selector = null) { |
||
347 | |||
348 | /** |
||
349 | * [!] Method is generated. Documentation taken from corresponding module. |
||
350 | * |
||
351 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
352 | * Give a locator as the second parameter to match a specific region. |
||
353 | * |
||
354 | * ```php |
||
355 | * <?php |
||
356 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
357 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
358 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
359 | * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
360 | * ``` |
||
361 | * |
||
362 | * Note that the search is done after stripping all HTML tags from the body, |
||
363 | * so `$I->dontSee('strong')` will fail on strings like: |
||
364 | * |
||
365 | * - `<p>I am Stronger than thou</p>` |
||
366 | * - `<script>document.createElement('strong');</script>` |
||
367 | * |
||
368 | * But will ignore strings like: |
||
369 | * |
||
370 | * - `<strong>Home</strong>` |
||
371 | * - `<div class="strong">Home</strong>` |
||
372 | * - `<!-- strong -->` |
||
373 | * |
||
374 | * For checking the raw source code, use `seeInSource()`. |
||
375 | * |
||
376 | * @param string $text |
||
377 | * @param string $selector optional |
||
378 | * Conditional Assertion: Test won't be stopped on fail |
||
379 | * @see \Codeception\Module\WebDriver::dontSee() |
||
380 | */ |
||
381 | public function cantSee($text, $selector = null) { |
||
384 | /** |
||
385 | * [!] Method is generated. Documentation taken from corresponding module. |
||
386 | * |
||
387 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
388 | * Give a locator as the second parameter to match a specific region. |
||
389 | * |
||
390 | * ```php |
||
391 | * <?php |
||
392 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
393 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
394 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
395 | * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
396 | * ``` |
||
397 | * |
||
398 | * Note that the search is done after stripping all HTML tags from the body, |
||
399 | * so `$I->dontSee('strong')` will fail on strings like: |
||
400 | * |
||
401 | * - `<p>I am Stronger than thou</p>` |
||
402 | * - `<script>document.createElement('strong');</script>` |
||
403 | * |
||
404 | * But will ignore strings like: |
||
405 | * |
||
406 | * - `<strong>Home</strong>` |
||
407 | * - `<div class="strong">Home</strong>` |
||
408 | * - `<!-- strong -->` |
||
409 | * |
||
410 | * For checking the raw source code, use `seeInSource()`. |
||
411 | * |
||
412 | * @param string $text |
||
413 | * @param string $selector optional |
||
414 | * @see \Codeception\Module\WebDriver::dontSee() |
||
415 | */ |
||
416 | public function dontSee($text, $selector = null) { |
||
419 | |||
420 | /** |
||
421 | * [!] Method is generated. Documentation taken from corresponding module. |
||
422 | * |
||
423 | * Checks that the current page contains the given string in its |
||
424 | * raw source code. |
||
425 | * |
||
426 | * ``` php |
||
427 | * <?php |
||
428 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
429 | * ``` |
||
430 | * |
||
431 | * @param $raw |
||
432 | * Conditional Assertion: Test won't be stopped on fail |
||
433 | * @see \Codeception\Module\WebDriver::seeInSource() |
||
434 | */ |
||
435 | public function canSeeInSource($raw) { |
||
438 | /** |
||
439 | * [!] Method is generated. Documentation taken from corresponding module. |
||
440 | * |
||
441 | * Checks that the current page contains the given string in its |
||
442 | * raw source code. |
||
443 | * |
||
444 | * ``` php |
||
445 | * <?php |
||
446 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
447 | * ``` |
||
448 | * |
||
449 | * @param $raw |
||
450 | * @see \Codeception\Module\WebDriver::seeInSource() |
||
451 | */ |
||
452 | public function seeInSource($raw) { |
||
455 | |||
456 | /** |
||
457 | * [!] Method is generated. Documentation taken from corresponding module. |
||
458 | * |
||
459 | * Checks that the current page contains the given string in its |
||
460 | * raw source code. |
||
461 | * |
||
462 | * ```php |
||
463 | * <?php |
||
464 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
465 | * ``` |
||
466 | * |
||
467 | * @param $raw |
||
468 | * Conditional Assertion: Test won't be stopped on fail |
||
469 | * @see \Codeception\Module\WebDriver::dontSeeInSource() |
||
470 | */ |
||
471 | public function cantSeeInSource($raw) { |
||
474 | /** |
||
475 | * [!] Method is generated. Documentation taken from corresponding module. |
||
476 | * |
||
477 | * Checks that the current page contains the given string in its |
||
478 | * raw source code. |
||
479 | * |
||
480 | * ```php |
||
481 | * <?php |
||
482 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
483 | * ``` |
||
484 | * |
||
485 | * @param $raw |
||
486 | * @see \Codeception\Module\WebDriver::dontSeeInSource() |
||
487 | */ |
||
488 | public function dontSeeInSource($raw) { |
||
491 | |||
492 | /** |
||
493 | * [!] Method is generated. Documentation taken from corresponding module. |
||
494 | * |
||
495 | * Checks that the page source contains the given string. |
||
496 | * |
||
497 | * ```php |
||
498 | * <?php |
||
499 | * $I->seeInPageSource('<link rel="apple-touch-icon"'); |
||
500 | * ``` |
||
501 | * |
||
502 | * @param $text |
||
503 | * Conditional Assertion: Test won't be stopped on fail |
||
504 | * @see \Codeception\Module\WebDriver::seeInPageSource() |
||
505 | */ |
||
506 | public function canSeeInPageSource($text) { |
||
509 | /** |
||
510 | * [!] Method is generated. Documentation taken from corresponding module. |
||
511 | * |
||
512 | * Checks that the page source contains the given string. |
||
513 | * |
||
514 | * ```php |
||
515 | * <?php |
||
516 | * $I->seeInPageSource('<link rel="apple-touch-icon"'); |
||
517 | * ``` |
||
518 | * |
||
519 | * @param $text |
||
520 | * @see \Codeception\Module\WebDriver::seeInPageSource() |
||
521 | */ |
||
522 | public function seeInPageSource($text) { |
||
525 | |||
526 | /** |
||
527 | * [!] Method is generated. Documentation taken from corresponding module. |
||
528 | * |
||
529 | * Checks that the page source doesn't contain the given string. |
||
530 | * |
||
531 | * @param $text |
||
532 | * Conditional Assertion: Test won't be stopped on fail |
||
533 | * @see \Codeception\Module\WebDriver::dontSeeInPageSource() |
||
534 | */ |
||
535 | public function cantSeeInPageSource($text) { |
||
538 | /** |
||
539 | * [!] Method is generated. Documentation taken from corresponding module. |
||
540 | * |
||
541 | * Checks that the page source doesn't contain the given string. |
||
542 | * |
||
543 | * @param $text |
||
544 | * @see \Codeception\Module\WebDriver::dontSeeInPageSource() |
||
545 | */ |
||
546 | public function dontSeeInPageSource($text) { |
||
549 | |||
550 | /** |
||
551 | * [!] Method is generated. Documentation taken from corresponding module. |
||
552 | * |
||
553 | * Perform a click on a link or a button, given by a locator. |
||
554 | * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. |
||
555 | * For buttons, the "value" attribute, "name" attribute, and inner text are searched. |
||
556 | * For links, the link text is searched. |
||
557 | * For images, the "alt" attribute and inner text of any parent links are searched. |
||
558 | * |
||
559 | * The second parameter is a context (CSS or XPath locator) to narrow the search. |
||
560 | * |
||
561 | * Note that if the locator matches a button of type `submit`, the form will be submitted. |
||
562 | * |
||
563 | * ``` php |
||
564 | * <?php |
||
565 | * // simple link |
||
566 | * $I->click('Logout'); |
||
567 | * // button of form |
||
568 | * $I->click('Submit'); |
||
569 | * // CSS button |
||
570 | * $I->click('#form input[type=submit]'); |
||
571 | * // XPath |
||
572 | * $I->click('//form/*[@type=submit]'); |
||
573 | * // link in context |
||
574 | * $I->click('Logout', '#nav'); |
||
575 | * // using strict locator |
||
576 | * $I->click(['link' => 'Login']); |
||
577 | * ?> |
||
578 | * ``` |
||
579 | * |
||
580 | * @param $link |
||
581 | * @param $context |
||
582 | * @see \Codeception\Module\WebDriver::click() |
||
583 | */ |
||
584 | public function click($link, $context = null) { |
||
587 | |||
588 | /** |
||
589 | * [!] Method is generated. Documentation taken from corresponding module. |
||
590 | * |
||
591 | * Checks that there's a link with the specified text. |
||
592 | * Give a full URL as the second parameter to match links with that exact URL. |
||
593 | * |
||
594 | * ``` php |
||
595 | * <?php |
||
596 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
597 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
598 | * ?> |
||
599 | * ``` |
||
600 | * |
||
601 | * @param string $text |
||
602 | * @param string $url optional |
||
603 | * Conditional Assertion: Test won't be stopped on fail |
||
604 | * @see \Codeception\Module\WebDriver::seeLink() |
||
605 | */ |
||
606 | public function canSeeLink($text, $url = null) { |
||
609 | /** |
||
610 | * [!] Method is generated. Documentation taken from corresponding module. |
||
611 | * |
||
612 | * Checks that there's a link with the specified text. |
||
613 | * Give a full URL as the second parameter to match links with that exact URL. |
||
614 | * |
||
615 | * ``` php |
||
616 | * <?php |
||
617 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
618 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
619 | * ?> |
||
620 | * ``` |
||
621 | * |
||
622 | * @param string $text |
||
623 | * @param string $url optional |
||
624 | * @see \Codeception\Module\WebDriver::seeLink() |
||
625 | */ |
||
626 | public function seeLink($text, $url = null) { |
||
629 | |||
630 | /** |
||
631 | * [!] Method is generated. Documentation taken from corresponding module. |
||
632 | * |
||
633 | * Checks that the page doesn't contain a link with the given string. |
||
634 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
635 | * |
||
636 | * ``` php |
||
637 | * <?php |
||
638 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
639 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
640 | * ?> |
||
641 | * ``` |
||
642 | * |
||
643 | * @param string $text |
||
644 | * @param string $url optional |
||
645 | * Conditional Assertion: Test won't be stopped on fail |
||
646 | * @see \Codeception\Module\WebDriver::dontSeeLink() |
||
647 | */ |
||
648 | public function cantSeeLink($text, $url = null) { |
||
651 | /** |
||
652 | * [!] Method is generated. Documentation taken from corresponding module. |
||
653 | * |
||
654 | * Checks that the page doesn't contain a link with the given string. |
||
655 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
656 | * |
||
657 | * ``` php |
||
658 | * <?php |
||
659 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
660 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
661 | * ?> |
||
662 | * ``` |
||
663 | * |
||
664 | * @param string $text |
||
665 | * @param string $url optional |
||
666 | * @see \Codeception\Module\WebDriver::dontSeeLink() |
||
667 | */ |
||
668 | public function dontSeeLink($text, $url = null) { |
||
671 | |||
672 | /** |
||
673 | * [!] Method is generated. Documentation taken from corresponding module. |
||
674 | * |
||
675 | * Checks that current URI contains the given string. |
||
676 | * |
||
677 | * ``` php |
||
678 | * <?php |
||
679 | * // to match: /home/dashboard |
||
680 | * $I->seeInCurrentUrl('home'); |
||
681 | * // to match: /users/1 |
||
682 | * $I->seeInCurrentUrl('/users/'); |
||
683 | * ?> |
||
684 | * ``` |
||
685 | * |
||
686 | * @param string $uri |
||
687 | * Conditional Assertion: Test won't be stopped on fail |
||
688 | * @see \Codeception\Module\WebDriver::seeInCurrentUrl() |
||
689 | */ |
||
690 | public function canSeeInCurrentUrl($uri) { |
||
693 | /** |
||
694 | * [!] Method is generated. Documentation taken from corresponding module. |
||
695 | * |
||
696 | * Checks that current URI contains the given string. |
||
697 | * |
||
698 | * ``` php |
||
699 | * <?php |
||
700 | * // to match: /home/dashboard |
||
701 | * $I->seeInCurrentUrl('home'); |
||
702 | * // to match: /users/1 |
||
703 | * $I->seeInCurrentUrl('/users/'); |
||
704 | * ?> |
||
705 | * ``` |
||
706 | * |
||
707 | * @param string $uri |
||
708 | * @see \Codeception\Module\WebDriver::seeInCurrentUrl() |
||
709 | */ |
||
710 | public function seeInCurrentUrl($uri) { |
||
713 | |||
714 | /** |
||
715 | * [!] Method is generated. Documentation taken from corresponding module. |
||
716 | * |
||
717 | * Checks that the current URL is equal to the given string. |
||
718 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
719 | * |
||
720 | * ``` php |
||
721 | * <?php |
||
722 | * // to match root url |
||
723 | * $I->seeCurrentUrlEquals('/'); |
||
724 | * ?> |
||
725 | * ``` |
||
726 | * |
||
727 | * @param string $uri |
||
728 | * Conditional Assertion: Test won't be stopped on fail |
||
729 | * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() |
||
730 | */ |
||
731 | public function canSeeCurrentUrlEquals($uri) { |
||
734 | /** |
||
735 | * [!] Method is generated. Documentation taken from corresponding module. |
||
736 | * |
||
737 | * Checks that the current URL is equal to the given string. |
||
738 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
739 | * |
||
740 | * ``` php |
||
741 | * <?php |
||
742 | * // to match root url |
||
743 | * $I->seeCurrentUrlEquals('/'); |
||
744 | * ?> |
||
745 | * ``` |
||
746 | * |
||
747 | * @param string $uri |
||
748 | * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() |
||
749 | */ |
||
750 | public function seeCurrentUrlEquals($uri) { |
||
753 | |||
754 | /** |
||
755 | * [!] Method is generated. Documentation taken from corresponding module. |
||
756 | * |
||
757 | * Checks that the current URL matches the given regular expression. |
||
758 | * |
||
759 | * ``` php |
||
760 | * <?php |
||
761 | * // to match root url |
||
762 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
763 | * ?> |
||
764 | * ``` |
||
765 | * |
||
766 | * @param string $uri |
||
767 | * Conditional Assertion: Test won't be stopped on fail |
||
768 | * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() |
||
769 | */ |
||
770 | public function canSeeCurrentUrlMatches($uri) { |
||
773 | /** |
||
774 | * [!] Method is generated. Documentation taken from corresponding module. |
||
775 | * |
||
776 | * Checks that the current URL matches the given regular expression. |
||
777 | * |
||
778 | * ``` php |
||
779 | * <?php |
||
780 | * // to match root url |
||
781 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
782 | * ?> |
||
783 | * ``` |
||
784 | * |
||
785 | * @param string $uri |
||
786 | * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() |
||
787 | */ |
||
788 | public function seeCurrentUrlMatches($uri) { |
||
791 | |||
792 | /** |
||
793 | * [!] Method is generated. Documentation taken from corresponding module. |
||
794 | * |
||
795 | * Checks that the current URI doesn't contain the given string. |
||
796 | * |
||
797 | * ``` php |
||
798 | * <?php |
||
799 | * $I->dontSeeInCurrentUrl('/users/'); |
||
800 | * ?> |
||
801 | * ``` |
||
802 | * |
||
803 | * @param string $uri |
||
804 | * Conditional Assertion: Test won't be stopped on fail |
||
805 | * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() |
||
806 | */ |
||
807 | public function cantSeeInCurrentUrl($uri) { |
||
810 | /** |
||
811 | * [!] Method is generated. Documentation taken from corresponding module. |
||
812 | * |
||
813 | * Checks that the current URI doesn't contain the given string. |
||
814 | * |
||
815 | * ``` php |
||
816 | * <?php |
||
817 | * $I->dontSeeInCurrentUrl('/users/'); |
||
818 | * ?> |
||
819 | * ``` |
||
820 | * |
||
821 | * @param string $uri |
||
822 | * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() |
||
823 | */ |
||
824 | public function dontSeeInCurrentUrl($uri) { |
||
827 | |||
828 | /** |
||
829 | * [!] Method is generated. Documentation taken from corresponding module. |
||
830 | * |
||
831 | * Checks that the current URL doesn't equal the given string. |
||
832 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
833 | * |
||
834 | * ``` php |
||
835 | * <?php |
||
836 | * // current url is not root |
||
837 | * $I->dontSeeCurrentUrlEquals('/'); |
||
838 | * ?> |
||
839 | * ``` |
||
840 | * |
||
841 | * @param string $uri |
||
842 | * Conditional Assertion: Test won't be stopped on fail |
||
843 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() |
||
844 | */ |
||
845 | public function cantSeeCurrentUrlEquals($uri) { |
||
848 | /** |
||
849 | * [!] Method is generated. Documentation taken from corresponding module. |
||
850 | * |
||
851 | * Checks that the current URL doesn't equal the given string. |
||
852 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
853 | * |
||
854 | * ``` php |
||
855 | * <?php |
||
856 | * // current url is not root |
||
857 | * $I->dontSeeCurrentUrlEquals('/'); |
||
858 | * ?> |
||
859 | * ``` |
||
860 | * |
||
861 | * @param string $uri |
||
862 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() |
||
863 | */ |
||
864 | public function dontSeeCurrentUrlEquals($uri) { |
||
867 | |||
868 | /** |
||
869 | * [!] Method is generated. Documentation taken from corresponding module. |
||
870 | * |
||
871 | * Checks that current url doesn't match the given regular expression. |
||
872 | * |
||
873 | * ``` php |
||
874 | * <?php |
||
875 | * // to match root url |
||
876 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
877 | * ?> |
||
878 | * ``` |
||
879 | * |
||
880 | * @param string $uri |
||
881 | * Conditional Assertion: Test won't be stopped on fail |
||
882 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() |
||
883 | */ |
||
884 | public function cantSeeCurrentUrlMatches($uri) { |
||
887 | /** |
||
888 | * [!] Method is generated. Documentation taken from corresponding module. |
||
889 | * |
||
890 | * Checks that current url doesn't match the given regular expression. |
||
891 | * |
||
892 | * ``` php |
||
893 | * <?php |
||
894 | * // to match root url |
||
895 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
896 | * ?> |
||
897 | * ``` |
||
898 | * |
||
899 | * @param string $uri |
||
900 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() |
||
901 | */ |
||
902 | public function dontSeeCurrentUrlMatches($uri) { |
||
905 | |||
906 | /** |
||
907 | * [!] Method is generated. Documentation taken from corresponding module. |
||
908 | * |
||
909 | * Executes the given regular expression against the current URI and returns the first capturing group. |
||
910 | * If no parameters are provided, the full URI is returned. |
||
911 | * |
||
912 | * ``` php |
||
913 | * <?php |
||
914 | * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); |
||
915 | * $uri = $I->grabFromCurrentUrl(); |
||
916 | * ?> |
||
917 | * ``` |
||
918 | * |
||
919 | * @param string $uri optional |
||
920 | * |
||
921 | * @return mixed |
||
922 | * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() |
||
923 | */ |
||
924 | public function grabFromCurrentUrl($uri = null) { |
||
927 | |||
928 | /** |
||
929 | * [!] Method is generated. Documentation taken from corresponding module. |
||
930 | * |
||
931 | * Checks that the specified checkbox is checked. |
||
932 | * |
||
933 | * ``` php |
||
934 | * <?php |
||
935 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
936 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
937 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
938 | * ?> |
||
939 | * ``` |
||
940 | * |
||
941 | * @param $checkbox |
||
942 | * Conditional Assertion: Test won't be stopped on fail |
||
943 | * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() |
||
944 | */ |
||
945 | public function canSeeCheckboxIsChecked($checkbox) { |
||
948 | /** |
||
949 | * [!] Method is generated. Documentation taken from corresponding module. |
||
950 | * |
||
951 | * Checks that the specified checkbox is checked. |
||
952 | * |
||
953 | * ``` php |
||
954 | * <?php |
||
955 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
956 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
957 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
958 | * ?> |
||
959 | * ``` |
||
960 | * |
||
961 | * @param $checkbox |
||
962 | * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() |
||
963 | */ |
||
964 | public function seeCheckboxIsChecked($checkbox) { |
||
967 | |||
968 | /** |
||
969 | * [!] Method is generated. Documentation taken from corresponding module. |
||
970 | * |
||
971 | * Check that the specified checkbox is unchecked. |
||
972 | * |
||
973 | * ``` php |
||
974 | * <?php |
||
975 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
976 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
977 | * ?> |
||
978 | * ``` |
||
979 | * |
||
980 | * @param $checkbox |
||
981 | * Conditional Assertion: Test won't be stopped on fail |
||
982 | * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() |
||
983 | */ |
||
984 | public function cantSeeCheckboxIsChecked($checkbox) { |
||
987 | /** |
||
988 | * [!] Method is generated. Documentation taken from corresponding module. |
||
989 | * |
||
990 | * Check that the specified checkbox is unchecked. |
||
991 | * |
||
992 | * ``` php |
||
993 | * <?php |
||
994 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
995 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
996 | * ?> |
||
997 | * ``` |
||
998 | * |
||
999 | * @param $checkbox |
||
1000 | * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() |
||
1001 | */ |
||
1002 | public function dontSeeCheckboxIsChecked($checkbox) { |
||
1005 | |||
1006 | /** |
||
1007 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1008 | * |
||
1009 | * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. |
||
1010 | * Fields are matched by label text, the "name" attribute, CSS, or XPath. |
||
1011 | * |
||
1012 | * ``` php |
||
1013 | * <?php |
||
1014 | * $I->seeInField('Body','Type your comment here'); |
||
1015 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
1016 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
1017 | * $I->seeInField('#searchform input','Search'); |
||
1018 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
1019 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
1020 | * ?> |
||
1021 | * ``` |
||
1022 | * |
||
1023 | * @param $field |
||
1024 | * @param $value |
||
1025 | * Conditional Assertion: Test won't be stopped on fail |
||
1026 | * @see \Codeception\Module\WebDriver::seeInField() |
||
1027 | */ |
||
1028 | public function canSeeInField($field, $value) { |
||
1031 | /** |
||
1032 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1033 | * |
||
1034 | * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. |
||
1035 | * Fields are matched by label text, the "name" attribute, CSS, or XPath. |
||
1036 | * |
||
1037 | * ``` php |
||
1038 | * <?php |
||
1039 | * $I->seeInField('Body','Type your comment here'); |
||
1040 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
1041 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
1042 | * $I->seeInField('#searchform input','Search'); |
||
1043 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
1044 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
1045 | * ?> |
||
1046 | * ``` |
||
1047 | * |
||
1048 | * @param $field |
||
1049 | * @param $value |
||
1050 | * @see \Codeception\Module\WebDriver::seeInField() |
||
1051 | */ |
||
1052 | public function seeInField($field, $value) { |
||
1055 | |||
1056 | /** |
||
1057 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1058 | * |
||
1059 | * Checks that an input field or textarea doesn't contain the given value. |
||
1060 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
1061 | * |
||
1062 | * ``` php |
||
1063 | * <?php |
||
1064 | * $I->dontSeeInField('Body','Type your comment here'); |
||
1065 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
1066 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
1067 | * $I->dontSeeInField('#searchform input','Search'); |
||
1068 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
1069 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
1070 | * ?> |
||
1071 | * ``` |
||
1072 | * |
||
1073 | * @param $field |
||
1074 | * @param $value |
||
1075 | * Conditional Assertion: Test won't be stopped on fail |
||
1076 | * @see \Codeception\Module\WebDriver::dontSeeInField() |
||
1077 | */ |
||
1078 | public function cantSeeInField($field, $value) { |
||
1081 | /** |
||
1082 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1083 | * |
||
1084 | * Checks that an input field or textarea doesn't contain the given value. |
||
1085 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
1086 | * |
||
1087 | * ``` php |
||
1088 | * <?php |
||
1089 | * $I->dontSeeInField('Body','Type your comment here'); |
||
1090 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
1091 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
1092 | * $I->dontSeeInField('#searchform input','Search'); |
||
1093 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
1094 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
1095 | * ?> |
||
1096 | * ``` |
||
1097 | * |
||
1098 | * @param $field |
||
1099 | * @param $value |
||
1100 | * @see \Codeception\Module\WebDriver::dontSeeInField() |
||
1101 | */ |
||
1102 | public function dontSeeInField($field, $value) { |
||
1105 | |||
1106 | /** |
||
1107 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1108 | * |
||
1109 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
1110 | * passed selector. |
||
1111 | * |
||
1112 | * ``` php |
||
1113 | * <?php |
||
1114 | * $I->seeInFormFields('form[name=myform]', [ |
||
1115 | * 'input1' => 'value', |
||
1116 | * 'input2' => 'other value', |
||
1117 | * ]); |
||
1118 | * ?> |
||
1119 | * ``` |
||
1120 | * |
||
1121 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
1122 | * array may be passed: |
||
1123 | * |
||
1124 | * ``` php |
||
1125 | * <?php |
||
1126 | * $I->seeInFormFields('.form-class', [ |
||
1127 | * 'multiselect' => [ |
||
1128 | * 'value1', |
||
1129 | * 'value2', |
||
1130 | * ], |
||
1131 | * 'checkbox[]' => [ |
||
1132 | * 'a checked value', |
||
1133 | * 'another checked value', |
||
1134 | * ], |
||
1135 | * ]); |
||
1136 | * ?> |
||
1137 | * ``` |
||
1138 | * |
||
1139 | * Additionally, checkbox values can be checked with a boolean. |
||
1140 | * |
||
1141 | * ``` php |
||
1142 | * <?php |
||
1143 | * $I->seeInFormFields('#form-id', [ |
||
1144 | * 'checkbox1' => true, // passes if checked |
||
1145 | * 'checkbox2' => false, // passes if unchecked |
||
1146 | * ]); |
||
1147 | * ?> |
||
1148 | * ``` |
||
1149 | * |
||
1150 | * Pair this with submitForm for quick testing magic. |
||
1151 | * |
||
1152 | * ``` php |
||
1153 | * <?php |
||
1154 | * $form = [ |
||
1155 | * 'field1' => 'value', |
||
1156 | * 'field2' => 'another value', |
||
1157 | * 'checkbox1' => true, |
||
1158 | * // ... |
||
1159 | * ]; |
||
1160 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
1161 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
1162 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
1163 | * ?> |
||
1164 | * ``` |
||
1165 | * |
||
1166 | * @param $formSelector |
||
1167 | * @param $params |
||
1168 | * Conditional Assertion: Test won't be stopped on fail |
||
1169 | * @see \Codeception\Module\WebDriver::seeInFormFields() |
||
1170 | */ |
||
1171 | public function canSeeInFormFields($formSelector, $params) { |
||
1174 | /** |
||
1175 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1176 | * |
||
1177 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
1178 | * passed selector. |
||
1179 | * |
||
1180 | * ``` php |
||
1181 | * <?php |
||
1182 | * $I->seeInFormFields('form[name=myform]', [ |
||
1183 | * 'input1' => 'value', |
||
1184 | * 'input2' => 'other value', |
||
1185 | * ]); |
||
1186 | * ?> |
||
1187 | * ``` |
||
1188 | * |
||
1189 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
1190 | * array may be passed: |
||
1191 | * |
||
1192 | * ``` php |
||
1193 | * <?php |
||
1194 | * $I->seeInFormFields('.form-class', [ |
||
1195 | * 'multiselect' => [ |
||
1196 | * 'value1', |
||
1197 | * 'value2', |
||
1198 | * ], |
||
1199 | * 'checkbox[]' => [ |
||
1200 | * 'a checked value', |
||
1201 | * 'another checked value', |
||
1202 | * ], |
||
1203 | * ]); |
||
1204 | * ?> |
||
1205 | * ``` |
||
1206 | * |
||
1207 | * Additionally, checkbox values can be checked with a boolean. |
||
1208 | * |
||
1209 | * ``` php |
||
1210 | * <?php |
||
1211 | * $I->seeInFormFields('#form-id', [ |
||
1212 | * 'checkbox1' => true, // passes if checked |
||
1213 | * 'checkbox2' => false, // passes if unchecked |
||
1214 | * ]); |
||
1215 | * ?> |
||
1216 | * ``` |
||
1217 | * |
||
1218 | * Pair this with submitForm for quick testing magic. |
||
1219 | * |
||
1220 | * ``` php |
||
1221 | * <?php |
||
1222 | * $form = [ |
||
1223 | * 'field1' => 'value', |
||
1224 | * 'field2' => 'another value', |
||
1225 | * 'checkbox1' => true, |
||
1226 | * // ... |
||
1227 | * ]; |
||
1228 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
1229 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
1230 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
1231 | * ?> |
||
1232 | * ``` |
||
1233 | * |
||
1234 | * @param $formSelector |
||
1235 | * @param $params |
||
1236 | * @see \Codeception\Module\WebDriver::seeInFormFields() |
||
1237 | */ |
||
1238 | public function seeInFormFields($formSelector, $params) { |
||
1241 | |||
1242 | /** |
||
1243 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1244 | * |
||
1245 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
1246 | * the passed selector. |
||
1247 | * |
||
1248 | * ``` php |
||
1249 | * <?php |
||
1250 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
1251 | * 'input1' => 'non-existent value', |
||
1252 | * 'input2' => 'other non-existent value', |
||
1253 | * ]); |
||
1254 | * ?> |
||
1255 | * ``` |
||
1256 | * |
||
1257 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
1258 | * as the value: |
||
1259 | * |
||
1260 | * ``` php |
||
1261 | * <?php |
||
1262 | * $I->dontSeeInFormFields('.form-class', [ |
||
1263 | * 'fieldName' => [ |
||
1264 | * 'This value shouldn\'t be set', |
||
1265 | * 'And this value shouldn\'t be set', |
||
1266 | * ], |
||
1267 | * ]); |
||
1268 | * ?> |
||
1269 | * ``` |
||
1270 | * |
||
1271 | * Additionally, checkbox values can be checked with a boolean. |
||
1272 | * |
||
1273 | * ``` php |
||
1274 | * <?php |
||
1275 | * $I->dontSeeInFormFields('#form-id', [ |
||
1276 | * 'checkbox1' => true, // fails if checked |
||
1277 | * 'checkbox2' => false, // fails if unchecked |
||
1278 | * ]); |
||
1279 | * ?> |
||
1280 | * ``` |
||
1281 | * |
||
1282 | * @param $formSelector |
||
1283 | * @param $params |
||
1284 | * Conditional Assertion: Test won't be stopped on fail |
||
1285 | * @see \Codeception\Module\WebDriver::dontSeeInFormFields() |
||
1286 | */ |
||
1287 | public function cantSeeInFormFields($formSelector, $params) { |
||
1290 | /** |
||
1291 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1292 | * |
||
1293 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
1294 | * the passed selector. |
||
1295 | * |
||
1296 | * ``` php |
||
1297 | * <?php |
||
1298 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
1299 | * 'input1' => 'non-existent value', |
||
1300 | * 'input2' => 'other non-existent value', |
||
1301 | * ]); |
||
1302 | * ?> |
||
1303 | * ``` |
||
1304 | * |
||
1305 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
1306 | * as the value: |
||
1307 | * |
||
1308 | * ``` php |
||
1309 | * <?php |
||
1310 | * $I->dontSeeInFormFields('.form-class', [ |
||
1311 | * 'fieldName' => [ |
||
1312 | * 'This value shouldn\'t be set', |
||
1313 | * 'And this value shouldn\'t be set', |
||
1314 | * ], |
||
1315 | * ]); |
||
1316 | * ?> |
||
1317 | * ``` |
||
1318 | * |
||
1319 | * Additionally, checkbox values can be checked with a boolean. |
||
1320 | * |
||
1321 | * ``` php |
||
1322 | * <?php |
||
1323 | * $I->dontSeeInFormFields('#form-id', [ |
||
1324 | * 'checkbox1' => true, // fails if checked |
||
1325 | * 'checkbox2' => false, // fails if unchecked |
||
1326 | * ]); |
||
1327 | * ?> |
||
1328 | * ``` |
||
1329 | * |
||
1330 | * @param $formSelector |
||
1331 | * @param $params |
||
1332 | * @see \Codeception\Module\WebDriver::dontSeeInFormFields() |
||
1333 | */ |
||
1334 | public function dontSeeInFormFields($formSelector, $params) { |
||
1337 | |||
1338 | /** |
||
1339 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1340 | * |
||
1341 | * Selects an option in a select tag or in radio button group. |
||
1342 | * |
||
1343 | * ``` php |
||
1344 | * <?php |
||
1345 | * $I->selectOption('form select[name=account]', 'Premium'); |
||
1346 | * $I->selectOption('form input[name=payment]', 'Monthly'); |
||
1347 | * $I->selectOption('//form/select[@name=account]', 'Monthly'); |
||
1348 | * ?> |
||
1349 | * ``` |
||
1350 | * |
||
1351 | * Provide an array for the second argument to select multiple options: |
||
1352 | * |
||
1353 | * ``` php |
||
1354 | * <?php |
||
1355 | * $I->selectOption('Which OS do you use?', array('Windows','Linux')); |
||
1356 | * ?> |
||
1357 | * ``` |
||
1358 | * |
||
1359 | * Or provide an associative array for the second argument to specifically define which selection method should be used: |
||
1360 | * |
||
1361 | * ``` php |
||
1362 | * <?php |
||
1363 | * $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' |
||
1364 | * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' |
||
1365 | * ?> |
||
1366 | * ``` |
||
1367 | * |
||
1368 | * @param $select |
||
1369 | * @param $option |
||
1370 | * @see \Codeception\Module\WebDriver::selectOption() |
||
1371 | */ |
||
1372 | public function selectOption($select, $option) { |
||
1375 | |||
1376 | /** |
||
1377 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1378 | * |
||
1379 | * Unselect an option in the given select box. |
||
1380 | * |
||
1381 | * @param $select |
||
1382 | * @param $option |
||
1383 | * @see \Codeception\Module\WebDriver::unselectOption() |
||
1384 | */ |
||
1385 | public function unselectOption($select, $option) { |
||
1388 | |||
1389 | /** |
||
1390 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1391 | * |
||
1392 | * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. |
||
1393 | * |
||
1394 | * ``` php |
||
1395 | * <?php |
||
1396 | * $I->checkOption('#agree'); |
||
1397 | * ?> |
||
1398 | * ``` |
||
1399 | * |
||
1400 | * @param $option |
||
1401 | * @see \Codeception\Module\WebDriver::checkOption() |
||
1402 | */ |
||
1403 | public function checkOption($option) { |
||
1406 | |||
1407 | /** |
||
1408 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1409 | * |
||
1410 | * Unticks a checkbox. |
||
1411 | * |
||
1412 | * ``` php |
||
1413 | * <?php |
||
1414 | * $I->uncheckOption('#notify'); |
||
1415 | * ?> |
||
1416 | * ``` |
||
1417 | * |
||
1418 | * @param $option |
||
1419 | * @see \Codeception\Module\WebDriver::uncheckOption() |
||
1420 | */ |
||
1421 | public function uncheckOption($option) { |
||
1424 | |||
1425 | /** |
||
1426 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1427 | * |
||
1428 | * Fills a text field or textarea with the given string. |
||
1429 | * |
||
1430 | * ``` php |
||
1431 | * <?php |
||
1432 | * $I->fillField("//input[@type='text']", "Hello World!"); |
||
1433 | * $I->fillField(['name' => 'email'], '[email protected]'); |
||
1434 | * ?> |
||
1435 | * ``` |
||
1436 | * |
||
1437 | * @param $field |
||
1438 | * @param $value |
||
1439 | * @see \Codeception\Module\WebDriver::fillField() |
||
1440 | */ |
||
1441 | public function fillField($field, $value) { |
||
1444 | |||
1445 | /** |
||
1446 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1447 | * |
||
1448 | * Clears given field which isn't empty. |
||
1449 | * |
||
1450 | * ``` php |
||
1451 | * <?php |
||
1452 | * $I->clearField('#username'); |
||
1453 | * ``` |
||
1454 | * |
||
1455 | * @param $field |
||
1456 | * @see \Codeception\Module\WebDriver::clearField() |
||
1457 | */ |
||
1458 | public function clearField($field) { |
||
1461 | |||
1462 | /** |
||
1463 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1464 | * |
||
1465 | * Attaches a file relative to the Codeception `_data` directory to the given file upload field. |
||
1466 | * |
||
1467 | * ``` php |
||
1468 | * <?php |
||
1469 | * // file is stored in 'tests/_data/prices.xls' |
||
1470 | * $I->attachFile('input[@type="file"]', 'prices.xls'); |
||
1471 | * ?> |
||
1472 | * ``` |
||
1473 | * |
||
1474 | * @param $field |
||
1475 | * @param $filename |
||
1476 | * @see \Codeception\Module\WebDriver::attachFile() |
||
1477 | */ |
||
1478 | public function attachFile($field, $filename) { |
||
1481 | |||
1482 | /** |
||
1483 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1484 | * |
||
1485 | * Finds and returns the text contents of the given element. |
||
1486 | * If a fuzzy locator is used, the element is found using CSS, XPath, |
||
1487 | * and by matching the full page source by regular expression. |
||
1488 | * |
||
1489 | * ``` php |
||
1490 | * <?php |
||
1491 | * $heading = $I->grabTextFrom('h1'); |
||
1492 | * $heading = $I->grabTextFrom('descendant-or-self::h1'); |
||
1493 | * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex |
||
1494 | * ?> |
||
1495 | * ``` |
||
1496 | * |
||
1497 | * @param $cssOrXPathOrRegex |
||
1498 | * |
||
1499 | * @return mixed |
||
1500 | * @see \Codeception\Module\WebDriver::grabTextFrom() |
||
1501 | */ |
||
1502 | public function grabTextFrom($cssOrXPathOrRegex) { |
||
1505 | |||
1506 | /** |
||
1507 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1508 | * |
||
1509 | * Grabs the value of the given attribute value from the given element. |
||
1510 | * Fails if element is not found. |
||
1511 | * |
||
1512 | * ``` php |
||
1513 | * <?php |
||
1514 | * $I->grabAttributeFrom('#tooltip', 'title'); |
||
1515 | * ?> |
||
1516 | * ``` |
||
1517 | * |
||
1518 | * |
||
1519 | * @param $cssOrXpath |
||
1520 | * @param $attribute |
||
1521 | * |
||
1522 | * @return mixed |
||
1523 | * @see \Codeception\Module\WebDriver::grabAttributeFrom() |
||
1524 | */ |
||
1525 | public function grabAttributeFrom($cssOrXpath, $attribute) { |
||
1528 | |||
1529 | /** |
||
1530 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1531 | * |
||
1532 | * Finds the value for the given form field. |
||
1533 | * If a fuzzy locator is used, the field is found by field name, CSS, and XPath. |
||
1534 | * |
||
1535 | * ``` php |
||
1536 | * <?php |
||
1537 | * $name = $I->grabValueFrom('Name'); |
||
1538 | * $name = $I->grabValueFrom('input[name=username]'); |
||
1539 | * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); |
||
1540 | * $name = $I->grabValueFrom(['name' => 'username']); |
||
1541 | * ?> |
||
1542 | * ``` |
||
1543 | * |
||
1544 | * @param $field |
||
1545 | * |
||
1546 | * @return mixed |
||
1547 | * @see \Codeception\Module\WebDriver::grabValueFrom() |
||
1548 | */ |
||
1549 | public function grabValueFrom($field) { |
||
1552 | |||
1553 | /** |
||
1554 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1555 | * |
||
1556 | * Grabs either the text content, or attribute values, of nodes |
||
1557 | * matched by $cssOrXpath and returns them as an array. |
||
1558 | * |
||
1559 | * ```html |
||
1560 | * <a href="#first">First</a> |
||
1561 | * <a href="#second">Second</a> |
||
1562 | * <a href="#third">Third</a> |
||
1563 | * ``` |
||
1564 | * |
||
1565 | * ```php |
||
1566 | * <?php |
||
1567 | * // would return ['First', 'Second', 'Third'] |
||
1568 | * $aLinkText = $I->grabMultiple('a'); |
||
1569 | * |
||
1570 | * // would return ['#first', '#second', '#third'] |
||
1571 | * $aLinks = $I->grabMultiple('a', 'href'); |
||
1572 | * ?> |
||
1573 | * ``` |
||
1574 | * |
||
1575 | * @param $cssOrXpath |
||
1576 | * @param $attribute |
||
1577 | * @return string[] |
||
1578 | * @see \Codeception\Module\WebDriver::grabMultiple() |
||
1579 | */ |
||
1580 | public function grabMultiple($cssOrXpath, $attribute = null) { |
||
1583 | |||
1584 | /** |
||
1585 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1586 | * |
||
1587 | * Checks that the given element exists on the page and is visible. |
||
1588 | * You can also specify expected attributes of this element. |
||
1589 | * |
||
1590 | * ``` php |
||
1591 | * <?php |
||
1592 | * $I->seeElement('.error'); |
||
1593 | * $I->seeElement('//form/input[1]'); |
||
1594 | * $I->seeElement('input', ['name' => 'login']); |
||
1595 | * $I->seeElement('input', ['value' => '123456']); |
||
1596 | * |
||
1597 | * // strict locator in first arg, attributes in second |
||
1598 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
1599 | * ?> |
||
1600 | * ``` |
||
1601 | * |
||
1602 | * @param $selector |
||
1603 | * @param array $attributes |
||
1604 | * @return |
||
1605 | * Conditional Assertion: Test won't be stopped on fail |
||
1606 | * @see \Codeception\Module\WebDriver::seeElement() |
||
1607 | */ |
||
1608 | public function canSeeElement($selector, $attributes = null) { |
||
1611 | /** |
||
1612 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1613 | * |
||
1614 | * Checks that the given element exists on the page and is visible. |
||
1615 | * You can also specify expected attributes of this element. |
||
1616 | * |
||
1617 | * ``` php |
||
1618 | * <?php |
||
1619 | * $I->seeElement('.error'); |
||
1620 | * $I->seeElement('//form/input[1]'); |
||
1621 | * $I->seeElement('input', ['name' => 'login']); |
||
1622 | * $I->seeElement('input', ['value' => '123456']); |
||
1623 | * |
||
1624 | * // strict locator in first arg, attributes in second |
||
1625 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
1626 | * ?> |
||
1627 | * ``` |
||
1628 | * |
||
1629 | * @param $selector |
||
1630 | * @param array $attributes |
||
1631 | * @return |
||
1632 | * @see \Codeception\Module\WebDriver::seeElement() |
||
1633 | */ |
||
1634 | public function seeElement($selector, $attributes = null) { |
||
1637 | |||
1638 | /** |
||
1639 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1640 | * |
||
1641 | * Checks that the given element is invisible or not present on the page. |
||
1642 | * You can also specify expected attributes of this element. |
||
1643 | * |
||
1644 | * ``` php |
||
1645 | * <?php |
||
1646 | * $I->dontSeeElement('.error'); |
||
1647 | * $I->dontSeeElement('//form/input[1]'); |
||
1648 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
1649 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
1650 | * ?> |
||
1651 | * ``` |
||
1652 | * |
||
1653 | * @param $selector |
||
1654 | * @param array $attributes |
||
1655 | * Conditional Assertion: Test won't be stopped on fail |
||
1656 | * @see \Codeception\Module\WebDriver::dontSeeElement() |
||
1657 | */ |
||
1658 | public function cantSeeElement($selector, $attributes = null) { |
||
1661 | /** |
||
1662 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1663 | * |
||
1664 | * Checks that the given element is invisible or not present on the page. |
||
1665 | * You can also specify expected attributes of this element. |
||
1666 | * |
||
1667 | * ``` php |
||
1668 | * <?php |
||
1669 | * $I->dontSeeElement('.error'); |
||
1670 | * $I->dontSeeElement('//form/input[1]'); |
||
1671 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
1672 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
1673 | * ?> |
||
1674 | * ``` |
||
1675 | * |
||
1676 | * @param $selector |
||
1677 | * @param array $attributes |
||
1678 | * @see \Codeception\Module\WebDriver::dontSeeElement() |
||
1679 | */ |
||
1680 | public function dontSeeElement($selector, $attributes = null) { |
||
1683 | |||
1684 | /** |
||
1685 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1686 | * |
||
1687 | * Checks that the given element exists on the page, even it is invisible. |
||
1688 | * |
||
1689 | * ``` php |
||
1690 | * <?php |
||
1691 | * $I->seeElementInDOM('//form/input[type=hidden]'); |
||
1692 | * ?> |
||
1693 | * ``` |
||
1694 | * |
||
1695 | * @param $selector |
||
1696 | * @param array $attributes |
||
1697 | * Conditional Assertion: Test won't be stopped on fail |
||
1698 | * @see \Codeception\Module\WebDriver::seeElementInDOM() |
||
1699 | */ |
||
1700 | public function canSeeElementInDOM($selector, $attributes = null) { |
||
1703 | /** |
||
1704 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1705 | * |
||
1706 | * Checks that the given element exists on the page, even it is invisible. |
||
1707 | * |
||
1708 | * ``` php |
||
1709 | * <?php |
||
1710 | * $I->seeElementInDOM('//form/input[type=hidden]'); |
||
1711 | * ?> |
||
1712 | * ``` |
||
1713 | * |
||
1714 | * @param $selector |
||
1715 | * @param array $attributes |
||
1716 | * @see \Codeception\Module\WebDriver::seeElementInDOM() |
||
1717 | */ |
||
1718 | public function seeElementInDOM($selector, $attributes = null) { |
||
1721 | |||
1722 | /** |
||
1723 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1724 | * |
||
1725 | * Opposite of `seeElementInDOM`. |
||
1726 | * |
||
1727 | * @param $selector |
||
1728 | * @param array $attributes |
||
1729 | * Conditional Assertion: Test won't be stopped on fail |
||
1730 | * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() |
||
1731 | */ |
||
1732 | public function cantSeeElementInDOM($selector, $attributes = null) { |
||
1735 | /** |
||
1736 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1737 | * |
||
1738 | * Opposite of `seeElementInDOM`. |
||
1739 | * |
||
1740 | * @param $selector |
||
1741 | * @param array $attributes |
||
1742 | * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() |
||
1743 | */ |
||
1744 | public function dontSeeElementInDOM($selector, $attributes = null) { |
||
1747 | |||
1748 | /** |
||
1749 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1750 | * |
||
1751 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
1752 | * |
||
1753 | * ``` php |
||
1754 | * <?php |
||
1755 | * $I->seeNumberOfElements('tr', 10); |
||
1756 | * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements |
||
1757 | * ?> |
||
1758 | * ``` |
||
1759 | * @param $selector |
||
1760 | * @param mixed $expected int or int[] |
||
1761 | * Conditional Assertion: Test won't be stopped on fail |
||
1762 | * @see \Codeception\Module\WebDriver::seeNumberOfElements() |
||
1763 | */ |
||
1764 | public function canSeeNumberOfElements($selector, $expected) { |
||
1767 | /** |
||
1768 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1769 | * |
||
1770 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
1771 | * |
||
1772 | * ``` php |
||
1773 | * <?php |
||
1774 | * $I->seeNumberOfElements('tr', 10); |
||
1775 | * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements |
||
1776 | * ?> |
||
1777 | * ``` |
||
1778 | * @param $selector |
||
1779 | * @param mixed $expected int or int[] |
||
1780 | * @see \Codeception\Module\WebDriver::seeNumberOfElements() |
||
1781 | */ |
||
1782 | public function seeNumberOfElements($selector, $expected) { |
||
1785 | |||
1786 | /** |
||
1787 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1788 | * |
||
1789 | * |
||
1790 | * Conditional Assertion: Test won't be stopped on fail |
||
1791 | * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() |
||
1792 | */ |
||
1793 | public function canSeeNumberOfElementsInDOM($selector, $expected) { |
||
1796 | /** |
||
1797 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1798 | * |
||
1799 | * |
||
1800 | * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() |
||
1801 | */ |
||
1802 | public function seeNumberOfElementsInDOM($selector, $expected) { |
||
1805 | |||
1806 | /** |
||
1807 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1808 | * |
||
1809 | * Checks that the given option is selected. |
||
1810 | * |
||
1811 | * ``` php |
||
1812 | * <?php |
||
1813 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
1814 | * ?> |
||
1815 | * ``` |
||
1816 | * |
||
1817 | * @param $selector |
||
1818 | * @param $optionText |
||
1819 | * |
||
1820 | * @return mixed |
||
1821 | * Conditional Assertion: Test won't be stopped on fail |
||
1822 | * @see \Codeception\Module\WebDriver::seeOptionIsSelected() |
||
1823 | */ |
||
1824 | public function canSeeOptionIsSelected($selector, $optionText) { |
||
1827 | /** |
||
1828 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1829 | * |
||
1830 | * Checks that the given option is selected. |
||
1831 | * |
||
1832 | * ``` php |
||
1833 | * <?php |
||
1834 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
1835 | * ?> |
||
1836 | * ``` |
||
1837 | * |
||
1838 | * @param $selector |
||
1839 | * @param $optionText |
||
1840 | * |
||
1841 | * @return mixed |
||
1842 | * @see \Codeception\Module\WebDriver::seeOptionIsSelected() |
||
1843 | */ |
||
1844 | public function seeOptionIsSelected($selector, $optionText) { |
||
1847 | |||
1848 | /** |
||
1849 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1850 | * |
||
1851 | * Checks that the given option is not selected. |
||
1852 | * |
||
1853 | * ``` php |
||
1854 | * <?php |
||
1855 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
1856 | * ?> |
||
1857 | * ``` |
||
1858 | * |
||
1859 | * @param $selector |
||
1860 | * @param $optionText |
||
1861 | * |
||
1862 | * @return mixed |
||
1863 | * Conditional Assertion: Test won't be stopped on fail |
||
1864 | * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() |
||
1865 | */ |
||
1866 | public function cantSeeOptionIsSelected($selector, $optionText) { |
||
1869 | /** |
||
1870 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1871 | * |
||
1872 | * Checks that the given option is not selected. |
||
1873 | * |
||
1874 | * ``` php |
||
1875 | * <?php |
||
1876 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
1877 | * ?> |
||
1878 | * ``` |
||
1879 | * |
||
1880 | * @param $selector |
||
1881 | * @param $optionText |
||
1882 | * |
||
1883 | * @return mixed |
||
1884 | * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() |
||
1885 | */ |
||
1886 | public function dontSeeOptionIsSelected($selector, $optionText) { |
||
1889 | |||
1890 | /** |
||
1891 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1892 | * |
||
1893 | * Checks that the page title contains the given string. |
||
1894 | * |
||
1895 | * ``` php |
||
1896 | * <?php |
||
1897 | * $I->seeInTitle('Blog - Post #1'); |
||
1898 | * ?> |
||
1899 | * ``` |
||
1900 | * |
||
1901 | * @param $title |
||
1902 | * |
||
1903 | * @return mixed |
||
1904 | * Conditional Assertion: Test won't be stopped on fail |
||
1905 | * @see \Codeception\Module\WebDriver::seeInTitle() |
||
1906 | */ |
||
1907 | public function canSeeInTitle($title) { |
||
1910 | /** |
||
1911 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1912 | * |
||
1913 | * Checks that the page title contains the given string. |
||
1914 | * |
||
1915 | * ``` php |
||
1916 | * <?php |
||
1917 | * $I->seeInTitle('Blog - Post #1'); |
||
1918 | * ?> |
||
1919 | * ``` |
||
1920 | * |
||
1921 | * @param $title |
||
1922 | * |
||
1923 | * @return mixed |
||
1924 | * @see \Codeception\Module\WebDriver::seeInTitle() |
||
1925 | */ |
||
1926 | public function seeInTitle($title) { |
||
1929 | |||
1930 | /** |
||
1931 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1932 | * |
||
1933 | * Checks that the page title does not contain the given string. |
||
1934 | * |
||
1935 | * @param $title |
||
1936 | * |
||
1937 | * @return mixed |
||
1938 | * Conditional Assertion: Test won't be stopped on fail |
||
1939 | * @see \Codeception\Module\WebDriver::dontSeeInTitle() |
||
1940 | */ |
||
1941 | public function cantSeeInTitle($title) { |
||
1944 | /** |
||
1945 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1946 | * |
||
1947 | * Checks that the page title does not contain the given string. |
||
1948 | * |
||
1949 | * @param $title |
||
1950 | * |
||
1951 | * @return mixed |
||
1952 | * @see \Codeception\Module\WebDriver::dontSeeInTitle() |
||
1953 | */ |
||
1954 | public function dontSeeInTitle($title) { |
||
1957 | |||
1958 | /** |
||
1959 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1960 | * |
||
1961 | * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. |
||
1962 | * Don't confuse popups with modal windows, |
||
1963 | * as created by [various libraries](http://jster.net/category/windows-modals-popups). |
||
1964 | * @see \Codeception\Module\WebDriver::acceptPopup() |
||
1965 | */ |
||
1966 | public function acceptPopup() { |
||
1969 | |||
1970 | /** |
||
1971 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1972 | * |
||
1973 | * Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`. |
||
1974 | * @see \Codeception\Module\WebDriver::cancelPopup() |
||
1975 | */ |
||
1976 | public function cancelPopup() { |
||
1979 | |||
1980 | /** |
||
1981 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1982 | * |
||
1983 | * Checks that the active JavaScript popup, |
||
1984 | * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. |
||
1985 | * |
||
1986 | * @param $text |
||
1987 | * |
||
1988 | * @throws \Codeception\Exception\ModuleException |
||
1989 | * Conditional Assertion: Test won't be stopped on fail |
||
1990 | * @see \Codeception\Module\WebDriver::seeInPopup() |
||
1991 | */ |
||
1992 | public function canSeeInPopup($text) { |
||
1995 | /** |
||
1996 | * [!] Method is generated. Documentation taken from corresponding module. |
||
1997 | * |
||
1998 | * Checks that the active JavaScript popup, |
||
1999 | * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. |
||
2000 | * |
||
2001 | * @param $text |
||
2002 | * |
||
2003 | * @throws \Codeception\Exception\ModuleException |
||
2004 | * @see \Codeception\Module\WebDriver::seeInPopup() |
||
2005 | */ |
||
2006 | public function seeInPopup($text) { |
||
2009 | |||
2010 | /** |
||
2011 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2012 | * |
||
2013 | * Checks that the active JavaScript popup, |
||
2014 | * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. |
||
2015 | * |
||
2016 | * @param $text |
||
2017 | * |
||
2018 | * @throws \Codeception\Exception\ModuleException |
||
2019 | * Conditional Assertion: Test won't be stopped on fail |
||
2020 | * @see \Codeception\Module\WebDriver::dontSeeInPopup() |
||
2021 | */ |
||
2022 | public function cantSeeInPopup($text) { |
||
2025 | /** |
||
2026 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2027 | * |
||
2028 | * Checks that the active JavaScript popup, |
||
2029 | * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. |
||
2030 | * |
||
2031 | * @param $text |
||
2032 | * |
||
2033 | * @throws \Codeception\Exception\ModuleException |
||
2034 | * @see \Codeception\Module\WebDriver::dontSeeInPopup() |
||
2035 | */ |
||
2036 | public function dontSeeInPopup($text) { |
||
2039 | |||
2040 | /** |
||
2041 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2042 | * |
||
2043 | * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. |
||
2044 | * |
||
2045 | * @param $keys |
||
2046 | * |
||
2047 | * @throws \Codeception\Exception\ModuleException |
||
2048 | * @see \Codeception\Module\WebDriver::typeInPopup() |
||
2049 | */ |
||
2050 | public function typeInPopup($keys) { |
||
2053 | |||
2054 | /** |
||
2055 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2056 | * |
||
2057 | * Reloads the current page. |
||
2058 | * @see \Codeception\Module\WebDriver::reloadPage() |
||
2059 | */ |
||
2060 | public function reloadPage() { |
||
2063 | |||
2064 | /** |
||
2065 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2066 | * |
||
2067 | * Moves back in history. |
||
2068 | * @see \Codeception\Module\WebDriver::moveBack() |
||
2069 | */ |
||
2070 | public function moveBack() { |
||
2073 | |||
2074 | /** |
||
2075 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2076 | * |
||
2077 | * Moves forward in history. |
||
2078 | * @see \Codeception\Module\WebDriver::moveForward() |
||
2079 | */ |
||
2080 | public function moveForward() { |
||
2083 | |||
2084 | /** |
||
2085 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2086 | * |
||
2087 | * Submits the given form on the page, optionally with the given form |
||
2088 | * values. Give the form fields values as an array. Note that hidden fields |
||
2089 | * can't be accessed. |
||
2090 | * |
||
2091 | * Skipped fields will be filled by their values from the page. |
||
2092 | * You don't need to click the 'Submit' button afterwards. |
||
2093 | * This command itself triggers the request to form's action. |
||
2094 | * |
||
2095 | * You can optionally specify what button's value to include |
||
2096 | * in the request with the last parameter as an alternative to |
||
2097 | * explicitly setting its value in the second parameter, as |
||
2098 | * button values are not otherwise included in the request. |
||
2099 | * |
||
2100 | * Examples: |
||
2101 | * |
||
2102 | * ``` php |
||
2103 | * <?php |
||
2104 | * $I->submitForm('#login', [ |
||
2105 | * 'login' => 'davert', |
||
2106 | * 'password' => '123456' |
||
2107 | * ]); |
||
2108 | * // or |
||
2109 | * $I->submitForm('#login', [ |
||
2110 | * 'login' => 'davert', |
||
2111 | * 'password' => '123456' |
||
2112 | * ], 'submitButtonName'); |
||
2113 | * |
||
2114 | * ``` |
||
2115 | * |
||
2116 | * For example, given this sample "Sign Up" form: |
||
2117 | * |
||
2118 | * ``` html |
||
2119 | * <form action="/sign_up"> |
||
2120 | * Login: |
||
2121 | * <input type="text" name="user[login]" /><br/> |
||
2122 | * Password: |
||
2123 | * <input type="password" name="user[password]" /><br/> |
||
2124 | * Do you agree to our terms? |
||
2125 | * <input type="checkbox" name="user[agree]" /><br/> |
||
2126 | * Select pricing plan: |
||
2127 | * <select name="plan"> |
||
2128 | * <option value="1">Free</option> |
||
2129 | * <option value="2" selected="selected">Paid</option> |
||
2130 | * </select> |
||
2131 | * <input type="submit" name="submitButton" value="Submit" /> |
||
2132 | * </form> |
||
2133 | * ``` |
||
2134 | * |
||
2135 | * You could write the following to submit it: |
||
2136 | * |
||
2137 | * ``` php |
||
2138 | * <?php |
||
2139 | * $I->submitForm( |
||
2140 | * '#userForm', |
||
2141 | * [ |
||
2142 | * 'user[login]' => 'Davert', |
||
2143 | * 'user[password]' => '123456', |
||
2144 | * 'user[agree]' => true |
||
2145 | * ], |
||
2146 | * 'submitButton' |
||
2147 | * ); |
||
2148 | * ``` |
||
2149 | * Note that "2" will be the submitted value for the "plan" field, as it is |
||
2150 | * the selected option. |
||
2151 | * |
||
2152 | * Also note that this differs from PhpBrowser, in that |
||
2153 | * ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment. |
||
2154 | * Named array keys *must* be included in the name as above. |
||
2155 | * |
||
2156 | * Pair this with seeInFormFields for quick testing magic. |
||
2157 | * |
||
2158 | * ``` php |
||
2159 | * <?php |
||
2160 | * $form = [ |
||
2161 | * 'field1' => 'value', |
||
2162 | * 'field2' => 'another value', |
||
2163 | * 'checkbox1' => true, |
||
2164 | * // ... |
||
2165 | * ]; |
||
2166 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
2167 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
2168 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
2169 | * ?> |
||
2170 | * ``` |
||
2171 | * |
||
2172 | * Parameter values must be set to arrays for multiple input fields |
||
2173 | * of the same name, or multi-select combo boxes. For checkboxes, |
||
2174 | * either the string value can be used, or boolean values which will |
||
2175 | * be replaced by the checkbox's value in the DOM. |
||
2176 | * |
||
2177 | * ``` php |
||
2178 | * <?php |
||
2179 | * $I->submitForm('#my-form', [ |
||
2180 | * 'field1' => 'value', |
||
2181 | * 'checkbox' => [ |
||
2182 | * 'value of first checkbox', |
||
2183 | * 'value of second checkbox, |
||
2184 | * ], |
||
2185 | * 'otherCheckboxes' => [ |
||
2186 | * true, |
||
2187 | * false, |
||
2188 | * false |
||
2189 | * ], |
||
2190 | * 'multiselect' => [ |
||
2191 | * 'first option value', |
||
2192 | * 'second option value' |
||
2193 | * ] |
||
2194 | * ]); |
||
2195 | * ?> |
||
2196 | * ``` |
||
2197 | * |
||
2198 | * Mixing string and boolean values for a checkbox's value is not supported |
||
2199 | * and may produce unexpected results. |
||
2200 | * |
||
2201 | * Field names ending in "[]" must be passed without the trailing square |
||
2202 | * bracket characters, and must contain an array for its value. This allows |
||
2203 | * submitting multiple values with the same name, consider: |
||
2204 | * |
||
2205 | * ```php |
||
2206 | * $I->submitForm('#my-form', [ |
||
2207 | * 'field[]' => 'value', |
||
2208 | * 'field[]' => 'another value', // 'field[]' is already a defined key |
||
2209 | * ]); |
||
2210 | * ``` |
||
2211 | * |
||
2212 | * The solution is to pass an array value: |
||
2213 | * |
||
2214 | * ```php |
||
2215 | * // this way both values are submitted |
||
2216 | * $I->submitForm('#my-form', [ |
||
2217 | * 'field' => [ |
||
2218 | * 'value', |
||
2219 | * 'another value', |
||
2220 | * ] |
||
2221 | * ]); |
||
2222 | * ``` |
||
2223 | * |
||
2224 | * The `$button` parameter can be either a string, an array or an instance |
||
2225 | * of Facebook\WebDriver\WebDriverBy. When it is a string, the |
||
2226 | * button will be found by its "name" attribute. If $button is an |
||
2227 | * array then it will be treated as a strict selector and a WebDriverBy |
||
2228 | * will be used verbatim. |
||
2229 | * |
||
2230 | * For example, given the following HTML: |
||
2231 | * |
||
2232 | * ``` html |
||
2233 | * <input type="submit" name="submitButton" value="Submit" /> |
||
2234 | * ``` |
||
2235 | * |
||
2236 | * `$button` could be any one of the following: |
||
2237 | * - 'submitButton' |
||
2238 | * - ['name' => 'submitButton'] |
||
2239 | * - WebDriverBy::name('submitButton') |
||
2240 | * |
||
2241 | * @param $selector |
||
2242 | * @param $params |
||
2243 | * @param $button |
||
2244 | * @see \Codeception\Module\WebDriver::submitForm() |
||
2245 | */ |
||
2246 | public function submitForm($selector, $params, $button = null) { |
||
2249 | |||
2250 | /** |
||
2251 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2252 | * |
||
2253 | * Waits up to $timeout seconds for the given element to change. |
||
2254 | * Element "change" is determined by a callback function which is called repeatedly |
||
2255 | * until the return value evaluates to true. |
||
2256 | * |
||
2257 | * ``` php |
||
2258 | * <?php |
||
2259 | * use \Facebook\WebDriver\WebDriverElement |
||
2260 | * $I->waitForElementChange('#menu', function(WebDriverElement $el) { |
||
2261 | * return $el->isDisplayed(); |
||
2262 | * }, 100); |
||
2263 | * ?> |
||
2264 | * ``` |
||
2265 | * |
||
2266 | * @param $element |
||
2267 | * @param \Closure $callback |
||
2268 | * @param int $timeout seconds |
||
2269 | * @throws \Codeception\Exception\ElementNotFound |
||
2270 | * @see \Codeception\Module\WebDriver::waitForElementChange() |
||
2271 | */ |
||
2272 | public function waitForElementChange($element, $callback, $timeout = null) { |
||
2275 | |||
2276 | /** |
||
2277 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2278 | * |
||
2279 | * Waits up to $timeout seconds for an element to appear on the page. |
||
2280 | * If the element doesn't appear, a timeout exception is thrown. |
||
2281 | * |
||
2282 | * ``` php |
||
2283 | * <?php |
||
2284 | * $I->waitForElement('#agree_button', 30); // secs |
||
2285 | * $I->click('#agree_button'); |
||
2286 | * ?> |
||
2287 | * ``` |
||
2288 | * |
||
2289 | * @param $element |
||
2290 | * @param int $timeout seconds |
||
2291 | * @throws \Exception |
||
2292 | * @see \Codeception\Module\WebDriver::waitForElement() |
||
2293 | */ |
||
2294 | public function waitForElement($element, $timeout = null) { |
||
2297 | |||
2298 | /** |
||
2299 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2300 | * |
||
2301 | * Waits up to $timeout seconds for the given element to be visible on the page. |
||
2302 | * If element doesn't appear, a timeout exception is thrown. |
||
2303 | * |
||
2304 | * ``` php |
||
2305 | * <?php |
||
2306 | * $I->waitForElementVisible('#agree_button', 30); // secs |
||
2307 | * $I->click('#agree_button'); |
||
2308 | * ?> |
||
2309 | * ``` |
||
2310 | * |
||
2311 | * @param $element |
||
2312 | * @param int $timeout seconds |
||
2313 | * @throws \Exception |
||
2314 | * @see \Codeception\Module\WebDriver::waitForElementVisible() |
||
2315 | */ |
||
2316 | public function waitForElementVisible($element, $timeout = null) { |
||
2319 | |||
2320 | /** |
||
2321 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2322 | * |
||
2323 | * Waits up to $timeout seconds for the given element to become invisible. |
||
2324 | * If element stays visible, a timeout exception is thrown. |
||
2325 | * |
||
2326 | * ``` php |
||
2327 | * <?php |
||
2328 | * $I->waitForElementNotVisible('#agree_button', 30); // secs |
||
2329 | * ?> |
||
2330 | * ``` |
||
2331 | * |
||
2332 | * @param $element |
||
2333 | * @param int $timeout seconds |
||
2334 | * @throws \Exception |
||
2335 | * @see \Codeception\Module\WebDriver::waitForElementNotVisible() |
||
2336 | */ |
||
2337 | public function waitForElementNotVisible($element, $timeout = null) { |
||
2340 | |||
2341 | /** |
||
2342 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2343 | * |
||
2344 | * Waits up to $timeout seconds for the given string to appear on the page. |
||
2345 | * |
||
2346 | * Can also be passed a selector to search in, be as specific as possible when using selectors. |
||
2347 | * waitForText() will only watch the first instance of the matching selector / text provided. |
||
2348 | * If the given text doesn't appear, a timeout exception is thrown. |
||
2349 | * |
||
2350 | * ``` php |
||
2351 | * <?php |
||
2352 | * $I->waitForText('foo', 30); // secs |
||
2353 | * $I->waitForText('foo', 30, '.title'); // secs |
||
2354 | * ?> |
||
2355 | * ``` |
||
2356 | * |
||
2357 | * @param string $text |
||
2358 | * @param int $timeout seconds |
||
2359 | * @param string $selector optional |
||
2360 | * @throws \Exception |
||
2361 | * @see \Codeception\Module\WebDriver::waitForText() |
||
2362 | */ |
||
2363 | public function waitForText($text, $timeout = null, $selector = null) { |
||
2366 | |||
2367 | /** |
||
2368 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2369 | * |
||
2370 | * Wait for $timeout seconds. |
||
2371 | * |
||
2372 | * @param int|float $timeout secs |
||
2373 | * @throws \Codeception\Exception\TestRuntimeException |
||
2374 | * @see \Codeception\Module\WebDriver::wait() |
||
2375 | */ |
||
2376 | public function wait($timeout) { |
||
2379 | |||
2380 | /** |
||
2381 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2382 | * |
||
2383 | * Low-level API method. |
||
2384 | * If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly: |
||
2385 | * |
||
2386 | * ``` php |
||
2387 | * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { |
||
2388 | * $webdriver->get('http://google.com'); |
||
2389 | * }); |
||
2390 | * ``` |
||
2391 | * |
||
2392 | * This runs in the context of the |
||
2393 | * [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). |
||
2394 | * Try not to use this command on a regular basis. |
||
2395 | * If Codeception lacks a feature you need, please implement it and submit a patch. |
||
2396 | * |
||
2397 | * @param callable $function |
||
2398 | * @see \Codeception\Module\WebDriver::executeInSelenium() |
||
2399 | */ |
||
2400 | public function executeInSelenium($function) { |
||
2403 | |||
2404 | /** |
||
2405 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2406 | * |
||
2407 | * Switch to another window identified by name. |
||
2408 | * |
||
2409 | * The window can only be identified by name. If the $name parameter is blank, the parent window will be used. |
||
2410 | * |
||
2411 | * Example: |
||
2412 | * ``` html |
||
2413 | * <input type="button" value="Open window" onclick="window.open('http://example.com', 'another_window')"> |
||
2414 | * ``` |
||
2415 | * |
||
2416 | * ``` php |
||
2417 | * <?php |
||
2418 | * $I->click("Open window"); |
||
2419 | * # switch to another window |
||
2420 | * $I->switchToWindow("another_window"); |
||
2421 | * # switch to parent window |
||
2422 | * $I->switchToWindow(); |
||
2423 | * ?> |
||
2424 | * ``` |
||
2425 | * |
||
2426 | * If the window has no name, match it by switching to next active tab using `switchToNextTab` method. |
||
2427 | * |
||
2428 | * Or use native Selenium functions to get access to all opened windows: |
||
2429 | * |
||
2430 | * ``` php |
||
2431 | * <?php |
||
2432 | * $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { |
||
2433 | * $handles=$webdriver->getWindowHandles(); |
||
2434 | * $last_window = end($handles); |
||
2435 | * $webdriver->switchTo()->window($last_window); |
||
2436 | * }); |
||
2437 | * ?> |
||
2438 | * ``` |
||
2439 | * |
||
2440 | * @param string|null $name |
||
2441 | * @see \Codeception\Module\WebDriver::switchToWindow() |
||
2442 | */ |
||
2443 | public function switchToWindow($name = null) { |
||
2446 | |||
2447 | /** |
||
2448 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2449 | * |
||
2450 | * Switch to another frame on the page. |
||
2451 | * |
||
2452 | * Example: |
||
2453 | * ``` html |
||
2454 | * <iframe name="another_frame" src="http://example.com"> |
||
2455 | * |
||
2456 | * ``` |
||
2457 | * |
||
2458 | * ``` php |
||
2459 | * <?php |
||
2460 | * # switch to iframe |
||
2461 | * $I->switchToIFrame("another_frame"); |
||
2462 | * # switch to parent page |
||
2463 | * $I->switchToIFrame(); |
||
2464 | * |
||
2465 | * ``` |
||
2466 | * |
||
2467 | * @param string|null $name |
||
2468 | * @see \Codeception\Module\WebDriver::switchToIFrame() |
||
2469 | */ |
||
2470 | public function switchToIFrame($name = null) { |
||
2473 | |||
2474 | /** |
||
2475 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2476 | * |
||
2477 | * Executes JavaScript and waits up to $timeout seconds for it to return true. |
||
2478 | * |
||
2479 | * In this example we will wait up to 60 seconds for all jQuery AJAX requests to finish. |
||
2480 | * |
||
2481 | * ``` php |
||
2482 | * <?php |
||
2483 | * $I->waitForJS("return $.active == 0;", 60); |
||
2484 | * ?> |
||
2485 | * ``` |
||
2486 | * |
||
2487 | * @param string $script |
||
2488 | * @param int $timeout seconds |
||
2489 | * @see \Codeception\Module\WebDriver::waitForJS() |
||
2490 | */ |
||
2491 | public function waitForJS($script, $timeout = null) { |
||
2494 | |||
2495 | /** |
||
2496 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2497 | * |
||
2498 | * Executes custom JavaScript. |
||
2499 | * |
||
2500 | * This example uses jQuery to get a value and assigns that value to a PHP variable: |
||
2501 | * |
||
2502 | * ```php |
||
2503 | * <?php |
||
2504 | * $myVar = $I->executeJS('return $("#myField").val()'); |
||
2505 | * |
||
2506 | * // additional arguments can be passed as array |
||
2507 | * // Example shows `Hello World` alert: |
||
2508 | * $I->executeJS("window.alert(arguments[0])", ['Hello world']); |
||
2509 | * ``` |
||
2510 | * |
||
2511 | * @param $script |
||
2512 | * @param array $arguments |
||
2513 | * @return mixed |
||
2514 | * @see \Codeception\Module\WebDriver::executeJS() |
||
2515 | */ |
||
2516 | public function executeJS($script, $arguments = null) { |
||
2519 | |||
2520 | /** |
||
2521 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2522 | * |
||
2523 | * Executes asynchronous JavaScript. |
||
2524 | * A callback should be executed by JavaScript to exit from a script. |
||
2525 | * Callback is passed as a last element in `arguments` array. |
||
2526 | * Additional arguments can be passed as array in second parameter. |
||
2527 | * |
||
2528 | * ```js |
||
2529 | * // wait for 1200 milliseconds my running `setTimeout` |
||
2530 | * * $I->executeAsyncJS('setTimeout(arguments[0], 1200)'); |
||
2531 | * |
||
2532 | * $seconds = 1200; // or seconds are passed as argument |
||
2533 | * $I->executeAsyncJS('setTimeout(arguments[1], arguments[0])', [$seconds]); |
||
2534 | * ``` |
||
2535 | * |
||
2536 | * @param $script |
||
2537 | * @param array $arguments |
||
2538 | * @return mixed |
||
2539 | * @see \Codeception\Module\WebDriver::executeAsyncJS() |
||
2540 | */ |
||
2541 | public function executeAsyncJS($script, $arguments = null) { |
||
2544 | |||
2545 | /** |
||
2546 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2547 | * |
||
2548 | * Maximizes the current window. |
||
2549 | * @see \Codeception\Module\WebDriver::maximizeWindow() |
||
2550 | */ |
||
2551 | public function maximizeWindow() { |
||
2554 | |||
2555 | /** |
||
2556 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2557 | * |
||
2558 | * Performs a simple mouse drag-and-drop operation. |
||
2559 | * |
||
2560 | * ``` php |
||
2561 | * <?php |
||
2562 | * $I->dragAndDrop('#drag', '#drop'); |
||
2563 | * ?> |
||
2564 | * ``` |
||
2565 | * |
||
2566 | * @param string $source (CSS ID or XPath) |
||
2567 | * @param string $target (CSS ID or XPath) |
||
2568 | * @see \Codeception\Module\WebDriver::dragAndDrop() |
||
2569 | */ |
||
2570 | public function dragAndDrop($source, $target) { |
||
2573 | |||
2574 | /** |
||
2575 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2576 | * |
||
2577 | * Move mouse over the first element matched by the given locator. |
||
2578 | * If the first parameter null then the page is used. |
||
2579 | * If the second and third parameters are given, |
||
2580 | * then the mouse is moved to an offset of the element's top-left corner. |
||
2581 | * Otherwise, the mouse is moved to the center of the element. |
||
2582 | * |
||
2583 | * ``` php |
||
2584 | * <?php |
||
2585 | * $I->moveMouseOver(['css' => '.checkout']); |
||
2586 | * $I->moveMouseOver(null, 20, 50); |
||
2587 | * $I->moveMouseOver(['css' => '.checkout'], 20, 50); |
||
2588 | * ?> |
||
2589 | * ``` |
||
2590 | * |
||
2591 | * @param string $cssOrXPath css or xpath of the web element |
||
2592 | * @param int $offsetX |
||
2593 | * @param int $offsetY |
||
2594 | * |
||
2595 | * @throws \Codeception\Exception\ElementNotFound |
||
2596 | * @see \Codeception\Module\WebDriver::moveMouseOver() |
||
2597 | */ |
||
2598 | public function moveMouseOver($cssOrXPath = null, $offsetX = null, $offsetY = null) { |
||
2601 | |||
2602 | /** |
||
2603 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2604 | * |
||
2605 | * Performs click with the left mouse button on an element. |
||
2606 | * If the first parameter `null` then the offset is relative to the actual mouse position. |
||
2607 | * If the second and third parameters are given, |
||
2608 | * then the mouse is moved to an offset of the element's top-left corner. |
||
2609 | * Otherwise, the mouse is moved to the center of the element. |
||
2610 | * |
||
2611 | * ``` php |
||
2612 | * <?php |
||
2613 | * $I->clickWithLeftButton(['css' => '.checkout']); |
||
2614 | * $I->clickWithLeftButton(null, 20, 50); |
||
2615 | * $I->clickWithLeftButton(['css' => '.checkout'], 20, 50); |
||
2616 | * ?> |
||
2617 | * ``` |
||
2618 | * |
||
2619 | * @param string $cssOrXPath css or xpath of the web element (body by default). |
||
2620 | * @param int $offsetX |
||
2621 | * @param int $offsetY |
||
2622 | * |
||
2623 | * @throws \Codeception\Exception\ElementNotFound |
||
2624 | * @see \Codeception\Module\WebDriver::clickWithLeftButton() |
||
2625 | */ |
||
2626 | public function clickWithLeftButton($cssOrXPath = null, $offsetX = null, $offsetY = null) { |
||
2629 | |||
2630 | /** |
||
2631 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2632 | * |
||
2633 | * Performs contextual click with the right mouse button on an element. |
||
2634 | * If the first parameter `null` then the offset is relative to the actual mouse position. |
||
2635 | * If the second and third parameters are given, |
||
2636 | * then the mouse is moved to an offset of the element's top-left corner. |
||
2637 | * Otherwise, the mouse is moved to the center of the element. |
||
2638 | * |
||
2639 | * ``` php |
||
2640 | * <?php |
||
2641 | * $I->clickWithRightButton(['css' => '.checkout']); |
||
2642 | * $I->clickWithRightButton(null, 20, 50); |
||
2643 | * $I->clickWithRightButton(['css' => '.checkout'], 20, 50); |
||
2644 | * ?> |
||
2645 | * ``` |
||
2646 | * |
||
2647 | * @param string $cssOrXPath css or xpath of the web element (body by default). |
||
2648 | * @param int $offsetX |
||
2649 | * @param int $offsetY |
||
2650 | * |
||
2651 | * @throws \Codeception\Exception\ElementNotFound |
||
2652 | * @see \Codeception\Module\WebDriver::clickWithRightButton() |
||
2653 | */ |
||
2654 | public function clickWithRightButton($cssOrXPath = null, $offsetX = null, $offsetY = null) { |
||
2657 | |||
2658 | /** |
||
2659 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2660 | * |
||
2661 | * Pauses test execution in debug mode. |
||
2662 | * To proceed test press "ENTER" in console. |
||
2663 | * |
||
2664 | * This method is useful while writing tests, |
||
2665 | * since it allows you to inspect the current page in the middle of a test case. |
||
2666 | * @see \Codeception\Module\WebDriver::pauseExecution() |
||
2667 | */ |
||
2668 | public function pauseExecution() { |
||
2671 | |||
2672 | /** |
||
2673 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2674 | * |
||
2675 | * Performs a double-click on an element matched by CSS or XPath. |
||
2676 | * |
||
2677 | * @param $cssOrXPath |
||
2678 | * @throws \Codeception\Exception\ElementNotFound |
||
2679 | * @see \Codeception\Module\WebDriver::doubleClick() |
||
2680 | */ |
||
2681 | public function doubleClick($cssOrXPath) { |
||
2684 | |||
2685 | /** |
||
2686 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2687 | * |
||
2688 | * Presses the given key on the given element. |
||
2689 | * To specify a character and modifier (e.g. ctrl, alt, shift, meta), pass an array for $char with |
||
2690 | * the modifier as the first element and the character as the second. |
||
2691 | * For special keys use key constants from WebDriverKeys class. |
||
2692 | * |
||
2693 | * ``` php |
||
2694 | * <?php |
||
2695 | * // <input id="page" value="old" /> |
||
2696 | * $I->pressKey('#page','a'); // => olda |
||
2697 | * $I->pressKey('#page',array('ctrl','a'),'new'); //=> new |
||
2698 | * $I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x |
||
2699 | * $I->pressKey('descendant-or-self::*[@id='page']','u'); //=> oldu |
||
2700 | * $I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DELETE); //=>'' |
||
2701 | * ?> |
||
2702 | * ``` |
||
2703 | * |
||
2704 | * @param $element |
||
2705 | * @param $char string|array Can be char or array with modifier. You can provide several chars. |
||
2706 | * @throws \Codeception\Exception\ElementNotFound |
||
2707 | * @see \Codeception\Module\WebDriver::pressKey() |
||
2708 | */ |
||
2709 | public function pressKey($element, $char) { |
||
2712 | |||
2713 | /** |
||
2714 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2715 | * |
||
2716 | * Append the given text to the given element. |
||
2717 | * Can also add a selection to a select box. |
||
2718 | * |
||
2719 | * ``` php |
||
2720 | * <?php |
||
2721 | * $I->appendField('#mySelectbox', 'SelectValue'); |
||
2722 | * $I->appendField('#myTextField', 'appended'); |
||
2723 | * ?> |
||
2724 | * ``` |
||
2725 | * |
||
2726 | * @param string $field |
||
2727 | * @param string $value |
||
2728 | * @throws \Codeception\Exception\ElementNotFound |
||
2729 | * @see \Codeception\Module\WebDriver::appendField() |
||
2730 | */ |
||
2731 | public function appendField($field, $value) { |
||
2734 | |||
2735 | /** |
||
2736 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2737 | * |
||
2738 | * Saves current cookies into named snapshot in order to restore them in other tests |
||
2739 | * This is useful to save session state between tests. |
||
2740 | * For example, if user needs log in to site for each test this scenario can be executed once |
||
2741 | * while other tests can just restore saved cookies. |
||
2742 | * |
||
2743 | * ``` php |
||
2744 | * <?php |
||
2745 | * // inside AcceptanceTester class: |
||
2746 | * |
||
2747 | * public function login() |
||
2748 | * { |
||
2749 | * // if snapshot exists - skipping login |
||
2750 | * if ($I->loadSessionSnapshot('login')) return; |
||
2751 | * |
||
2752 | * // logging in |
||
2753 | * $I->amOnPage('/login'); |
||
2754 | * $I->fillField('name', 'jon'); |
||
2755 | * $I->fillField('password', '123345'); |
||
2756 | * $I->click('Login'); |
||
2757 | * |
||
2758 | * // saving snapshot |
||
2759 | * $I->saveSessionSnapshot('login'); |
||
2760 | * } |
||
2761 | * ?> |
||
2762 | * ``` |
||
2763 | * |
||
2764 | * @param $name |
||
2765 | * @return mixed |
||
2766 | * @see \Codeception\Module\WebDriver::saveSessionSnapshot() |
||
2767 | */ |
||
2768 | public function saveSessionSnapshot($name) { |
||
2771 | |||
2772 | /** |
||
2773 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2774 | * |
||
2775 | * Loads cookies from a saved snapshot. |
||
2776 | * Allows to reuse same session across tests without additional login. |
||
2777 | * |
||
2778 | * See [saveSessionSnapshot](#saveSessionSnapshot) |
||
2779 | * |
||
2780 | * @param $name |
||
2781 | * @return mixed |
||
2782 | * @see \Codeception\Module\WebDriver::loadSessionSnapshot() |
||
2783 | */ |
||
2784 | public function loadSessionSnapshot($name) { |
||
2787 | |||
2788 | /** |
||
2789 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2790 | * |
||
2791 | * Deletes session snapshot. |
||
2792 | * |
||
2793 | * See [saveSessionSnapshot](#saveSessionSnapshot) |
||
2794 | * |
||
2795 | * @param $name |
||
2796 | * @return mixed |
||
2797 | * @see \Codeception\Module\WebDriver::deleteSessionSnapshot() |
||
2798 | */ |
||
2799 | public function deleteSessionSnapshot($name) { |
||
2802 | |||
2803 | /** |
||
2804 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2805 | * |
||
2806 | * Move to the middle of the given element matched by the given locator. |
||
2807 | * Extra shift, calculated from the top-left corner of the element, |
||
2808 | * can be set by passing $offsetX and $offsetY parameters. |
||
2809 | * |
||
2810 | * ``` php |
||
2811 | * <?php |
||
2812 | * $I->scrollTo(['css' => '.checkout'], 20, 50); |
||
2813 | * ?> |
||
2814 | * ``` |
||
2815 | * |
||
2816 | * @param $selector |
||
2817 | * @param int $offsetX |
||
2818 | * @param int $offsetY |
||
2819 | * @see \Codeception\Module\WebDriver::scrollTo() |
||
2820 | */ |
||
2821 | public function scrollTo($selector, $offsetX = null, $offsetY = null) { |
||
2824 | |||
2825 | /** |
||
2826 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2827 | * |
||
2828 | * Opens a new browser tab (wherever it is possible) and switches to it. |
||
2829 | * |
||
2830 | * ```php |
||
2831 | * <?php |
||
2832 | * $I->openNewTab(); |
||
2833 | * ``` |
||
2834 | * Tab is opened by using `window.open` javascript in a browser. |
||
2835 | * Please note, that adblock can restrict creating such tabs. |
||
2836 | * |
||
2837 | * Can't be used with PhantomJS |
||
2838 | * |
||
2839 | * @see \Codeception\Module\WebDriver::openNewTab() |
||
2840 | */ |
||
2841 | public function openNewTab() { |
||
2844 | |||
2845 | /** |
||
2846 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2847 | * |
||
2848 | * Closes current browser tab and switches to previous active tab. |
||
2849 | * |
||
2850 | * ```php |
||
2851 | * <?php |
||
2852 | * $I->closeTab(); |
||
2853 | * ``` |
||
2854 | * |
||
2855 | * Can't be used with PhantomJS |
||
2856 | * @see \Codeception\Module\WebDriver::closeTab() |
||
2857 | */ |
||
2858 | public function closeTab() { |
||
2861 | |||
2862 | /** |
||
2863 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2864 | * |
||
2865 | * Switches to next browser tab. |
||
2866 | * An offset can be specified. |
||
2867 | * |
||
2868 | * ```php |
||
2869 | * <?php |
||
2870 | * // switch to next tab |
||
2871 | * $I->switchToNextTab(); |
||
2872 | * // switch to 2nd next tab |
||
2873 | * $I->switchToNextTab(2); |
||
2874 | * ``` |
||
2875 | * |
||
2876 | * Can't be used with PhantomJS |
||
2877 | * |
||
2878 | * @param int $offset 1 |
||
2879 | * @see \Codeception\Module\WebDriver::switchToNextTab() |
||
2880 | */ |
||
2881 | public function switchToNextTab($offset = null) { |
||
2884 | |||
2885 | /** |
||
2886 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2887 | * |
||
2888 | * Switches to previous browser tab. |
||
2889 | * An offset can be specified. |
||
2890 | * |
||
2891 | * ```php |
||
2892 | * <?php |
||
2893 | * // switch to previous tab |
||
2894 | * $I->switchToPreviousTab(); |
||
2895 | * // switch to 2nd previous tab |
||
2896 | * $I->switchToPreviousTab(2); |
||
2897 | * ``` |
||
2898 | * |
||
2899 | * Can't be used with PhantomJS |
||
2900 | * |
||
2901 | * @param int $offset 1 |
||
2902 | * @see \Codeception\Module\WebDriver::switchToPreviousTab() |
||
2903 | */ |
||
2904 | public function switchToPreviousTab($offset = null) { |
||
2907 | |||
2908 | /** |
||
2909 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2910 | * |
||
2911 | * Waits for element and runs a sequence of actions inside its context. |
||
2912 | * Actions can be defined with array, callback, or `Codeception\Util\ActionSequence` instance. |
||
2913 | * |
||
2914 | * Actions as array are recommended for simple to combine "waitForElement" with assertions; |
||
2915 | * `waitForElement($el)` and `see('text', $el)` can be simplified to: |
||
2916 | * |
||
2917 | * ```php |
||
2918 | * <?php |
||
2919 | * $I->performOn($el, ['see' => 'text']); |
||
2920 | * ``` |
||
2921 | * |
||
2922 | * List of actions can be pragmatically build using `Codeception\Util\ActionSequence`: |
||
2923 | * |
||
2924 | * ```php |
||
2925 | * <?php |
||
2926 | * $I->performOn('.model', ActionSequence::build() |
||
2927 | * ->see('Warning') |
||
2928 | * ->see('Are you sure you want to delete this?') |
||
2929 | * ->click('Yes') |
||
2930 | * ); |
||
2931 | * ``` |
||
2932 | * |
||
2933 | * Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to |
||
2934 | * exception on failure. |
||
2935 | * |
||
2936 | * Whenever you need to define more actions a callback can be used. A WebDriver module is passed for argument: |
||
2937 | * |
||
2938 | * ```php |
||
2939 | * <?php |
||
2940 | * $I->performOn('.rememberMe', function (WebDriver $I) { |
||
2941 | * $I->see('Remember me next time'); |
||
2942 | * $I->seeElement('#LoginForm_rememberMe'); |
||
2943 | * $I->dontSee('Login'); |
||
2944 | * }); |
||
2945 | * ``` |
||
2946 | * |
||
2947 | * In 3rd argument you can set number a seconds to wait for element to appear |
||
2948 | * |
||
2949 | * @param $element |
||
2950 | * @param $actions |
||
2951 | * @param int $timeout |
||
2952 | * @see \Codeception\Module\WebDriver::performOn() |
||
2953 | */ |
||
2954 | public function performOn($element, $actions, $timeout = null) { |
||
2957 | |||
2958 | /** |
||
2959 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2960 | * |
||
2961 | * @inheritdoc |
||
2962 | * @see \tests\codeception\_support\DynamicFixtureHelper::globalFixtures() |
||
2963 | */ |
||
2964 | public function globalFixtures() { |
||
2967 | |||
2968 | /** |
||
2969 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2970 | * |
||
2971 | * @inheritdoc |
||
2972 | * @see \tests\codeception\_support\DynamicFixtureHelper::fixtures() |
||
2973 | */ |
||
2974 | public function fixtures() { |
||
2977 | |||
2978 | /** |
||
2979 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2980 | * |
||
2981 | * Loads the specified fixtures. |
||
2982 | * This method will call [[Fixture::load()]] for every fixture object. |
||
2983 | * @param Fixture[] $fixtures the fixtures to be loaded. If this parameter is not specified, |
||
2984 | * the return value of [[getFixtures()]] will be used. |
||
2985 | * @see \tests\codeception\_support\DynamicFixtureHelper::loadFixtures() |
||
2986 | */ |
||
2987 | public function loadFixtures($fixtures = null) { |
||
2990 | |||
2991 | /** |
||
2992 | * [!] Method is generated. Documentation taken from corresponding module. |
||
2993 | * |
||
2994 | * Initialize the fixtures. |
||
2995 | * @since 2.0.12 |
||
2996 | * @see \tests\codeception\_support\DynamicFixtureHelper::initFixtures() |
||
2997 | */ |
||
2998 | public function initFixtures() { |
||
3001 | |||
3002 | /** |
||
3003 | * [!] Method is generated. Documentation taken from corresponding module. |
||
3004 | * |
||
3005 | * Creates the specified fixture instances. |
||
3006 | * All dependent fixtures will also be created. |
||
3007 | * @param array $fixtures the fixtures to be created. You may provide fixture names or fixture configurations. |
||
3008 | * If this parameter is not provided, the fixtures specified in [[globalFixtures()]] and [[fixtures()]] will be created. |
||
3009 | * @return Fixture[] the created fixture instances |
||
3010 | * @throws InvalidConfigException if fixtures are not properly configured or if a circular dependency among |
||
3011 | * the fixtures is detected. |
||
3012 | * @see \tests\codeception\_support\DynamicFixtureHelper::createFixtures() |
||
3013 | */ |
||
3014 | public function createFixtures($fixtures) { |
||
3017 | } |
||
3018 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.