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