WebGuy.php 35 KB

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