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