WebGuy.php 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. <?php
  2. // This class was automatically generated by build task
  3. // You can change it manually, but it will be overwritten on next build
  4. // @codingStandardsIgnoreFile
  5. use Codeception\Maybe;
  6. use Codeception\Module\PhpBrowser;
  7. use Codeception\Module\WebHelper;
  8. /**
  9. * Inherited methods
  10. * @method void wantToTest($text)
  11. * @method void wantTo($text)
  12. * @method void amTesting($method)
  13. * @method void amTestingMethod($method)
  14. * @method void testMethod($signature)
  15. * @method void expectTo($prediction)
  16. * @method void expect($prediction)
  17. * @method void amGoingTo($argumentation)
  18. * @method void am($role)
  19. * @method void lookForwardTo($role)
  20. */
  21. class WebGuy extends \Codeception\AbstractGuy
  22. {
  23. /**
  24. * Submits a form located on page.
  25. * Specify the form by it's css or xpath selector.
  26. * Fill the form fields values as array.
  27. *
  28. * Skipped fields will be filled by their values from page.
  29. * You don't need to click the 'Submit' button afterwards.
  30. * This command itself triggers the request to form's action.
  31. *
  32. * Examples:
  33. *
  34. * ``` php
  35. * <?php
  36. * $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));
  37. *
  38. * ```
  39. *
  40. * For sample Sign Up form:
  41. *
  42. * ``` html
  43. * <form action="/sign_up">
  44. * Login: <input type="text" name="user[login]" /><br/>
  45. * Password: <input type="password" name="user[password]" /><br/>
  46. * Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/>
  47. * Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select>
  48. * <input type="submit" value="Submit" />
  49. * </form>
  50. * ```
  51. * I can write this:
  52. *
  53. * ``` php
  54. * <?php
  55. * $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));
  56. *
  57. * ```
  58. * Note, that pricing plan will be set to Paid, as it's selected on page.
  59. *
  60. * @param $selector
  61. * @param $params
  62. * @see PhpBrowser::submitForm()
  63. * @return \Codeception\Maybe
  64. * ! This method is generated. DO NOT EDIT. !
  65. * ! Documentation taken from corresponding module !
  66. */
  67. public function submitForm($selector, $params) {
  68. $this->scenario->action('submitForm', func_get_args());
  69. if ($this->scenario->running()) {
  70. $result = $this->scenario->runStep();
  71. return new Maybe($result);
  72. }
  73. return new Maybe();
  74. }
  75. /**
  76. * If your page triggers an ajax request, you can perform it manually.
  77. * This action sends a POST ajax request with specified params.
  78. * Additional params can be passed as array.
  79. *
  80. * Example:
  81. *
  82. * Imagine that by clicking checkbox you trigger ajax request which updates user settings.
  83. * We emulate that click by running this ajax request manually.
  84. *
  85. * ``` php
  86. * <?php
  87. * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST
  88. * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET
  89. *
  90. * ```
  91. *
  92. * @param $uri
  93. * @param $params
  94. * @see PhpBrowser::sendAjaxPostRequest()
  95. * @return \Codeception\Maybe
  96. * ! This method is generated. DO NOT EDIT. !
  97. * ! Documentation taken from corresponding module !
  98. */
  99. public function sendAjaxPostRequest($uri, $params = null) {
  100. $this->scenario->action('sendAjaxPostRequest', func_get_args());
  101. if ($this->scenario->running()) {
  102. $result = $this->scenario->runStep();
  103. return new Maybe($result);
  104. }
  105. return new Maybe();
  106. }
  107. /**
  108. * If your page triggers an ajax request, you can perform it manually.
  109. * This action sends a GET ajax request with specified params.
  110. *
  111. * See ->sendAjaxPostRequest for examples.
  112. *
  113. * @param $uri
  114. * @param $params
  115. * @see PhpBrowser::sendAjaxGetRequest()
  116. * @return \Codeception\Maybe
  117. * ! This method is generated. DO NOT EDIT. !
  118. * ! Documentation taken from corresponding module !
  119. */
  120. public function sendAjaxGetRequest($uri, $params = null) {
  121. $this->scenario->action('sendAjaxGetRequest', func_get_args());
  122. if ($this->scenario->running()) {
  123. $result = $this->scenario->runStep();
  124. return new Maybe($result);
  125. }
  126. return new Maybe();
  127. }
  128. /**
  129. * Asserts that current page has 404 response status code.
  130. * @see PhpBrowser::seePageNotFound()
  131. * @return \Codeception\Maybe
  132. * ! This method is generated. DO NOT EDIT. !
  133. * ! Documentation taken from corresponding module !
  134. */
  135. public function seePageNotFound() {
  136. $this->scenario->assertion('seePageNotFound', func_get_args());
  137. if ($this->scenario->running()) {
  138. $result = $this->scenario->runStep();
  139. return new Maybe($result);
  140. }
  141. return new Maybe();
  142. }
  143. /**
  144. * Checks that response code is equal to value provided.
  145. *
  146. * @param $code
  147. * @return mixed
  148. * @see PhpBrowser::seeResponseCodeIs()
  149. * @return \Codeception\Maybe
  150. * ! This method is generated. DO NOT EDIT. !
  151. * ! Documentation taken from corresponding module !
  152. */
  153. public function seeResponseCodeIs($code) {
  154. $this->scenario->assertion('seeResponseCodeIs', func_get_args());
  155. if ($this->scenario->running()) {
  156. $result = $this->scenario->runStep();
  157. return new Maybe($result);
  158. }
  159. return new Maybe();
  160. }
  161. /**
  162. * Adds HTTP authentication via username/password.
  163. *
  164. * @param $username
  165. * @param $password
  166. * @see PhpBrowser::amHttpAuthenticated()
  167. * @return \Codeception\Maybe
  168. * ! This method is generated. DO NOT EDIT. !
  169. * ! Documentation taken from corresponding module !
  170. */
  171. public function amHttpAuthenticated($username, $password) {
  172. $this->scenario->condition('amHttpAuthenticated', func_get_args());
  173. if ($this->scenario->running()) {
  174. $result = $this->scenario->runStep();
  175. return new Maybe($result);
  176. }
  177. return new Maybe();
  178. }
  179. /**
  180. * Low-level API method.
  181. * If Codeception commands are not enough, use [Guzzle HTTP Client](http://guzzlephp.org/) methods directly
  182. *
  183. * Example:
  184. *
  185. * ``` php
  186. * <?php
  187. * // from the official Guzzle manual
  188. * $I->amGoingTo('Sign all requests with OAuth');
  189. * $I->executeInGuzzle(function (\Guzzle\Http\Client $client) {
  190. * $client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(array(
  191. * 'consumer_key' => '***',
  192. * 'consumer_secret' => '***',
  193. * 'token' => '***',
  194. * 'token_secret' => '***'
  195. * )));
  196. * });
  197. * ?>
  198. * ```
  199. *
  200. * Not recommended this command too be used on regular basis.
  201. * If Codeception lacks important Guzzle Client methods implement then and submit patches.
  202. *
  203. * @param callable $function
  204. * @see PhpBrowser::executeInGuzzle()
  205. * @return \Codeception\Maybe
  206. * ! This method is generated. DO NOT EDIT. !
  207. * ! Documentation taken from corresponding module !
  208. */
  209. public function executeInGuzzle($function) {
  210. $this->scenario->action('executeInGuzzle', func_get_args());
  211. if ($this->scenario->running()) {
  212. $result = $this->scenario->runStep();
  213. return new Maybe($result);
  214. }
  215. return new Maybe();
  216. }
  217. /**
  218. * Opens the page.
  219. *
  220. * @param $page
  221. * @see PhpBrowser::amOnPage()
  222. * @return \Codeception\Maybe
  223. * ! This method is generated. DO NOT EDIT. !
  224. * ! Documentation taken from corresponding module !
  225. */
  226. public function amOnPage($page) {
  227. $this->scenario->condition('amOnPage', func_get_args());
  228. if ($this->scenario->running()) {
  229. $result = $this->scenario->runStep();
  230. return new Maybe($result);
  231. }
  232. return new Maybe();
  233. }
  234. /**
  235. * Sets 'url' configuration parameter to hosts subdomain.
  236. * It does not open a page on subdomain. Use `amOnPage` for that
  237. *
  238. * ``` php
  239. * <?php
  240. * // If config is: 'http://mysite.com'
  241. * // or config is: 'http://www.mysite.com'
  242. * // or config is: 'http://company.mysite.com'
  243. *
  244. * $I->amOnSubdomain('user');
  245. * $I->amOnPage('/');
  246. * // moves to http://user.mysite.com/
  247. * ?>
  248. * ```
  249. * @param $subdomain
  250. * @return mixed
  251. * @see PhpBrowser::amOnSubdomain()
  252. * @return \Codeception\Maybe
  253. * ! This method is generated. DO NOT EDIT. !
  254. * ! Documentation taken from corresponding module !
  255. */
  256. public function amOnSubdomain($subdomain) {
  257. $this->scenario->condition('amOnSubdomain', func_get_args());
  258. if ($this->scenario->running()) {
  259. $result = $this->scenario->runStep();
  260. return new Maybe($result);
  261. }
  262. return new Maybe();
  263. }
  264. /**
  265. * Check if current page doesn't contain the text specified.
  266. * Specify the css selector to match only specific region.
  267. *
  268. * Examples:
  269. *
  270. * ```php
  271. * <?php
  272. * $I->dontSee('Login'); // I can suppose user is already logged in
  273. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  274. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  275. * ```
  276. *
  277. * @param $text
  278. * @param null $selector
  279. * @see PhpBrowser::dontSee()
  280. * @return \Codeception\Maybe
  281. * ! This method is generated. DO NOT EDIT. !
  282. * ! Documentation taken from corresponding module !
  283. */
  284. public function dontSee($text, $selector = null) {
  285. $this->scenario->action('dontSee', func_get_args());
  286. if ($this->scenario->running()) {
  287. $result = $this->scenario->runStep();
  288. return new Maybe($result);
  289. }
  290. return new Maybe();
  291. }
  292. /**
  293. * Check if current page contains the text specified.
  294. * Specify the css selector to match only specific region.
  295. *
  296. * Examples:
  297. *
  298. * ``` php
  299. * <?php
  300. * $I->see('Logout'); // I can suppose user is logged in
  301. * $I->see('Sign Up','h1'); // I can suppose it's a signup page
  302. * $I->see('Sign Up','//body/h1'); // with XPath
  303. *
  304. * ```
  305. *
  306. * @param $text
  307. * @param null $selector
  308. * @see PhpBrowser::see()
  309. * @return \Codeception\Maybe
  310. * ! This method is generated. DO NOT EDIT. !
  311. * ! Documentation taken from corresponding module !
  312. */
  313. public function see($text, $selector = null) {
  314. $this->scenario->assertion('see', func_get_args());
  315. if ($this->scenario->running()) {
  316. $result = $this->scenario->runStep();
  317. return new Maybe($result);
  318. }
  319. return new Maybe();
  320. }
  321. /**
  322. * Checks if there is a link with text specified.
  323. * Specify url to match link with exact this url.
  324. *
  325. * Examples:
  326. *
  327. * ``` php
  328. * <?php
  329. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  330. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  331. *
  332. * ```
  333. *
  334. * @param $text
  335. * @param null $url
  336. * @see PhpBrowser::seeLink()
  337. * @return \Codeception\Maybe
  338. * ! This method is generated. DO NOT EDIT. !
  339. * ! Documentation taken from corresponding module !
  340. */
  341. public function seeLink($text, $url = null) {
  342. $this->scenario->assertion('seeLink', func_get_args());
  343. if ($this->scenario->running()) {
  344. $result = $this->scenario->runStep();
  345. return new Maybe($result);
  346. }
  347. return new Maybe();
  348. }
  349. /**
  350. * Checks if page doesn't contain the link with text specified.
  351. * Specify url to narrow the results.
  352. *
  353. * Examples:
  354. *
  355. * ``` php
  356. * <?php
  357. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  358. *
  359. * ```
  360. *
  361. * @param $text
  362. * @param null $url
  363. * @see PhpBrowser::dontSeeLink()
  364. * @return \Codeception\Maybe
  365. * ! This method is generated. DO NOT EDIT. !
  366. * ! Documentation taken from corresponding module !
  367. */
  368. public function dontSeeLink($text, $url = null) {
  369. $this->scenario->action('dontSeeLink', func_get_args());
  370. if ($this->scenario->running()) {
  371. $result = $this->scenario->runStep();
  372. return new Maybe($result);
  373. }
  374. return new Maybe();
  375. }
  376. /**
  377. * Perform a click on link or button.
  378. * Link or button are found by their names or CSS selector.
  379. * Submits a form if button is a submit type.
  380. *
  381. * If link is an image it's found by alt attribute value of image.
  382. * If button is image button is found by it's value
  383. * If link or button can't be found by name they are searched by CSS selector.
  384. *
  385. * The second parameter is a context: CSS or XPath locator to narrow the search.
  386. *
  387. * Examples:
  388. *
  389. * ``` php
  390. * <?php
  391. * // simple link
  392. * $I->click('Logout');
  393. * // button of form
  394. * $I->click('Submit');
  395. * // CSS button
  396. * $I->click('#form input[type=submit]');
  397. * // XPath
  398. * $I->click('//form/*[@type=submit]')
  399. * // link in context
  400. * $I->click('Logout', '#nav');
  401. * ?>
  402. * ```
  403. * @param $link
  404. * @param $context
  405. * @see PhpBrowser::click()
  406. * @return \Codeception\Maybe
  407. * ! This method is generated. DO NOT EDIT. !
  408. * ! Documentation taken from corresponding module !
  409. */
  410. public function click($link, $context = null) {
  411. $this->scenario->action('click', func_get_args());
  412. if ($this->scenario->running()) {
  413. $result = $this->scenario->runStep();
  414. return new Maybe($result);
  415. }
  416. return new Maybe();
  417. }
  418. /**
  419. * Checks if element exists on a page, matching it by CSS or XPath
  420. *
  421. * ``` php
  422. * <?php
  423. * $I->seeElement('.error');
  424. * $I->seeElement(//form/input[1]);
  425. * ?>
  426. * ```
  427. * @param $selector
  428. * @see PhpBrowser::seeElement()
  429. * @return \Codeception\Maybe
  430. * ! This method is generated. DO NOT EDIT. !
  431. * ! Documentation taken from corresponding module !
  432. */
  433. public function seeElement($selector) {
  434. $this->scenario->assertion('seeElement', func_get_args());
  435. if ($this->scenario->running()) {
  436. $result = $this->scenario->runStep();
  437. return new Maybe($result);
  438. }
  439. return new Maybe();
  440. }
  441. /**
  442. * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath
  443. *
  444. * ``` php
  445. * <?php
  446. * $I->dontSeeElement('.error');
  447. * $I->dontSeeElement(//form/input[1]);
  448. * ?>
  449. * ```
  450. * @param $selector
  451. * @see PhpBrowser::dontSeeElement()
  452. * @return \Codeception\Maybe
  453. * ! This method is generated. DO NOT EDIT. !
  454. * ! Documentation taken from corresponding module !
  455. */
  456. public function dontSeeElement($selector) {
  457. $this->scenario->action('dontSeeElement', func_get_args());
  458. if ($this->scenario->running()) {
  459. $result = $this->scenario->runStep();
  460. return new Maybe($result);
  461. }
  462. return new Maybe();
  463. }
  464. /**
  465. * Reloads current page
  466. * @see PhpBrowser::reloadPage()
  467. * @return \Codeception\Maybe
  468. * ! This method is generated. DO NOT EDIT. !
  469. * ! Documentation taken from corresponding module !
  470. */
  471. public function reloadPage() {
  472. $this->scenario->action('reloadPage', func_get_args());
  473. if ($this->scenario->running()) {
  474. $result = $this->scenario->runStep();
  475. return new Maybe($result);
  476. }
  477. return new Maybe();
  478. }
  479. /**
  480. * Moves back in history
  481. * @see PhpBrowser::moveBack()
  482. * @return \Codeception\Maybe
  483. * ! This method is generated. DO NOT EDIT. !
  484. * ! Documentation taken from corresponding module !
  485. */
  486. public function moveBack() {
  487. $this->scenario->action('moveBack', func_get_args());
  488. if ($this->scenario->running()) {
  489. $result = $this->scenario->runStep();
  490. return new Maybe($result);
  491. }
  492. return new Maybe();
  493. }
  494. /**
  495. * Moves forward in history
  496. * @see PhpBrowser::moveForward()
  497. * @return \Codeception\Maybe
  498. * ! This method is generated. DO NOT EDIT. !
  499. * ! Documentation taken from corresponding module !
  500. */
  501. public function moveForward() {
  502. $this->scenario->action('moveForward', func_get_args());
  503. if ($this->scenario->running()) {
  504. $result = $this->scenario->runStep();
  505. return new Maybe($result);
  506. }
  507. return new Maybe();
  508. }
  509. /**
  510. * Fills a text field or textarea with value.
  511. *
  512. * @param $field
  513. * @param $value
  514. * @see PhpBrowser::fillField()
  515. * @return \Codeception\Maybe
  516. * ! This method is generated. DO NOT EDIT. !
  517. * ! Documentation taken from corresponding module !
  518. */
  519. public function fillField($field, $value) {
  520. $this->scenario->action('fillField', func_get_args());
  521. if ($this->scenario->running()) {
  522. $result = $this->scenario->runStep();
  523. return new Maybe($result);
  524. }
  525. return new Maybe();
  526. }
  527. /**
  528. * Selects an option in select tag or in radio button group.
  529. *
  530. * Example:
  531. *
  532. * ``` php
  533. * <?php
  534. * $I->selectOption('form select[name=account]', 'Premium');
  535. * $I->selectOption('form input[name=payment]', 'Monthly');
  536. * $I->selectOption('//form/select[@name=account]', 'Monthly');
  537. * ?>
  538. * ```
  539. *
  540. * @param $select
  541. * @param $option
  542. * @see PhpBrowser::selectOption()
  543. * @return \Codeception\Maybe
  544. * ! This method is generated. DO NOT EDIT. !
  545. * ! Documentation taken from corresponding module !
  546. */
  547. public function selectOption($select, $option) {
  548. $this->scenario->action('selectOption', func_get_args());
  549. if ($this->scenario->running()) {
  550. $result = $this->scenario->runStep();
  551. return new Maybe($result);
  552. }
  553. return new Maybe();
  554. }
  555. /**
  556. * Ticks a checkbox.
  557. * For radio buttons use `selectOption` method.
  558. *
  559. * Example:
  560. *
  561. * ``` php
  562. * <?php
  563. * $I->checkOption('#agree');
  564. * ?>
  565. * ```
  566. *
  567. * @param $option
  568. * @see PhpBrowser::checkOption()
  569. * @return \Codeception\Maybe
  570. * ! This method is generated. DO NOT EDIT. !
  571. * ! Documentation taken from corresponding module !
  572. */
  573. public function checkOption($option) {
  574. $this->scenario->action('checkOption', func_get_args());
  575. if ($this->scenario->running()) {
  576. $result = $this->scenario->runStep();
  577. return new Maybe($result);
  578. }
  579. return new Maybe();
  580. }
  581. /**
  582. * Unticks a checkbox.
  583. *
  584. * Example:
  585. *
  586. * ``` php
  587. * <?php
  588. * $I->uncheckOption('#notify');
  589. * ?>
  590. * ```
  591. *
  592. * @param $option
  593. * @see PhpBrowser::uncheckOption()
  594. * @return \Codeception\Maybe
  595. * ! This method is generated. DO NOT EDIT. !
  596. * ! Documentation taken from corresponding module !
  597. */
  598. public function uncheckOption($option) {
  599. $this->scenario->action('uncheckOption', func_get_args());
  600. if ($this->scenario->running()) {
  601. $result = $this->scenario->runStep();
  602. return new Maybe($result);
  603. }
  604. return new Maybe();
  605. }
  606. /**
  607. * Checks that current uri contains a value
  608. *
  609. * ``` php
  610. * <?php
  611. * // to match: /home/dashboard
  612. * $I->seeInCurrentUrl('home');
  613. * // to match: /users/1
  614. * $I->seeInCurrentUrl('/users/');
  615. * ?>
  616. * ```
  617. *
  618. * @param $uri
  619. * @see PhpBrowser::seeInCurrentUrl()
  620. * @return \Codeception\Maybe
  621. * ! This method is generated. DO NOT EDIT. !
  622. * ! Documentation taken from corresponding module !
  623. */
  624. public function seeInCurrentUrl($uri) {
  625. $this->scenario->assertion('seeInCurrentUrl', func_get_args());
  626. if ($this->scenario->running()) {
  627. $result = $this->scenario->runStep();
  628. return new Maybe($result);
  629. }
  630. return new Maybe();
  631. }
  632. /**
  633. * Checks that current uri does not contain a value
  634. *
  635. * ``` php
  636. * <?php
  637. * $I->dontSeeInCurrentUrl('/users/');
  638. * ?>
  639. * ```
  640. *
  641. * @param $uri
  642. * @see PhpBrowser::dontSeeInCurrentUrl()
  643. * @return \Codeception\Maybe
  644. * ! This method is generated. DO NOT EDIT. !
  645. * ! Documentation taken from corresponding module !
  646. */
  647. public function dontSeeInCurrentUrl($uri) {
  648. $this->scenario->action('dontSeeInCurrentUrl', func_get_args());
  649. if ($this->scenario->running()) {
  650. $result = $this->scenario->runStep();
  651. return new Maybe($result);
  652. }
  653. return new Maybe();
  654. }
  655. /**
  656. * Checks that current url is equal to value.
  657. * Unlike `seeInCurrentUrl` performs a strict check.
  658. *
  659. * <?php
  660. * // to match root url
  661. * $I->seeCurrentUrlEquals('/');
  662. * ?>
  663. *
  664. * @param $uri
  665. * @see PhpBrowser::seeCurrentUrlEquals()
  666. * @return \Codeception\Maybe
  667. * ! This method is generated. DO NOT EDIT. !
  668. * ! Documentation taken from corresponding module !
  669. */
  670. public function seeCurrentUrlEquals($uri) {
  671. $this->scenario->assertion('seeCurrentUrlEquals', func_get_args());
  672. if ($this->scenario->running()) {
  673. $result = $this->scenario->runStep();
  674. return new Maybe($result);
  675. }
  676. return new Maybe();
  677. }
  678. /**
  679. * Checks that current url is not equal to value.
  680. * Unlike `dontSeeInCurrentUrl` performs a strict check.
  681. *
  682. * <?php
  683. * // current url is not root
  684. * $I->dontSeeCurrentUrlEquals('/');
  685. * ?>
  686. *
  687. * @param $uri
  688. * @see PhpBrowser::dontSeeCurrentUrlEquals()
  689. * @return \Codeception\Maybe
  690. * ! This method is generated. DO NOT EDIT. !
  691. * ! Documentation taken from corresponding module !
  692. */
  693. public function dontSeeCurrentUrlEquals($uri) {
  694. $this->scenario->action('dontSeeCurrentUrlEquals', func_get_args());
  695. if ($this->scenario->running()) {
  696. $result = $this->scenario->runStep();
  697. return new Maybe($result);
  698. }
  699. return new Maybe();
  700. }
  701. /**
  702. * Checks that current url is matches a RegEx value
  703. *
  704. * <?php
  705. * // to match root url
  706. * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
  707. * ?>
  708. *
  709. * @param $uri
  710. * @see PhpBrowser::seeCurrentUrlMatches()
  711. * @return \Codeception\Maybe
  712. * ! This method is generated. DO NOT EDIT. !
  713. * ! Documentation taken from corresponding module !
  714. */
  715. public function seeCurrentUrlMatches($uri) {
  716. $this->scenario->assertion('seeCurrentUrlMatches', func_get_args());
  717. if ($this->scenario->running()) {
  718. $result = $this->scenario->runStep();
  719. return new Maybe($result);
  720. }
  721. return new Maybe();
  722. }
  723. /**
  724. * Checks that current url does not match a RegEx value
  725. *
  726. * <?php
  727. * // to match root url
  728. * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
  729. * ?>
  730. *
  731. * @param $uri
  732. * @see PhpBrowser::dontSeeCurrentUrlMatches()
  733. * @return \Codeception\Maybe
  734. * ! This method is generated. DO NOT EDIT. !
  735. * ! Documentation taken from corresponding module !
  736. */
  737. public function dontSeeCurrentUrlMatches($uri) {
  738. $this->scenario->action('dontSeeCurrentUrlMatches', func_get_args());
  739. if ($this->scenario->running()) {
  740. $result = $this->scenario->runStep();
  741. return new Maybe($result);
  742. }
  743. return new Maybe();
  744. }
  745. /**
  746. *
  747. * @see PhpBrowser::seeCookie()
  748. * @return \Codeception\Maybe
  749. * ! This method is generated. DO NOT EDIT. !
  750. * ! Documentation taken from corresponding module !
  751. */
  752. public function seeCookie($cookie) {
  753. $this->scenario->assertion('seeCookie', func_get_args());
  754. if ($this->scenario->running()) {
  755. $result = $this->scenario->runStep();
  756. return new Maybe($result);
  757. }
  758. return new Maybe();
  759. }
  760. /**
  761. *
  762. * @see PhpBrowser::dontSeeCookie()
  763. * @return \Codeception\Maybe
  764. * ! This method is generated. DO NOT EDIT. !
  765. * ! Documentation taken from corresponding module !
  766. */
  767. public function dontSeeCookie($cookie) {
  768. $this->scenario->action('dontSeeCookie', func_get_args());
  769. if ($this->scenario->running()) {
  770. $result = $this->scenario->runStep();
  771. return new Maybe($result);
  772. }
  773. return new Maybe();
  774. }
  775. /**
  776. *
  777. * @see PhpBrowser::setCookie()
  778. * @return \Codeception\Maybe
  779. * ! This method is generated. DO NOT EDIT. !
  780. * ! Documentation taken from corresponding module !
  781. */
  782. public function setCookie($cookie, $value) {
  783. $this->scenario->action('setCookie', func_get_args());
  784. if ($this->scenario->running()) {
  785. $result = $this->scenario->runStep();
  786. return new Maybe($result);
  787. }
  788. return new Maybe();
  789. }
  790. /**
  791. *
  792. * @see PhpBrowser::resetCookie()
  793. * @return \Codeception\Maybe
  794. * ! This method is generated. DO NOT EDIT. !
  795. * ! Documentation taken from corresponding module !
  796. */
  797. public function resetCookie($cookie) {
  798. $this->scenario->action('resetCookie', func_get_args());
  799. if ($this->scenario->running()) {
  800. $result = $this->scenario->runStep();
  801. return new Maybe($result);
  802. }
  803. return new Maybe();
  804. }
  805. /**
  806. *
  807. * @see PhpBrowser::grabCookie()
  808. * @return \Codeception\Maybe
  809. * ! This method is generated. DO NOT EDIT. !
  810. * ! Documentation taken from corresponding module !
  811. */
  812. public function grabCookie($cookie) {
  813. $this->scenario->action('grabCookie', func_get_args());
  814. if ($this->scenario->running()) {
  815. $result = $this->scenario->runStep();
  816. return new Maybe($result);
  817. }
  818. return new Maybe();
  819. }
  820. /**
  821. * Takes a parameters from current URI by RegEx.
  822. * If no url provided returns full URI.
  823. *
  824. * ``` php
  825. * <?php
  826. * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
  827. * $uri = $I->grabFromCurrentUrl();
  828. * ?>
  829. * ```
  830. *
  831. * @param null $uri
  832. * @internal param $url
  833. * @return mixed
  834. * @see PhpBrowser::grabFromCurrentUrl()
  835. * @return \Codeception\Maybe
  836. * ! This method is generated. DO NOT EDIT. !
  837. * ! Documentation taken from corresponding module !
  838. */
  839. public function grabFromCurrentUrl($uri = null) {
  840. $this->scenario->action('grabFromCurrentUrl', func_get_args());
  841. if ($this->scenario->running()) {
  842. $result = $this->scenario->runStep();
  843. return new Maybe($result);
  844. }
  845. return new Maybe();
  846. }
  847. /**
  848. * Attaches file from Codeception data directory to upload field.
  849. *
  850. * Example:
  851. *
  852. * ``` php
  853. * <?php
  854. * // file is stored in 'tests/data/tests.xls'
  855. * $I->attachFile('prices.xls');
  856. * ?>
  857. * ```
  858. *
  859. * @param $field
  860. * @param $filename
  861. * @see PhpBrowser::attachFile()
  862. * @return \Codeception\Maybe
  863. * ! This method is generated. DO NOT EDIT. !
  864. * ! Documentation taken from corresponding module !
  865. */
  866. public function attachFile($field, $filename) {
  867. $this->scenario->action('attachFile', func_get_args());
  868. if ($this->scenario->running()) {
  869. $result = $this->scenario->runStep();
  870. return new Maybe($result);
  871. }
  872. return new Maybe();
  873. }
  874. /**
  875. * Checks if option is selected in select field.
  876. *
  877. * ``` php
  878. * <?php
  879. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  880. * ?>
  881. * ```
  882. *
  883. * @param $selector
  884. * @param $optionText
  885. * @return mixed
  886. * @see PhpBrowser::seeOptionIsSelected()
  887. * @return \Codeception\Maybe
  888. * ! This method is generated. DO NOT EDIT. !
  889. * ! Documentation taken from corresponding module !
  890. */
  891. public function seeOptionIsSelected($select, $text) {
  892. $this->scenario->assertion('seeOptionIsSelected', func_get_args());
  893. if ($this->scenario->running()) {
  894. $result = $this->scenario->runStep();
  895. return new Maybe($result);
  896. }
  897. return new Maybe();
  898. }
  899. /**
  900. * Checks if option is not selected in select field.
  901. *
  902. * ``` php
  903. * <?php
  904. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  905. * ?>
  906. * ```
  907. *
  908. * @param $selector
  909. * @param $optionText
  910. * @return mixed
  911. * @see PhpBrowser::dontSeeOptionIsSelected()
  912. * @return \Codeception\Maybe
  913. * ! This method is generated. DO NOT EDIT. !
  914. * ! Documentation taken from corresponding module !
  915. */
  916. public function dontSeeOptionIsSelected($select, $text) {
  917. $this->scenario->action('dontSeeOptionIsSelected', func_get_args());
  918. if ($this->scenario->running()) {
  919. $result = $this->scenario->runStep();
  920. return new Maybe($result);
  921. }
  922. return new Maybe();
  923. }
  924. /**
  925. * Assert if the specified checkbox is checked.
  926. * Use css selector or xpath to match.
  927. *
  928. * Example:
  929. *
  930. * ``` php
  931. * <?php
  932. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  933. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  934. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  935. *
  936. * ```
  937. *
  938. * @param $checkbox
  939. * @see PhpBrowser::seeCheckboxIsChecked()
  940. * @return \Codeception\Maybe
  941. * ! This method is generated. DO NOT EDIT. !
  942. * ! Documentation taken from corresponding module !
  943. */
  944. public function seeCheckboxIsChecked($checkbox) {
  945. $this->scenario->assertion('seeCheckboxIsChecked', func_get_args());
  946. if ($this->scenario->running()) {
  947. $result = $this->scenario->runStep();
  948. return new Maybe($result);
  949. }
  950. return new Maybe();
  951. }
  952. /**
  953. * Assert if the specified checkbox is unchecked.
  954. * Use css selector or xpath to match.
  955. *
  956. * Example:
  957. *
  958. * ``` php
  959. * <?php
  960. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  961. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  962. *
  963. * ```
  964. *
  965. * @param $checkbox
  966. * @see PhpBrowser::dontSeeCheckboxIsChecked()
  967. * @return \Codeception\Maybe
  968. * ! This method is generated. DO NOT EDIT. !
  969. * ! Documentation taken from corresponding module !
  970. */
  971. public function dontSeeCheckboxIsChecked($checkbox) {
  972. $this->scenario->action('dontSeeCheckboxIsChecked', func_get_args());
  973. if ($this->scenario->running()) {
  974. $result = $this->scenario->runStep();
  975. return new Maybe($result);
  976. }
  977. return new Maybe();
  978. }
  979. /**
  980. * Checks that an input field or textarea contains value.
  981. * Field is matched either by label or CSS or Xpath
  982. *
  983. * Example:
  984. *
  985. * ``` php
  986. * <?php
  987. * $I->seeInField('Body','Type your comment here');
  988. * $I->seeInField('form textarea[name=body]','Type your comment here');
  989. * $I->seeInField('form input[type=hidden]','hidden_value');
  990. * $I->seeInField('#searchform input','Search');
  991. * $I->seeInField('//form/*[@name=search]','Search');
  992. * ?>
  993. * ```
  994. *
  995. * @param $field
  996. * @param $value
  997. * @see PhpBrowser::seeInField()
  998. * @return \Codeception\Maybe
  999. * ! This method is generated. DO NOT EDIT. !
  1000. * ! Documentation taken from corresponding module !
  1001. */
  1002. public function seeInField($field, $value) {
  1003. $this->scenario->assertion('seeInField', func_get_args());
  1004. if ($this->scenario->running()) {
  1005. $result = $this->scenario->runStep();
  1006. return new Maybe($result);
  1007. }
  1008. return new Maybe();
  1009. }
  1010. /**
  1011. * Checks that an input field or textarea doesn't contain value.
  1012. * Field is matched either by label or CSS or Xpath
  1013. * Example:
  1014. *
  1015. * ``` php
  1016. * <?php
  1017. * $I->dontSeeInField('Body','Type your comment here');
  1018. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1019. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1020. * $I->dontSeeInField('#searchform input','Search');
  1021. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1022. * ?>
  1023. * ```
  1024. *
  1025. * @param $field
  1026. * @param $value
  1027. * @see PhpBrowser::dontSeeInField()
  1028. * @return \Codeception\Maybe
  1029. * ! This method is generated. DO NOT EDIT. !
  1030. * ! Documentation taken from corresponding module !
  1031. */
  1032. public function dontSeeInField($field, $value) {
  1033. $this->scenario->action('dontSeeInField', func_get_args());
  1034. if ($this->scenario->running()) {
  1035. $result = $this->scenario->runStep();
  1036. return new Maybe($result);
  1037. }
  1038. return new Maybe();
  1039. }
  1040. /**
  1041. * Finds and returns text contents of element.
  1042. * Element is searched by CSS selector, XPath or matcher by regex.
  1043. *
  1044. * Example:
  1045. *
  1046. * ``` php
  1047. * <?php
  1048. * $heading = $I->grabTextFrom('h1');
  1049. * $heading = $I->grabTextFrom('descendant-or-self::h1');
  1050. * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi');
  1051. * ?>
  1052. * ```
  1053. *
  1054. * @param $cssOrXPathOrRegex
  1055. * @return mixed
  1056. * @see PhpBrowser::grabTextFrom()
  1057. * @return \Codeception\Maybe
  1058. * ! This method is generated. DO NOT EDIT. !
  1059. * ! Documentation taken from corresponding module !
  1060. */
  1061. public function grabTextFrom($cssOrXPathOrRegex) {
  1062. $this->scenario->action('grabTextFrom', func_get_args());
  1063. if ($this->scenario->running()) {
  1064. $result = $this->scenario->runStep();
  1065. return new Maybe($result);
  1066. }
  1067. return new Maybe();
  1068. }
  1069. /**
  1070. * Finds and returns field and returns it's value.
  1071. * Searches by field name, then by CSS, then by XPath
  1072. *
  1073. * Example:
  1074. *
  1075. * ``` php
  1076. * <?php
  1077. * $name = $I->grabValueFrom('Name');
  1078. * $name = $I->grabValueFrom('input[name=username]');
  1079. * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']');
  1080. * ?>
  1081. * ```
  1082. *
  1083. * @param $field
  1084. * @return mixed
  1085. * @see PhpBrowser::grabValueFrom()
  1086. * @return \Codeception\Maybe
  1087. * ! This method is generated. DO NOT EDIT. !
  1088. * ! Documentation taken from corresponding module !
  1089. */
  1090. public function grabValueFrom($field) {
  1091. $this->scenario->action('grabValueFrom', func_get_args());
  1092. if ($this->scenario->running()) {
  1093. $result = $this->scenario->runStep();
  1094. return new Maybe($result);
  1095. }
  1096. return new Maybe();
  1097. }
  1098. /**
  1099. *
  1100. * @see PhpBrowser::grabAttribute()
  1101. * @return \Codeception\Maybe
  1102. * ! This method is generated. DO NOT EDIT. !
  1103. * ! Documentation taken from corresponding module !
  1104. */
  1105. public function grabAttribute() {
  1106. $this->scenario->action('grabAttribute', func_get_args());
  1107. if ($this->scenario->running()) {
  1108. $result = $this->scenario->runStep();
  1109. return new Maybe($result);
  1110. }
  1111. return new Maybe();
  1112. }
  1113. }