AcceptanceTesterActions.php 73 KB

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