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