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