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.

3115 line
101KB

  1. <?php //[STAMP] 14411246556411adb06b0da3793eafed
  2. namespace tests\codeception\producer\_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 FunctionalTesterActions
  7. {
  8. /**
  9. * @return \Codeception\Scenario
  10. */
  11. abstract protected function getScenario();
  12. /**
  13. * [!] Method is generated. Documentation taken from corresponding module.
  14. *
  15. * Enters a directory In local filesystem.
  16. * Project root directory is used by default
  17. *
  18. * @param string $path
  19. * @see \Codeception\Module\Filesystem::amInPath()
  20. */
  21. public function amInPath($path) {
  22. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amInPath', func_get_args()));
  23. }
  24. /**
  25. * [!] Method is generated. Documentation taken from corresponding module.
  26. *
  27. * Opens a file and stores it's content.
  28. *
  29. * Usage:
  30. *
  31. * ``` php
  32. * <?php
  33. * $I->openFile('composer.json');
  34. * $I->seeInThisFile('codeception/codeception');
  35. * ?>
  36. * ```
  37. *
  38. * @param string $filename
  39. * @see \Codeception\Module\Filesystem::openFile()
  40. */
  41. public function openFile($filename) {
  42. return $this->getScenario()->runStep(new \Codeception\Step\Action('openFile', func_get_args()));
  43. }
  44. /**
  45. * [!] Method is generated. Documentation taken from corresponding module.
  46. *
  47. * Deletes a file
  48. *
  49. * ``` php
  50. * <?php
  51. * $I->deleteFile('composer.lock');
  52. * ?>
  53. * ```
  54. *
  55. * @param string $filename
  56. * @see \Codeception\Module\Filesystem::deleteFile()
  57. */
  58. public function deleteFile($filename) {
  59. return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteFile', func_get_args()));
  60. }
  61. /**
  62. * [!] Method is generated. Documentation taken from corresponding module.
  63. *
  64. * Deletes directory with all subdirectories
  65. *
  66. * ``` php
  67. * <?php
  68. * $I->deleteDir('vendor');
  69. * ?>
  70. * ```
  71. *
  72. * @param string $dirname
  73. * @see \Codeception\Module\Filesystem::deleteDir()
  74. */
  75. public function deleteDir($dirname) {
  76. return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteDir', func_get_args()));
  77. }
  78. /**
  79. * [!] Method is generated. Documentation taken from corresponding module.
  80. *
  81. * Copies directory with all contents
  82. *
  83. * ``` php
  84. * <?php
  85. * $I->copyDir('vendor','old_vendor');
  86. * ?>
  87. * ```
  88. *
  89. * @param string $src
  90. * @param string $dst
  91. * @see \Codeception\Module\Filesystem::copyDir()
  92. */
  93. public function copyDir($src, $dst) {
  94. return $this->getScenario()->runStep(new \Codeception\Step\Action('copyDir', func_get_args()));
  95. }
  96. /**
  97. * [!] Method is generated. Documentation taken from corresponding module.
  98. *
  99. * Checks If opened file has `text` in it.
  100. *
  101. * Usage:
  102. *
  103. * ``` php
  104. * <?php
  105. * $I->openFile('composer.json');
  106. * $I->seeInThisFile('codeception/codeception');
  107. * ?>
  108. * ```
  109. *
  110. * @param string $text
  111. * Conditional Assertion: Test won't be stopped on fail
  112. * @see \Codeception\Module\Filesystem::seeInThisFile()
  113. */
  114. public function canSeeInThisFile($text) {
  115. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInThisFile', func_get_args()));
  116. }
  117. /**
  118. * [!] Method is generated. Documentation taken from corresponding module.
  119. *
  120. * Checks If opened file has `text` in it.
  121. *
  122. * Usage:
  123. *
  124. * ``` php
  125. * <?php
  126. * $I->openFile('composer.json');
  127. * $I->seeInThisFile('codeception/codeception');
  128. * ?>
  129. * ```
  130. *
  131. * @param string $text
  132. * @see \Codeception\Module\Filesystem::seeInThisFile()
  133. */
  134. public function seeInThisFile($text) {
  135. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInThisFile', func_get_args()));
  136. }
  137. /**
  138. * [!] Method is generated. Documentation taken from corresponding module.
  139. *
  140. * Checks If opened file has the `number` of new lines.
  141. *
  142. * Usage:
  143. *
  144. * ``` php
  145. * <?php
  146. * $I->openFile('composer.json');
  147. * $I->seeNumberNewLines(5);
  148. * ?>
  149. * ```
  150. *
  151. * @param int $number New lines
  152. * Conditional Assertion: Test won't be stopped on fail
  153. * @see \Codeception\Module\Filesystem::seeNumberNewLines()
  154. */
  155. public function canSeeNumberNewLines($number) {
  156. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberNewLines', func_get_args()));
  157. }
  158. /**
  159. * [!] Method is generated. Documentation taken from corresponding module.
  160. *
  161. * Checks If opened file has the `number` of new lines.
  162. *
  163. * Usage:
  164. *
  165. * ``` php
  166. * <?php
  167. * $I->openFile('composer.json');
  168. * $I->seeNumberNewLines(5);
  169. * ?>
  170. * ```
  171. *
  172. * @param int $number New lines
  173. * @see \Codeception\Module\Filesystem::seeNumberNewLines()
  174. */
  175. public function seeNumberNewLines($number) {
  176. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberNewLines', func_get_args()));
  177. }
  178. /**
  179. * [!] Method is generated. Documentation taken from corresponding module.
  180. *
  181. * Checks that contents of currently opened file matches $regex
  182. *
  183. * @param string $regex
  184. * Conditional Assertion: Test won't be stopped on fail
  185. * @see \Codeception\Module\Filesystem::seeThisFileMatches()
  186. */
  187. public function canSeeThisFileMatches($regex) {
  188. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeThisFileMatches', func_get_args()));
  189. }
  190. /**
  191. * [!] Method is generated. Documentation taken from corresponding module.
  192. *
  193. * Checks that contents of currently opened file matches $regex
  194. *
  195. * @param string $regex
  196. * @see \Codeception\Module\Filesystem::seeThisFileMatches()
  197. */
  198. public function seeThisFileMatches($regex) {
  199. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeThisFileMatches', func_get_args()));
  200. }
  201. /**
  202. * [!] Method is generated. Documentation taken from corresponding module.
  203. *
  204. * Checks the strict matching of file contents.
  205. * Unlike `seeInThisFile` will fail if file has something more than expected lines.
  206. * Better to use with HEREDOC strings.
  207. * Matching is done after removing "\r" chars from file content.
  208. *
  209. * ``` php
  210. * <?php
  211. * $I->openFile('process.pid');
  212. * $I->seeFileContentsEqual('3192');
  213. * ?>
  214. * ```
  215. *
  216. * @param string $text
  217. * Conditional Assertion: Test won't be stopped on fail
  218. * @see \Codeception\Module\Filesystem::seeFileContentsEqual()
  219. */
  220. public function canSeeFileContentsEqual($text) {
  221. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeFileContentsEqual', func_get_args()));
  222. }
  223. /**
  224. * [!] Method is generated. Documentation taken from corresponding module.
  225. *
  226. * Checks the strict matching of file contents.
  227. * Unlike `seeInThisFile` will fail if file has something more than expected lines.
  228. * Better to use with HEREDOC strings.
  229. * Matching is done after removing "\r" chars from file content.
  230. *
  231. * ``` php
  232. * <?php
  233. * $I->openFile('process.pid');
  234. * $I->seeFileContentsEqual('3192');
  235. * ?>
  236. * ```
  237. *
  238. * @param string $text
  239. * @see \Codeception\Module\Filesystem::seeFileContentsEqual()
  240. */
  241. public function seeFileContentsEqual($text) {
  242. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeFileContentsEqual', func_get_args()));
  243. }
  244. /**
  245. * [!] Method is generated. Documentation taken from corresponding module.
  246. *
  247. * Checks If opened file doesn't contain `text` in it
  248. *
  249. * ``` php
  250. * <?php
  251. * $I->openFile('composer.json');
  252. * $I->dontSeeInThisFile('codeception/codeception');
  253. * ?>
  254. * ```
  255. *
  256. * @param string $text
  257. * Conditional Assertion: Test won't be stopped on fail
  258. * @see \Codeception\Module\Filesystem::dontSeeInThisFile()
  259. */
  260. public function cantSeeInThisFile($text) {
  261. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInThisFile', func_get_args()));
  262. }
  263. /**
  264. * [!] Method is generated. Documentation taken from corresponding module.
  265. *
  266. * Checks If opened file doesn't contain `text` in it
  267. *
  268. * ``` php
  269. * <?php
  270. * $I->openFile('composer.json');
  271. * $I->dontSeeInThisFile('codeception/codeception');
  272. * ?>
  273. * ```
  274. *
  275. * @param string $text
  276. * @see \Codeception\Module\Filesystem::dontSeeInThisFile()
  277. */
  278. public function dontSeeInThisFile($text) {
  279. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInThisFile', func_get_args()));
  280. }
  281. /**
  282. * [!] Method is generated. Documentation taken from corresponding module.
  283. *
  284. * Deletes a file
  285. * @see \Codeception\Module\Filesystem::deleteThisFile()
  286. */
  287. public function deleteThisFile() {
  288. return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteThisFile', func_get_args()));
  289. }
  290. /**
  291. * [!] Method is generated. Documentation taken from corresponding module.
  292. *
  293. * Checks if file exists in path.
  294. * Opens a file when it's exists
  295. *
  296. * ``` php
  297. * <?php
  298. * $I->seeFileFound('UserModel.php','app/models');
  299. * ?>
  300. * ```
  301. *
  302. * @param string $filename
  303. * @param string $path
  304. * Conditional Assertion: Test won't be stopped on fail
  305. * @see \Codeception\Module\Filesystem::seeFileFound()
  306. */
  307. public function canSeeFileFound($filename, $path = null) {
  308. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeFileFound', func_get_args()));
  309. }
  310. /**
  311. * [!] Method is generated. Documentation taken from corresponding module.
  312. *
  313. * Checks if file exists in path.
  314. * Opens a file when it's exists
  315. *
  316. * ``` php
  317. * <?php
  318. * $I->seeFileFound('UserModel.php','app/models');
  319. * ?>
  320. * ```
  321. *
  322. * @param string $filename
  323. * @param string $path
  324. * @see \Codeception\Module\Filesystem::seeFileFound()
  325. */
  326. public function seeFileFound($filename, $path = null) {
  327. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeFileFound', func_get_args()));
  328. }
  329. /**
  330. * [!] Method is generated. Documentation taken from corresponding module.
  331. *
  332. * Checks if file does not exist in path
  333. *
  334. * @param string $filename
  335. * @param string $path
  336. * Conditional Assertion: Test won't be stopped on fail
  337. * @see \Codeception\Module\Filesystem::dontSeeFileFound()
  338. */
  339. public function cantSeeFileFound($filename, $path = null) {
  340. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeFileFound', func_get_args()));
  341. }
  342. /**
  343. * [!] Method is generated. Documentation taken from corresponding module.
  344. *
  345. * Checks if file does not exist in path
  346. *
  347. * @param string $filename
  348. * @param string $path
  349. * @see \Codeception\Module\Filesystem::dontSeeFileFound()
  350. */
  351. public function dontSeeFileFound($filename, $path = null) {
  352. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeFileFound', func_get_args()));
  353. }
  354. /**
  355. * [!] Method is generated. Documentation taken from corresponding module.
  356. *
  357. * Erases directory contents
  358. *
  359. * ``` php
  360. * <?php
  361. * $I->cleanDir('logs');
  362. * ?>
  363. * ```
  364. *
  365. * @param string $dirname
  366. * @see \Codeception\Module\Filesystem::cleanDir()
  367. */
  368. public function cleanDir($dirname) {
  369. return $this->getScenario()->runStep(new \Codeception\Step\Action('cleanDir', func_get_args()));
  370. }
  371. /**
  372. * [!] Method is generated. Documentation taken from corresponding module.
  373. *
  374. * Saves contents to file
  375. *
  376. * @param string $filename
  377. * @param string $contents
  378. * @see \Codeception\Module\Filesystem::writeToFile()
  379. */
  380. public function writeToFile($filename, $contents) {
  381. return $this->getScenario()->runStep(new \Codeception\Step\Action('writeToFile', func_get_args()));
  382. }
  383. /**
  384. * [!] Method is generated. Documentation taken from corresponding module.
  385. *
  386. * Authorizes user on a site without submitting login form.
  387. * Use it for fast pragmatic authorization in functional tests.
  388. *
  389. * ```php
  390. * <?php
  391. * // User is found by id
  392. * $I->amLoggedInAs(1);
  393. *
  394. * // User object is passed as parameter
  395. * $admin = \app\models\User::findByUsername('admin');
  396. * $I->amLoggedInAs($admin);
  397. * ```
  398. * Requires `user` component to be enabled and configured.
  399. *
  400. * @param $user
  401. * @throws ModuleException
  402. * @see \Codeception\Module\Yii2::amLoggedInAs()
  403. */
  404. public function amLoggedInAs($user) {
  405. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amLoggedInAs', func_get_args()));
  406. }
  407. /**
  408. * [!] Method is generated. Documentation taken from corresponding module.
  409. *
  410. * Creates and loads fixtures from a config.
  411. * Signature is the same as for `fixtures()` method of `yii\test\FixtureTrait`
  412. *
  413. * ```php
  414. * <?php
  415. * $I->haveFixtures([
  416. * 'posts' => PostsFixture::className(),
  417. * 'user' => [
  418. * 'class' => UserFixture::className(),
  419. * 'dataFile' => '@tests/_data/models/user.php',
  420. * ],
  421. * ]);
  422. * ```
  423. *
  424. * Note: if you need to load fixtures before the test (probably before the cleanup transaction is started;
  425. * `cleanup` options is `true` by default), you can specify fixtures with _fixtures method of a testcase
  426. * ```php
  427. * <?php
  428. * // inside Cest file or Codeception\TestCase\Unit
  429. * public function _fixtures(){
  430. * return [
  431. * 'user' => [
  432. * 'class' => UserFixture::className(),
  433. * 'dataFile' => codecept_data_dir() . 'user.php'
  434. * ]
  435. * ];
  436. * }
  437. * ```
  438. * instead of defining `haveFixtures` in Cest `_before`
  439. *
  440. * @param $fixtures
  441. * @part fixtures
  442. * @see \Codeception\Module\Yii2::haveFixtures()
  443. */
  444. public function haveFixtures($fixtures) {
  445. return $this->getScenario()->runStep(new \Codeception\Step\Action('haveFixtures', func_get_args()));
  446. }
  447. /**
  448. * [!] Method is generated. Documentation taken from corresponding module.
  449. *
  450. * Returns all loaded fixtures.
  451. * Array of fixture instances
  452. *
  453. * @part fixtures
  454. * @return array
  455. * @see \Codeception\Module\Yii2::grabFixtures()
  456. */
  457. public function grabFixtures() {
  458. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFixtures', func_get_args()));
  459. }
  460. /**
  461. * [!] Method is generated. Documentation taken from corresponding module.
  462. *
  463. * Gets a fixture by name.
  464. * Returns a Fixture instance. If a fixture is an instance of `\yii\test\BaseActiveFixture` a second parameter
  465. * can be used to return a specific model:
  466. *
  467. * ```php
  468. * <?php
  469. * $I->haveFixtures(['users' => UserFixture::className()]);
  470. *
  471. * $users = $I->grabFixture('users');
  472. *
  473. * // get first user by key, if a fixture is instance of ActiveFixture
  474. * $user = $I->grabFixture('users', 'user1');
  475. * ```
  476. *
  477. * @param $name
  478. * @return mixed
  479. * @throws ModuleException if a fixture is not found
  480. * @part fixtures
  481. * @see \Codeception\Module\Yii2::grabFixture()
  482. */
  483. public function grabFixture($name, $index = null) {
  484. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFixture', func_get_args()));
  485. }
  486. /**
  487. * [!] Method is generated. Documentation taken from corresponding module.
  488. *
  489. * Inserts record into the database.
  490. *
  491. * ``` php
  492. * <?php
  493. * $user_id = $I->haveRecord('app\models\User', array('name' => 'Davert'));
  494. * ?>
  495. * ```
  496. *
  497. * @param $model
  498. * @param array $attributes
  499. * @return mixed
  500. * @part orm
  501. * @see \Codeception\Module\Yii2::haveRecord()
  502. */
  503. public function haveRecord($model, $attributes = null) {
  504. return $this->getScenario()->runStep(new \Codeception\Step\Action('haveRecord', func_get_args()));
  505. }
  506. /**
  507. * [!] Method is generated. Documentation taken from corresponding module.
  508. *
  509. * Checks that record exists in database.
  510. *
  511. * ``` php
  512. * $I->seeRecord('app\models\User', array('name' => 'davert'));
  513. * ```
  514. *
  515. * @param $model
  516. * @param array $attributes
  517. * @part orm
  518. * Conditional Assertion: Test won't be stopped on fail
  519. * @see \Codeception\Module\Yii2::seeRecord()
  520. */
  521. public function canSeeRecord($model, $attributes = null) {
  522. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeRecord', func_get_args()));
  523. }
  524. /**
  525. * [!] Method is generated. Documentation taken from corresponding module.
  526. *
  527. * Checks that record exists in database.
  528. *
  529. * ``` php
  530. * $I->seeRecord('app\models\User', array('name' => 'davert'));
  531. * ```
  532. *
  533. * @param $model
  534. * @param array $attributes
  535. * @part orm
  536. * @see \Codeception\Module\Yii2::seeRecord()
  537. */
  538. public function seeRecord($model, $attributes = null) {
  539. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeRecord', func_get_args()));
  540. }
  541. /**
  542. * [!] Method is generated. Documentation taken from corresponding module.
  543. *
  544. * Checks that record does not exist in database.
  545. *
  546. * ``` php
  547. * $I->dontSeeRecord('app\models\User', array('name' => 'davert'));
  548. * ```
  549. *
  550. * @param $model
  551. * @param array $attributes
  552. * @part orm
  553. * Conditional Assertion: Test won't be stopped on fail
  554. * @see \Codeception\Module\Yii2::dontSeeRecord()
  555. */
  556. public function cantSeeRecord($model, $attributes = null) {
  557. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeRecord', func_get_args()));
  558. }
  559. /**
  560. * [!] Method is generated. Documentation taken from corresponding module.
  561. *
  562. * Checks that record does not exist in database.
  563. *
  564. * ``` php
  565. * $I->dontSeeRecord('app\models\User', array('name' => 'davert'));
  566. * ```
  567. *
  568. * @param $model
  569. * @param array $attributes
  570. * @part orm
  571. * @see \Codeception\Module\Yii2::dontSeeRecord()
  572. */
  573. public function dontSeeRecord($model, $attributes = null) {
  574. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeRecord', func_get_args()));
  575. }
  576. /**
  577. * [!] Method is generated. Documentation taken from corresponding module.
  578. *
  579. * Retrieves record from database
  580. *
  581. * ``` php
  582. * $category = $I->grabRecord('app\models\User', array('name' => 'davert'));
  583. * ```
  584. *
  585. * @param $model
  586. * @param array $attributes
  587. * @return mixed
  588. * @part orm
  589. * @see \Codeception\Module\Yii2::grabRecord()
  590. */
  591. public function grabRecord($model, $attributes = null) {
  592. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabRecord', func_get_args()));
  593. }
  594. /**
  595. * [!] Method is generated. Documentation taken from corresponding module.
  596. *
  597. * Similar to amOnPage but accepts route as first argument and params as second
  598. *
  599. * ```
  600. * $I->amOnRoute('site/view', ['page' => 'about']);
  601. * ```
  602. *
  603. * @see \Codeception\Module\Yii2::amOnRoute()
  604. */
  605. public function amOnRoute($route, $params = null) {
  606. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnRoute', func_get_args()));
  607. }
  608. /**
  609. * [!] Method is generated. Documentation taken from corresponding module.
  610. *
  611. * Gets a component from Yii container. Throws exception if component is not available
  612. *
  613. * ```php
  614. * <?php
  615. * $mailer = $I->grabComponent('mailer');
  616. * ```
  617. *
  618. * @param $component
  619. * @return mixed
  620. * @throws ModuleException
  621. * @deprecated in your tests you can use \Yii::$app directly.
  622. * @see \Codeception\Module\Yii2::grabComponent()
  623. */
  624. public function grabComponent($component) {
  625. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabComponent', func_get_args()));
  626. }
  627. /**
  628. * [!] Method is generated. Documentation taken from corresponding module.
  629. *
  630. * Checks that email is sent.
  631. *
  632. * ```php
  633. * <?php
  634. * // check that at least 1 email was sent
  635. * $I->seeEmailIsSent();
  636. *
  637. * // check that only 3 emails were sent
  638. * $I->seeEmailIsSent(3);
  639. * ```
  640. *
  641. * @param int $num
  642. * @throws ModuleException
  643. * @part email
  644. * Conditional Assertion: Test won't be stopped on fail
  645. * @see \Codeception\Module\Yii2::seeEmailIsSent()
  646. */
  647. public function canSeeEmailIsSent($num = null) {
  648. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeEmailIsSent', func_get_args()));
  649. }
  650. /**
  651. * [!] Method is generated. Documentation taken from corresponding module.
  652. *
  653. * Checks that email is sent.
  654. *
  655. * ```php
  656. * <?php
  657. * // check that at least 1 email was sent
  658. * $I->seeEmailIsSent();
  659. *
  660. * // check that only 3 emails were sent
  661. * $I->seeEmailIsSent(3);
  662. * ```
  663. *
  664. * @param int $num
  665. * @throws ModuleException
  666. * @part email
  667. * @see \Codeception\Module\Yii2::seeEmailIsSent()
  668. */
  669. public function seeEmailIsSent($num = null) {
  670. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeEmailIsSent', func_get_args()));
  671. }
  672. /**
  673. * [!] Method is generated. Documentation taken from corresponding module.
  674. *
  675. * Checks that no email was sent
  676. *
  677. * @part email
  678. * Conditional Assertion: Test won't be stopped on fail
  679. * @see \Codeception\Module\Yii2::dontSeeEmailIsSent()
  680. */
  681. public function cantSeeEmailIsSent() {
  682. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeEmailIsSent', func_get_args()));
  683. }
  684. /**
  685. * [!] Method is generated. Documentation taken from corresponding module.
  686. *
  687. * Checks that no email was sent
  688. *
  689. * @part email
  690. * @see \Codeception\Module\Yii2::dontSeeEmailIsSent()
  691. */
  692. public function dontSeeEmailIsSent() {
  693. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeEmailIsSent', func_get_args()));
  694. }
  695. /**
  696. * [!] Method is generated. Documentation taken from corresponding module.
  697. *
  698. * Returns array of all sent email messages.
  699. * Each message implements `yii\mail\MessageInterface` interface.
  700. * Useful to perform additional checks using `Asserts` module:
  701. *
  702. * ```php
  703. * <?php
  704. * $I->seeEmailIsSent();
  705. * $messages = $I->grabSentEmails();
  706. * $I->assertEquals('admin@site,com', $messages[0]->getTo());
  707. * ```
  708. *
  709. * @part email
  710. * @return array
  711. * @throws ModuleException
  712. * @see \Codeception\Module\Yii2::grabSentEmails()
  713. */
  714. public function grabSentEmails() {
  715. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabSentEmails', func_get_args()));
  716. }
  717. /**
  718. * [!] Method is generated. Documentation taken from corresponding module.
  719. *
  720. * Returns last sent email:
  721. *
  722. * ```php
  723. * <?php
  724. * $I->seeEmailIsSent();
  725. * $message = $I->grabLastSentEmail();
  726. * $I->assertEquals('admin@site,com', $message->getTo());
  727. * ```
  728. * @part email
  729. * @see \Codeception\Module\Yii2::grabLastSentEmail()
  730. */
  731. public function grabLastSentEmail() {
  732. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabLastSentEmail', func_get_args()));
  733. }
  734. /**
  735. * [!] Method is generated. Documentation taken from corresponding module.
  736. *
  737. * Returns a list of regex patterns for recognized domain names
  738. *
  739. * @return array
  740. * @see \Codeception\Module\Yii2::getInternalDomains()
  741. */
  742. public function getInternalDomains() {
  743. return $this->getScenario()->runStep(new \Codeception\Step\Action('getInternalDomains', func_get_args()));
  744. }
  745. /**
  746. * [!] Method is generated. Documentation taken from corresponding module.
  747. *
  748. * Sets a cookie and, if validation is enabled, signs it.
  749. * @param string $name The name of the cookie
  750. * @param string $value The value of the cookie
  751. * @param array $params Additional cookie params like `domain`, `path`, `expires` and `secure`.
  752. * @see \Codeception\Module\Yii2::setCookie()
  753. */
  754. public function setCookie($name, $val, $params = null) {
  755. return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
  756. }
  757. /**
  758. * [!] Method is generated. Documentation taken from corresponding module.
  759. *
  760. * This function creates the CSRF Cookie.
  761. * @param string $val The value of the CSRF token
  762. * @return string[] Returns an array containing the name of the CSRF param and the masked CSRF token.
  763. * @see \Codeception\Module\Yii2::createAndSetCsrfCookie()
  764. */
  765. public function createAndSetCsrfCookie($val) {
  766. return $this->getScenario()->runStep(new \Codeception\Step\Action('createAndSetCsrfCookie', func_get_args()));
  767. }
  768. /**
  769. * [!] Method is generated. Documentation taken from corresponding module.
  770. *
  771. * Authenticates user for HTTP_AUTH
  772. *
  773. * @param $username
  774. * @param $password
  775. * @see \Codeception\Lib\InnerBrowser::amHttpAuthenticated()
  776. */
  777. public function amHttpAuthenticated($username, $password) {
  778. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
  779. }
  780. /**
  781. * [!] Method is generated. Documentation taken from corresponding module.
  782. *
  783. * Sets the HTTP header to the passed value - which is used on
  784. * subsequent HTTP requests through PhpBrowser.
  785. *
  786. * Example:
  787. * ```php
  788. * <?php
  789. * $I->haveHttpHeader('X-Requested-With', 'Codeception');
  790. * $I->amOnPage('test-headers.php');
  791. * ?>
  792. * ```
  793. *
  794. * To use special chars in Header Key use HTML Character Entities:
  795. * Example:
  796. * Header with underscore - 'Client_Id'
  797. * should be represented as - 'Client&#x0005F;Id' or 'Client&#95;Id'
  798. *
  799. * ```php
  800. * <?php
  801. * $I->haveHttpHeader('Client&#95;Id', 'Codeception');
  802. * ?>
  803. * ```
  804. *
  805. * @param string $name the name of the request header
  806. * @param string $value the value to set it to for subsequent
  807. * requests
  808. * @see \Codeception\Lib\InnerBrowser::haveHttpHeader()
  809. */
  810. public function haveHttpHeader($name, $value) {
  811. return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args()));
  812. }
  813. /**
  814. * [!] Method is generated. Documentation taken from corresponding module.
  815. *
  816. * Deletes the header with the passed name. Subsequent requests
  817. * will not have the deleted header in its request.
  818. *
  819. * Example:
  820. * ```php
  821. * <?php
  822. * $I->haveHttpHeader('X-Requested-With', 'Codeception');
  823. * $I->amOnPage('test-headers.php');
  824. * // ...
  825. * $I->deleteHeader('X-Requested-With');
  826. * $I->amOnPage('some-other-page.php');
  827. * ?>
  828. * ```
  829. *
  830. * @param string $name the name of the header to delete.
  831. * @see \Codeception\Lib\InnerBrowser::deleteHeader()
  832. */
  833. public function deleteHeader($name) {
  834. return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args()));
  835. }
  836. /**
  837. * [!] Method is generated. Documentation taken from corresponding module.
  838. *
  839. * Opens the page for the given relative URI.
  840. *
  841. * ``` php
  842. * <?php
  843. * // opens front page
  844. * $I->amOnPage('/');
  845. * // opens /register page
  846. * $I->amOnPage('/register');
  847. * ```
  848. *
  849. * @param string $page
  850. * @see \Codeception\Lib\InnerBrowser::amOnPage()
  851. */
  852. public function amOnPage($page) {
  853. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
  854. }
  855. /**
  856. * [!] Method is generated. Documentation taken from corresponding module.
  857. *
  858. * Perform a click on a link or a button, given by a locator.
  859. * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
  860. * For buttons, the "value" attribute, "name" attribute, and inner text are searched.
  861. * For links, the link text is searched.
  862. * For images, the "alt" attribute and inner text of any parent links are searched.
  863. *
  864. * The second parameter is a context (CSS or XPath locator) to narrow the search.
  865. *
  866. * Note that if the locator matches a button of type `submit`, the form will be submitted.
  867. *
  868. * ``` php
  869. * <?php
  870. * // simple link
  871. * $I->click('Logout');
  872. * // button of form
  873. * $I->click('Submit');
  874. * // CSS button
  875. * $I->click('#form input[type=submit]');
  876. * // XPath
  877. * $I->click('//form/*[@type="submit"]');
  878. * // link in context
  879. * $I->click('Logout', '#nav');
  880. * // using strict locator
  881. * $I->click(['link' => 'Login']);
  882. * ?>
  883. * ```
  884. *
  885. * @param $link
  886. * @param $context
  887. * @see \Codeception\Lib\InnerBrowser::click()
  888. */
  889. public function click($link, $context = null) {
  890. return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args()));
  891. }
  892. /**
  893. * [!] Method is generated. Documentation taken from corresponding module.
  894. *
  895. * Checks that the current page contains the given string (case insensitive).
  896. *
  897. * You can specify a specific HTML element (via CSS or XPath) as the second
  898. * parameter to only search within that element.
  899. *
  900. * ``` php
  901. * <?php
  902. * $I->see('Logout'); // I can suppose user is logged in
  903. * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
  904. * $I->see('Sign Up', '//body/h1'); // with XPath
  905. * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  906. * ```
  907. *
  908. * Note that the search is done after stripping all HTML tags from the body,
  909. * so `$I->see('strong')` will return true for strings like:
  910. *
  911. * - `<p>I am Stronger than thou</p>`
  912. * - `<script>document.createElement('strong');</script>`
  913. *
  914. * But will *not* be true for strings like:
  915. *
  916. * - `<strong>Home</strong>`
  917. * - `<div class="strong">Home</strong>`
  918. * - `<!-- strong -->`
  919. *
  920. * For checking the raw source code, use `seeInSource()`.
  921. *
  922. * @param string $text
  923. * @param array|string $selector optional
  924. * Conditional Assertion: Test won't be stopped on fail
  925. * @see \Codeception\Lib\InnerBrowser::see()
  926. */
  927. public function canSee($text, $selector = null) {
  928. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
  929. }
  930. /**
  931. * [!] Method is generated. Documentation taken from corresponding module.
  932. *
  933. * Checks that the current page contains the given string (case insensitive).
  934. *
  935. * You can specify a specific HTML element (via CSS or XPath) as the second
  936. * parameter to only search within that element.
  937. *
  938. * ``` php
  939. * <?php
  940. * $I->see('Logout'); // I can suppose user is logged in
  941. * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
  942. * $I->see('Sign Up', '//body/h1'); // with XPath
  943. * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  944. * ```
  945. *
  946. * Note that the search is done after stripping all HTML tags from the body,
  947. * so `$I->see('strong')` will return true for strings like:
  948. *
  949. * - `<p>I am Stronger than thou</p>`
  950. * - `<script>document.createElement('strong');</script>`
  951. *
  952. * But will *not* be true for strings like:
  953. *
  954. * - `<strong>Home</strong>`
  955. * - `<div class="strong">Home</strong>`
  956. * - `<!-- strong -->`
  957. *
  958. * For checking the raw source code, use `seeInSource()`.
  959. *
  960. * @param string $text
  961. * @param array|string $selector optional
  962. * @see \Codeception\Lib\InnerBrowser::see()
  963. */
  964. public function see($text, $selector = null) {
  965. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
  966. }
  967. /**
  968. * [!] Method is generated. Documentation taken from corresponding module.
  969. *
  970. * Checks that the current page doesn't contain the text specified (case insensitive).
  971. * Give a locator as the second parameter to match a specific region.
  972. *
  973. * ```php
  974. * <?php
  975. * $I->dontSee('Login'); // I can suppose user is already logged in
  976. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  977. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  978. * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  979. * ```
  980. *
  981. * Note that the search is done after stripping all HTML tags from the body,
  982. * so `$I->dontSee('strong')` will fail on strings like:
  983. *
  984. * - `<p>I am Stronger than thou</p>`
  985. * - `<script>document.createElement('strong');</script>`
  986. *
  987. * But will ignore strings like:
  988. *
  989. * - `<strong>Home</strong>`
  990. * - `<div class="strong">Home</strong>`
  991. * - `<!-- strong -->`
  992. *
  993. * For checking the raw source code, use `seeInSource()`.
  994. *
  995. * @param string $text
  996. * @param array|string $selector optional
  997. * Conditional Assertion: Test won't be stopped on fail
  998. * @see \Codeception\Lib\InnerBrowser::dontSee()
  999. */
  1000. public function cantSee($text, $selector = null) {
  1001. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
  1002. }
  1003. /**
  1004. * [!] Method is generated. Documentation taken from corresponding module.
  1005. *
  1006. * Checks that the current page doesn't contain the text specified (case insensitive).
  1007. * Give a locator as the second parameter to match a specific region.
  1008. *
  1009. * ```php
  1010. * <?php
  1011. * $I->dontSee('Login'); // I can suppose user is already logged in
  1012. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  1013. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  1014. * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  1015. * ```
  1016. *
  1017. * Note that the search is done after stripping all HTML tags from the body,
  1018. * so `$I->dontSee('strong')` will fail on strings like:
  1019. *
  1020. * - `<p>I am Stronger than thou</p>`
  1021. * - `<script>document.createElement('strong');</script>`
  1022. *
  1023. * But will ignore strings like:
  1024. *
  1025. * - `<strong>Home</strong>`
  1026. * - `<div class="strong">Home</strong>`
  1027. * - `<!-- strong -->`
  1028. *
  1029. * For checking the raw source code, use `seeInSource()`.
  1030. *
  1031. * @param string $text
  1032. * @param array|string $selector optional
  1033. * @see \Codeception\Lib\InnerBrowser::dontSee()
  1034. */
  1035. public function dontSee($text, $selector = null) {
  1036. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
  1037. }
  1038. /**
  1039. * [!] Method is generated. Documentation taken from corresponding module.
  1040. *
  1041. * Checks that the current page contains the given string in its
  1042. * raw source code.
  1043. *
  1044. * ``` php
  1045. * <?php
  1046. * $I->seeInSource('<h1>Green eggs &amp; ham</h1>');
  1047. * ```
  1048. *
  1049. * @param $raw
  1050. * Conditional Assertion: Test won't be stopped on fail
  1051. * @see \Codeception\Lib\InnerBrowser::seeInSource()
  1052. */
  1053. public function canSeeInSource($raw) {
  1054. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args()));
  1055. }
  1056. /**
  1057. * [!] Method is generated. Documentation taken from corresponding module.
  1058. *
  1059. * Checks that the current page contains the given string in its
  1060. * raw source code.
  1061. *
  1062. * ``` php
  1063. * <?php
  1064. * $I->seeInSource('<h1>Green eggs &amp; ham</h1>');
  1065. * ```
  1066. *
  1067. * @param $raw
  1068. * @see \Codeception\Lib\InnerBrowser::seeInSource()
  1069. */
  1070. public function seeInSource($raw) {
  1071. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args()));
  1072. }
  1073. /**
  1074. * [!] Method is generated. Documentation taken from corresponding module.
  1075. *
  1076. * Checks that the current page contains the given string in its
  1077. * raw source code.
  1078. *
  1079. * ```php
  1080. * <?php
  1081. * $I->dontSeeInSource('<h1>Green eggs &amp; ham</h1>');
  1082. * ```
  1083. *
  1084. * @param $raw
  1085. * Conditional Assertion: Test won't be stopped on fail
  1086. * @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
  1087. */
  1088. public function cantSeeInSource($raw) {
  1089. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args()));
  1090. }
  1091. /**
  1092. * [!] Method is generated. Documentation taken from corresponding module.
  1093. *
  1094. * Checks that the current page contains the given string in its
  1095. * raw source code.
  1096. *
  1097. * ```php
  1098. * <?php
  1099. * $I->dontSeeInSource('<h1>Green eggs &amp; ham</h1>');
  1100. * ```
  1101. *
  1102. * @param $raw
  1103. * @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
  1104. */
  1105. public function dontSeeInSource($raw) {
  1106. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args()));
  1107. }
  1108. /**
  1109. * [!] Method is generated. Documentation taken from corresponding module.
  1110. *
  1111. * Checks that there's a link with the specified text.
  1112. * Give a full URL as the second parameter to match links with that exact URL.
  1113. *
  1114. * ``` php
  1115. * <?php
  1116. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  1117. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  1118. * ?>
  1119. * ```
  1120. *
  1121. * @param string $text
  1122. * @param string $url optional
  1123. * Conditional Assertion: Test won't be stopped on fail
  1124. * @see \Codeception\Lib\InnerBrowser::seeLink()
  1125. */
  1126. public function canSeeLink($text, $url = null) {
  1127. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
  1128. }
  1129. /**
  1130. * [!] Method is generated. Documentation taken from corresponding module.
  1131. *
  1132. * Checks that there's a link with the specified text.
  1133. * Give a full URL as the second parameter to match links with that exact URL.
  1134. *
  1135. * ``` php
  1136. * <?php
  1137. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  1138. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  1139. * ?>
  1140. * ```
  1141. *
  1142. * @param string $text
  1143. * @param string $url optional
  1144. * @see \Codeception\Lib\InnerBrowser::seeLink()
  1145. */
  1146. public function seeLink($text, $url = null) {
  1147. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
  1148. }
  1149. /**
  1150. * [!] Method is generated. Documentation taken from corresponding module.
  1151. *
  1152. * Checks that the page doesn't contain a link with the given string.
  1153. * If the second parameter is given, only links with a matching "href" attribute will be checked.
  1154. *
  1155. * ``` php
  1156. * <?php
  1157. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  1158. * $I->dontSeeLink('Checkout now', '/store/cart.php');
  1159. * ?>
  1160. * ```
  1161. *
  1162. * @param string $text
  1163. * @param string $url optional
  1164. * Conditional Assertion: Test won't be stopped on fail
  1165. * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
  1166. */
  1167. public function cantSeeLink($text, $url = null) {
  1168. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
  1169. }
  1170. /**
  1171. * [!] Method is generated. Documentation taken from corresponding module.
  1172. *
  1173. * Checks that the page doesn't contain a link with the given string.
  1174. * If the second parameter is given, only links with a matching "href" attribute will be checked.
  1175. *
  1176. * ``` php
  1177. * <?php
  1178. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  1179. * $I->dontSeeLink('Checkout now', '/store/cart.php');
  1180. * ?>
  1181. * ```
  1182. *
  1183. * @param string $text
  1184. * @param string $url optional
  1185. * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
  1186. */
  1187. public function dontSeeLink($text, $url = null) {
  1188. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
  1189. }
  1190. /**
  1191. * [!] Method is generated. Documentation taken from corresponding module.
  1192. *
  1193. * Checks that current URI contains the given string.
  1194. *
  1195. * ``` php
  1196. * <?php
  1197. * // to match: /home/dashboard
  1198. * $I->seeInCurrentUrl('home');
  1199. * // to match: /users/1
  1200. * $I->seeInCurrentUrl('/users/');
  1201. * ?>
  1202. * ```
  1203. *
  1204. * @param string $uri
  1205. * Conditional Assertion: Test won't be stopped on fail
  1206. * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
  1207. */
  1208. public function canSeeInCurrentUrl($uri) {
  1209. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
  1210. }
  1211. /**
  1212. * [!] Method is generated. Documentation taken from corresponding module.
  1213. *
  1214. * Checks that current URI contains the given string.
  1215. *
  1216. * ``` php
  1217. * <?php
  1218. * // to match: /home/dashboard
  1219. * $I->seeInCurrentUrl('home');
  1220. * // to match: /users/1
  1221. * $I->seeInCurrentUrl('/users/');
  1222. * ?>
  1223. * ```
  1224. *
  1225. * @param string $uri
  1226. * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
  1227. */
  1228. public function seeInCurrentUrl($uri) {
  1229. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
  1230. }
  1231. /**
  1232. * [!] Method is generated. Documentation taken from corresponding module.
  1233. *
  1234. * Checks that the current URI doesn't contain the given string.
  1235. *
  1236. * ``` php
  1237. * <?php
  1238. * $I->dontSeeInCurrentUrl('/users/');
  1239. * ?>
  1240. * ```
  1241. *
  1242. * @param string $uri
  1243. * Conditional Assertion: Test won't be stopped on fail
  1244. * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
  1245. */
  1246. public function cantSeeInCurrentUrl($uri) {
  1247. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
  1248. }
  1249. /**
  1250. * [!] Method is generated. Documentation taken from corresponding module.
  1251. *
  1252. * Checks that the current URI doesn't contain the given string.
  1253. *
  1254. * ``` php
  1255. * <?php
  1256. * $I->dontSeeInCurrentUrl('/users/');
  1257. * ?>
  1258. * ```
  1259. *
  1260. * @param string $uri
  1261. * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
  1262. */
  1263. public function dontSeeInCurrentUrl($uri) {
  1264. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
  1265. }
  1266. /**
  1267. * [!] Method is generated. Documentation taken from corresponding module.
  1268. *
  1269. * Checks that the current URL is equal to the given string.
  1270. * Unlike `seeInCurrentUrl`, this only matches the full URL.
  1271. *
  1272. * ``` php
  1273. * <?php
  1274. * // to match root url
  1275. * $I->seeCurrentUrlEquals('/');
  1276. * ?>
  1277. * ```
  1278. *
  1279. * @param string $uri
  1280. * Conditional Assertion: Test won't be stopped on fail
  1281. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
  1282. */
  1283. public function canSeeCurrentUrlEquals($uri) {
  1284. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
  1285. }
  1286. /**
  1287. * [!] Method is generated. Documentation taken from corresponding module.
  1288. *
  1289. * Checks that the current URL is equal to the given string.
  1290. * Unlike `seeInCurrentUrl`, this only matches the full URL.
  1291. *
  1292. * ``` php
  1293. * <?php
  1294. * // to match root url
  1295. * $I->seeCurrentUrlEquals('/');
  1296. * ?>
  1297. * ```
  1298. *
  1299. * @param string $uri
  1300. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
  1301. */
  1302. public function seeCurrentUrlEquals($uri) {
  1303. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
  1304. }
  1305. /**
  1306. * [!] Method is generated. Documentation taken from corresponding module.
  1307. *
  1308. * Checks that the current URL doesn't equal the given string.
  1309. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
  1310. *
  1311. * ``` php
  1312. * <?php
  1313. * // current url is not root
  1314. * $I->dontSeeCurrentUrlEquals('/');
  1315. * ?>
  1316. * ```
  1317. *
  1318. * @param string $uri
  1319. * Conditional Assertion: Test won't be stopped on fail
  1320. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
  1321. */
  1322. public function cantSeeCurrentUrlEquals($uri) {
  1323. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
  1324. }
  1325. /**
  1326. * [!] Method is generated. Documentation taken from corresponding module.
  1327. *
  1328. * Checks that the current URL doesn't equal the given string.
  1329. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
  1330. *
  1331. * ``` php
  1332. * <?php
  1333. * // current url is not root
  1334. * $I->dontSeeCurrentUrlEquals('/');
  1335. * ?>
  1336. * ```
  1337. *
  1338. * @param string $uri
  1339. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
  1340. */
  1341. public function dontSeeCurrentUrlEquals($uri) {
  1342. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
  1343. }
  1344. /**
  1345. * [!] Method is generated. Documentation taken from corresponding module.
  1346. *
  1347. * Checks that the current URL matches the given regular expression.
  1348. *
  1349. * ``` php
  1350. * <?php
  1351. * // to match root url
  1352. * $I->seeCurrentUrlMatches('~^/users/(\d+)~');
  1353. * ?>
  1354. * ```
  1355. *
  1356. * @param string $uri
  1357. * Conditional Assertion: Test won't be stopped on fail
  1358. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
  1359. */
  1360. public function canSeeCurrentUrlMatches($uri) {
  1361. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
  1362. }
  1363. /**
  1364. * [!] Method is generated. Documentation taken from corresponding module.
  1365. *
  1366. * Checks that the current URL matches the given regular expression.
  1367. *
  1368. * ``` php
  1369. * <?php
  1370. * // to match root url
  1371. * $I->seeCurrentUrlMatches('~^/users/(\d+)~');
  1372. * ?>
  1373. * ```
  1374. *
  1375. * @param string $uri
  1376. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
  1377. */
  1378. public function seeCurrentUrlMatches($uri) {
  1379. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
  1380. }
  1381. /**
  1382. * [!] Method is generated. Documentation taken from corresponding module.
  1383. *
  1384. * Checks that current url doesn't match the given regular expression.
  1385. *
  1386. * ``` php
  1387. * <?php
  1388. * // to match root url
  1389. * $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
  1390. * ?>
  1391. * ```
  1392. *
  1393. * @param string $uri
  1394. * Conditional Assertion: Test won't be stopped on fail
  1395. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
  1396. */
  1397. public function cantSeeCurrentUrlMatches($uri) {
  1398. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
  1399. }
  1400. /**
  1401. * [!] Method is generated. Documentation taken from corresponding module.
  1402. *
  1403. * Checks that current url doesn't match the given regular expression.
  1404. *
  1405. * ``` php
  1406. * <?php
  1407. * // to match root url
  1408. * $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
  1409. * ?>
  1410. * ```
  1411. *
  1412. * @param string $uri
  1413. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
  1414. */
  1415. public function dontSeeCurrentUrlMatches($uri) {
  1416. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
  1417. }
  1418. /**
  1419. * [!] Method is generated. Documentation taken from corresponding module.
  1420. *
  1421. * Executes the given regular expression against the current URI and returns the first capturing group.
  1422. * If no parameters are provided, the full URI is returned.
  1423. *
  1424. * ``` php
  1425. * <?php
  1426. * $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
  1427. * $uri = $I->grabFromCurrentUrl();
  1428. * ?>
  1429. * ```
  1430. *
  1431. * @param string $uri optional
  1432. *
  1433. * @return mixed
  1434. * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
  1435. */
  1436. public function grabFromCurrentUrl($uri = null) {
  1437. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
  1438. }
  1439. /**
  1440. * [!] Method is generated. Documentation taken from corresponding module.
  1441. *
  1442. * Checks that the specified checkbox is checked.
  1443. *
  1444. * ``` php
  1445. * <?php
  1446. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  1447. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  1448. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  1449. * ?>
  1450. * ```
  1451. *
  1452. * @param $checkbox
  1453. * Conditional Assertion: Test won't be stopped on fail
  1454. * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
  1455. */
  1456. public function canSeeCheckboxIsChecked($checkbox) {
  1457. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
  1458. }
  1459. /**
  1460. * [!] Method is generated. Documentation taken from corresponding module.
  1461. *
  1462. * Checks that the specified checkbox is checked.
  1463. *
  1464. * ``` php
  1465. * <?php
  1466. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  1467. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  1468. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  1469. * ?>
  1470. * ```
  1471. *
  1472. * @param $checkbox
  1473. * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
  1474. */
  1475. public function seeCheckboxIsChecked($checkbox) {
  1476. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
  1477. }
  1478. /**
  1479. * [!] Method is generated. Documentation taken from corresponding module.
  1480. *
  1481. * Check that the specified checkbox is unchecked.
  1482. *
  1483. * ``` php
  1484. * <?php
  1485. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  1486. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  1487. * ?>
  1488. * ```
  1489. *
  1490. * @param $checkbox
  1491. * Conditional Assertion: Test won't be stopped on fail
  1492. * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
  1493. */
  1494. public function cantSeeCheckboxIsChecked($checkbox) {
  1495. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
  1496. }
  1497. /**
  1498. * [!] Method is generated. Documentation taken from corresponding module.
  1499. *
  1500. * Check that the specified checkbox is unchecked.
  1501. *
  1502. * ``` php
  1503. * <?php
  1504. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  1505. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  1506. * ?>
  1507. * ```
  1508. *
  1509. * @param $checkbox
  1510. * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
  1511. */
  1512. public function dontSeeCheckboxIsChecked($checkbox) {
  1513. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
  1514. }
  1515. /**
  1516. * [!] Method is generated. Documentation taken from corresponding module.
  1517. *
  1518. * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value.
  1519. * Fields are matched by label text, the "name" attribute, CSS, or XPath.
  1520. *
  1521. * ``` php
  1522. * <?php
  1523. * $I->seeInField('Body','Type your comment here');
  1524. * $I->seeInField('form textarea[name=body]','Type your comment here');
  1525. * $I->seeInField('form input[type=hidden]','hidden_value');
  1526. * $I->seeInField('#searchform input','Search');
  1527. * $I->seeInField('//form/*[@name=search]','Search');
  1528. * $I->seeInField(['name' => 'search'], 'Search');
  1529. * ?>
  1530. * ```
  1531. *
  1532. * @param $field
  1533. * @param $value
  1534. * Conditional Assertion: Test won't be stopped on fail
  1535. * @see \Codeception\Lib\InnerBrowser::seeInField()
  1536. */
  1537. public function canSeeInField($field, $value) {
  1538. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
  1539. }
  1540. /**
  1541. * [!] Method is generated. Documentation taken from corresponding module.
  1542. *
  1543. * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value.
  1544. * Fields are matched by label text, the "name" attribute, CSS, or XPath.
  1545. *
  1546. * ``` php
  1547. * <?php
  1548. * $I->seeInField('Body','Type your comment here');
  1549. * $I->seeInField('form textarea[name=body]','Type your comment here');
  1550. * $I->seeInField('form input[type=hidden]','hidden_value');
  1551. * $I->seeInField('#searchform input','Search');
  1552. * $I->seeInField('//form/*[@name=search]','Search');
  1553. * $I->seeInField(['name' => 'search'], 'Search');
  1554. * ?>
  1555. * ```
  1556. *
  1557. * @param $field
  1558. * @param $value
  1559. * @see \Codeception\Lib\InnerBrowser::seeInField()
  1560. */
  1561. public function seeInField($field, $value) {
  1562. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
  1563. }
  1564. /**
  1565. * [!] Method is generated. Documentation taken from corresponding module.
  1566. *
  1567. * Checks that an input field or textarea doesn't contain the given value.
  1568. * For fuzzy locators, the field is matched by label text, CSS and XPath.
  1569. *
  1570. * ``` php
  1571. * <?php
  1572. * $I->dontSeeInField('Body','Type your comment here');
  1573. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1574. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1575. * $I->dontSeeInField('#searchform input','Search');
  1576. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1577. * $I->dontSeeInField(['name' => 'search'], 'Search');
  1578. * ?>
  1579. * ```
  1580. *
  1581. * @param $field
  1582. * @param $value
  1583. * Conditional Assertion: Test won't be stopped on fail
  1584. * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
  1585. */
  1586. public function cantSeeInField($field, $value) {
  1587. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
  1588. }
  1589. /**
  1590. * [!] Method is generated. Documentation taken from corresponding module.
  1591. *
  1592. * Checks that an input field or textarea doesn't contain the given value.
  1593. * For fuzzy locators, the field is matched by label text, CSS and XPath.
  1594. *
  1595. * ``` php
  1596. * <?php
  1597. * $I->dontSeeInField('Body','Type your comment here');
  1598. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1599. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1600. * $I->dontSeeInField('#searchform input','Search');
  1601. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1602. * $I->dontSeeInField(['name' => 'search'], 'Search');
  1603. * ?>
  1604. * ```
  1605. *
  1606. * @param $field
  1607. * @param $value
  1608. * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
  1609. */
  1610. public function dontSeeInField($field, $value) {
  1611. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
  1612. }
  1613. /**
  1614. * [!] Method is generated. Documentation taken from corresponding module.
  1615. *
  1616. * Checks if the array of form parameters (name => value) are set on the form matched with the
  1617. * passed selector.
  1618. *
  1619. * ``` php
  1620. * <?php
  1621. * $I->seeInFormFields('form[name=myform]', [
  1622. * 'input1' => 'value',
  1623. * 'input2' => 'other value',
  1624. * ]);
  1625. * ?>
  1626. * ```
  1627. *
  1628. * For multi-select elements, or to check values of multiple elements with the same name, an
  1629. * array may be passed:
  1630. *
  1631. * ``` php
  1632. * <?php
  1633. * $I->seeInFormFields('.form-class', [
  1634. * 'multiselect' => [
  1635. * 'value1',
  1636. * 'value2',
  1637. * ],
  1638. * 'checkbox[]' => [
  1639. * 'a checked value',
  1640. * 'another checked value',
  1641. * ],
  1642. * ]);
  1643. * ?>
  1644. * ```
  1645. *
  1646. * Additionally, checkbox values can be checked with a boolean.
  1647. *
  1648. * ``` php
  1649. * <?php
  1650. * $I->seeInFormFields('#form-id', [
  1651. * 'checkbox1' => true, // passes if checked
  1652. * 'checkbox2' => false, // passes if unchecked
  1653. * ]);
  1654. * ?>
  1655. * ```
  1656. *
  1657. * Pair this with submitForm for quick testing magic.
  1658. *
  1659. * ``` php
  1660. * <?php
  1661. * $form = [
  1662. * 'field1' => 'value',
  1663. * 'field2' => 'another value',
  1664. * 'checkbox1' => true,
  1665. * // ...
  1666. * ];
  1667. * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
  1668. * // $I->amOnPage('/path/to/form-page') may be needed
  1669. * $I->seeInFormFields('//form[@id=my-form]', $form);
  1670. * ?>
  1671. * ```
  1672. *
  1673. * @param $formSelector
  1674. * @param $params
  1675. * Conditional Assertion: Test won't be stopped on fail
  1676. * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
  1677. */
  1678. public function canSeeInFormFields($formSelector, $params) {
  1679. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args()));
  1680. }
  1681. /**
  1682. * [!] Method is generated. Documentation taken from corresponding module.
  1683. *
  1684. * Checks if the array of form parameters (name => value) are set on the form matched with the
  1685. * passed selector.
  1686. *
  1687. * ``` php
  1688. * <?php
  1689. * $I->seeInFormFields('form[name=myform]', [
  1690. * 'input1' => 'value',
  1691. * 'input2' => 'other value',
  1692. * ]);
  1693. * ?>
  1694. * ```
  1695. *
  1696. * For multi-select elements, or to check values of multiple elements with the same name, an
  1697. * array may be passed:
  1698. *
  1699. * ``` php
  1700. * <?php
  1701. * $I->seeInFormFields('.form-class', [
  1702. * 'multiselect' => [
  1703. * 'value1',
  1704. * 'value2',
  1705. * ],
  1706. * 'checkbox[]' => [
  1707. * 'a checked value',
  1708. * 'another checked value',
  1709. * ],
  1710. * ]);
  1711. * ?>
  1712. * ```
  1713. *
  1714. * Additionally, checkbox values can be checked with a boolean.
  1715. *
  1716. * ``` php
  1717. * <?php
  1718. * $I->seeInFormFields('#form-id', [
  1719. * 'checkbox1' => true, // passes if checked
  1720. * 'checkbox2' => false, // passes if unchecked
  1721. * ]);
  1722. * ?>
  1723. * ```
  1724. *
  1725. * Pair this with submitForm for quick testing magic.
  1726. *
  1727. * ``` php
  1728. * <?php
  1729. * $form = [
  1730. * 'field1' => 'value',
  1731. * 'field2' => 'another value',
  1732. * 'checkbox1' => true,
  1733. * // ...
  1734. * ];
  1735. * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
  1736. * // $I->amOnPage('/path/to/form-page') may be needed
  1737. * $I->seeInFormFields('//form[@id=my-form]', $form);
  1738. * ?>
  1739. * ```
  1740. *
  1741. * @param $formSelector
  1742. * @param $params
  1743. * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
  1744. */
  1745. public function seeInFormFields($formSelector, $params) {
  1746. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args()));
  1747. }
  1748. /**
  1749. * [!] Method is generated. Documentation taken from corresponding module.
  1750. *
  1751. * Checks if the array of form parameters (name => value) are not set on the form matched with
  1752. * the passed selector.
  1753. *
  1754. * ``` php
  1755. * <?php
  1756. * $I->dontSeeInFormFields('form[name=myform]', [
  1757. * 'input1' => 'non-existent value',
  1758. * 'input2' => 'other non-existent value',
  1759. * ]);
  1760. * ?>
  1761. * ```
  1762. *
  1763. * To check that an element hasn't been assigned any one of many values, an array can be passed
  1764. * as the value:
  1765. *
  1766. * ``` php
  1767. * <?php
  1768. * $I->dontSeeInFormFields('.form-class', [
  1769. * 'fieldName' => [
  1770. * 'This value shouldn\'t be set',
  1771. * 'And this value shouldn\'t be set',
  1772. * ],
  1773. * ]);
  1774. * ?>
  1775. * ```
  1776. *
  1777. * Additionally, checkbox values can be checked with a boolean.
  1778. *
  1779. * ``` php
  1780. * <?php
  1781. * $I->dontSeeInFormFields('#form-id', [
  1782. * 'checkbox1' => true, // fails if checked
  1783. * 'checkbox2' => false, // fails if unchecked
  1784. * ]);
  1785. * ?>
  1786. * ```
  1787. *
  1788. * @param $formSelector
  1789. * @param $params
  1790. * Conditional Assertion: Test won't be stopped on fail
  1791. * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
  1792. */
  1793. public function cantSeeInFormFields($formSelector, $params) {
  1794. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args()));
  1795. }
  1796. /**
  1797. * [!] Method is generated. Documentation taken from corresponding module.
  1798. *
  1799. * Checks if the array of form parameters (name => value) are not set on the form matched with
  1800. * the passed selector.
  1801. *
  1802. * ``` php
  1803. * <?php
  1804. * $I->dontSeeInFormFields('form[name=myform]', [
  1805. * 'input1' => 'non-existent value',
  1806. * 'input2' => 'other non-existent value',
  1807. * ]);
  1808. * ?>
  1809. * ```
  1810. *
  1811. * To check that an element hasn't been assigned any one of many values, an array can be passed
  1812. * as the value:
  1813. *
  1814. * ``` php
  1815. * <?php
  1816. * $I->dontSeeInFormFields('.form-class', [
  1817. * 'fieldName' => [
  1818. * 'This value shouldn\'t be set',
  1819. * 'And this value shouldn\'t be set',
  1820. * ],
  1821. * ]);
  1822. * ?>
  1823. * ```
  1824. *
  1825. * Additionally, checkbox values can be checked with a boolean.
  1826. *
  1827. * ``` php
  1828. * <?php
  1829. * $I->dontSeeInFormFields('#form-id', [
  1830. * 'checkbox1' => true, // fails if checked
  1831. * 'checkbox2' => false, // fails if unchecked
  1832. * ]);
  1833. * ?>
  1834. * ```
  1835. *
  1836. * @param $formSelector
  1837. * @param $params
  1838. * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
  1839. */
  1840. public function dontSeeInFormFields($formSelector, $params) {
  1841. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args()));
  1842. }
  1843. /**
  1844. * [!] Method is generated. Documentation taken from corresponding module.
  1845. *
  1846. * Submits the given form on the page, with the given form
  1847. * values. Pass the form field's values as an array in the second
  1848. * parameter.
  1849. *
  1850. * Although this function can be used as a short-hand version of
  1851. * `fillField()`, `selectOption()`, `click()` etc. it has some important
  1852. * differences:
  1853. *
  1854. * * Only field *names* may be used, not CSS/XPath selectors nor field labels
  1855. * * If a field is sent to this function that does *not* exist on the page,
  1856. * it will silently be added to the HTTP request. This is helpful for testing
  1857. * some types of forms, but be aware that you will *not* get an exception
  1858. * like you would if you called `fillField()` or `selectOption()` with
  1859. * a missing field.
  1860. *
  1861. * Fields that are not provided will be filled by their values from the page,
  1862. * or from any previous calls to `fillField()`, `selectOption()` etc.
  1863. * You don't need to click the 'Submit' button afterwards.
  1864. * This command itself triggers the request to form's action.
  1865. *
  1866. * You can optionally specify which button's value to include
  1867. * in the request with the last parameter (as an alternative to
  1868. * explicitly setting its value in the second parameter), as
  1869. * button values are not otherwise included in the request.
  1870. *
  1871. * Examples:
  1872. *
  1873. * ``` php
  1874. * <?php
  1875. * $I->submitForm('#login', [
  1876. * 'login' => 'davert',
  1877. * 'password' => '123456'
  1878. * ]);
  1879. * // or
  1880. * $I->submitForm('#login', [
  1881. * 'login' => 'davert',
  1882. * 'password' => '123456'
  1883. * ], 'submitButtonName');
  1884. *
  1885. * ```
  1886. *
  1887. * For example, given this sample "Sign Up" form:
  1888. *
  1889. * ``` html
  1890. * <form action="/sign_up">
  1891. * Login:
  1892. * <input type="text" name="user[login]" /><br/>
  1893. * Password:
  1894. * <input type="password" name="user[password]" /><br/>
  1895. * Do you agree to our terms?
  1896. * <input type="checkbox" name="user[agree]" /><br/>
  1897. * Select pricing plan:
  1898. * <select name="plan">
  1899. * <option value="1">Free</option>
  1900. * <option value="2" selected="selected">Paid</option>
  1901. * </select>
  1902. * <input type="submit" name="submitButton" value="Submit" />
  1903. * </form>
  1904. * ```
  1905. *
  1906. * You could write the following to submit it:
  1907. *
  1908. * ``` php
  1909. * <?php
  1910. * $I->submitForm(
  1911. * '#userForm',
  1912. * [
  1913. * 'user' => [
  1914. * 'login' => 'Davert',
  1915. * 'password' => '123456',
  1916. * 'agree' => true
  1917. * ]
  1918. * ],
  1919. * 'submitButton'
  1920. * );
  1921. * ```
  1922. * Note that "2" will be the submitted value for the "plan" field, as it is
  1923. * the selected option.
  1924. *
  1925. * You can also emulate a JavaScript submission by not specifying any
  1926. * buttons in the third parameter to submitForm.
  1927. *
  1928. * ```php
  1929. * <?php
  1930. * $I->submitForm(
  1931. * '#userForm',
  1932. * [
  1933. * 'user' => [
  1934. * 'login' => 'Davert',
  1935. * 'password' => '123456',
  1936. * 'agree' => true
  1937. * ]
  1938. * ]
  1939. * );
  1940. * ```
  1941. *
  1942. * This function works well when paired with `seeInFormFields()`
  1943. * for quickly testing CRUD interfaces and form validation logic.
  1944. *
  1945. * ``` php
  1946. * <?php
  1947. * $form = [
  1948. * 'field1' => 'value',
  1949. * 'field2' => 'another value',
  1950. * 'checkbox1' => true,
  1951. * // ...
  1952. * ];
  1953. * $I->submitForm('#my-form', $form, 'submitButton');
  1954. * // $I->amOnPage('/path/to/form-page') may be needed
  1955. * $I->seeInFormFields('#my-form', $form);
  1956. * ```
  1957. *
  1958. * Parameter values can be set to arrays for multiple input fields
  1959. * of the same name, or multi-select combo boxes. For checkboxes,
  1960. * you can use either the string value or boolean `true`/`false` which will
  1961. * be replaced by the checkbox's value in the DOM.
  1962. *
  1963. * ``` php
  1964. * <?php
  1965. * $I->submitForm('#my-form', [
  1966. * 'field1' => 'value',
  1967. * 'checkbox' => [
  1968. * 'value of first checkbox',
  1969. * 'value of second checkbox',
  1970. * ],
  1971. * 'otherCheckboxes' => [
  1972. * true,
  1973. * false,
  1974. * false
  1975. * ],
  1976. * 'multiselect' => [
  1977. * 'first option value',
  1978. * 'second option value'
  1979. * ]
  1980. * ]);
  1981. * ```
  1982. *
  1983. * Mixing string and boolean values for a checkbox's value is not supported
  1984. * and may produce unexpected results.
  1985. *
  1986. * Field names ending in `[]` must be passed without the trailing square
  1987. * bracket characters, and must contain an array for its value. This allows
  1988. * submitting multiple values with the same name, consider:
  1989. *
  1990. * ```php
  1991. * <?php
  1992. * // This will NOT work correctly
  1993. * $I->submitForm('#my-form', [
  1994. * 'field[]' => 'value',
  1995. * 'field[]' => 'another value', // 'field[]' is already a defined key
  1996. * ]);
  1997. * ```
  1998. *
  1999. * The solution is to pass an array value:
  2000. *
  2001. * ```php
  2002. * <?php
  2003. * // This way both values are submitted
  2004. * $I->submitForm('#my-form', [
  2005. * 'field' => [
  2006. * 'value',
  2007. * 'another value',
  2008. * ]
  2009. * ]);
  2010. * ```
  2011. *
  2012. * @param $selector
  2013. * @param $params
  2014. * @param $button
  2015. * @see \Codeception\Lib\InnerBrowser::submitForm()
  2016. */
  2017. public function submitForm($selector, $params, $button = null) {
  2018. return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
  2019. }
  2020. /**
  2021. * [!] Method is generated. Documentation taken from corresponding module.
  2022. *
  2023. * Fills a text field or textarea with the given string.
  2024. *
  2025. * ``` php
  2026. * <?php
  2027. * $I->fillField("//input[@type='text']", "Hello World!");
  2028. * $I->fillField(['name' => 'email'], 'jon@mail.com');
  2029. * ?>
  2030. * ```
  2031. *
  2032. * @param $field
  2033. * @param $value
  2034. * @see \Codeception\Lib\InnerBrowser::fillField()
  2035. */
  2036. public function fillField($field, $value) {
  2037. return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
  2038. }
  2039. /**
  2040. * [!] Method is generated. Documentation taken from corresponding module.
  2041. *
  2042. * Selects an option in a select tag or in radio button group.
  2043. *
  2044. * ``` php
  2045. * <?php
  2046. * $I->selectOption('form select[name=account]', 'Premium');
  2047. * $I->selectOption('form input[name=payment]', 'Monthly');
  2048. * $I->selectOption('//form/select[@name=account]', 'Monthly');
  2049. * ?>
  2050. * ```
  2051. *
  2052. * Provide an array for the second argument to select multiple options:
  2053. *
  2054. * ``` php
  2055. * <?php
  2056. * $I->selectOption('Which OS do you use?', array('Windows','Linux'));
  2057. * ?>
  2058. * ```
  2059. *
  2060. * Or provide an associative array for the second argument to specifically define which selection method should be used:
  2061. *
  2062. * ``` php
  2063. * <?php
  2064. * $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows'
  2065. * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows'
  2066. * ?>
  2067. * ```
  2068. *
  2069. * @param $select
  2070. * @param $option
  2071. * @see \Codeception\Lib\InnerBrowser::selectOption()
  2072. */
  2073. public function selectOption($select, $option) {
  2074. return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
  2075. }
  2076. /**
  2077. * [!] Method is generated. Documentation taken from corresponding module.
  2078. *
  2079. * Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
  2080. *
  2081. * ``` php
  2082. * <?php
  2083. * $I->checkOption('#agree');
  2084. * ?>
  2085. * ```
  2086. *
  2087. * @param $option
  2088. * @see \Codeception\Lib\InnerBrowser::checkOption()
  2089. */
  2090. public function checkOption($option) {
  2091. return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
  2092. }
  2093. /**
  2094. * [!] Method is generated. Documentation taken from corresponding module.
  2095. *
  2096. * Unticks a checkbox.
  2097. *
  2098. * ``` php
  2099. * <?php
  2100. * $I->uncheckOption('#notify');
  2101. * ?>
  2102. * ```
  2103. *
  2104. * @param $option
  2105. * @see \Codeception\Lib\InnerBrowser::uncheckOption()
  2106. */
  2107. public function uncheckOption($option) {
  2108. return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
  2109. }
  2110. /**
  2111. * [!] Method is generated. Documentation taken from corresponding module.
  2112. *
  2113. * Attaches a file relative to the Codeception `_data` directory to the given file upload field.
  2114. *
  2115. * ``` php
  2116. * <?php
  2117. * // file is stored in 'tests/_data/prices.xls'
  2118. * $I->attachFile('input[@type="file"]', 'prices.xls');
  2119. * ?>
  2120. * ```
  2121. *
  2122. * @param $field
  2123. * @param $filename
  2124. * @see \Codeception\Lib\InnerBrowser::attachFile()
  2125. */
  2126. public function attachFile($field, $filename) {
  2127. return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
  2128. }
  2129. /**
  2130. * [!] Method is generated. Documentation taken from corresponding module.
  2131. *
  2132. * If your page triggers an ajax request, you can perform it manually.
  2133. * This action sends a GET ajax request with specified params.
  2134. *
  2135. * See ->sendAjaxPostRequest for examples.
  2136. *
  2137. * @param $uri
  2138. * @param $params
  2139. * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest()
  2140. */
  2141. public function sendAjaxGetRequest($uri, $params = null) {
  2142. return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
  2143. }
  2144. /**
  2145. * [!] Method is generated. Documentation taken from corresponding module.
  2146. *
  2147. * If your page triggers an ajax request, you can perform it manually.
  2148. * This action sends a POST ajax request with specified params.
  2149. * Additional params can be passed as array.
  2150. *
  2151. * Example:
  2152. *
  2153. * Imagine that by clicking checkbox you trigger ajax request which updates user settings.
  2154. * We emulate that click by running this ajax request manually.
  2155. *
  2156. * ``` php
  2157. * <?php
  2158. * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST
  2159. * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET
  2160. *
  2161. * ```
  2162. *
  2163. * @param $uri
  2164. * @param $params
  2165. * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest()
  2166. */
  2167. public function sendAjaxPostRequest($uri, $params = null) {
  2168. return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
  2169. }
  2170. /**
  2171. * [!] Method is generated. Documentation taken from corresponding module.
  2172. *
  2173. * If your page triggers an ajax request, you can perform it manually.
  2174. * This action sends an ajax request with specified method and params.
  2175. *
  2176. * Example:
  2177. *
  2178. * You need to perform an ajax request specifying the HTTP method.
  2179. *
  2180. * ``` php
  2181. * <?php
  2182. * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title'));
  2183. *
  2184. * ```
  2185. *
  2186. * @param $method
  2187. * @param $uri
  2188. * @param $params
  2189. * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest()
  2190. */
  2191. public function sendAjaxRequest($method, $uri, $params = null) {
  2192. return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args()));
  2193. }
  2194. /**
  2195. * [!] Method is generated. Documentation taken from corresponding module.
  2196. *
  2197. * Finds and returns the text contents of the given element.
  2198. * If a fuzzy locator is used, the element is found using CSS, XPath,
  2199. * and by matching the full page source by regular expression.
  2200. *
  2201. * ``` php
  2202. * <?php
  2203. * $heading = $I->grabTextFrom('h1');
  2204. * $heading = $I->grabTextFrom('descendant-or-self::h1');
  2205. * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex
  2206. * ?>
  2207. * ```
  2208. *
  2209. * @param $cssOrXPathOrRegex
  2210. *
  2211. * @return mixed
  2212. * @see \Codeception\Lib\InnerBrowser::grabTextFrom()
  2213. */
  2214. public function grabTextFrom($cssOrXPathOrRegex) {
  2215. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
  2216. }
  2217. /**
  2218. * [!] Method is generated. Documentation taken from corresponding module.
  2219. *
  2220. * Grabs the value of the given attribute value from the given element.
  2221. * Fails if element is not found.
  2222. *
  2223. * ``` php
  2224. * <?php
  2225. * $I->grabAttributeFrom('#tooltip', 'title');
  2226. * ?>
  2227. * ```
  2228. *
  2229. *
  2230. * @param $cssOrXpath
  2231. * @param $attribute
  2232. *
  2233. * @return mixed
  2234. * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
  2235. */
  2236. public function grabAttributeFrom($cssOrXpath, $attribute) {
  2237. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
  2238. }
  2239. /**
  2240. * [!] Method is generated. Documentation taken from corresponding module.
  2241. *
  2242. * Grabs either the text content, or attribute values, of nodes
  2243. * matched by $cssOrXpath and returns them as an array.
  2244. *
  2245. * ```html
  2246. * <a href="#first">First</a>
  2247. * <a href="#second">Second</a>
  2248. * <a href="#third">Third</a>
  2249. * ```
  2250. *
  2251. * ```php
  2252. * <?php
  2253. * // would return ['First', 'Second', 'Third']
  2254. * $aLinkText = $I->grabMultiple('a');
  2255. *
  2256. * // would return ['#first', '#second', '#third']
  2257. * $aLinks = $I->grabMultiple('a', 'href');
  2258. * ?>
  2259. * ```
  2260. *
  2261. * @param $cssOrXpath
  2262. * @param $attribute
  2263. * @return string[]
  2264. * @see \Codeception\Lib\InnerBrowser::grabMultiple()
  2265. */
  2266. public function grabMultiple($cssOrXpath, $attribute = null) {
  2267. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args()));
  2268. }
  2269. /**
  2270. * [!] Method is generated. Documentation taken from corresponding module.
  2271. *
  2272. * @param $field
  2273. *
  2274. * @return array|mixed|null|string
  2275. * @see \Codeception\Lib\InnerBrowser::grabValueFrom()
  2276. */
  2277. public function grabValueFrom($field) {
  2278. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
  2279. }
  2280. /**
  2281. * [!] Method is generated. Documentation taken from corresponding module.
  2282. *
  2283. * Grabs a cookie value.
  2284. * You can set additional cookie params like `domain`, `path` in array passed as last argument.
  2285. *
  2286. * @param $cookie
  2287. *
  2288. * @param array $params
  2289. * @return mixed
  2290. * @see \Codeception\Lib\InnerBrowser::grabCookie()
  2291. */
  2292. public function grabCookie($cookie, $params = null) {
  2293. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
  2294. }
  2295. /**
  2296. * [!] Method is generated. Documentation taken from corresponding module.
  2297. *
  2298. * Grabs current page source code.
  2299. *
  2300. * @throws ModuleException if no page was opened.
  2301. *
  2302. * @return string Current page source code.
  2303. * @see \Codeception\Lib\InnerBrowser::grabPageSource()
  2304. */
  2305. public function grabPageSource() {
  2306. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args()));
  2307. }
  2308. /**
  2309. * [!] Method is generated. Documentation taken from corresponding module.
  2310. *
  2311. * Checks that a cookie with the given name is set.
  2312. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2313. *
  2314. * ``` php
  2315. * <?php
  2316. * $I->seeCookie('PHPSESSID');
  2317. * ?>
  2318. * ```
  2319. *
  2320. * @param $cookie
  2321. * @param array $params
  2322. * @return mixed
  2323. * Conditional Assertion: Test won't be stopped on fail
  2324. * @see \Codeception\Lib\InnerBrowser::seeCookie()
  2325. */
  2326. public function canSeeCookie($cookie, $params = null) {
  2327. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
  2328. }
  2329. /**
  2330. * [!] Method is generated. Documentation taken from corresponding module.
  2331. *
  2332. * Checks that a cookie with the given name is set.
  2333. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2334. *
  2335. * ``` php
  2336. * <?php
  2337. * $I->seeCookie('PHPSESSID');
  2338. * ?>
  2339. * ```
  2340. *
  2341. * @param $cookie
  2342. * @param array $params
  2343. * @return mixed
  2344. * @see \Codeception\Lib\InnerBrowser::seeCookie()
  2345. */
  2346. public function seeCookie($cookie, $params = null) {
  2347. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
  2348. }
  2349. /**
  2350. * [!] Method is generated. Documentation taken from corresponding module.
  2351. *
  2352. * Checks that there isn't a cookie with the given name.
  2353. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2354. *
  2355. * @param $cookie
  2356. *
  2357. * @param array $params
  2358. * @return mixed
  2359. * Conditional Assertion: Test won't be stopped on fail
  2360. * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
  2361. */
  2362. public function cantSeeCookie($cookie, $params = null) {
  2363. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
  2364. }
  2365. /**
  2366. * [!] Method is generated. Documentation taken from corresponding module.
  2367. *
  2368. * Checks that there isn't a cookie with the given name.
  2369. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2370. *
  2371. * @param $cookie
  2372. *
  2373. * @param array $params
  2374. * @return mixed
  2375. * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
  2376. */
  2377. public function dontSeeCookie($cookie, $params = null) {
  2378. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
  2379. }
  2380. /**
  2381. * [!] Method is generated. Documentation taken from corresponding module.
  2382. *
  2383. * Unsets cookie with the given name.
  2384. * You can set additional cookie params like `domain`, `path` in array passed as last argument.
  2385. *
  2386. * @param $cookie
  2387. *
  2388. * @param array $params
  2389. * @return mixed
  2390. * @see \Codeception\Lib\InnerBrowser::resetCookie()
  2391. */
  2392. public function resetCookie($name, $params = null) {
  2393. return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
  2394. }
  2395. /**
  2396. * [!] Method is generated. Documentation taken from corresponding module.
  2397. *
  2398. * Checks that the given element exists on the page and is visible.
  2399. * You can also specify expected attributes of this element.
  2400. *
  2401. * ``` php
  2402. * <?php
  2403. * $I->seeElement('.error');
  2404. * $I->seeElement('//form/input[1]');
  2405. * $I->seeElement('input', ['name' => 'login']);
  2406. * $I->seeElement('input', ['value' => '123456']);
  2407. *
  2408. * // strict locator in first arg, attributes in second
  2409. * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
  2410. * ?>
  2411. * ```
  2412. *
  2413. * @param $selector
  2414. * @param array $attributes
  2415. * @return
  2416. * Conditional Assertion: Test won't be stopped on fail
  2417. * @see \Codeception\Lib\InnerBrowser::seeElement()
  2418. */
  2419. public function canSeeElement($selector, $attributes = null) {
  2420. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
  2421. }
  2422. /**
  2423. * [!] Method is generated. Documentation taken from corresponding module.
  2424. *
  2425. * Checks that the given element exists on the page and is visible.
  2426. * You can also specify expected attributes of this element.
  2427. *
  2428. * ``` php
  2429. * <?php
  2430. * $I->seeElement('.error');
  2431. * $I->seeElement('//form/input[1]');
  2432. * $I->seeElement('input', ['name' => 'login']);
  2433. * $I->seeElement('input', ['value' => '123456']);
  2434. *
  2435. * // strict locator in first arg, attributes in second
  2436. * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
  2437. * ?>
  2438. * ```
  2439. *
  2440. * @param $selector
  2441. * @param array $attributes
  2442. * @return
  2443. * @see \Codeception\Lib\InnerBrowser::seeElement()
  2444. */
  2445. public function seeElement($selector, $attributes = null) {
  2446. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
  2447. }
  2448. /**
  2449. * [!] Method is generated. Documentation taken from corresponding module.
  2450. *
  2451. * Checks that the given element is invisible or not present on the page.
  2452. * You can also specify expected attributes of this element.
  2453. *
  2454. * ``` php
  2455. * <?php
  2456. * $I->dontSeeElement('.error');
  2457. * $I->dontSeeElement('//form/input[1]');
  2458. * $I->dontSeeElement('input', ['name' => 'login']);
  2459. * $I->dontSeeElement('input', ['value' => '123456']);
  2460. * ?>
  2461. * ```
  2462. *
  2463. * @param $selector
  2464. * @param array $attributes
  2465. * Conditional Assertion: Test won't be stopped on fail
  2466. * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
  2467. */
  2468. public function cantSeeElement($selector, $attributes = null) {
  2469. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
  2470. }
  2471. /**
  2472. * [!] Method is generated. Documentation taken from corresponding module.
  2473. *
  2474. * Checks that the given element is invisible or not present on the page.
  2475. * You can also specify expected attributes of this element.
  2476. *
  2477. * ``` php
  2478. * <?php
  2479. * $I->dontSeeElement('.error');
  2480. * $I->dontSeeElement('//form/input[1]');
  2481. * $I->dontSeeElement('input', ['name' => 'login']);
  2482. * $I->dontSeeElement('input', ['value' => '123456']);
  2483. * ?>
  2484. * ```
  2485. *
  2486. * @param $selector
  2487. * @param array $attributes
  2488. * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
  2489. */
  2490. public function dontSeeElement($selector, $attributes = null) {
  2491. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
  2492. }
  2493. /**
  2494. * [!] Method is generated. Documentation taken from corresponding module.
  2495. *
  2496. * Checks that there are a certain number of elements matched by the given locator on the page.
  2497. *
  2498. * ``` php
  2499. * <?php
  2500. * $I->seeNumberOfElements('tr', 10);
  2501. * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements
  2502. * ?>
  2503. * ```
  2504. * @param $selector
  2505. * @param mixed $expected int or int[]
  2506. * Conditional Assertion: Test won't be stopped on fail
  2507. * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
  2508. */
  2509. public function canSeeNumberOfElements($selector, $expected) {
  2510. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
  2511. }
  2512. /**
  2513. * [!] Method is generated. Documentation taken from corresponding module.
  2514. *
  2515. * Checks that there are a certain number of elements matched by the given locator on the page.
  2516. *
  2517. * ``` php
  2518. * <?php
  2519. * $I->seeNumberOfElements('tr', 10);
  2520. * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements
  2521. * ?>
  2522. * ```
  2523. * @param $selector
  2524. * @param mixed $expected int or int[]
  2525. * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
  2526. */
  2527. public function seeNumberOfElements($selector, $expected) {
  2528. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
  2529. }
  2530. /**
  2531. * [!] Method is generated. Documentation taken from corresponding module.
  2532. *
  2533. * Checks that the given option is selected.
  2534. *
  2535. * ``` php
  2536. * <?php
  2537. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  2538. * ?>
  2539. * ```
  2540. *
  2541. * @param $selector
  2542. * @param $optionText
  2543. *
  2544. * @return mixed
  2545. * Conditional Assertion: Test won't be stopped on fail
  2546. * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
  2547. */
  2548. public function canSeeOptionIsSelected($selector, $optionText) {
  2549. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
  2550. }
  2551. /**
  2552. * [!] Method is generated. Documentation taken from corresponding module.
  2553. *
  2554. * Checks that the given option is selected.
  2555. *
  2556. * ``` php
  2557. * <?php
  2558. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  2559. * ?>
  2560. * ```
  2561. *
  2562. * @param $selector
  2563. * @param $optionText
  2564. *
  2565. * @return mixed
  2566. * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
  2567. */
  2568. public function seeOptionIsSelected($selector, $optionText) {
  2569. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
  2570. }
  2571. /**
  2572. * [!] Method is generated. Documentation taken from corresponding module.
  2573. *
  2574. * Checks that the given option is not selected.
  2575. *
  2576. * ``` php
  2577. * <?php
  2578. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  2579. * ?>
  2580. * ```
  2581. *
  2582. * @param $selector
  2583. * @param $optionText
  2584. *
  2585. * @return mixed
  2586. * Conditional Assertion: Test won't be stopped on fail
  2587. * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
  2588. */
  2589. public function cantSeeOptionIsSelected($selector, $optionText) {
  2590. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
  2591. }
  2592. /**
  2593. * [!] Method is generated. Documentation taken from corresponding module.
  2594. *
  2595. * Checks that the given option is not selected.
  2596. *
  2597. * ``` php
  2598. * <?php
  2599. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  2600. * ?>
  2601. * ```
  2602. *
  2603. * @param $selector
  2604. * @param $optionText
  2605. *
  2606. * @return mixed
  2607. * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
  2608. */
  2609. public function dontSeeOptionIsSelected($selector, $optionText) {
  2610. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
  2611. }
  2612. /**
  2613. * [!] Method is generated. Documentation taken from corresponding module.
  2614. *
  2615. * Asserts that current page has 404 response status code.
  2616. * Conditional Assertion: Test won't be stopped on fail
  2617. * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
  2618. */
  2619. public function canSeePageNotFound() {
  2620. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
  2621. }
  2622. /**
  2623. * [!] Method is generated. Documentation taken from corresponding module.
  2624. *
  2625. * Asserts that current page has 404 response status code.
  2626. * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
  2627. */
  2628. public function seePageNotFound() {
  2629. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
  2630. }
  2631. /**
  2632. * [!] Method is generated. Documentation taken from corresponding module.
  2633. *
  2634. * Checks that response code is equal to value provided.
  2635. *
  2636. * ```php
  2637. * <?php
  2638. * $I->seeResponseCodeIs(200);
  2639. *
  2640. * // recommended \Codeception\Util\HttpCode
  2641. * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2642. * ```
  2643. *
  2644. * @param $code
  2645. * Conditional Assertion: Test won't be stopped on fail
  2646. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
  2647. */
  2648. public function canSeeResponseCodeIs($code) {
  2649. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
  2650. }
  2651. /**
  2652. * [!] Method is generated. Documentation taken from corresponding module.
  2653. *
  2654. * Checks that response code is equal to value provided.
  2655. *
  2656. * ```php
  2657. * <?php
  2658. * $I->seeResponseCodeIs(200);
  2659. *
  2660. * // recommended \Codeception\Util\HttpCode
  2661. * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2662. * ```
  2663. *
  2664. * @param $code
  2665. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
  2666. */
  2667. public function seeResponseCodeIs($code) {
  2668. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
  2669. }
  2670. /**
  2671. * [!] Method is generated. Documentation taken from corresponding module.
  2672. *
  2673. * Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
  2674. *
  2675. * @param $from
  2676. * @param $to
  2677. * Conditional Assertion: Test won't be stopped on fail
  2678. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
  2679. */
  2680. public function canSeeResponseCodeIsBetween($from, $to) {
  2681. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
  2682. }
  2683. /**
  2684. * [!] Method is generated. Documentation taken from corresponding module.
  2685. *
  2686. * Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
  2687. *
  2688. * @param $from
  2689. * @param $to
  2690. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
  2691. */
  2692. public function seeResponseCodeIsBetween($from, $to) {
  2693. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
  2694. }
  2695. /**
  2696. * [!] Method is generated. Documentation taken from corresponding module.
  2697. *
  2698. * Checks that response code is equal to value provided.
  2699. *
  2700. * ```php
  2701. * <?php
  2702. * $I->dontSeeResponseCodeIs(200);
  2703. *
  2704. * // recommended \Codeception\Util\HttpCode
  2705. * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2706. * ```
  2707. * @param $code
  2708. * Conditional Assertion: Test won't be stopped on fail
  2709. * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs()
  2710. */
  2711. public function cantSeeResponseCodeIs($code) {
  2712. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args()));
  2713. }
  2714. /**
  2715. * [!] Method is generated. Documentation taken from corresponding module.
  2716. *
  2717. * Checks that response code is equal to value provided.
  2718. *
  2719. * ```php
  2720. * <?php
  2721. * $I->dontSeeResponseCodeIs(200);
  2722. *
  2723. * // recommended \Codeception\Util\HttpCode
  2724. * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2725. * ```
  2726. * @param $code
  2727. * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs()
  2728. */
  2729. public function dontSeeResponseCodeIs($code) {
  2730. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args()));
  2731. }
  2732. /**
  2733. * [!] Method is generated. Documentation taken from corresponding module.
  2734. *
  2735. * Checks that the response code 2xx
  2736. * Conditional Assertion: Test won't be stopped on fail
  2737. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
  2738. */
  2739. public function canSeeResponseCodeIsSuccessful() {
  2740. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
  2741. }
  2742. /**
  2743. * [!] Method is generated. Documentation taken from corresponding module.
  2744. *
  2745. * Checks that the response code 2xx
  2746. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
  2747. */
  2748. public function seeResponseCodeIsSuccessful() {
  2749. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
  2750. }
  2751. /**
  2752. * [!] Method is generated. Documentation taken from corresponding module.
  2753. *
  2754. * Checks that the response code 3xx
  2755. * Conditional Assertion: Test won't be stopped on fail
  2756. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
  2757. */
  2758. public function canSeeResponseCodeIsRedirection() {
  2759. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
  2760. }
  2761. /**
  2762. * [!] Method is generated. Documentation taken from corresponding module.
  2763. *
  2764. * Checks that the response code 3xx
  2765. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
  2766. */
  2767. public function seeResponseCodeIsRedirection() {
  2768. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
  2769. }
  2770. /**
  2771. * [!] Method is generated. Documentation taken from corresponding module.
  2772. *
  2773. * Checks that the response code is 4xx
  2774. * Conditional Assertion: Test won't be stopped on fail
  2775. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
  2776. */
  2777. public function canSeeResponseCodeIsClientError() {
  2778. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
  2779. }
  2780. /**
  2781. * [!] Method is generated. Documentation taken from corresponding module.
  2782. *
  2783. * Checks that the response code is 4xx
  2784. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
  2785. */
  2786. public function seeResponseCodeIsClientError() {
  2787. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
  2788. }
  2789. /**
  2790. * [!] Method is generated. Documentation taken from corresponding module.
  2791. *
  2792. * Checks that the response code is 5xx
  2793. * Conditional Assertion: Test won't be stopped on fail
  2794. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
  2795. */
  2796. public function canSeeResponseCodeIsServerError() {
  2797. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
  2798. }
  2799. /**
  2800. * [!] Method is generated. Documentation taken from corresponding module.
  2801. *
  2802. * Checks that the response code is 5xx
  2803. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
  2804. */
  2805. public function seeResponseCodeIsServerError() {
  2806. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
  2807. }
  2808. /**
  2809. * [!] Method is generated. Documentation taken from corresponding module.
  2810. *
  2811. * Checks that the page title contains the given string.
  2812. *
  2813. * ``` php
  2814. * <?php
  2815. * $I->seeInTitle('Blog - Post #1');
  2816. * ?>
  2817. * ```
  2818. *
  2819. * @param $title
  2820. *
  2821. * @return mixed
  2822. * Conditional Assertion: Test won't be stopped on fail
  2823. * @see \Codeception\Lib\InnerBrowser::seeInTitle()
  2824. */
  2825. public function canSeeInTitle($title) {
  2826. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
  2827. }
  2828. /**
  2829. * [!] Method is generated. Documentation taken from corresponding module.
  2830. *
  2831. * Checks that the page title contains the given string.
  2832. *
  2833. * ``` php
  2834. * <?php
  2835. * $I->seeInTitle('Blog - Post #1');
  2836. * ?>
  2837. * ```
  2838. *
  2839. * @param $title
  2840. *
  2841. * @return mixed
  2842. * @see \Codeception\Lib\InnerBrowser::seeInTitle()
  2843. */
  2844. public function seeInTitle($title) {
  2845. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
  2846. }
  2847. /**
  2848. * [!] Method is generated. Documentation taken from corresponding module.
  2849. *
  2850. * Checks that the page title does not contain the given string.
  2851. *
  2852. * @param $title
  2853. *
  2854. * @return mixed
  2855. * Conditional Assertion: Test won't be stopped on fail
  2856. * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
  2857. */
  2858. public function cantSeeInTitle($title) {
  2859. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
  2860. }
  2861. /**
  2862. * [!] Method is generated. Documentation taken from corresponding module.
  2863. *
  2864. * Checks that the page title does not contain the given string.
  2865. *
  2866. * @param $title
  2867. *
  2868. * @return mixed
  2869. * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
  2870. */
  2871. public function dontSeeInTitle($title) {
  2872. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
  2873. }
  2874. /**
  2875. * [!] Method is generated. Documentation taken from corresponding module.
  2876. *
  2877. * Switch to iframe or frame on the page.
  2878. *
  2879. * Example:
  2880. * ``` html
  2881. * <iframe name="another_frame" src="http://example.com">
  2882. * ```
  2883. *
  2884. * ``` php
  2885. * <?php
  2886. * # switch to iframe
  2887. * $I->switchToIframe("another_frame");
  2888. * ```
  2889. *
  2890. * @param string $name
  2891. * @see \Codeception\Lib\InnerBrowser::switchToIframe()
  2892. */
  2893. public function switchToIframe($name) {
  2894. return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToIframe', func_get_args()));
  2895. }
  2896. /**
  2897. * [!] Method is generated. Documentation taken from corresponding module.
  2898. *
  2899. * Moves back in history.
  2900. *
  2901. * @param int $numberOfSteps (default value 1)
  2902. * @see \Codeception\Lib\InnerBrowser::moveBack()
  2903. */
  2904. public function moveBack($numberOfSteps = null) {
  2905. return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args()));
  2906. }
  2907. /**
  2908. * [!] Method is generated. Documentation taken from corresponding module.
  2909. *
  2910. * @inheritdoc
  2911. * @see \tests\codeception\common\_support\FixtureHelper::fixtures()
  2912. */
  2913. public function fixtures() {
  2914. return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args()));
  2915. }
  2916. /**
  2917. * [!] Method is generated. Documentation taken from corresponding module.
  2918. *
  2919. * Initialize the fixtures.
  2920. * @since 2.0.12
  2921. * @see \tests\codeception\common\_support\FixtureHelper::initFixtures()
  2922. */
  2923. public function initFixtures() {
  2924. return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args()));
  2925. }
  2926. }