TestGuy.php 37 KB

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