From b1bb1ccb12ae7387dafb5e0e0a6a1c55c09daafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Klatt?= Date: Thu, 3 Aug 2017 13:57:29 +0000 Subject: [PATCH] core-1652 replaced slow Presentation with an example of a fast functional Controller test --- codeception.yml | 2 +- composer.lock | 6 +- config/Shared/config_default-devtest_DE.php | 1 + .../Helper/Bootstrap/YvesBootstrap.php | 178 + .../Testify/_support/Helper/YvesBootstrap.php | 56 + .../Controller}/HomepageCest.php | 11 +- .../Application/_output/phantomjs.output.txt | 2 +- ...php => ApplicationCommunicationTester.php} | 17 +- .../ApplicationPresentationTesterActions.php | 2960 ----------------- .../PyzTest/Yves/Application/codeception.yml | 25 +- .../Availability/_output/phantomjs.output.txt | 86 +- 11 files changed, 263 insertions(+), 3081 deletions(-) create mode 100644 tests/PyzTest/Shared/Testify/_support/Helper/Bootstrap/YvesBootstrap.php create mode 100644 tests/PyzTest/Shared/Testify/_support/Helper/YvesBootstrap.php rename tests/PyzTest/Yves/Application/{Presentation => Communication/Controller}/HomepageCest.php (65%) rename tests/PyzTest/Yves/Application/_support/{ApplicationPresentationTester.php => ApplicationCommunicationTester.php} (62%) delete mode 100644 tests/PyzTest/Yves/Application/_support/_generated/ApplicationPresentationTesterActions.php diff --git a/codeception.yml b/codeception.yml index 81a788476..d42a23fc9 100644 --- a/codeception.yml +++ b/codeception.yml @@ -3,7 +3,7 @@ actor: Tester include: - tests/PyzTest/*/* - - vendor/spryker/spryker/Bundles/*/* +# - vendor/spryker/spryker/Bundles/*/* paths: tests: tests diff --git a/composer.lock b/composer.lock index 27f294fec..2f2a3312e 100644 --- a/composer.lock +++ b/composer.lock @@ -1625,7 +1625,7 @@ "source": { "type": "git", "url": "git@github.com:spryker/spryker.git", - "reference": "68c27f4e49295b64553db4b7b9a5cddb7fc3821d" + "reference": "ed22b492a96c1d4b89b4f4a035d2eb08267ac0dd" }, "require": { "everon/criteria-builder": "^1.1.0", @@ -1802,7 +1802,7 @@ "proprietary" ], "description": "Spryker Framework", - "time": "2017-08-03 10:14:59" + "time": "2017-08-03 13:29:19" }, { "name": "swiftmailer/swiftmailer", @@ -6604,7 +6604,7 @@ "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/spryker/code-generator.git", + "url": "git@github.com:spryker/code-generator.git", "reference": "469e2eb7841bb26c5c77e955c61574dcb24851a6" }, "dist": { diff --git a/config/Shared/config_default-devtest_DE.php b/config/Shared/config_default-devtest_DE.php index adb6847de..f7c4711b0 100644 --- a/config/Shared/config_default-devtest_DE.php +++ b/config/Shared/config_default-devtest_DE.php @@ -57,6 +57,7 @@ $config[ApplicationConstants::YVES_TRUSTED_HOSTS] = [ $config[ApplicationConstants::HOST_YVES], $config[ApplicationConstants::HOST_ZED], + 'localhost', ]; // ---------- Propel diff --git a/tests/PyzTest/Shared/Testify/_support/Helper/Bootstrap/YvesBootstrap.php b/tests/PyzTest/Shared/Testify/_support/Helper/Bootstrap/YvesBootstrap.php new file mode 100644 index 000000000..631c22d98 --- /dev/null +++ b/tests/PyzTest/Shared/Testify/_support/Helper/Bootstrap/YvesBootstrap.php @@ -0,0 +1,178 @@ +application = new Application(); + } + + /** + * @return \Spryker\Yves\Kernel\Application + */ + public function boot() + { + $this->registerServiceProviders(); + + $this->registerRouters(); + + $this->registerControllerProviders(); + + return $this->application; + } + + /** + * @return void + */ + protected function registerServiceProviders() + { + $this->application->register(new StorageCacheServiceProvider()); + $this->application->register(new SprykerTwigServiceProvider()); + $this->application->register(new TwigServiceProvider()); + $this->application->register(new ApplicationServiceProvider()); + $this->application->register(new SessionServiceProvider()); + $this->application->register(new SprykerSessionServiceProvider()); + $this->application->register(new SecurityServiceProvider()); + $this->application->register(new CustomerSecurityServiceProvider()); + $this->application->register(new YvesSecurityServiceProvider()); + $this->application->register(new ExceptionServiceProvider()); + $this->application->register(new NewRelicRequestTransactionServiceProvider()); + $this->application->register(new CookieServiceProvider()); + $this->application->register(new UrlGeneratorServiceProvider()); + $this->application->register(new ServiceControllerServiceProvider()); + $this->application->register(new RememberMeServiceProvider()); + $this->application->register(new RoutingServiceProvider()); + $this->application->register(new TranslationServiceProvider()); + $this->application->register(new ValidatorServiceProvider()); + $this->application->register(new FormServiceProvider()); + $this->application->register(new HttpFragmentServiceProvider()); + $this->application->register(new CategoryServiceProvider()); + $this->application->register(new FlashMessengerServiceProvider()); + $this->application->register(new HeadersSecurityServiceProvider()); + $this->application->register(new WebProfilerServiceProvider()); + $this->application->register(new AutoloaderCacheServiceProvider()); + $this->application->register(new YvesHstsServiceProvider()); + $this->application->register(new CartServiceProvider()); + $this->application->register(new FormFactoryServiceProvider()); + $this->application->register(new LanguageServiceProvider()); + $this->application->register(new TwigMoneyServiceProvider()); + $this->application->register(new ProductRelationTwigServiceProvider()); + $this->application->register(new NavigationTwigServiceProvider()); + $this->application->register(new ProductGroupTwigServiceProvider()); + $this->application->register(new ProductLabelTwigServiceProvider()); + $this->application->register(new CmsContentWidgetServiceProvider()); + } + + /** + * @return void + */ + protected function registerRouters() + { + $this->application->addRouter((new StorageRouter())->setSsl(false)); + $this->application->addRouter(new SilexRouter($this->application)); + } + + /** + * @return void + */ + protected function registerControllerProviders() + { + $isSsl = Config::get(ApplicationConstants::YVES_SSL_ENABLED); + + $controllerProviders = $this->getControllerProviderStack($isSsl); + + foreach ($controllerProviders as $controllerProvider) { + $this->application->mount($controllerProvider->getUrlPrefix(), $controllerProvider); + } + } + + /** + * @param bool|null $isSsl + * + * @return \Pyz\Yves\Application\Plugin\Provider\AbstractYvesControllerProvider[] + */ + protected function getControllerProviderStack($isSsl) + { + return [ + new ApplicationControllerProvider($isSsl), + new CheckoutControllerProvider($isSsl), + new CustomerControllerProvider($isSsl), + new CartControllerProvider($isSsl), + new WishlistControllerProvider($isSsl), + new HeartbeatControllerProvider($isSsl), + new NewsletterControllerProvider($isSsl), + new CatalogControllerProvider($isSsl), + new CalculationControllerProvider($isSsl), + new ProductSetControllerProvider($isSsl), + new ProductSaleControllerProvider($isSsl), + new ProductNewControllerProvider($isSsl), + ]; + } + +} diff --git a/tests/PyzTest/Shared/Testify/_support/Helper/YvesBootstrap.php b/tests/PyzTest/Shared/Testify/_support/Helper/YvesBootstrap.php new file mode 100644 index 000000000..9134c1390 --- /dev/null +++ b/tests/PyzTest/Shared/Testify/_support/Helper/YvesBootstrap.php @@ -0,0 +1,56 @@ +loadApplication(); + } + + /** + * @param \Codeception\TestInterface $test + * + * @return void + */ + public function _before(TestInterface $test) + { + $this->client = new Client($this->application->boot()); + } + + /** + * @throws \Codeception\Exception\ModuleConfigException + * + * @return void + */ + protected function loadApplication() + { + $this->application = new ApplicationYvesBootstrap(); + + if (!isset($this->application)) { + throw new ModuleConfigException(__CLASS__, 'Application instance was not received from bootstrap file'); + } + } + +} diff --git a/tests/PyzTest/Yves/Application/Presentation/HomepageCest.php b/tests/PyzTest/Yves/Application/Communication/Controller/HomepageCest.php similarity index 65% rename from tests/PyzTest/Yves/Application/Presentation/HomepageCest.php rename to tests/PyzTest/Yves/Application/Communication/Controller/HomepageCest.php index 082a536a8..154b8f34b 100644 --- a/tests/PyzTest/Yves/Application/Presentation/HomepageCest.php +++ b/tests/PyzTest/Yves/Application/Communication/Controller/HomepageCest.php @@ -5,9 +5,9 @@ * For full license information, please view the LICENSE file that was distributed with this source code. */ -namespace PyzTest\Yves\Application\Presentation; +namespace PyzTest\Yves\Application\Communication\Controller; -use PyzTest\Yves\Application\ApplicationPresentationTester; +use PyzTest\Yves\Application\ApplicationCommunicationTester; use PyzTest\Yves\Application\PageObject\Homepage; /** @@ -15,7 +15,8 @@ * @group PyzTest * @group Yves * @group Application - * @group Presentation + * @group Communication + * @group Controller * @group HomepageCest * Add your own group annotations below this line */ @@ -23,11 +24,11 @@ class HomepageCest { /** - * @param \PyzTest\Yves\Application\ApplicationPresentationTester $i + * @param \PyzTest\Yves\Application\ApplicationCommunicationTester $i * * @return void */ - public function testICanOpenHomepage(ApplicationPresentationTester $i) + public function testICanOpenHomepage(ApplicationCommunicationTester $i) { $i->wantTo('See that i can open the homepage'); $i->amOnPage(Homepage::URL); diff --git a/tests/PyzTest/Yves/Application/_output/phantomjs.output.txt b/tests/PyzTest/Yves/Application/_output/phantomjs.output.txt index 8644758dc..5161a97e7 100644 --- a/tests/PyzTest/Yves/Application/_output/phantomjs.output.txt +++ b/tests/PyzTest/Yves/Application/_output/phantomjs.output.txt @@ -1 +1 @@ -[INFO - 2017-08-03T13:17:58.677Z] GhostDriver - Main - running on port 4444 +[INFO - 2017-08-03T13:56:18.713Z] GhostDriver - Main - running on port 4444 diff --git a/tests/PyzTest/Yves/Application/_support/ApplicationPresentationTester.php b/tests/PyzTest/Yves/Application/_support/ApplicationCommunicationTester.php similarity index 62% rename from tests/PyzTest/Yves/Application/_support/ApplicationPresentationTester.php rename to tests/PyzTest/Yves/Application/_support/ApplicationCommunicationTester.php index bff5cd31e..5d64a7c88 100644 --- a/tests/PyzTest/Yves/Application/_support/ApplicationPresentationTester.php +++ b/tests/PyzTest/Yves/Application/_support/ApplicationCommunicationTester.php @@ -2,7 +2,6 @@ namespace PyzTest\Yves\Application; use Codeception\Actor; -use Codeception\Scenario; /** * Inherited Methods @@ -19,19 +18,13 @@ * * @SuppressWarnings(PHPMD) */ -class ApplicationPresentationTester extends Actor +class ApplicationCommunicationTester extends Actor { - use _generated\ApplicationPresentationTesterActions; + use _generated\ApplicationCommunicationTesterActions; - /** - * @param \Codeception\Scenario $scenario - */ - public function __construct(Scenario $scenario) - { - parent::__construct($scenario); - - $this->amYves(); - } + /** + * Define custom actions here + */ } diff --git a/tests/PyzTest/Yves/Application/_support/_generated/ApplicationPresentationTesterActions.php b/tests/PyzTest/Yves/Application/_support/_generated/ApplicationPresentationTesterActions.php deleted file mode 100644 index 367cb895d..000000000 --- a/tests/PyzTest/Yves/Application/_support/_generated/ApplicationPresentationTesterActions.php +++ /dev/null @@ -1,2960 +0,0 @@ -getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Print out latest Selenium Logs in debug mode - * - * @param TestInterface $test - * @see \Codeception\Module\WebDriver::debugWebDriverLogs() - */ - public function debugWebDriverLogs($test = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Changes the subdomain for the 'url' configuration parameter. - * Does not open a page; use `amOnPage` for that. - * - * ``` php - * amOnSubdomain('user'); - * $I->amOnPage('/'); - * // moves to http://user.mysite.com/ - * ?> - * ``` - * - * @param $subdomain - * - * @return mixed - * @see \Codeception\Module\WebDriver::amOnSubdomain() - */ - public function amOnSubdomain($subdomain) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Takes a screenshot of the current window and saves it to `tests/_output/debug`. - * - * ``` php - * amOnPage('/user/edit'); - * $I->makeScreenshot('edit_page'); - * // saved to: tests/_output/debug/edit_page.png - * $I->makeScreenshot(); - * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png - * ``` - * - * @param $name - * @see \Codeception\Module\WebDriver::makeScreenshot() - */ - public function makeScreenshot($name = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('makeScreenshot', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Resize the current window. - * - * ``` php - * resizeWindow(800, 600); - * - * ``` - * - * @param int $width - * @param int $height - * @see \Codeception\Module\WebDriver::resizeWindow() - */ - public function resizeWindow($width, $height) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('resizeWindow', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that a cookie with the given name is set. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * ``` php - * seeCookie('PHPSESSID'); - * ?> - * ``` - * - * @param $cookie - * @param array $params - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCookie() - */ - public function canSeeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that a cookie with the given name is set. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * ``` php - * seeCookie('PHPSESSID'); - * ?> - * ``` - * - * @param $cookie - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::seeCookie() - */ - public function seeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there isn't a cookie with the given name. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCookie() - */ - public function cantSeeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there isn't a cookie with the given name. - * You can set additional cookie params like `domain`, `path` as array passed in last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::dontSeeCookie() - */ - public function dontSeeCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Sets a cookie with the given name and value. - * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. - * - * ``` php - * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); - * ?> - * ``` - * - * @param $name - * @param $val - * @param array $params - * - * @return mixed - * @see \Codeception\Module\WebDriver::setCookie() - */ - public function setCookie($cookie, $value, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Unsets cookie with the given name. - * You can set additional cookie params like `domain`, `path` in array passed as last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::resetCookie() - */ - public function resetCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs a cookie value. - * You can set additional cookie params like `domain`, `path` in array passed as last argument. - * - * @param $cookie - * - * @param array $params - * @return mixed - * @see \Codeception\Module\WebDriver::grabCookie() - */ - public function grabCookie($cookie, $params = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs current page source code. - * - * @throws ModuleException if no page was opened. - * - * @return string Current page source code. - * @see \Codeception\Module\WebDriver::grabPageSource() - */ - public function grabPageSource() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Open web page at the given absolute URL and sets its hostname as the base host. - * - * ``` php - * amOnUrl('http://codeception.com'); - * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart - * ?> - * ``` - * @see \Codeception\Module\WebDriver::amOnUrl() - */ - public function amOnUrl($url) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Opens the page for the given relative URI. - * - * ``` php - * amOnPage('/'); - * // opens /register page - * $I->amOnPage('/register'); - * ``` - * - * @param string $page - * @see \Codeception\Module\WebDriver::amOnPage() - */ - public function amOnPage($page) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string (case insensitive). - * - * You can specify a specific HTML element (via CSS or XPath) as the second - * parameter to only search within that element. - * - * ``` php - * see('Logout'); // I can suppose user is logged in - * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page - * $I->see('Sign Up', '//body/h1'); // with XPath - * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->see('strong')` will return true for strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::see() - */ - public function canSee($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string (case insensitive). - * - * You can specify a specific HTML element (via CSS or XPath) as the second - * parameter to only search within that element. - * - * ``` php - * see('Logout'); // I can suppose user is logged in - * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page - * $I->see('Sign Up', '//body/h1'); // with XPath - * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->see('strong')` will return true for strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will *not* be true for strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * @see \Codeception\Module\WebDriver::see() - */ - public function see($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page doesn't contain the text specified (case insensitive). - * Give a locator as the second parameter to match a specific region. - * - * ```php - * dontSee('Login'); // I can suppose user is already logged in - * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page - * $I->dontSee('Sign Up','//body/h1'); // with XPath - * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->dontSee('strong')` will fail on strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSee() - */ - public function cantSee($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page doesn't contain the text specified (case insensitive). - * Give a locator as the second parameter to match a specific region. - * - * ```php - * dontSee('Login'); // I can suppose user is already logged in - * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page - * $I->dontSee('Sign Up','//body/h1'); // with XPath - * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator - * ``` - * - * Note that the search is done after stripping all HTML tags from the body, - * so `$I->dontSee('strong')` will fail on strings like: - * - * - `

I am Stronger than thou

` - * - `` - * - * But will ignore strings like: - * - * - `Home` - * - `
Home` - * - `` - * - * For checking the raw source code, use `seeInSource()`. - * - * @param string $text - * @param string $selector optional - * @see \Codeception\Module\WebDriver::dontSee() - */ - public function dontSee($text, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ``` php - * seeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInSource() - */ - public function canSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ``` php - * seeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * @see \Codeception\Module\WebDriver::seeInSource() - */ - public function seeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ```php - * dontSeeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInSource() - */ - public function cantSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current page contains the given string in its - * raw source code. - * - * ```php - * dontSeeInSource('

Green eggs & ham

'); - * ``` - * - * @param $raw - * @see \Codeception\Module\WebDriver::dontSeeInSource() - */ - public function dontSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source contains the given string. - * - * ```php - * seeInPageSource('getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPageSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source contains the given string. - * - * ```php - * seeInPageSource('getScenario()->runStep(new \Codeception\Step\Assertion('seeInPageSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source doesn't contain the given string. - * - * @param $text - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInPageSource() - */ - public function cantSeeInPageSource($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPageSource', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page source doesn't contain the given string. - * - * @param $text - * @see \Codeception\Module\WebDriver::dontSeeInPageSource() - */ - public function dontSeeInPageSource($text) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInPageSource', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Perform a click on a link or a button, given by a locator. - * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. - * For buttons, the "value" attribute, "name" attribute, and inner text are searched. - * For links, the link text is searched. - * For images, the "alt" attribute and inner text of any parent links are searched. - * - * The second parameter is a context (CSS or XPath locator) to narrow the search. - * - * Note that if the locator matches a button of type `submit`, the form will be submitted. - * - * ``` php - * click('Logout'); - * // button of form - * $I->click('Submit'); - * // CSS button - * $I->click('#form input[type=submit]'); - * // XPath - * $I->click('//form/*[@type=submit]'); - * // link in context - * $I->click('Logout', '#nav'); - * // using strict locator - * $I->click(['link' => 'Login']); - * ?> - * ``` - * - * @param $link - * @param $context - * @see \Codeception\Module\WebDriver::click() - */ - public function click($link, $context = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there's a link with the specified text. - * Give a full URL as the second parameter to match links with that exact URL. - * - * ``` php - * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeLink() - */ - public function canSeeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there's a link with the specified text. - * Give a full URL as the second parameter to match links with that exact URL. - * - * ``` php - * seeLink('Logout'); // matches Logout - * $I->seeLink('Logout','/logout'); // matches Logout - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * @see \Codeception\Module\WebDriver::seeLink() - */ - public function seeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page doesn't contain a link with the given string. - * If the second parameter is given, only links with a matching "href" attribute will be checked. - * - * ``` php - * dontSeeLink('Logout'); // I suppose user is not logged in - * $I->dontSeeLink('Checkout now', '/store/cart.php'); - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeLink() - */ - public function cantSeeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page doesn't contain a link with the given string. - * If the second parameter is given, only links with a matching "href" attribute will be checked. - * - * ``` php - * dontSeeLink('Logout'); // I suppose user is not logged in - * $I->dontSeeLink('Checkout now', '/store/cart.php'); - * ?> - * ``` - * - * @param string $text - * @param string $url optional - * @see \Codeception\Module\WebDriver::dontSeeLink() - */ - public function dontSeeLink($text, $url = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current URI contains the given string. - * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInCurrentUrl() - */ - public function canSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current URI contains the given string. - * - * ``` php - * seeInCurrentUrl('home'); - * // to match: /users/1 - * $I->seeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::seeInCurrentUrl() - */ - public function seeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL is equal to the given string. - * Unlike `seeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() - */ - public function canSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL is equal to the given string. - * Unlike `seeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * seeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() - */ - public function seeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL matches the given regular expression. - * - * ``` php - * seeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() - */ - public function canSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL matches the given regular expression. - * - * ``` php - * seeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() - */ - public function seeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URI doesn't contain the given string. - * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() - */ - public function cantSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URI doesn't contain the given string. - * - * ``` php - * dontSeeInCurrentUrl('/users/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() - */ - public function dontSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL doesn't equal the given string. - * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * dontSeeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() - */ - public function cantSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the current URL doesn't equal the given string. - * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. - * - * ``` php - * dontSeeCurrentUrlEquals('/'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() - */ - public function dontSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current url doesn't match the given regular expression. - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() - */ - public function cantSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that current url doesn't match the given regular expression. - * - * ``` php - * dontSeeCurrentUrlMatches('~$/users/(\d+)~'); - * ?> - * ``` - * - * @param string $uri - * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() - */ - public function dontSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Executes the given regular expression against the current URI and returns the first match. - * If no parameters are provided, the full URI is returned. - * - * ``` php - * grabFromCurrentUrl('~$/user/(\d+)/~'); - * $uri = $I->grabFromCurrentUrl(); - * ?> - * ``` - * - * @param string $uri optional - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() - */ - public function grabFromCurrentUrl($uri = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the specified checkbox is checked. - * - * ``` php - * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. - * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); - * ?> - * ``` - * - * @param $checkbox - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() - */ - public function canSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the specified checkbox is checked. - * - * ``` php - * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. - * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); - * ?> - * ``` - * - * @param $checkbox - * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() - */ - public function seeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Check that the specified checkbox is unchecked. - * - * ``` php - * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. - * ?> - * ``` - * - * @param $checkbox - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() - */ - public function cantSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Check that the specified checkbox is unchecked. - * - * ``` php - * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms - * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. - * ?> - * ``` - * - * @param $checkbox - * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() - */ - public function dontSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. - * Fields are matched by label text, the "name" attribute, CSS, or XPath. - * - * ``` php - * seeInField('Body','Type your comment here'); - * $I->seeInField('form textarea[name=body]','Type your comment here'); - * $I->seeInField('form input[type=hidden]','hidden_value'); - * $I->seeInField('#searchform input','Search'); - * $I->seeInField('//form/*[@name=search]','Search'); - * $I->seeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInField() - */ - public function canSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. - * Fields are matched by label text, the "name" attribute, CSS, or XPath. - * - * ``` php - * seeInField('Body','Type your comment here'); - * $I->seeInField('form textarea[name=body]','Type your comment here'); - * $I->seeInField('form input[type=hidden]','hidden_value'); - * $I->seeInField('#searchform input','Search'); - * $I->seeInField('//form/*[@name=search]','Search'); - * $I->seeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see \Codeception\Module\WebDriver::seeInField() - */ - public function seeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that an input field or textarea doesn't contain the given value. - * For fuzzy locators, the field is matched by label text, CSS and XPath. - * - * ``` php - * dontSeeInField('Body','Type your comment here'); - * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); - * $I->dontSeeInField('form input[type=hidden]','hidden_value'); - * $I->dontSeeInField('#searchform input','Search'); - * $I->dontSeeInField('//form/*[@name=search]','Search'); - * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInField() - */ - public function cantSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that an input field or textarea doesn't contain the given value. - * For fuzzy locators, the field is matched by label text, CSS and XPath. - * - * ``` php - * dontSeeInField('Body','Type your comment here'); - * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); - * $I->dontSeeInField('form input[type=hidden]','hidden_value'); - * $I->dontSeeInField('#searchform input','Search'); - * $I->dontSeeInField('//form/*[@name=search]','Search'); - * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see \Codeception\Module\WebDriver::dontSeeInField() - */ - public function dontSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are set on the form matched with the - * passed selector. - * - * ``` php - * seeInFormFields('form[name=myform]', [ - * 'input1' => 'value', - * 'input2' => 'other value', - * ]); - * ?> - * ``` - * - * For multi-select elements, or to check values of multiple elements with the same name, an - * array may be passed: - * - * ``` php - * seeInFormFields('.form-class', [ - * 'multiselect' => [ - * 'value1', - * 'value2', - * ], - * 'checkbox[]' => [ - * 'a checked value', - * 'another checked value', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * seeInFormFields('#form-id', [ - * 'checkbox1' => true, // passes if checked - * 'checkbox2' => false, // passes if unchecked - * ]); - * ?> - * ``` - * - * Pair this with submitForm for quick testing magic. - * - * ``` php - * 'value', - * 'field2' => 'another value', - * 'checkbox1' => true, - * // ... - * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); - * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInFormFields() - */ - public function canSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are set on the form matched with the - * passed selector. - * - * ``` php - * seeInFormFields('form[name=myform]', [ - * 'input1' => 'value', - * 'input2' => 'other value', - * ]); - * ?> - * ``` - * - * For multi-select elements, or to check values of multiple elements with the same name, an - * array may be passed: - * - * ``` php - * seeInFormFields('.form-class', [ - * 'multiselect' => [ - * 'value1', - * 'value2', - * ], - * 'checkbox[]' => [ - * 'a checked value', - * 'another checked value', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * seeInFormFields('#form-id', [ - * 'checkbox1' => true, // passes if checked - * 'checkbox2' => false, // passes if unchecked - * ]); - * ?> - * ``` - * - * Pair this with submitForm for quick testing magic. - * - * ``` php - * 'value', - * 'field2' => 'another value', - * 'checkbox1' => true, - * // ... - * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); - * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * @see \Codeception\Module\WebDriver::seeInFormFields() - */ - public function seeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are not set on the form matched with - * the passed selector. - * - * ``` php - * dontSeeInFormFields('form[name=myform]', [ - * 'input1' => 'non-existent value', - * 'input2' => 'other non-existent value', - * ]); - * ?> - * ``` - * - * To check that an element hasn't been assigned any one of many values, an array can be passed - * as the value: - * - * ``` php - * dontSeeInFormFields('.form-class', [ - * 'fieldName' => [ - * 'This value shouldn\'t be set', - * 'And this value shouldn\'t be set', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * dontSeeInFormFields('#form-id', [ - * 'checkbox1' => true, // fails if checked - * 'checkbox2' => false, // fails if unchecked - * ]); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInFormFields() - */ - public function cantSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks if the array of form parameters (name => value) are not set on the form matched with - * the passed selector. - * - * ``` php - * dontSeeInFormFields('form[name=myform]', [ - * 'input1' => 'non-existent value', - * 'input2' => 'other non-existent value', - * ]); - * ?> - * ``` - * - * To check that an element hasn't been assigned any one of many values, an array can be passed - * as the value: - * - * ``` php - * dontSeeInFormFields('.form-class', [ - * 'fieldName' => [ - * 'This value shouldn\'t be set', - * 'And this value shouldn\'t be set', - * ], - * ]); - * ?> - * ``` - * - * Additionally, checkbox values can be checked with a boolean. - * - * ``` php - * dontSeeInFormFields('#form-id', [ - * 'checkbox1' => true, // fails if checked - * 'checkbox2' => false, // fails if unchecked - * ]); - * ?> - * ``` - * - * @param $formSelector - * @param $params - * @see \Codeception\Module\WebDriver::dontSeeInFormFields() - */ - public function dontSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Selects an option in a select tag or in radio button group. - * - * ``` php - * selectOption('form select[name=account]', 'Premium'); - * $I->selectOption('form input[name=payment]', 'Monthly'); - * $I->selectOption('//form/select[@name=account]', 'Monthly'); - * ?> - * ``` - * - * Provide an array for the second argument to select multiple options: - * - * ``` php - * selectOption('Which OS do you use?', array('Windows','Linux')); - * ?> - * ``` - * - * Or provide an associative array for the second argument to specifically define which selection method should be used: - * - * ``` php - * selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' - * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' - * ?> - * ``` - * - * @param $select - * @param $option - * @see \Codeception\Module\WebDriver::selectOption() - */ - public function selectOption($select, $option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Unselect an option in the given select box. - * - * @param $select - * @param $option - * @see \Codeception\Module\WebDriver::unselectOption() - */ - public function unselectOption($select, $option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('unselectOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. - * - * ``` php - * checkOption('#agree'); - * ?> - * ``` - * - * @param $option - * @see \Codeception\Module\WebDriver::checkOption() - */ - public function checkOption($option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Unticks a checkbox. - * - * ``` php - * uncheckOption('#notify'); - * ?> - * ``` - * - * @param $option - * @see \Codeception\Module\WebDriver::uncheckOption() - */ - public function uncheckOption($option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Fills a text field or textarea with the given string. - * - * ``` php - * fillField("//input[@type='text']", "Hello World!"); - * $I->fillField(['name' => 'email'], 'jon@mail.com'); - * ?> - * ``` - * - * @param $field - * @param $value - * @see \Codeception\Module\WebDriver::fillField() - */ - public function fillField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Attaches a file relative to the Codeception `_data` directory to the given file upload field. - * - * ``` php - * attachFile('input[@type="file"]', 'prices.xls'); - * ?> - * ``` - * - * @param $field - * @param $filename - * @see \Codeception\Module\WebDriver::attachFile() - */ - public function attachFile($field, $filename) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Finds and returns the text contents of the given element. - * If a fuzzy locator is used, the element is found using CSS, XPath, - * and by matching the full page source by regular expression. - * - * ``` php - * grabTextFrom('h1'); - * $heading = $I->grabTextFrom('descendant-or-self::h1'); - * $value = $I->grabTextFrom('~ - * ``` - * - * @param $cssOrXPathOrRegex - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabTextFrom() - */ - public function grabTextFrom($cssOrXPathOrRegex) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs the value of the given attribute value from the given element. - * Fails if element is not found. - * - * ``` php - * grabAttributeFrom('#tooltip', 'title'); - * ?> - * ``` - * - * - * @param $cssOrXpath - * @param $attribute - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabAttributeFrom() - */ - public function grabAttributeFrom($cssOrXpath, $attribute) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Finds the value for the given form field. - * If a fuzzy locator is used, the field is found by field name, CSS, and XPath. - * - * ``` php - * grabValueFrom('Name'); - * $name = $I->grabValueFrom('input[name=username]'); - * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); - * $name = $I->grabValueFrom(['name' => 'username']); - * ?> - * ``` - * - * @param $field - * - * @return mixed - * @see \Codeception\Module\WebDriver::grabValueFrom() - */ - public function grabValueFrom($field) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Grabs either the text content, or attribute values, of nodes - * matched by $cssOrXpath and returns them as an array. - * - * ```html - * First - * Second - * Third - * ``` - * - * ```php - * grabMultiple('a'); - * - * // would return ['#first', '#second', '#third'] - * $aLinks = $I->grabMultiple('a', 'href'); - * ?> - * ``` - * - * @param $cssOrXpath - * @param $attribute - * @return string[] - * @see \Codeception\Module\WebDriver::grabMultiple() - */ - public function grabMultiple($cssOrXpath, $attribute = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page and is visible. - * You can also specify expected attributes of this element. - * - * ``` php - * seeElement('.error'); - * $I->seeElement('//form/input[1]'); - * $I->seeElement('input', ['name' => 'login']); - * $I->seeElement('input', ['value' => '123456']); - * - * // strict locator in first arg, attributes in second - * $I->seeElement(['css' => 'form input'], ['name' => 'login']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @return - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeElement() - */ - public function canSeeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page and is visible. - * You can also specify expected attributes of this element. - * - * ``` php - * seeElement('.error'); - * $I->seeElement('//form/input[1]'); - * $I->seeElement('input', ['name' => 'login']); - * $I->seeElement('input', ['value' => '123456']); - * - * // strict locator in first arg, attributes in second - * $I->seeElement(['css' => 'form input'], ['name' => 'login']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @return - * @see \Codeception\Module\WebDriver::seeElement() - */ - public function seeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element is invisible or not present on the page. - * You can also specify expected attributes of this element. - * - * ``` php - * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); - * $I->dontSeeElement('input', ['name' => 'login']); - * $I->dontSeeElement('input', ['value' => '123456']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeElement() - */ - public function cantSeeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element is invisible or not present on the page. - * You can also specify expected attributes of this element. - * - * ``` php - * dontSeeElement('.error'); - * $I->dontSeeElement('//form/input[1]'); - * $I->dontSeeElement('input', ['name' => 'login']); - * $I->dontSeeElement('input', ['value' => '123456']); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @see \Codeception\Module\WebDriver::dontSeeElement() - */ - public function dontSeeElement($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page, even it is invisible. - * - * ``` php - * seeElementInDOM('//form/input[type=hidden]'); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeElementInDOM() - */ - public function canSeeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given element exists on the page, even it is invisible. - * - * ``` php - * seeElementInDOM('//form/input[type=hidden]'); - * ?> - * ``` - * - * @param $selector - * @param array $attributes - * @see \Codeception\Module\WebDriver::seeElementInDOM() - */ - public function seeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Opposite of `seeElementInDOM`. - * - * @param $selector - * @param array $attributes - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() - */ - public function cantSeeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Opposite of `seeElementInDOM`. - * - * @param $selector - * @param array $attributes - * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() - */ - public function dontSeeElementInDOM($selector, $attributes = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElementInDOM', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there are a certain number of elements matched by the given locator on the page. - * - * ``` php - * seeNumberOfElements('tr', 10); - * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements - * ?> - * ``` - * @param $selector - * @param mixed $expected int or int[] - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeNumberOfElements() - */ - public function canSeeNumberOfElements($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that there are a certain number of elements matched by the given locator on the page. - * - * ``` php - * seeNumberOfElements('tr', 10); - * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements - * ?> - * ``` - * @param $selector - * @param mixed $expected int or int[] - * @see \Codeception\Module\WebDriver::seeNumberOfElements() - */ - public function seeNumberOfElements($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() - */ - public function canSeeNumberOfElementsInDOM($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElementsInDOM', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * - * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() - */ - public function seeNumberOfElementsInDOM($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElementsInDOM', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is selected. - * - * ``` php - * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeOptionIsSelected() - */ - public function canSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is selected. - * - * ``` php - * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * @see \Codeception\Module\WebDriver::seeOptionIsSelected() - */ - public function seeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is not selected. - * - * ``` php - * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() - */ - public function cantSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the given option is not selected. - * - * ``` php - * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> - * ``` - * - * @param $selector - * @param $optionText - * - * @return mixed - * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() - */ - public function dontSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title contains the given string. - * - * ``` php - * seeInTitle('Blog - Post #1'); - * ?> - * ``` - * - * @param $title - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInTitle() - */ - public function canSeeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title contains the given string. - * - * ``` php - * seeInTitle('Blog - Post #1'); - * ?> - * ``` - * - * @param $title - * - * @return mixed - * @see \Codeception\Module\WebDriver::seeInTitle() - */ - public function seeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title does not contain the given string. - * - * @param $title - * - * @return mixed - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::dontSeeInTitle() - */ - public function cantSeeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the page title does not contain the given string. - * - * @param $title - * - * @return mixed - * @see \Codeception\Module\WebDriver::dontSeeInTitle() - */ - public function dontSeeInTitle($title) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. - * Don't confuse popups with modal windows, - * as created by [various libraries](http://jster.net/category/windows-modals-popups). - * @see \Codeception\Module\WebDriver::acceptPopup() - */ - public function acceptPopup() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('acceptPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`. - * @see \Codeception\Module\WebDriver::cancelPopup() - */ - public function cancelPopup() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('cancelPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the active JavaScript popup, - * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. - * - * @param $text - * - * @throws \Codeception\Exception\ModuleException - * Conditional Assertion: Test won't be stopped on fail - * @see \Codeception\Module\WebDriver::seeInPopup() - */ - public function canSeeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args())); - } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that the active JavaScript popup, - * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. - * - * @param $text - * - * @throws \Codeception\Exception\ModuleException - * @see \Codeception\Module\WebDriver::seeInPopup() - */ - public function seeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. - * - * @param $keys - * - * @throws \Codeception\Exception\ModuleException - * @see \Codeception\Module\WebDriver::typeInPopup() - */ - public function typeInPopup($keys) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('typeInPopup', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Reloads the current page. - * @see \Codeception\Module\WebDriver::reloadPage() - */ - public function reloadPage() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('reloadPage', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Moves back in history. - * @see \Codeception\Module\WebDriver::moveBack() - */ - public function moveBack() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Moves forward in history. - * @see \Codeception\Module\WebDriver::moveForward() - */ - public function moveForward() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('moveForward', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Submits the given form on the page, optionally with the given form - * values. Give the form fields values as an array. Note that hidden fields - * can't be accessed. - * - * Skipped fields will be filled by their values from the page. - * You don't need to click the 'Submit' button afterwards. - * This command itself triggers the request to form's action. - * - * You can optionally specify what button's value to include - * in the request with the last parameter as an alternative to - * explicitly setting its value in the second parameter, as - * button values are not otherwise included in the request. - * - * Examples: - * - * ``` php - * submitForm('#login', [ - * 'login' => 'davert', - * 'password' => '123456' - * ]); - * // or - * $I->submitForm('#login', [ - * 'login' => 'davert', - * 'password' => '123456' - * ], 'submitButtonName'); - * - * ``` - * - * For example, given this sample "Sign Up" form: - * - * ``` html - *
- * Login: - *
- * Password: - *
- * Do you agree to our terms? - *
- * Select pricing plan: - * - * - *
- * ``` - * - * You could write the following to submit it: - * - * ``` php - * submitForm( - * '#userForm', - * [ - * 'user[login]' => 'Davert', - * 'user[password]' => '123456', - * 'user[agree]' => true - * ], - * 'submitButton' - * ); - * ``` - * Note that "2" will be the submitted value for the "plan" field, as it is - * the selected option. - * - * Also note that this differs from PhpBrowser, in that - * ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment. - * Named array keys *must* be included in the name as above. - * - * Pair this with seeInFormFields for quick testing magic. - * - * ``` php - * 'value', - * 'field2' => 'another value', - * 'checkbox1' => true, - * // ... - * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); - * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> - * ``` - * - * Parameter values must be set to arrays for multiple input fields - * of the same name, or multi-select combo boxes. For checkboxes, - * either the string value can be used, or boolean values which will - * be replaced by the checkbox's value in the DOM. - * - * ``` php - * submitForm('#my-form', [ - * 'field1' => 'value', - * 'checkbox' => [ - * 'value of first checkbox', - * 'value of second checkbox, - * ], - * 'otherCheckboxes' => [ - * true, - * false, - * false - * ], - * 'multiselect' => [ - * 'first option value', - * 'second option value' - * ] - * ]); - * ?> - * ``` - * - * Mixing string and boolean values for a checkbox's value is not supported - * and may produce unexpected results. - * - * Field names ending in "[]" must be passed without the trailing square - * bracket characters, and must contain an array for its value. This allows - * submitting multiple values with the same name, consider: - * - * ```php - * $I->submitForm('#my-form', [ - * 'field[]' => 'value', - * 'field[]' => 'another value', // 'field[]' is already a defined key - * ]); - * ``` - * - * The solution is to pass an array value: - * - * ```php - * // this way both values are submitted - * $I->submitForm('#my-form', [ - * 'field' => [ - * 'value', - * 'another value', - * ] - * ]); - * ``` - * - * The `$button` parameter can be either a string, an array or an instance - * of Facebook\WebDriver\WebDriverBy. When it is a string, the - * button will be found by its "name" attribute. If $button is an - * array then it will be treated as a strict selector and a WebDriverBy - * will be used verbatim. - * - * For example, given the following HTML: - * - * ``` html - * - * ``` - * - * `$button` could be any one of the following: - * - 'submitButton' - * - ['name' => 'submitButton'] - * - WebDriverBy::name('submitButton') - * - * @param $selector - * @param $params - * @param $button - * @see \Codeception\Module\WebDriver::submitForm() - */ - public function submitForm($selector, $params, $button = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given element to change. - * Element "change" is determined by a callback function which is called repeatedly - * until the return value evaluates to true. - * - * ``` php - * waitForElementChange('#menu', function(WebDriverElement $el) { - * return $el->isDisplayed(); - * }, 100); - * ?> - * ``` - * - * @param $element - * @param \Closure $callback - * @param int $timeout seconds - * @throws \Codeception\Exception\ElementNotFound - * @see \Codeception\Module\WebDriver::waitForElementChange() - */ - public function waitForElementChange($element, $callback, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementChange', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for an element to appear on the page. - * If the element doesn't appear, a timeout exception is thrown. - * - * ``` php - * waitForElement('#agree_button', 30); // secs - * $I->click('#agree_button'); - * ?> - * ``` - * - * @param $element - * @param int $timeout seconds - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForElement() - */ - public function waitForElement($element, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElement', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given element to be visible on the page. - * If element doesn't appear, a timeout exception is thrown. - * - * ``` php - * waitForElementVisible('#agree_button', 30); // secs - * $I->click('#agree_button'); - * ?> - * ``` - * - * @param $element - * @param int $timeout seconds - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForElementVisible() - */ - public function waitForElementVisible($element, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given element to become invisible. - * If element stays visible, a timeout exception is thrown. - * - * ``` php - * waitForElementNotVisible('#agree_button', 30); // secs - * ?> - * ``` - * - * @param $element - * @param int $timeout seconds - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForElementNotVisible() - */ - public function waitForElementNotVisible($element, $timeout = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Waits up to $timeout seconds for the given string to appear on the page. - * - * Can also be passed a selector to search in, be as specific as possible when using selectors. - * waitForText() will only watch the first instance of the matching selector / text provided. - * If the given text doesn't appear, a timeout exception is thrown. - * - * ``` php - * waitForText('foo', 30); // secs - * $I->waitForText('foo', 30, '.title'); // secs - * ?> - * ``` - * - * @param string $text - * @param int $timeout seconds - * @param string $selector optional - * @throws \Exception - * @see \Codeception\Module\WebDriver::waitForText() - */ - public function waitForText($text, $timeout = null, $selector = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForText', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Wait for $timeout seconds. - * - * @param int $timeout secs - * @throws \Codeception\Exception\TestRuntimeException - * @see \Codeception\Module\WebDriver::wait() - */ - public function wait($timeout) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('wait', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Low-level API method. - * If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly: - * - * ``` php - * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - * $webdriver->get('http://google.com'); - * }); - * ``` - * - * This runs in the context of the - * [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). - * Try not to use this command on a regular basis. - * If Codeception lacks a feature you need, please implement it and submit a patch. - * - * @param callable $function - * @see \Codeception\Module\WebDriver::executeInSelenium() - */ - public function executeInSelenium($function) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInSelenium', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Switch to another window identified by name. - * - * The window can only be identified by name. If the $name parameter is blank, the parent window will be used. - * - * Example: - * ``` html - * - * ``` - * - * ``` php - * click("Open window"); - * # switch to another window - * $I->switchToWindow("another_window"); - * # switch to parent window - * $I->switchToWindow(); - * ?> - * ``` - * - * If the window has no name, match it by switching to next active tab using `switchToNextTab` method. - * - * Or use native Selenium functions to get access to all opened windows: - * - * ``` php - * executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - * $handles=$webdriver->getWindowHandles(); - * $last_window = end($handles); - * $webdriver->switchTo()->window($last_window); - * }); - * ?> - * ``` - * - * @param string|null $name - * @see \Codeception\Module\WebDriver::switchToWindow() - */ - public function switchToWindow($name = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToWindow', func_get_args())); - } - - - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Switch to another frame on the page. - * - * Example: - * ``` html - *