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.

2988 satır
95KB

  1. <?php //[STAMP] bc506f891c6c86019a4495b1d981dae8
  2. namespace tests\codeception\backend\_generated;
  3. // This class was automatically generated by build task
  4. // You should not change it manually as it will be overwritten on next build
  5. // @codingStandardsIgnoreFile
  6. trait 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. * @see \Codeception\Module\Yii2::grabComponent()
  622. */
  623. public function grabComponent($component) {
  624. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabComponent', func_get_args()));
  625. }
  626. /**
  627. * [!] Method is generated. Documentation taken from corresponding module.
  628. *
  629. * Checks that email is sent.
  630. *
  631. * ```php
  632. * <?php
  633. * // check that at least 1 email was sent
  634. * $I->seeEmailIsSent();
  635. *
  636. * // check that only 3 emails were sent
  637. * $I->seeEmailIsSent(3);
  638. * ```
  639. *
  640. * @param int $num
  641. * @throws ModuleException
  642. * @part email
  643. * Conditional Assertion: Test won't be stopped on fail
  644. * @see \Codeception\Module\Yii2::seeEmailIsSent()
  645. */
  646. public function canSeeEmailIsSent($num = null) {
  647. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeEmailIsSent', func_get_args()));
  648. }
  649. /**
  650. * [!] Method is generated. Documentation taken from corresponding module.
  651. *
  652. * Checks that email is sent.
  653. *
  654. * ```php
  655. * <?php
  656. * // check that at least 1 email was sent
  657. * $I->seeEmailIsSent();
  658. *
  659. * // check that only 3 emails were sent
  660. * $I->seeEmailIsSent(3);
  661. * ```
  662. *
  663. * @param int $num
  664. * @throws ModuleException
  665. * @part email
  666. * @see \Codeception\Module\Yii2::seeEmailIsSent()
  667. */
  668. public function seeEmailIsSent($num = null) {
  669. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeEmailIsSent', func_get_args()));
  670. }
  671. /**
  672. * [!] Method is generated. Documentation taken from corresponding module.
  673. *
  674. * Checks that no email was sent
  675. *
  676. * @part email
  677. * Conditional Assertion: Test won't be stopped on fail
  678. * @see \Codeception\Module\Yii2::dontSeeEmailIsSent()
  679. */
  680. public function cantSeeEmailIsSent() {
  681. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeEmailIsSent', func_get_args()));
  682. }
  683. /**
  684. * [!] Method is generated. Documentation taken from corresponding module.
  685. *
  686. * Checks that no email was sent
  687. *
  688. * @part email
  689. * @see \Codeception\Module\Yii2::dontSeeEmailIsSent()
  690. */
  691. public function dontSeeEmailIsSent() {
  692. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeEmailIsSent', func_get_args()));
  693. }
  694. /**
  695. * [!] Method is generated. Documentation taken from corresponding module.
  696. *
  697. * Returns array of all sent email messages.
  698. * Each message implements `yii\mail\Message` interface.
  699. * Useful to perform additional checks using `Asserts` module:
  700. *
  701. * ```php
  702. * <?php
  703. * $I->seeEmailIsSent();
  704. * $messages = $I->grabSentEmails();
  705. * $I->assertEquals('admin@site,com', $messages[0]->getTo());
  706. * ```
  707. *
  708. * @part email
  709. * @return array
  710. * @throws ModuleException
  711. * @see \Codeception\Module\Yii2::grabSentEmails()
  712. */
  713. public function grabSentEmails() {
  714. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabSentEmails', func_get_args()));
  715. }
  716. /**
  717. * [!] Method is generated. Documentation taken from corresponding module.
  718. *
  719. * Returns last sent email:
  720. *
  721. * ```php
  722. * <?php
  723. * $I->seeEmailIsSent();
  724. * $message = $I->grabLastSentEmail();
  725. * $I->assertEquals('admin@site,com', $message->getTo());
  726. * ```
  727. * @part email
  728. * @see \Codeception\Module\Yii2::grabLastSentEmail()
  729. */
  730. public function grabLastSentEmail() {
  731. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabLastSentEmail', func_get_args()));
  732. }
  733. /**
  734. * [!] Method is generated. Documentation taken from corresponding module.
  735. *
  736. * Returns a list of regex patterns for recognized domain names
  737. *
  738. * @return array
  739. * @see \Codeception\Module\Yii2::getInternalDomains()
  740. */
  741. public function getInternalDomains() {
  742. return $this->getScenario()->runStep(new \Codeception\Step\Action('getInternalDomains', func_get_args()));
  743. }
  744. /**
  745. * [!] Method is generated. Documentation taken from corresponding module.
  746. *
  747. * Authenticates user for HTTP_AUTH
  748. *
  749. * @param $username
  750. * @param $password
  751. * @see \Codeception\Lib\InnerBrowser::amHttpAuthenticated()
  752. */
  753. public function amHttpAuthenticated($username, $password) {
  754. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amHttpAuthenticated', func_get_args()));
  755. }
  756. /**
  757. * [!] Method is generated. Documentation taken from corresponding module.
  758. *
  759. * Sets the HTTP header to the passed value - which is used on
  760. * subsequent HTTP requests through PhpBrowser.
  761. *
  762. * Example:
  763. * ```php
  764. * <?php
  765. * $I->haveHttpHeader('X-Requested-With', 'Codeception');
  766. * $I->amOnPage('test-headers.php');
  767. * ?>
  768. * ```
  769. *
  770. * To use special chars in Header Key use HTML Character Entities:
  771. * Example:
  772. * Header with underscore - 'Client_Id'
  773. * should be represented as - 'Client&#x0005F;Id' or 'Client&#95;Id'
  774. *
  775. * ```php
  776. * <?php
  777. * $I->haveHttpHeader('Client&#95;Id', 'Codeception');
  778. * ?>
  779. * ```
  780. *
  781. * @param string $name the name of the request header
  782. * @param string $value the value to set it to for subsequent
  783. * requests
  784. * @see \Codeception\Lib\InnerBrowser::haveHttpHeader()
  785. */
  786. public function haveHttpHeader($name, $value) {
  787. return $this->getScenario()->runStep(new \Codeception\Step\Action('haveHttpHeader', func_get_args()));
  788. }
  789. /**
  790. * [!] Method is generated. Documentation taken from corresponding module.
  791. *
  792. * Deletes the header with the passed name. Subsequent requests
  793. * will not have the deleted header in its request.
  794. *
  795. * Example:
  796. * ```php
  797. * <?php
  798. * $I->haveHttpHeader('X-Requested-With', 'Codeception');
  799. * $I->amOnPage('test-headers.php');
  800. * // ...
  801. * $I->deleteHeader('X-Requested-With');
  802. * $I->amOnPage('some-other-page.php');
  803. * ?>
  804. * ```
  805. *
  806. * @param string $name the name of the header to delete.
  807. * @see \Codeception\Lib\InnerBrowser::deleteHeader()
  808. */
  809. public function deleteHeader($name) {
  810. return $this->getScenario()->runStep(new \Codeception\Step\Action('deleteHeader', func_get_args()));
  811. }
  812. /**
  813. * [!] Method is generated. Documentation taken from corresponding module.
  814. *
  815. * Opens the page for the given relative URI.
  816. *
  817. * ``` php
  818. * <?php
  819. * // opens front page
  820. * $I->amOnPage('/');
  821. * // opens /register page
  822. * $I->amOnPage('/register');
  823. * ```
  824. *
  825. * @param string $page
  826. * @see \Codeception\Lib\InnerBrowser::amOnPage()
  827. */
  828. public function amOnPage($page) {
  829. return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
  830. }
  831. /**
  832. * [!] Method is generated. Documentation taken from corresponding module.
  833. *
  834. * Perform a click on a link or a button, given by a locator.
  835. * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
  836. * For buttons, the "value" attribute, "name" attribute, and inner text are searched.
  837. * For links, the link text is searched.
  838. * For images, the "alt" attribute and inner text of any parent links are searched.
  839. *
  840. * The second parameter is a context (CSS or XPath locator) to narrow the search.
  841. *
  842. * Note that if the locator matches a button of type `submit`, the form will be submitted.
  843. *
  844. * ``` php
  845. * <?php
  846. * // simple link
  847. * $I->click('Logout');
  848. * // button of form
  849. * $I->click('Submit');
  850. * // CSS button
  851. * $I->click('#form input[type=submit]');
  852. * // XPath
  853. * $I->click('//form/*[@type=submit]');
  854. * // link in context
  855. * $I->click('Logout', '#nav');
  856. * // using strict locator
  857. * $I->click(['link' => 'Login']);
  858. * ?>
  859. * ```
  860. *
  861. * @param $link
  862. * @param $context
  863. * @see \Codeception\Lib\InnerBrowser::click()
  864. */
  865. public function click($link, $context = null) {
  866. return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args()));
  867. }
  868. /**
  869. * [!] Method is generated. Documentation taken from corresponding module.
  870. *
  871. * Checks that the current page contains the given string (case insensitive).
  872. *
  873. * You can specify a specific HTML element (via CSS or XPath) as the second
  874. * parameter to only search within that element.
  875. *
  876. * ``` php
  877. * <?php
  878. * $I->see('Logout'); // I can suppose user is logged in
  879. * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
  880. * $I->see('Sign Up', '//body/h1'); // with XPath
  881. * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  882. * ```
  883. *
  884. * Note that the search is done after stripping all HTML tags from the body,
  885. * so `$I->see('strong')` will return true for strings like:
  886. *
  887. * - `<p>I am Stronger than thou</p>`
  888. * - `<script>document.createElement('strong');</script>`
  889. *
  890. * But will *not* be true for strings like:
  891. *
  892. * - `<strong>Home</strong>`
  893. * - `<div class="strong">Home</strong>`
  894. * - `<!-- strong -->`
  895. *
  896. * For checking the raw source code, use `seeInSource()`.
  897. *
  898. * @param string $text
  899. * @param string $selector optional
  900. * Conditional Assertion: Test won't be stopped on fail
  901. * @see \Codeception\Lib\InnerBrowser::see()
  902. */
  903. public function canSee($text, $selector = null) {
  904. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
  905. }
  906. /**
  907. * [!] Method is generated. Documentation taken from corresponding module.
  908. *
  909. * Checks that the current page contains the given string (case insensitive).
  910. *
  911. * You can specify a specific HTML element (via CSS or XPath) as the second
  912. * parameter to only search within that element.
  913. *
  914. * ``` php
  915. * <?php
  916. * $I->see('Logout'); // I can suppose user is logged in
  917. * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
  918. * $I->see('Sign Up', '//body/h1'); // with XPath
  919. * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  920. * ```
  921. *
  922. * Note that the search is done after stripping all HTML tags from the body,
  923. * so `$I->see('strong')` will return true for strings like:
  924. *
  925. * - `<p>I am Stronger than thou</p>`
  926. * - `<script>document.createElement('strong');</script>`
  927. *
  928. * But will *not* be true for strings like:
  929. *
  930. * - `<strong>Home</strong>`
  931. * - `<div class="strong">Home</strong>`
  932. * - `<!-- strong -->`
  933. *
  934. * For checking the raw source code, use `seeInSource()`.
  935. *
  936. * @param string $text
  937. * @param string $selector optional
  938. * @see \Codeception\Lib\InnerBrowser::see()
  939. */
  940. public function see($text, $selector = null) {
  941. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
  942. }
  943. /**
  944. * [!] Method is generated. Documentation taken from corresponding module.
  945. *
  946. * Checks that the current page doesn't contain the text specified (case insensitive).
  947. * Give a locator as the second parameter to match a specific region.
  948. *
  949. * ```php
  950. * <?php
  951. * $I->dontSee('Login'); // I can suppose user is already logged in
  952. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  953. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  954. * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  955. * ```
  956. *
  957. * Note that the search is done after stripping all HTML tags from the body,
  958. * so `$I->dontSee('strong')` will fail on strings like:
  959. *
  960. * - `<p>I am Stronger than thou</p>`
  961. * - `<script>document.createElement('strong');</script>`
  962. *
  963. * But will ignore strings like:
  964. *
  965. * - `<strong>Home</strong>`
  966. * - `<div class="strong">Home</strong>`
  967. * - `<!-- strong -->`
  968. *
  969. * For checking the raw source code, use `seeInSource()`.
  970. *
  971. * @param string $text
  972. * @param string $selector optional
  973. * Conditional Assertion: Test won't be stopped on fail
  974. * @see \Codeception\Lib\InnerBrowser::dontSee()
  975. */
  976. public function cantSee($text, $selector = null) {
  977. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
  978. }
  979. /**
  980. * [!] Method is generated. Documentation taken from corresponding module.
  981. *
  982. * Checks that the current page doesn't contain the text specified (case insensitive).
  983. * Give a locator as the second parameter to match a specific region.
  984. *
  985. * ```php
  986. * <?php
  987. * $I->dontSee('Login'); // I can suppose user is already logged in
  988. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  989. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  990. * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator
  991. * ```
  992. *
  993. * Note that the search is done after stripping all HTML tags from the body,
  994. * so `$I->dontSee('strong')` will fail on strings like:
  995. *
  996. * - `<p>I am Stronger than thou</p>`
  997. * - `<script>document.createElement('strong');</script>`
  998. *
  999. * But will ignore strings like:
  1000. *
  1001. * - `<strong>Home</strong>`
  1002. * - `<div class="strong">Home</strong>`
  1003. * - `<!-- strong -->`
  1004. *
  1005. * For checking the raw source code, use `seeInSource()`.
  1006. *
  1007. * @param string $text
  1008. * @param string $selector optional
  1009. * @see \Codeception\Lib\InnerBrowser::dontSee()
  1010. */
  1011. public function dontSee($text, $selector = null) {
  1012. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
  1013. }
  1014. /**
  1015. * [!] Method is generated. Documentation taken from corresponding module.
  1016. *
  1017. * Checks that the current page contains the given string in its
  1018. * raw source code.
  1019. *
  1020. * ``` php
  1021. * <?php
  1022. * $I->seeInSource('<h1>Green eggs &amp; ham</h1>');
  1023. * ```
  1024. *
  1025. * @param $raw
  1026. * Conditional Assertion: Test won't be stopped on fail
  1027. * @see \Codeception\Lib\InnerBrowser::seeInSource()
  1028. */
  1029. public function canSeeInSource($raw) {
  1030. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args()));
  1031. }
  1032. /**
  1033. * [!] Method is generated. Documentation taken from corresponding module.
  1034. *
  1035. * Checks that the current page contains the given string in its
  1036. * raw source code.
  1037. *
  1038. * ``` php
  1039. * <?php
  1040. * $I->seeInSource('<h1>Green eggs &amp; ham</h1>');
  1041. * ```
  1042. *
  1043. * @param $raw
  1044. * @see \Codeception\Lib\InnerBrowser::seeInSource()
  1045. */
  1046. public function seeInSource($raw) {
  1047. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args()));
  1048. }
  1049. /**
  1050. * [!] Method is generated. Documentation taken from corresponding module.
  1051. *
  1052. * Checks that the current page contains the given string in its
  1053. * raw source code.
  1054. *
  1055. * ```php
  1056. * <?php
  1057. * $I->dontSeeInSource('<h1>Green eggs &amp; ham</h1>');
  1058. * ```
  1059. *
  1060. * @param $raw
  1061. * Conditional Assertion: Test won't be stopped on fail
  1062. * @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
  1063. */
  1064. public function cantSeeInSource($raw) {
  1065. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args()));
  1066. }
  1067. /**
  1068. * [!] Method is generated. Documentation taken from corresponding module.
  1069. *
  1070. * Checks that the current page contains the given string in its
  1071. * raw source code.
  1072. *
  1073. * ```php
  1074. * <?php
  1075. * $I->dontSeeInSource('<h1>Green eggs &amp; ham</h1>');
  1076. * ```
  1077. *
  1078. * @param $raw
  1079. * @see \Codeception\Lib\InnerBrowser::dontSeeInSource()
  1080. */
  1081. public function dontSeeInSource($raw) {
  1082. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args()));
  1083. }
  1084. /**
  1085. * [!] Method is generated. Documentation taken from corresponding module.
  1086. *
  1087. * Checks that there's a link with the specified text.
  1088. * Give a full URL as the second parameter to match links with that exact URL.
  1089. *
  1090. * ``` php
  1091. * <?php
  1092. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  1093. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  1094. * ?>
  1095. * ```
  1096. *
  1097. * @param string $text
  1098. * @param string $url optional
  1099. * Conditional Assertion: Test won't be stopped on fail
  1100. * @see \Codeception\Lib\InnerBrowser::seeLink()
  1101. */
  1102. public function canSeeLink($text, $url = null) {
  1103. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
  1104. }
  1105. /**
  1106. * [!] Method is generated. Documentation taken from corresponding module.
  1107. *
  1108. * Checks that there's a link with the specified text.
  1109. * Give a full URL as the second parameter to match links with that exact URL.
  1110. *
  1111. * ``` php
  1112. * <?php
  1113. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  1114. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  1115. * ?>
  1116. * ```
  1117. *
  1118. * @param string $text
  1119. * @param string $url optional
  1120. * @see \Codeception\Lib\InnerBrowser::seeLink()
  1121. */
  1122. public function seeLink($text, $url = null) {
  1123. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
  1124. }
  1125. /**
  1126. * [!] Method is generated. Documentation taken from corresponding module.
  1127. *
  1128. * Checks that the page doesn't contain a link with the given string.
  1129. * If the second parameter is given, only links with a matching "href" attribute will be checked.
  1130. *
  1131. * ``` php
  1132. * <?php
  1133. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  1134. * $I->dontSeeLink('Checkout now', '/store/cart.php');
  1135. * ?>
  1136. * ```
  1137. *
  1138. * @param string $text
  1139. * @param string $url optional
  1140. * Conditional Assertion: Test won't be stopped on fail
  1141. * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
  1142. */
  1143. public function cantSeeLink($text, $url = null) {
  1144. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
  1145. }
  1146. /**
  1147. * [!] Method is generated. Documentation taken from corresponding module.
  1148. *
  1149. * Checks that the page doesn't contain a link with the given string.
  1150. * If the second parameter is given, only links with a matching "href" attribute will be checked.
  1151. *
  1152. * ``` php
  1153. * <?php
  1154. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  1155. * $I->dontSeeLink('Checkout now', '/store/cart.php');
  1156. * ?>
  1157. * ```
  1158. *
  1159. * @param string $text
  1160. * @param string $url optional
  1161. * @see \Codeception\Lib\InnerBrowser::dontSeeLink()
  1162. */
  1163. public function dontSeeLink($text, $url = null) {
  1164. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
  1165. }
  1166. /**
  1167. * [!] Method is generated. Documentation taken from corresponding module.
  1168. *
  1169. * Checks that current URI contains the given string.
  1170. *
  1171. * ``` php
  1172. * <?php
  1173. * // to match: /home/dashboard
  1174. * $I->seeInCurrentUrl('home');
  1175. * // to match: /users/1
  1176. * $I->seeInCurrentUrl('/users/');
  1177. * ?>
  1178. * ```
  1179. *
  1180. * @param string $uri
  1181. * Conditional Assertion: Test won't be stopped on fail
  1182. * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
  1183. */
  1184. public function canSeeInCurrentUrl($uri) {
  1185. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
  1186. }
  1187. /**
  1188. * [!] Method is generated. Documentation taken from corresponding module.
  1189. *
  1190. * Checks that current URI contains the given string.
  1191. *
  1192. * ``` php
  1193. * <?php
  1194. * // to match: /home/dashboard
  1195. * $I->seeInCurrentUrl('home');
  1196. * // to match: /users/1
  1197. * $I->seeInCurrentUrl('/users/');
  1198. * ?>
  1199. * ```
  1200. *
  1201. * @param string $uri
  1202. * @see \Codeception\Lib\InnerBrowser::seeInCurrentUrl()
  1203. */
  1204. public function seeInCurrentUrl($uri) {
  1205. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
  1206. }
  1207. /**
  1208. * [!] Method is generated. Documentation taken from corresponding module.
  1209. *
  1210. * Checks that the current URI doesn't contain the given string.
  1211. *
  1212. * ``` php
  1213. * <?php
  1214. * $I->dontSeeInCurrentUrl('/users/');
  1215. * ?>
  1216. * ```
  1217. *
  1218. * @param string $uri
  1219. * Conditional Assertion: Test won't be stopped on fail
  1220. * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
  1221. */
  1222. public function cantSeeInCurrentUrl($uri) {
  1223. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
  1224. }
  1225. /**
  1226. * [!] Method is generated. Documentation taken from corresponding module.
  1227. *
  1228. * Checks that the current URI doesn't contain the given string.
  1229. *
  1230. * ``` php
  1231. * <?php
  1232. * $I->dontSeeInCurrentUrl('/users/');
  1233. * ?>
  1234. * ```
  1235. *
  1236. * @param string $uri
  1237. * @see \Codeception\Lib\InnerBrowser::dontSeeInCurrentUrl()
  1238. */
  1239. public function dontSeeInCurrentUrl($uri) {
  1240. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
  1241. }
  1242. /**
  1243. * [!] Method is generated. Documentation taken from corresponding module.
  1244. *
  1245. * Checks that the current URL is equal to the given string.
  1246. * Unlike `seeInCurrentUrl`, this only matches the full URL.
  1247. *
  1248. * ``` php
  1249. * <?php
  1250. * // to match root url
  1251. * $I->seeCurrentUrlEquals('/');
  1252. * ?>
  1253. * ```
  1254. *
  1255. * @param string $uri
  1256. * Conditional Assertion: Test won't be stopped on fail
  1257. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
  1258. */
  1259. public function canSeeCurrentUrlEquals($uri) {
  1260. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
  1261. }
  1262. /**
  1263. * [!] Method is generated. Documentation taken from corresponding module.
  1264. *
  1265. * Checks that the current URL is equal to the given string.
  1266. * Unlike `seeInCurrentUrl`, this only matches the full URL.
  1267. *
  1268. * ``` php
  1269. * <?php
  1270. * // to match root url
  1271. * $I->seeCurrentUrlEquals('/');
  1272. * ?>
  1273. * ```
  1274. *
  1275. * @param string $uri
  1276. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlEquals()
  1277. */
  1278. public function seeCurrentUrlEquals($uri) {
  1279. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
  1280. }
  1281. /**
  1282. * [!] Method is generated. Documentation taken from corresponding module.
  1283. *
  1284. * Checks that the current URL doesn't equal the given string.
  1285. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
  1286. *
  1287. * ``` php
  1288. * <?php
  1289. * // current url is not root
  1290. * $I->dontSeeCurrentUrlEquals('/');
  1291. * ?>
  1292. * ```
  1293. *
  1294. * @param string $uri
  1295. * Conditional Assertion: Test won't be stopped on fail
  1296. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
  1297. */
  1298. public function cantSeeCurrentUrlEquals($uri) {
  1299. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
  1300. }
  1301. /**
  1302. * [!] Method is generated. Documentation taken from corresponding module.
  1303. *
  1304. * Checks that the current URL doesn't equal the given string.
  1305. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
  1306. *
  1307. * ``` php
  1308. * <?php
  1309. * // current url is not root
  1310. * $I->dontSeeCurrentUrlEquals('/');
  1311. * ?>
  1312. * ```
  1313. *
  1314. * @param string $uri
  1315. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlEquals()
  1316. */
  1317. public function dontSeeCurrentUrlEquals($uri) {
  1318. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
  1319. }
  1320. /**
  1321. * [!] Method is generated. Documentation taken from corresponding module.
  1322. *
  1323. * Checks that the current URL matches the given regular expression.
  1324. *
  1325. * ``` php
  1326. * <?php
  1327. * // to match root url
  1328. * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
  1329. * ?>
  1330. * ```
  1331. *
  1332. * @param string $uri
  1333. * Conditional Assertion: Test won't be stopped on fail
  1334. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
  1335. */
  1336. public function canSeeCurrentUrlMatches($uri) {
  1337. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
  1338. }
  1339. /**
  1340. * [!] Method is generated. Documentation taken from corresponding module.
  1341. *
  1342. * Checks that the current URL matches the given regular expression.
  1343. *
  1344. * ``` php
  1345. * <?php
  1346. * // to match root url
  1347. * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
  1348. * ?>
  1349. * ```
  1350. *
  1351. * @param string $uri
  1352. * @see \Codeception\Lib\InnerBrowser::seeCurrentUrlMatches()
  1353. */
  1354. public function seeCurrentUrlMatches($uri) {
  1355. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
  1356. }
  1357. /**
  1358. * [!] Method is generated. Documentation taken from corresponding module.
  1359. *
  1360. * Checks that current url doesn't match the given regular expression.
  1361. *
  1362. * ``` php
  1363. * <?php
  1364. * // to match root url
  1365. * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
  1366. * ?>
  1367. * ```
  1368. *
  1369. * @param string $uri
  1370. * Conditional Assertion: Test won't be stopped on fail
  1371. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
  1372. */
  1373. public function cantSeeCurrentUrlMatches($uri) {
  1374. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
  1375. }
  1376. /**
  1377. * [!] Method is generated. Documentation taken from corresponding module.
  1378. *
  1379. * Checks that current url doesn't match the given regular expression.
  1380. *
  1381. * ``` php
  1382. * <?php
  1383. * // to match root url
  1384. * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
  1385. * ?>
  1386. * ```
  1387. *
  1388. * @param string $uri
  1389. * @see \Codeception\Lib\InnerBrowser::dontSeeCurrentUrlMatches()
  1390. */
  1391. public function dontSeeCurrentUrlMatches($uri) {
  1392. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
  1393. }
  1394. /**
  1395. * [!] Method is generated. Documentation taken from corresponding module.
  1396. *
  1397. * Executes the given regular expression against the current URI and returns the first capturing group.
  1398. * If no parameters are provided, the full URI is returned.
  1399. *
  1400. * ``` php
  1401. * <?php
  1402. * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
  1403. * $uri = $I->grabFromCurrentUrl();
  1404. * ?>
  1405. * ```
  1406. *
  1407. * @param string $uri optional
  1408. *
  1409. * @return mixed
  1410. * @see \Codeception\Lib\InnerBrowser::grabFromCurrentUrl()
  1411. */
  1412. public function grabFromCurrentUrl($uri = null) {
  1413. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
  1414. }
  1415. /**
  1416. * [!] Method is generated. Documentation taken from corresponding module.
  1417. *
  1418. * Checks that the specified checkbox is checked.
  1419. *
  1420. * ``` php
  1421. * <?php
  1422. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  1423. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  1424. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  1425. * ?>
  1426. * ```
  1427. *
  1428. * @param $checkbox
  1429. * Conditional Assertion: Test won't be stopped on fail
  1430. * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
  1431. */
  1432. public function canSeeCheckboxIsChecked($checkbox) {
  1433. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
  1434. }
  1435. /**
  1436. * [!] Method is generated. Documentation taken from corresponding module.
  1437. *
  1438. * Checks that the specified checkbox is checked.
  1439. *
  1440. * ``` php
  1441. * <?php
  1442. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  1443. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  1444. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  1445. * ?>
  1446. * ```
  1447. *
  1448. * @param $checkbox
  1449. * @see \Codeception\Lib\InnerBrowser::seeCheckboxIsChecked()
  1450. */
  1451. public function seeCheckboxIsChecked($checkbox) {
  1452. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
  1453. }
  1454. /**
  1455. * [!] Method is generated. Documentation taken from corresponding module.
  1456. *
  1457. * Check that the specified checkbox is unchecked.
  1458. *
  1459. * ``` php
  1460. * <?php
  1461. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  1462. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  1463. * ?>
  1464. * ```
  1465. *
  1466. * @param $checkbox
  1467. * Conditional Assertion: Test won't be stopped on fail
  1468. * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
  1469. */
  1470. public function cantSeeCheckboxIsChecked($checkbox) {
  1471. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
  1472. }
  1473. /**
  1474. * [!] Method is generated. Documentation taken from corresponding module.
  1475. *
  1476. * Check that the specified checkbox is unchecked.
  1477. *
  1478. * ``` php
  1479. * <?php
  1480. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  1481. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  1482. * ?>
  1483. * ```
  1484. *
  1485. * @param $checkbox
  1486. * @see \Codeception\Lib\InnerBrowser::dontSeeCheckboxIsChecked()
  1487. */
  1488. public function dontSeeCheckboxIsChecked($checkbox) {
  1489. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
  1490. }
  1491. /**
  1492. * [!] Method is generated. Documentation taken from corresponding module.
  1493. *
  1494. * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value.
  1495. * Fields are matched by label text, the "name" attribute, CSS, or XPath.
  1496. *
  1497. * ``` php
  1498. * <?php
  1499. * $I->seeInField('Body','Type your comment here');
  1500. * $I->seeInField('form textarea[name=body]','Type your comment here');
  1501. * $I->seeInField('form input[type=hidden]','hidden_value');
  1502. * $I->seeInField('#searchform input','Search');
  1503. * $I->seeInField('//form/*[@name=search]','Search');
  1504. * $I->seeInField(['name' => 'search'], 'Search');
  1505. * ?>
  1506. * ```
  1507. *
  1508. * @param $field
  1509. * @param $value
  1510. * Conditional Assertion: Test won't be stopped on fail
  1511. * @see \Codeception\Lib\InnerBrowser::seeInField()
  1512. */
  1513. public function canSeeInField($field, $value) {
  1514. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
  1515. }
  1516. /**
  1517. * [!] Method is generated. Documentation taken from corresponding module.
  1518. *
  1519. * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value.
  1520. * Fields are matched by label text, the "name" attribute, CSS, or XPath.
  1521. *
  1522. * ``` php
  1523. * <?php
  1524. * $I->seeInField('Body','Type your comment here');
  1525. * $I->seeInField('form textarea[name=body]','Type your comment here');
  1526. * $I->seeInField('form input[type=hidden]','hidden_value');
  1527. * $I->seeInField('#searchform input','Search');
  1528. * $I->seeInField('//form/*[@name=search]','Search');
  1529. * $I->seeInField(['name' => 'search'], 'Search');
  1530. * ?>
  1531. * ```
  1532. *
  1533. * @param $field
  1534. * @param $value
  1535. * @see \Codeception\Lib\InnerBrowser::seeInField()
  1536. */
  1537. public function seeInField($field, $value) {
  1538. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
  1539. }
  1540. /**
  1541. * [!] Method is generated. Documentation taken from corresponding module.
  1542. *
  1543. * Checks that an input field or textarea doesn't contain the given value.
  1544. * For fuzzy locators, the field is matched by label text, CSS and XPath.
  1545. *
  1546. * ``` php
  1547. * <?php
  1548. * $I->dontSeeInField('Body','Type your comment here');
  1549. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1550. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1551. * $I->dontSeeInField('#searchform input','Search');
  1552. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1553. * $I->dontSeeInField(['name' => 'search'], 'Search');
  1554. * ?>
  1555. * ```
  1556. *
  1557. * @param $field
  1558. * @param $value
  1559. * Conditional Assertion: Test won't be stopped on fail
  1560. * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
  1561. */
  1562. public function cantSeeInField($field, $value) {
  1563. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
  1564. }
  1565. /**
  1566. * [!] Method is generated. Documentation taken from corresponding module.
  1567. *
  1568. * Checks that an input field or textarea doesn't contain the given value.
  1569. * For fuzzy locators, the field is matched by label text, CSS and XPath.
  1570. *
  1571. * ``` php
  1572. * <?php
  1573. * $I->dontSeeInField('Body','Type your comment here');
  1574. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1575. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1576. * $I->dontSeeInField('#searchform input','Search');
  1577. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1578. * $I->dontSeeInField(['name' => 'search'], 'Search');
  1579. * ?>
  1580. * ```
  1581. *
  1582. * @param $field
  1583. * @param $value
  1584. * @see \Codeception\Lib\InnerBrowser::dontSeeInField()
  1585. */
  1586. public function dontSeeInField($field, $value) {
  1587. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
  1588. }
  1589. /**
  1590. * [!] Method is generated. Documentation taken from corresponding module.
  1591. *
  1592. * Checks if the array of form parameters (name => value) are set on the form matched with the
  1593. * passed selector.
  1594. *
  1595. * ``` php
  1596. * <?php
  1597. * $I->seeInFormFields('form[name=myform]', [
  1598. * 'input1' => 'value',
  1599. * 'input2' => 'other value',
  1600. * ]);
  1601. * ?>
  1602. * ```
  1603. *
  1604. * For multi-select elements, or to check values of multiple elements with the same name, an
  1605. * array may be passed:
  1606. *
  1607. * ``` php
  1608. * <?php
  1609. * $I->seeInFormFields('.form-class', [
  1610. * 'multiselect' => [
  1611. * 'value1',
  1612. * 'value2',
  1613. * ],
  1614. * 'checkbox[]' => [
  1615. * 'a checked value',
  1616. * 'another checked value',
  1617. * ],
  1618. * ]);
  1619. * ?>
  1620. * ```
  1621. *
  1622. * Additionally, checkbox values can be checked with a boolean.
  1623. *
  1624. * ``` php
  1625. * <?php
  1626. * $I->seeInFormFields('#form-id', [
  1627. * 'checkbox1' => true, // passes if checked
  1628. * 'checkbox2' => false, // passes if unchecked
  1629. * ]);
  1630. * ?>
  1631. * ```
  1632. *
  1633. * Pair this with submitForm for quick testing magic.
  1634. *
  1635. * ``` php
  1636. * <?php
  1637. * $form = [
  1638. * 'field1' => 'value',
  1639. * 'field2' => 'another value',
  1640. * 'checkbox1' => true,
  1641. * // ...
  1642. * ];
  1643. * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
  1644. * // $I->amOnPage('/path/to/form-page') may be needed
  1645. * $I->seeInFormFields('//form[@id=my-form]', $form);
  1646. * ?>
  1647. * ```
  1648. *
  1649. * @param $formSelector
  1650. * @param $params
  1651. * Conditional Assertion: Test won't be stopped on fail
  1652. * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
  1653. */
  1654. public function canSeeInFormFields($formSelector, $params) {
  1655. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args()));
  1656. }
  1657. /**
  1658. * [!] Method is generated. Documentation taken from corresponding module.
  1659. *
  1660. * Checks if the array of form parameters (name => value) are set on the form matched with the
  1661. * passed selector.
  1662. *
  1663. * ``` php
  1664. * <?php
  1665. * $I->seeInFormFields('form[name=myform]', [
  1666. * 'input1' => 'value',
  1667. * 'input2' => 'other value',
  1668. * ]);
  1669. * ?>
  1670. * ```
  1671. *
  1672. * For multi-select elements, or to check values of multiple elements with the same name, an
  1673. * array may be passed:
  1674. *
  1675. * ``` php
  1676. * <?php
  1677. * $I->seeInFormFields('.form-class', [
  1678. * 'multiselect' => [
  1679. * 'value1',
  1680. * 'value2',
  1681. * ],
  1682. * 'checkbox[]' => [
  1683. * 'a checked value',
  1684. * 'another checked value',
  1685. * ],
  1686. * ]);
  1687. * ?>
  1688. * ```
  1689. *
  1690. * Additionally, checkbox values can be checked with a boolean.
  1691. *
  1692. * ``` php
  1693. * <?php
  1694. * $I->seeInFormFields('#form-id', [
  1695. * 'checkbox1' => true, // passes if checked
  1696. * 'checkbox2' => false, // passes if unchecked
  1697. * ]);
  1698. * ?>
  1699. * ```
  1700. *
  1701. * Pair this with submitForm for quick testing magic.
  1702. *
  1703. * ``` php
  1704. * <?php
  1705. * $form = [
  1706. * 'field1' => 'value',
  1707. * 'field2' => 'another value',
  1708. * 'checkbox1' => true,
  1709. * // ...
  1710. * ];
  1711. * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
  1712. * // $I->amOnPage('/path/to/form-page') may be needed
  1713. * $I->seeInFormFields('//form[@id=my-form]', $form);
  1714. * ?>
  1715. * ```
  1716. *
  1717. * @param $formSelector
  1718. * @param $params
  1719. * @see \Codeception\Lib\InnerBrowser::seeInFormFields()
  1720. */
  1721. public function seeInFormFields($formSelector, $params) {
  1722. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args()));
  1723. }
  1724. /**
  1725. * [!] Method is generated. Documentation taken from corresponding module.
  1726. *
  1727. * Checks if the array of form parameters (name => value) are not set on the form matched with
  1728. * the passed selector.
  1729. *
  1730. * ``` php
  1731. * <?php
  1732. * $I->dontSeeInFormFields('form[name=myform]', [
  1733. * 'input1' => 'non-existent value',
  1734. * 'input2' => 'other non-existent value',
  1735. * ]);
  1736. * ?>
  1737. * ```
  1738. *
  1739. * To check that an element hasn't been assigned any one of many values, an array can be passed
  1740. * as the value:
  1741. *
  1742. * ``` php
  1743. * <?php
  1744. * $I->dontSeeInFormFields('.form-class', [
  1745. * 'fieldName' => [
  1746. * 'This value shouldn\'t be set',
  1747. * 'And this value shouldn\'t be set',
  1748. * ],
  1749. * ]);
  1750. * ?>
  1751. * ```
  1752. *
  1753. * Additionally, checkbox values can be checked with a boolean.
  1754. *
  1755. * ``` php
  1756. * <?php
  1757. * $I->dontSeeInFormFields('#form-id', [
  1758. * 'checkbox1' => true, // fails if checked
  1759. * 'checkbox2' => false, // fails if unchecked
  1760. * ]);
  1761. * ?>
  1762. * ```
  1763. *
  1764. * @param $formSelector
  1765. * @param $params
  1766. * Conditional Assertion: Test won't be stopped on fail
  1767. * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
  1768. */
  1769. public function cantSeeInFormFields($formSelector, $params) {
  1770. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args()));
  1771. }
  1772. /**
  1773. * [!] Method is generated. Documentation taken from corresponding module.
  1774. *
  1775. * Checks if the array of form parameters (name => value) are not set on the form matched with
  1776. * the passed selector.
  1777. *
  1778. * ``` php
  1779. * <?php
  1780. * $I->dontSeeInFormFields('form[name=myform]', [
  1781. * 'input1' => 'non-existent value',
  1782. * 'input2' => 'other non-existent value',
  1783. * ]);
  1784. * ?>
  1785. * ```
  1786. *
  1787. * To check that an element hasn't been assigned any one of many values, an array can be passed
  1788. * as the value:
  1789. *
  1790. * ``` php
  1791. * <?php
  1792. * $I->dontSeeInFormFields('.form-class', [
  1793. * 'fieldName' => [
  1794. * 'This value shouldn\'t be set',
  1795. * 'And this value shouldn\'t be set',
  1796. * ],
  1797. * ]);
  1798. * ?>
  1799. * ```
  1800. *
  1801. * Additionally, checkbox values can be checked with a boolean.
  1802. *
  1803. * ``` php
  1804. * <?php
  1805. * $I->dontSeeInFormFields('#form-id', [
  1806. * 'checkbox1' => true, // fails if checked
  1807. * 'checkbox2' => false, // fails if unchecked
  1808. * ]);
  1809. * ?>
  1810. * ```
  1811. *
  1812. * @param $formSelector
  1813. * @param $params
  1814. * @see \Codeception\Lib\InnerBrowser::dontSeeInFormFields()
  1815. */
  1816. public function dontSeeInFormFields($formSelector, $params) {
  1817. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args()));
  1818. }
  1819. /**
  1820. * [!] Method is generated. Documentation taken from corresponding module.
  1821. *
  1822. * Submits the given form on the page, with the given form
  1823. * values. Pass the form field's values as an array in the second
  1824. * parameter.
  1825. *
  1826. * Although this function can be used as a short-hand version of
  1827. * `fillField()`, `selectOption()`, `click()` etc. it has some important
  1828. * differences:
  1829. *
  1830. * * Only field *names* may be used, not CSS/XPath selectors nor field labels
  1831. * * If a field is sent to this function that does *not* exist on the page,
  1832. * it will silently be added to the HTTP request. This is helpful for testing
  1833. * some types of forms, but be aware that you will *not* get an exception
  1834. * like you would if you called `fillField()` or `selectOption()` with
  1835. * a missing field.
  1836. *
  1837. * Fields that are not provided will be filled by their values from the page,
  1838. * or from any previous calls to `fillField()`, `selectOption()` etc.
  1839. * You don't need to click the 'Submit' button afterwards.
  1840. * This command itself triggers the request to form's action.
  1841. *
  1842. * You can optionally specify which button's value to include
  1843. * in the request with the last parameter (as an alternative to
  1844. * explicitly setting its value in the second parameter), as
  1845. * button values are not otherwise included in the request.
  1846. *
  1847. * Examples:
  1848. *
  1849. * ``` php
  1850. * <?php
  1851. * $I->submitForm('#login', [
  1852. * 'login' => 'davert',
  1853. * 'password' => '123456'
  1854. * ]);
  1855. * // or
  1856. * $I->submitForm('#login', [
  1857. * 'login' => 'davert',
  1858. * 'password' => '123456'
  1859. * ], 'submitButtonName');
  1860. *
  1861. * ```
  1862. *
  1863. * For example, given this sample "Sign Up" form:
  1864. *
  1865. * ``` html
  1866. * <form action="/sign_up">
  1867. * Login:
  1868. * <input type="text" name="user[login]" /><br/>
  1869. * Password:
  1870. * <input type="password" name="user[password]" /><br/>
  1871. * Do you agree to our terms?
  1872. * <input type="checkbox" name="user[agree]" /><br/>
  1873. * Select pricing plan:
  1874. * <select name="plan">
  1875. * <option value="1">Free</option>
  1876. * <option value="2" selected="selected">Paid</option>
  1877. * </select>
  1878. * <input type="submit" name="submitButton" value="Submit" />
  1879. * </form>
  1880. * ```
  1881. *
  1882. * You could write the following to submit it:
  1883. *
  1884. * ``` php
  1885. * <?php
  1886. * $I->submitForm(
  1887. * '#userForm',
  1888. * [
  1889. * 'user' => [
  1890. * 'login' => 'Davert',
  1891. * 'password' => '123456',
  1892. * 'agree' => true
  1893. * ]
  1894. * ],
  1895. * 'submitButton'
  1896. * );
  1897. * ```
  1898. * Note that "2" will be the submitted value for the "plan" field, as it is
  1899. * the selected option.
  1900. *
  1901. * You can also emulate a JavaScript submission by not specifying any
  1902. * buttons in the third parameter to submitForm.
  1903. *
  1904. * ```php
  1905. * <?php
  1906. * $I->submitForm(
  1907. * '#userForm',
  1908. * [
  1909. * 'user' => [
  1910. * 'login' => 'Davert',
  1911. * 'password' => '123456',
  1912. * 'agree' => true
  1913. * ]
  1914. * ]
  1915. * );
  1916. * ```
  1917. *
  1918. * This function works well when paired with `seeInFormFields()`
  1919. * for quickly testing CRUD interfaces and form validation logic.
  1920. *
  1921. * ``` php
  1922. * <?php
  1923. * $form = [
  1924. * 'field1' => 'value',
  1925. * 'field2' => 'another value',
  1926. * 'checkbox1' => true,
  1927. * // ...
  1928. * ];
  1929. * $I->submitForm('#my-form', $form, 'submitButton');
  1930. * // $I->amOnPage('/path/to/form-page') may be needed
  1931. * $I->seeInFormFields('#my-form', $form);
  1932. * ```
  1933. *
  1934. * Parameter values can be set to arrays for multiple input fields
  1935. * of the same name, or multi-select combo boxes. For checkboxes,
  1936. * you can use either the string value or boolean `true`/`false` which will
  1937. * be replaced by the checkbox's value in the DOM.
  1938. *
  1939. * ``` php
  1940. * <?php
  1941. * $I->submitForm('#my-form', [
  1942. * 'field1' => 'value',
  1943. * 'checkbox' => [
  1944. * 'value of first checkbox',
  1945. * 'value of second checkbox',
  1946. * ],
  1947. * 'otherCheckboxes' => [
  1948. * true,
  1949. * false,
  1950. * false
  1951. * ],
  1952. * 'multiselect' => [
  1953. * 'first option value',
  1954. * 'second option value'
  1955. * ]
  1956. * ]);
  1957. * ```
  1958. *
  1959. * Mixing string and boolean values for a checkbox's value is not supported
  1960. * and may produce unexpected results.
  1961. *
  1962. * Field names ending in `[]` must be passed without the trailing square
  1963. * bracket characters, and must contain an array for its value. This allows
  1964. * submitting multiple values with the same name, consider:
  1965. *
  1966. * ```php
  1967. * <?php
  1968. * // This will NOT work correctly
  1969. * $I->submitForm('#my-form', [
  1970. * 'field[]' => 'value',
  1971. * 'field[]' => 'another value', // 'field[]' is already a defined key
  1972. * ]);
  1973. * ```
  1974. *
  1975. * The solution is to pass an array value:
  1976. *
  1977. * ```php
  1978. * <?php
  1979. * // This way both values are submitted
  1980. * $I->submitForm('#my-form', [
  1981. * 'field' => [
  1982. * 'value',
  1983. * 'another value',
  1984. * ]
  1985. * ]);
  1986. * ```
  1987. *
  1988. * @param $selector
  1989. * @param $params
  1990. * @param $button
  1991. * @see \Codeception\Lib\InnerBrowser::submitForm()
  1992. */
  1993. public function submitForm($selector, $params, $button = null) {
  1994. return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
  1995. }
  1996. /**
  1997. * [!] Method is generated. Documentation taken from corresponding module.
  1998. *
  1999. * Fills a text field or textarea with the given string.
  2000. *
  2001. * ``` php
  2002. * <?php
  2003. * $I->fillField("//input[@type='text']", "Hello World!");
  2004. * $I->fillField(['name' => 'email'], 'jon@mail.com');
  2005. * ?>
  2006. * ```
  2007. *
  2008. * @param $field
  2009. * @param $value
  2010. * @see \Codeception\Lib\InnerBrowser::fillField()
  2011. */
  2012. public function fillField($field, $value) {
  2013. return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
  2014. }
  2015. /**
  2016. * [!] Method is generated. Documentation taken from corresponding module.
  2017. *
  2018. * Selects an option in a select tag or in radio button group.
  2019. *
  2020. * ``` php
  2021. * <?php
  2022. * $I->selectOption('form select[name=account]', 'Premium');
  2023. * $I->selectOption('form input[name=payment]', 'Monthly');
  2024. * $I->selectOption('//form/select[@name=account]', 'Monthly');
  2025. * ?>
  2026. * ```
  2027. *
  2028. * Provide an array for the second argument to select multiple options:
  2029. *
  2030. * ``` php
  2031. * <?php
  2032. * $I->selectOption('Which OS do you use?', array('Windows','Linux'));
  2033. * ?>
  2034. * ```
  2035. *
  2036. * Or provide an associative array for the second argument to specifically define which selection method should be used:
  2037. *
  2038. * ``` php
  2039. * <?php
  2040. * $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows'
  2041. * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows'
  2042. * ?>
  2043. * ```
  2044. *
  2045. * @param $select
  2046. * @param $option
  2047. * @see \Codeception\Lib\InnerBrowser::selectOption()
  2048. */
  2049. public function selectOption($select, $option) {
  2050. return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
  2051. }
  2052. /**
  2053. * [!] Method is generated. Documentation taken from corresponding module.
  2054. *
  2055. * Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
  2056. *
  2057. * ``` php
  2058. * <?php
  2059. * $I->checkOption('#agree');
  2060. * ?>
  2061. * ```
  2062. *
  2063. * @param $option
  2064. * @see \Codeception\Lib\InnerBrowser::checkOption()
  2065. */
  2066. public function checkOption($option) {
  2067. return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
  2068. }
  2069. /**
  2070. * [!] Method is generated. Documentation taken from corresponding module.
  2071. *
  2072. * Unticks a checkbox.
  2073. *
  2074. * ``` php
  2075. * <?php
  2076. * $I->uncheckOption('#notify');
  2077. * ?>
  2078. * ```
  2079. *
  2080. * @param $option
  2081. * @see \Codeception\Lib\InnerBrowser::uncheckOption()
  2082. */
  2083. public function uncheckOption($option) {
  2084. return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
  2085. }
  2086. /**
  2087. * [!] Method is generated. Documentation taken from corresponding module.
  2088. *
  2089. * Attaches a file relative to the Codeception `_data` directory to the given file upload field.
  2090. *
  2091. * ``` php
  2092. * <?php
  2093. * // file is stored in 'tests/_data/prices.xls'
  2094. * $I->attachFile('input[@type="file"]', 'prices.xls');
  2095. * ?>
  2096. * ```
  2097. *
  2098. * @param $field
  2099. * @param $filename
  2100. * @see \Codeception\Lib\InnerBrowser::attachFile()
  2101. */
  2102. public function attachFile($field, $filename) {
  2103. return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
  2104. }
  2105. /**
  2106. * [!] Method is generated. Documentation taken from corresponding module.
  2107. *
  2108. * If your page triggers an ajax request, you can perform it manually.
  2109. * This action sends a GET ajax request with specified params.
  2110. *
  2111. * See ->sendAjaxPostRequest for examples.
  2112. *
  2113. * @param $uri
  2114. * @param $params
  2115. * @see \Codeception\Lib\InnerBrowser::sendAjaxGetRequest()
  2116. */
  2117. public function sendAjaxGetRequest($uri, $params = null) {
  2118. return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxGetRequest', func_get_args()));
  2119. }
  2120. /**
  2121. * [!] Method is generated. Documentation taken from corresponding module.
  2122. *
  2123. * If your page triggers an ajax request, you can perform it manually.
  2124. * This action sends a POST ajax request with specified params.
  2125. * Additional params can be passed as array.
  2126. *
  2127. * Example:
  2128. *
  2129. * Imagine that by clicking checkbox you trigger ajax request which updates user settings.
  2130. * We emulate that click by running this ajax request manually.
  2131. *
  2132. * ``` php
  2133. * <?php
  2134. * $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST
  2135. * $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET
  2136. *
  2137. * ```
  2138. *
  2139. * @param $uri
  2140. * @param $params
  2141. * @see \Codeception\Lib\InnerBrowser::sendAjaxPostRequest()
  2142. */
  2143. public function sendAjaxPostRequest($uri, $params = null) {
  2144. return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxPostRequest', func_get_args()));
  2145. }
  2146. /**
  2147. * [!] Method is generated. Documentation taken from corresponding module.
  2148. *
  2149. * If your page triggers an ajax request, you can perform it manually.
  2150. * This action sends an ajax request with specified method and params.
  2151. *
  2152. * Example:
  2153. *
  2154. * You need to perform an ajax request specifying the HTTP method.
  2155. *
  2156. * ``` php
  2157. * <?php
  2158. * $I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title'));
  2159. *
  2160. * ```
  2161. *
  2162. * @param $method
  2163. * @param $uri
  2164. * @param $params
  2165. * @see \Codeception\Lib\InnerBrowser::sendAjaxRequest()
  2166. */
  2167. public function sendAjaxRequest($method, $uri, $params = null) {
  2168. return $this->getScenario()->runStep(new \Codeception\Step\Action('sendAjaxRequest', func_get_args()));
  2169. }
  2170. /**
  2171. * [!] Method is generated. Documentation taken from corresponding module.
  2172. *
  2173. * Finds and returns the text contents of the given element.
  2174. * If a fuzzy locator is used, the element is found using CSS, XPath,
  2175. * and by matching the full page source by regular expression.
  2176. *
  2177. * ``` php
  2178. * <?php
  2179. * $heading = $I->grabTextFrom('h1');
  2180. * $heading = $I->grabTextFrom('descendant-or-self::h1');
  2181. * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex
  2182. * ?>
  2183. * ```
  2184. *
  2185. * @param $cssOrXPathOrRegex
  2186. *
  2187. * @return mixed
  2188. * @see \Codeception\Lib\InnerBrowser::grabTextFrom()
  2189. */
  2190. public function grabTextFrom($cssOrXPathOrRegex) {
  2191. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
  2192. }
  2193. /**
  2194. * [!] Method is generated. Documentation taken from corresponding module.
  2195. *
  2196. * Grabs the value of the given attribute value from the given element.
  2197. * Fails if element is not found.
  2198. *
  2199. * ``` php
  2200. * <?php
  2201. * $I->grabAttributeFrom('#tooltip', 'title');
  2202. * ?>
  2203. * ```
  2204. *
  2205. *
  2206. * @param $cssOrXpath
  2207. * @param $attribute
  2208. *
  2209. * @return mixed
  2210. * @see \Codeception\Lib\InnerBrowser::grabAttributeFrom()
  2211. */
  2212. public function grabAttributeFrom($cssOrXpath, $attribute) {
  2213. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
  2214. }
  2215. /**
  2216. * [!] Method is generated. Documentation taken from corresponding module.
  2217. *
  2218. * Grabs either the text content, or attribute values, of nodes
  2219. * matched by $cssOrXpath and returns them as an array.
  2220. *
  2221. * ```html
  2222. * <a href="#first">First</a>
  2223. * <a href="#second">Second</a>
  2224. * <a href="#third">Third</a>
  2225. * ```
  2226. *
  2227. * ```php
  2228. * <?php
  2229. * // would return ['First', 'Second', 'Third']
  2230. * $aLinkText = $I->grabMultiple('a');
  2231. *
  2232. * // would return ['#first', '#second', '#third']
  2233. * $aLinks = $I->grabMultiple('a', 'href');
  2234. * ?>
  2235. * ```
  2236. *
  2237. * @param $cssOrXpath
  2238. * @param $attribute
  2239. * @return string[]
  2240. * @see \Codeception\Lib\InnerBrowser::grabMultiple()
  2241. */
  2242. public function grabMultiple($cssOrXpath, $attribute = null) {
  2243. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args()));
  2244. }
  2245. /**
  2246. * [!] Method is generated. Documentation taken from corresponding module.
  2247. *
  2248. * @param $field
  2249. *
  2250. * @return array|mixed|null|string
  2251. * @see \Codeception\Lib\InnerBrowser::grabValueFrom()
  2252. */
  2253. public function grabValueFrom($field) {
  2254. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
  2255. }
  2256. /**
  2257. * [!] Method is generated. Documentation taken from corresponding module.
  2258. *
  2259. * Sets a cookie with the given name and value.
  2260. * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
  2261. *
  2262. * ``` php
  2263. * <?php
  2264. * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
  2265. * ?>
  2266. * ```
  2267. *
  2268. * @param $name
  2269. * @param $val
  2270. * @param array $params
  2271. *
  2272. * @return mixed
  2273. * @see \Codeception\Lib\InnerBrowser::setCookie()
  2274. */
  2275. public function setCookie($name, $val, $params = null) {
  2276. return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
  2277. }
  2278. /**
  2279. * [!] Method is generated. Documentation taken from corresponding module.
  2280. *
  2281. * Grabs a cookie value.
  2282. * You can set additional cookie params like `domain`, `path` in array passed as last argument.
  2283. *
  2284. * @param $cookie
  2285. *
  2286. * @param array $params
  2287. * @return mixed
  2288. * @see \Codeception\Lib\InnerBrowser::grabCookie()
  2289. */
  2290. public function grabCookie($cookie, $params = null) {
  2291. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
  2292. }
  2293. /**
  2294. * [!] Method is generated. Documentation taken from corresponding module.
  2295. *
  2296. * Grabs current page source code.
  2297. *
  2298. * @throws ModuleException if no page was opened.
  2299. *
  2300. * @return string Current page source code.
  2301. * @see \Codeception\Lib\InnerBrowser::grabPageSource()
  2302. */
  2303. public function grabPageSource() {
  2304. return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args()));
  2305. }
  2306. /**
  2307. * [!] Method is generated. Documentation taken from corresponding module.
  2308. *
  2309. * Checks that a cookie with the given name is set.
  2310. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2311. *
  2312. * ``` php
  2313. * <?php
  2314. * $I->seeCookie('PHPSESSID');
  2315. * ?>
  2316. * ```
  2317. *
  2318. * @param $cookie
  2319. * @param array $params
  2320. * @return mixed
  2321. * Conditional Assertion: Test won't be stopped on fail
  2322. * @see \Codeception\Lib\InnerBrowser::seeCookie()
  2323. */
  2324. public function canSeeCookie($cookie, $params = null) {
  2325. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
  2326. }
  2327. /**
  2328. * [!] Method is generated. Documentation taken from corresponding module.
  2329. *
  2330. * Checks that a cookie with the given name is set.
  2331. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2332. *
  2333. * ``` php
  2334. * <?php
  2335. * $I->seeCookie('PHPSESSID');
  2336. * ?>
  2337. * ```
  2338. *
  2339. * @param $cookie
  2340. * @param array $params
  2341. * @return mixed
  2342. * @see \Codeception\Lib\InnerBrowser::seeCookie()
  2343. */
  2344. public function seeCookie($cookie, $params = null) {
  2345. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
  2346. }
  2347. /**
  2348. * [!] Method is generated. Documentation taken from corresponding module.
  2349. *
  2350. * Checks that there isn't a cookie with the given name.
  2351. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2352. *
  2353. * @param $cookie
  2354. *
  2355. * @param array $params
  2356. * @return mixed
  2357. * Conditional Assertion: Test won't be stopped on fail
  2358. * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
  2359. */
  2360. public function cantSeeCookie($cookie, $params = null) {
  2361. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
  2362. }
  2363. /**
  2364. * [!] Method is generated. Documentation taken from corresponding module.
  2365. *
  2366. * Checks that there isn't a cookie with the given name.
  2367. * You can set additional cookie params like `domain`, `path` as array passed in last argument.
  2368. *
  2369. * @param $cookie
  2370. *
  2371. * @param array $params
  2372. * @return mixed
  2373. * @see \Codeception\Lib\InnerBrowser::dontSeeCookie()
  2374. */
  2375. public function dontSeeCookie($cookie, $params = null) {
  2376. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
  2377. }
  2378. /**
  2379. * [!] Method is generated. Documentation taken from corresponding module.
  2380. *
  2381. * Unsets cookie with the given name.
  2382. * You can set additional cookie params like `domain`, `path` in array passed as last argument.
  2383. *
  2384. * @param $cookie
  2385. *
  2386. * @param array $params
  2387. * @return mixed
  2388. * @see \Codeception\Lib\InnerBrowser::resetCookie()
  2389. */
  2390. public function resetCookie($name, $params = null) {
  2391. return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
  2392. }
  2393. /**
  2394. * [!] Method is generated. Documentation taken from corresponding module.
  2395. *
  2396. * Checks that the given element exists on the page and is visible.
  2397. * You can also specify expected attributes of this element.
  2398. *
  2399. * ``` php
  2400. * <?php
  2401. * $I->seeElement('.error');
  2402. * $I->seeElement('//form/input[1]');
  2403. * $I->seeElement('input', ['name' => 'login']);
  2404. * $I->seeElement('input', ['value' => '123456']);
  2405. *
  2406. * // strict locator in first arg, attributes in second
  2407. * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
  2408. * ?>
  2409. * ```
  2410. *
  2411. * @param $selector
  2412. * @param array $attributes
  2413. * @return
  2414. * Conditional Assertion: Test won't be stopped on fail
  2415. * @see \Codeception\Lib\InnerBrowser::seeElement()
  2416. */
  2417. public function canSeeElement($selector, $attributes = null) {
  2418. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
  2419. }
  2420. /**
  2421. * [!] Method is generated. Documentation taken from corresponding module.
  2422. *
  2423. * Checks that the given element exists on the page and is visible.
  2424. * You can also specify expected attributes of this element.
  2425. *
  2426. * ``` php
  2427. * <?php
  2428. * $I->seeElement('.error');
  2429. * $I->seeElement('//form/input[1]');
  2430. * $I->seeElement('input', ['name' => 'login']);
  2431. * $I->seeElement('input', ['value' => '123456']);
  2432. *
  2433. * // strict locator in first arg, attributes in second
  2434. * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
  2435. * ?>
  2436. * ```
  2437. *
  2438. * @param $selector
  2439. * @param array $attributes
  2440. * @return
  2441. * @see \Codeception\Lib\InnerBrowser::seeElement()
  2442. */
  2443. public function seeElement($selector, $attributes = null) {
  2444. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
  2445. }
  2446. /**
  2447. * [!] Method is generated. Documentation taken from corresponding module.
  2448. *
  2449. * Checks that the given element is invisible or not present on the page.
  2450. * You can also specify expected attributes of this element.
  2451. *
  2452. * ``` php
  2453. * <?php
  2454. * $I->dontSeeElement('.error');
  2455. * $I->dontSeeElement('//form/input[1]');
  2456. * $I->dontSeeElement('input', ['name' => 'login']);
  2457. * $I->dontSeeElement('input', ['value' => '123456']);
  2458. * ?>
  2459. * ```
  2460. *
  2461. * @param $selector
  2462. * @param array $attributes
  2463. * Conditional Assertion: Test won't be stopped on fail
  2464. * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
  2465. */
  2466. public function cantSeeElement($selector, $attributes = null) {
  2467. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
  2468. }
  2469. /**
  2470. * [!] Method is generated. Documentation taken from corresponding module.
  2471. *
  2472. * Checks that the given element is invisible or not present on the page.
  2473. * You can also specify expected attributes of this element.
  2474. *
  2475. * ``` php
  2476. * <?php
  2477. * $I->dontSeeElement('.error');
  2478. * $I->dontSeeElement('//form/input[1]');
  2479. * $I->dontSeeElement('input', ['name' => 'login']);
  2480. * $I->dontSeeElement('input', ['value' => '123456']);
  2481. * ?>
  2482. * ```
  2483. *
  2484. * @param $selector
  2485. * @param array $attributes
  2486. * @see \Codeception\Lib\InnerBrowser::dontSeeElement()
  2487. */
  2488. public function dontSeeElement($selector, $attributes = null) {
  2489. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
  2490. }
  2491. /**
  2492. * [!] Method is generated. Documentation taken from corresponding module.
  2493. *
  2494. * Checks that there are a certain number of elements matched by the given locator on the page.
  2495. *
  2496. * ``` php
  2497. * <?php
  2498. * $I->seeNumberOfElements('tr', 10);
  2499. * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements
  2500. * ?>
  2501. * ```
  2502. * @param $selector
  2503. * @param mixed $expected int or int[]
  2504. * Conditional Assertion: Test won't be stopped on fail
  2505. * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
  2506. */
  2507. public function canSeeNumberOfElements($selector, $expected) {
  2508. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
  2509. }
  2510. /**
  2511. * [!] Method is generated. Documentation taken from corresponding module.
  2512. *
  2513. * Checks that there are a certain number of elements matched by the given locator on the page.
  2514. *
  2515. * ``` php
  2516. * <?php
  2517. * $I->seeNumberOfElements('tr', 10);
  2518. * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements
  2519. * ?>
  2520. * ```
  2521. * @param $selector
  2522. * @param mixed $expected int or int[]
  2523. * @see \Codeception\Lib\InnerBrowser::seeNumberOfElements()
  2524. */
  2525. public function seeNumberOfElements($selector, $expected) {
  2526. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
  2527. }
  2528. /**
  2529. * [!] Method is generated. Documentation taken from corresponding module.
  2530. *
  2531. * Checks that the given option is selected.
  2532. *
  2533. * ``` php
  2534. * <?php
  2535. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  2536. * ?>
  2537. * ```
  2538. *
  2539. * @param $selector
  2540. * @param $optionText
  2541. *
  2542. * @return mixed
  2543. * Conditional Assertion: Test won't be stopped on fail
  2544. * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
  2545. */
  2546. public function canSeeOptionIsSelected($selector, $optionText) {
  2547. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
  2548. }
  2549. /**
  2550. * [!] Method is generated. Documentation taken from corresponding module.
  2551. *
  2552. * Checks that the given option is selected.
  2553. *
  2554. * ``` php
  2555. * <?php
  2556. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  2557. * ?>
  2558. * ```
  2559. *
  2560. * @param $selector
  2561. * @param $optionText
  2562. *
  2563. * @return mixed
  2564. * @see \Codeception\Lib\InnerBrowser::seeOptionIsSelected()
  2565. */
  2566. public function seeOptionIsSelected($selector, $optionText) {
  2567. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
  2568. }
  2569. /**
  2570. * [!] Method is generated. Documentation taken from corresponding module.
  2571. *
  2572. * Checks that the given option is not selected.
  2573. *
  2574. * ``` php
  2575. * <?php
  2576. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  2577. * ?>
  2578. * ```
  2579. *
  2580. * @param $selector
  2581. * @param $optionText
  2582. *
  2583. * @return mixed
  2584. * Conditional Assertion: Test won't be stopped on fail
  2585. * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
  2586. */
  2587. public function cantSeeOptionIsSelected($selector, $optionText) {
  2588. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
  2589. }
  2590. /**
  2591. * [!] Method is generated. Documentation taken from corresponding module.
  2592. *
  2593. * Checks that the given option is not selected.
  2594. *
  2595. * ``` php
  2596. * <?php
  2597. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  2598. * ?>
  2599. * ```
  2600. *
  2601. * @param $selector
  2602. * @param $optionText
  2603. *
  2604. * @return mixed
  2605. * @see \Codeception\Lib\InnerBrowser::dontSeeOptionIsSelected()
  2606. */
  2607. public function dontSeeOptionIsSelected($selector, $optionText) {
  2608. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
  2609. }
  2610. /**
  2611. * [!] Method is generated. Documentation taken from corresponding module.
  2612. *
  2613. * Asserts that current page has 404 response status code.
  2614. * Conditional Assertion: Test won't be stopped on fail
  2615. * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
  2616. */
  2617. public function canSeePageNotFound() {
  2618. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seePageNotFound', func_get_args()));
  2619. }
  2620. /**
  2621. * [!] Method is generated. Documentation taken from corresponding module.
  2622. *
  2623. * Asserts that current page has 404 response status code.
  2624. * @see \Codeception\Lib\InnerBrowser::seePageNotFound()
  2625. */
  2626. public function seePageNotFound() {
  2627. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seePageNotFound', func_get_args()));
  2628. }
  2629. /**
  2630. * [!] Method is generated. Documentation taken from corresponding module.
  2631. *
  2632. * Checks that response code is equal to value provided.
  2633. *
  2634. * ```php
  2635. * <?php
  2636. * $I->seeResponseCodeIs(200);
  2637. *
  2638. * // recommended \Codeception\Util\HttpCode
  2639. * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2640. * ```
  2641. *
  2642. * @param $code
  2643. * Conditional Assertion: Test won't be stopped on fail
  2644. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
  2645. */
  2646. public function canSeeResponseCodeIs($code) {
  2647. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIs', func_get_args()));
  2648. }
  2649. /**
  2650. * [!] Method is generated. Documentation taken from corresponding module.
  2651. *
  2652. * Checks that response code is equal to value provided.
  2653. *
  2654. * ```php
  2655. * <?php
  2656. * $I->seeResponseCodeIs(200);
  2657. *
  2658. * // recommended \Codeception\Util\HttpCode
  2659. * $I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2660. * ```
  2661. *
  2662. * @param $code
  2663. * @see \Codeception\Lib\InnerBrowser::seeResponseCodeIs()
  2664. */
  2665. public function seeResponseCodeIs($code) {
  2666. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIs', func_get_args()));
  2667. }
  2668. /**
  2669. * [!] Method is generated. Documentation taken from corresponding module.
  2670. *
  2671. * Checks that response code is equal to value provided.
  2672. *
  2673. * ```php
  2674. * <?php
  2675. * $I->dontSeeResponseCodeIs(200);
  2676. *
  2677. * // recommended \Codeception\Util\HttpCode
  2678. * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2679. * ```
  2680. * @param $code
  2681. * Conditional Assertion: Test won't be stopped on fail
  2682. * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs()
  2683. */
  2684. public function cantSeeResponseCodeIs($code) {
  2685. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeResponseCodeIs', func_get_args()));
  2686. }
  2687. /**
  2688. * [!] Method is generated. Documentation taken from corresponding module.
  2689. *
  2690. * Checks that response code is equal to value provided.
  2691. *
  2692. * ```php
  2693. * <?php
  2694. * $I->dontSeeResponseCodeIs(200);
  2695. *
  2696. * // recommended \Codeception\Util\HttpCode
  2697. * $I->dontSeeResponseCodeIs(\Codeception\Util\HttpCode::OK);
  2698. * ```
  2699. * @param $code
  2700. * @see \Codeception\Lib\InnerBrowser::dontSeeResponseCodeIs()
  2701. */
  2702. public function dontSeeResponseCodeIs($code) {
  2703. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeResponseCodeIs', func_get_args()));
  2704. }
  2705. /**
  2706. * [!] Method is generated. Documentation taken from corresponding module.
  2707. *
  2708. * Checks that the page title contains the given string.
  2709. *
  2710. * ``` php
  2711. * <?php
  2712. * $I->seeInTitle('Blog - Post #1');
  2713. * ?>
  2714. * ```
  2715. *
  2716. * @param $title
  2717. *
  2718. * @return mixed
  2719. * Conditional Assertion: Test won't be stopped on fail
  2720. * @see \Codeception\Lib\InnerBrowser::seeInTitle()
  2721. */
  2722. public function canSeeInTitle($title) {
  2723. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
  2724. }
  2725. /**
  2726. * [!] Method is generated. Documentation taken from corresponding module.
  2727. *
  2728. * Checks that the page title contains the given string.
  2729. *
  2730. * ``` php
  2731. * <?php
  2732. * $I->seeInTitle('Blog - Post #1');
  2733. * ?>
  2734. * ```
  2735. *
  2736. * @param $title
  2737. *
  2738. * @return mixed
  2739. * @see \Codeception\Lib\InnerBrowser::seeInTitle()
  2740. */
  2741. public function seeInTitle($title) {
  2742. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
  2743. }
  2744. /**
  2745. * [!] Method is generated. Documentation taken from corresponding module.
  2746. *
  2747. * Checks that the page title does not contain the given string.
  2748. *
  2749. * @param $title
  2750. *
  2751. * @return mixed
  2752. * Conditional Assertion: Test won't be stopped on fail
  2753. * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
  2754. */
  2755. public function cantSeeInTitle($title) {
  2756. return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
  2757. }
  2758. /**
  2759. * [!] Method is generated. Documentation taken from corresponding module.
  2760. *
  2761. * Checks that the page title does not contain the given string.
  2762. *
  2763. * @param $title
  2764. *
  2765. * @return mixed
  2766. * @see \Codeception\Lib\InnerBrowser::dontSeeInTitle()
  2767. */
  2768. public function dontSeeInTitle($title) {
  2769. return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
  2770. }
  2771. /**
  2772. * [!] Method is generated. Documentation taken from corresponding module.
  2773. *
  2774. * Switch to iframe or frame on the page.
  2775. *
  2776. * Example:
  2777. * ``` html
  2778. * <iframe name="another_frame" src="http://example.com">
  2779. * ```
  2780. *
  2781. * ``` php
  2782. * <?php
  2783. * # switch to iframe
  2784. * $I->switchToIframe("another_frame");
  2785. * ```
  2786. *
  2787. * @param string $name
  2788. * @see \Codeception\Lib\InnerBrowser::switchToIframe()
  2789. */
  2790. public function switchToIframe($name) {
  2791. return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToIframe', func_get_args()));
  2792. }
  2793. /**
  2794. * [!] Method is generated. Documentation taken from corresponding module.
  2795. *
  2796. * Moves back in history.
  2797. *
  2798. * @param int $numberOfSteps (default value 1)
  2799. * @see \Codeception\Lib\InnerBrowser::moveBack()
  2800. */
  2801. public function moveBack($numberOfSteps = null) {
  2802. return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args()));
  2803. }
  2804. /**
  2805. * [!] Method is generated. Documentation taken from corresponding module.
  2806. *
  2807. * @inheritdoc
  2808. * @see \tests\codeception\common\_support\FixtureHelper::fixtures()
  2809. */
  2810. public function fixtures() {
  2811. return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args()));
  2812. }
  2813. }