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.

3286 lines
108KB

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