From ac142bfca9d473a57ceefb38b74e611d1713312d Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Tue, 5 Mar 2024 08:37:46 +0100 Subject: [PATCH] test(suites) add request timeout time --- .../_generated/AcceptanceTesterActions.php | 154 +++++++++--------- tests/acceptance.suite.dist.yml | 1 + tests/climodule.suite.dist.yml | 1 + tests/webdriver.suite.dist.yml | 1 + 4 files changed, 80 insertions(+), 77 deletions(-) diff --git a/tests/_support/_generated/AcceptanceTesterActions.php b/tests/_support/_generated/AcceptanceTesterActions.php index 94c78f425..66283270f 100644 --- a/tests/_support/_generated/AcceptanceTesterActions.php +++ b/tests/_support/_generated/AcceptanceTesterActions.php @@ -1,4 +1,4 @@ -amOnPage('/'); @@ -266,7 +266,7 @@ public function amOnPage(string $page): void { * * Note that if the locator matches a button of type `submit`, the form will be submitted. * - * ``` php + * ```php * click('Logout'); @@ -297,7 +297,7 @@ public function click($link, $context = NULL): void { * You can specify a specific HTML element (via CSS or XPath) as the second * parameter to only search within that element. * - * ``` php + * ```php * see('Logout'); // I can suppose user is logged in * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page @@ -334,7 +334,7 @@ public function see(string $text, $selector = NULL): void { * You can specify a specific HTML element (via CSS or XPath) as the second * parameter to only search within that element. * - * ``` php + * ```php * see('Logout'); // I can suppose user is logged in * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page @@ -441,7 +441,7 @@ public function cantSee(string $text, $selector = NULL): void { * Checks that the current page contains the given string in its * raw source code. * - * ``` php + * ```php * seeInSource('

Green eggs & ham

'); * ``` @@ -457,7 +457,7 @@ public function seeInSource(string $raw): void { * Checks that the current page contains the given string in its * raw source code. * - * ``` php + * ```php * seeInSource('

Green eggs & ham

'); * ``` @@ -507,7 +507,7 @@ public function cantSeeInSource(string $raw): void { * 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 + * ```php * seeLink('Logout'); // matches Logout * $I->seeLink('Logout','/logout'); // matches Logout @@ -524,7 +524,7 @@ public function seeLink(string $text, ?string $url = NULL): void { * 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 + * ```php * seeLink('Logout'); // matches Logout * $I->seeLink('Logout','/logout'); // matches Logout @@ -542,7 +542,7 @@ public function canSeeLink(string $text, ?string $url = NULL): void { * 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 + * ```php * dontSeeLink('Logout'); // I suppose user is not logged in * $I->dontSeeLink('Checkout now', '/store/cart.php'); @@ -559,7 +559,7 @@ public function dontSeeLink(string $text, string $url = ""): void { * 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 + * ```php * dontSeeLink('Logout'); // I suppose user is not logged in * $I->dontSeeLink('Checkout now', '/store/cart.php'); @@ -576,7 +576,7 @@ public function cantSeeLink(string $text, string $url = ""): void { * * Checks that current URI contains the given string. * - * ``` php + * ```php * seeInCurrentUrl('home'); @@ -594,7 +594,7 @@ public function seeInCurrentUrl(string $uri): void { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that current URI contains the given string. * - * ``` php + * ```php * seeInCurrentUrl('home'); @@ -613,7 +613,7 @@ public function canSeeInCurrentUrl(string $uri): void { * * Checks that the current URI doesn't contain the given string. * - * ``` php + * ```php * dontSeeInCurrentUrl('/users/'); * ``` @@ -628,7 +628,7 @@ public function dontSeeInCurrentUrl(string $uri): void { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the current URI doesn't contain the given string. * - * ``` php + * ```php * dontSeeInCurrentUrl('/users/'); * ``` @@ -645,7 +645,7 @@ public function cantSeeInCurrentUrl(string $uri): void { * Checks that the current URL is equal to the given string. * Unlike `seeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * seeCurrentUrlEquals('/'); @@ -662,7 +662,7 @@ public function seeCurrentUrlEquals(string $uri): void { * Checks that the current URL is equal to the given string. * Unlike `seeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * seeCurrentUrlEquals('/'); @@ -680,7 +680,7 @@ public function canSeeCurrentUrlEquals(string $uri): void { * Checks that the current URL doesn't equal the given string. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * dontSeeCurrentUrlEquals('/'); @@ -697,7 +697,7 @@ public function dontSeeCurrentUrlEquals(string $uri): void { * Checks that the current URL doesn't equal the given string. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * dontSeeCurrentUrlEquals('/'); @@ -714,7 +714,7 @@ public function cantSeeCurrentUrlEquals(string $uri): void { * * Checks that the current URL matches the given regular expression. * - * ``` php + * ```php * seeCurrentUrlMatches('~^/users/(\d+)~'); @@ -730,7 +730,7 @@ public function seeCurrentUrlMatches(string $uri): void { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the current URL matches the given regular expression. * - * ``` php + * ```php * seeCurrentUrlMatches('~^/users/(\d+)~'); @@ -747,7 +747,7 @@ public function canSeeCurrentUrlMatches(string $uri): void { * * Checks that current url doesn't match the given regular expression. * - * ``` php + * ```php * dontSeeCurrentUrlMatches('~^/users/(\d+)~'); @@ -763,7 +763,7 @@ public function dontSeeCurrentUrlMatches(string $uri): void { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that current url doesn't match the given regular expression. * - * ``` php + * ```php * dontSeeCurrentUrlMatches('~^/users/(\d+)~'); @@ -781,7 +781,7 @@ public function cantSeeCurrentUrlMatches(string $uri): void { * Executes the given regular expression against the current URI and returns the first capturing group. * If no parameters are provided, the full URI is returned. * - * ``` php + * ```php * grabFromCurrentUrl('~^/user/(\d+)/~'); * $uri = $I->grabFromCurrentUrl(); @@ -798,7 +798,7 @@ public function grabFromCurrentUrl(?string $uri = NULL): mixed { * * Checks that the specified checkbox is checked. * - * ``` php + * ```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. @@ -815,7 +815,7 @@ public function seeCheckboxIsChecked($checkbox): void { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the specified checkbox is checked. * - * ``` php + * ```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. @@ -833,7 +833,7 @@ public function canSeeCheckboxIsChecked($checkbox): void { * * Check that the specified checkbox is unchecked. * - * ``` php + * ```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. @@ -849,7 +849,7 @@ public function dontSeeCheckboxIsChecked($checkbox): void { * [!] Conditional Assertion: Test won't be stopped on fail * Check that the specified checkbox is unchecked. * - * ``` php + * ```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. @@ -867,7 +867,7 @@ public function cantSeeCheckboxIsChecked($checkbox): void { * 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 + * ```php * seeInField('Body','Type your comment here'); * $I->seeInField('form textarea[name=body]','Type your comment here'); @@ -890,7 +890,7 @@ public function seeInField($field, $value): void { * 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 + * ```php * seeInField('Body','Type your comment here'); * $I->seeInField('form textarea[name=body]','Type your comment here'); @@ -914,7 +914,7 @@ public function canSeeInField($field, $value): void { * 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 + * ```php * dontSeeInField('Body','Type your comment here'); * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); @@ -936,7 +936,7 @@ public function dontSeeInField($field, $value): void { * 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 + * ```php * dontSeeInField('Body','Type your comment here'); * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); @@ -959,7 +959,7 @@ public function cantSeeInField($field, $value): void { * Checks if the array of form parameters (name => value) are set on the form matched with the * passed selector. * - * ``` php + * ```php * seeInFormFields('form[name=myform]', [ * 'input1' => 'value', @@ -970,7 +970,7 @@ public function cantSeeInField($field, $value): void { * For multi-select elements, or to check values of multiple elements with the same name, an * array may be passed: * - * ``` php + * ```php * seeInFormFields('.form-class', [ * 'multiselect' => [ @@ -986,7 +986,7 @@ public function cantSeeInField($field, $value): void { * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * seeInFormFields('#form-id', [ * 'checkbox1' => true, // passes if checked @@ -996,7 +996,7 @@ public function cantSeeInField($field, $value): void { * * Pair this with submitForm for quick testing magic. * - * ``` php + * ```php * 'value', @@ -1020,7 +1020,7 @@ public function seeInFormFields($formSelector, array $params): void { * Checks if the array of form parameters (name => value) are set on the form matched with the * passed selector. * - * ``` php + * ```php * seeInFormFields('form[name=myform]', [ * 'input1' => 'value', @@ -1031,7 +1031,7 @@ public function seeInFormFields($formSelector, array $params): void { * For multi-select elements, or to check values of multiple elements with the same name, an * array may be passed: * - * ``` php + * ```php * seeInFormFields('.form-class', [ * 'multiselect' => [ @@ -1047,7 +1047,7 @@ public function seeInFormFields($formSelector, array $params): void { * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * seeInFormFields('#form-id', [ * 'checkbox1' => true, // passes if checked @@ -1057,7 +1057,7 @@ public function seeInFormFields($formSelector, array $params): void { * * Pair this with submitForm for quick testing magic. * - * ``` php + * ```php * 'value', @@ -1082,7 +1082,7 @@ public function canSeeInFormFields($formSelector, array $params): void { * Checks if the array of form parameters (name => value) are not set on the form matched with * the passed selector. * - * ``` php + * ```php * dontSeeInFormFields('form[name=myform]', [ * 'input1' => 'non-existent value', @@ -1093,7 +1093,7 @@ public function canSeeInFormFields($formSelector, array $params): void { * To check that an element hasn't been assigned any one of many values, an array can be passed * as the value: * - * ``` php + * ```php * dontSeeInFormFields('.form-class', [ * 'fieldName' => [ @@ -1105,7 +1105,7 @@ public function canSeeInFormFields($formSelector, array $params): void { * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * dontSeeInFormFields('#form-id', [ * 'checkbox1' => true, // fails if checked @@ -1124,7 +1124,7 @@ public function dontSeeInFormFields($formSelector, array $params): void { * Checks if the array of form parameters (name => value) are not set on the form matched with * the passed selector. * - * ``` php + * ```php * dontSeeInFormFields('form[name=myform]', [ * 'input1' => 'non-existent value', @@ -1135,7 +1135,7 @@ public function dontSeeInFormFields($formSelector, array $params): void { * To check that an element hasn't been assigned any one of many values, an array can be passed * as the value: * - * ``` php + * ```php * dontSeeInFormFields('.form-class', [ * 'fieldName' => [ @@ -1147,7 +1147,7 @@ public function dontSeeInFormFields($formSelector, array $params): void { * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * dontSeeInFormFields('#form-id', [ * 'checkbox1' => true, // fails if checked @@ -1191,7 +1191,7 @@ public function cantSeeInFormFields($formSelector, array $params): void { * * Examples: * - * ``` php + * ```php * submitForm('#login', [ * 'login' => 'davert', @@ -1228,7 +1228,7 @@ public function cantSeeInFormFields($formSelector, array $params): void { * * You could write the following to submit it: * - * ``` php + * ```php * submitForm( * '#userForm', @@ -1268,7 +1268,7 @@ public function cantSeeInFormFields($formSelector, array $params): void { * This function works well when paired with `seeInFormFields()` * for quickly testing CRUD interfaces and form validation logic. * - * ``` php + * ```php * 'value', @@ -1286,7 +1286,7 @@ public function cantSeeInFormFields($formSelector, array $params): void { * you can use either the string value or boolean `true`/`false` which will * be replaced by the checkbox's value in the DOM. * - * ``` php + * ```php * submitForm('#my-form', [ * 'field1' => 'value', @@ -1346,7 +1346,7 @@ public function submitForm($selector, array $params, ?string $button = NULL): vo * * Fills a text field or textarea with the given string. * - * ``` php + * ```php * fillField("//input[@type='text']", "Hello World!"); * $I->fillField(['name' => 'email'], 'jon@example.com'); @@ -1363,7 +1363,7 @@ public function fillField($field, $value): void { * * Selects an option in a select tag or in radio button group. * - * ``` php + * ```php * selectOption('form select[name=account]', 'Premium'); * $I->selectOption('form input[name=payment]', 'Monthly'); @@ -1372,14 +1372,14 @@ public function fillField($field, $value): void { * * Provide an array for the second argument to select multiple options: * - * ``` php + * ```php * selectOption('Which OS do you use?', ['Windows', 'Linux']); * ``` * * Or provide an associative array for the second argument to specifically define which selection method should be used: * - * ``` php + * ```php * selectOption('Which OS do you use?', ['text' => 'Windows']); // Only search by text 'Windows' * $I->selectOption('Which OS do you use?', ['value' => 'windows']); // Only search by value 'windows' @@ -1396,7 +1396,7 @@ public function selectOption($select, $option): void { * * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. * - * ``` php + * ```php * checkOption('#agree'); * ``` @@ -1412,7 +1412,7 @@ public function checkOption($option): void { * * Unticks a checkbox. * - * ``` php + * ```php * uncheckOption('#notify'); * ``` @@ -1428,7 +1428,7 @@ public function uncheckOption($option): void { * * Attaches a file relative to the Codeception `_data` directory to the given file upload field. * - * ``` php + * ```php * attachFile('input[@type="file"]', 'prices.xls'); @@ -1523,7 +1523,7 @@ public function makeHtmlSnapshot(?string $name = NULL): void { * If a fuzzy locator is used, the element is found using CSS, XPath, * and by matching the full page source by regular expression. * - * ``` php + * ```php * grabTextFrom('h1'); * $heading = $I->grabTextFrom('descendant-or-self::h1'); @@ -1539,10 +1539,10 @@ public function grabTextFrom($cssOrXPathOrRegex): mixed { /** * [!] 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. + * Returns the value of the given attribute value from the given HTML element. For some attributes, the string `true` is returned instead of their literal value (e.g. `disabled="disabled"` or `required="required"`). + * Fails if the element is not found. Returns `null` if the attribute is not present on the element. * - * ``` php + * ```php * grabAttributeFrom('#tooltip', 'title'); * ``` @@ -1588,7 +1588,7 @@ public function grabMultiple($cssOrXpath, ?string $attribute = NULL): array { * 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 + * ```php * grabValueFrom('Name'); * $name = $I->grabValueFrom('input[name=username]'); @@ -1608,7 +1608,7 @@ public function grabValueFrom($field): mixed { * 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 + * ```php * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); * ``` @@ -1654,7 +1654,7 @@ public function grabPageSource(): string { * 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 + * ```php * seeCookie('PHPSESSID'); * ``` @@ -1672,7 +1672,7 @@ public function seeCookie($cookie, $params = []) { * 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 + * ```php * seeCookie('PHPSESSID'); * ``` @@ -1733,7 +1733,7 @@ public function resetCookie($cookie, $params = []) { * You can also specify expected attributes of this element. * Only works if `` tag is present. * - * ``` php + * ```php * seeElement('.error'); * $I->seeElement('//form/input[1]'); @@ -1756,7 +1756,7 @@ public function seeElement($selector, array $attributes = []): void { * You can also specify expected attributes of this element. * Only works if `` tag is present. * - * ``` php + * ```php * seeElement('.error'); * $I->seeElement('//form/input[1]'); @@ -1779,7 +1779,7 @@ public function canSeeElement($selector, array $attributes = []): void { * Checks that the given element is invisible or not present on the page. * You can also specify expected attributes of this element. * - * ``` php + * ```php * dontSeeElement('.error'); * $I->dontSeeElement('//form/input[1]'); @@ -1798,7 +1798,7 @@ public function dontSeeElement($selector, array $attributes = []): void { * Checks that the given element is invisible or not present on the page. * You can also specify expected attributes of this element. * - * ``` php + * ```php * dontSeeElement('.error'); * $I->dontSeeElement('//form/input[1]'); @@ -1817,7 +1817,7 @@ public function cantSeeElement($selector, array $attributes = []): void { * * Checks that there are a certain number of elements matched by the given locator on the page. * - * ``` php + * ```php * seeNumberOfElements('tr', 10); * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements @@ -1835,7 +1835,7 @@ public function seeNumberOfElements($selector, $expected): void { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that there are a certain number of elements matched by the given locator on the page. * - * ``` php + * ```php * seeNumberOfElements('tr', 10); * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements @@ -1854,7 +1854,7 @@ public function canSeeNumberOfElements($selector, $expected): void { * * Checks that the given option is selected. * - * ``` php + * ```php * seeOptionIsSelected('#form input[name=payment]', 'Visa'); * ``` @@ -1871,7 +1871,7 @@ public function seeOptionIsSelected($selector, $optionText) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the given option is selected. * - * ``` php + * ```php * seeOptionIsSelected('#form input[name=payment]', 'Visa'); * ``` @@ -1889,7 +1889,7 @@ public function canSeeOptionIsSelected($selector, $optionText) { * * Checks that the given option is not selected. * - * ``` php + * ```php * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); * ``` @@ -1906,7 +1906,7 @@ public function dontSeeOptionIsSelected($selector, $optionText) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the given option is not selected. * - * ``` php + * ```php * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); * ``` @@ -2124,7 +2124,7 @@ public function canSeeResponseCodeIsServerError(): void { * * Checks that the page title contains the given string. * - * ``` php + * ```php * seeInTitle('Blog - Post #1'); * ``` @@ -2141,7 +2141,7 @@ public function seeInTitle($title) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the page title contains the given string. * - * ``` php + * ```php * seeInTitle('Blog - Post #1'); * ``` diff --git a/tests/acceptance.suite.dist.yml b/tests/acceptance.suite.dist.yml index ccd8ffdde..c6728954c 100644 --- a/tests/acceptance.suite.dist.yml +++ b/tests/acceptance.suite.dist.yml @@ -22,6 +22,7 @@ modules: X_WPBROWSER_REQUEST: 1 X_TEST_REQUEST: 1 X_APM_REQUEST: 1 + connect_timeout: 3 lucatume\WPBrowser\Module\WPDb: dsn: '%WORDPRESS_DB_DSN%' user: %WORDPRESS_DB_USER% diff --git a/tests/climodule.suite.dist.yml b/tests/climodule.suite.dist.yml index 44e747c52..32ced8159 100644 --- a/tests/climodule.suite.dist.yml +++ b/tests/climodule.suite.dist.yml @@ -24,3 +24,4 @@ modules: adminUsername: '%WORDPRESS_ADMIN_USER%' adminPassword: '%WORDPRESS_ADMIN_PASSWORD%' adminPath: '/wp-admin' + connect_timeout: 3 diff --git a/tests/webdriver.suite.dist.yml b/tests/webdriver.suite.dist.yml index 48e90ec03..21a1b793e 100644 --- a/tests/webdriver.suite.dist.yml +++ b/tests/webdriver.suite.dist.yml @@ -26,6 +26,7 @@ modules: - "--proxy-server='direct://'" - "--proxy-bypass-list=*" - "--no-sandbox" + request_timeout: 3 WPDb: dbUrl: '%WORDPRESS_DB_URL%' dump: 'tests/_data/dump.sql'