You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AcceptanceTesterActions.php 74KB

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