From 530a4ec57d2d75145ea291d3121344d6fc0cd0d1 Mon Sep 17 00:00:00 2001 From: Ricardo Paes Date: Thu, 16 Apr 2026 00:17:40 -0300 Subject: [PATCH 01/11] :sparkles: [EIC-701] Atualizar EiChefe Backend para PHP 8.x --- .env.example | 18 +- .github/workflows/ci-56.yml | 36 - .github/workflows/ci-73.yml | 36 - .github/workflows/ci-74.yml | 36 - .github/workflows/ci-80.yml | 36 - .github/workflows/ci.yml | 66 + .php-cs-fixer.cache | 1 + .php-cs-fixer.php | 52 + .php_cs | 43 - composer.json | 27 +- docker-compose.yml | 8 +- phpstan-baseline.neon | 31 + phpstan.neon | 15 + public/index.php | 2 +- src/Console.php | 12 +- src/GitHubReporter.php | 450 ++- src/Lang.php | 53 +- src/StackTrace.php | 93 +- src/UploadImage.php | 87 +- tests/_support/AcceptanceTester.php | 14 +- tests/_support/ApiTester.php | 14 +- tests/_support/Helper/Acceptance.php | 5 +- tests/_support/Helper/Api.php | 5 +- .../_generated/AcceptanceTesterActions.php | 2818 ++++++++--------- .../_support/_generated/ApiTesterActions.php | 780 ++--- tests/acceptance/LoginCest.php | 12 +- tests/api/ApiCest.php | 12 +- tests/unit/GitHubReporterTest.php | 26 +- 28 files changed, 2207 insertions(+), 2581 deletions(-) delete mode 100644 .github/workflows/ci-56.yml delete mode 100644 .github/workflows/ci-73.yml delete mode 100644 .github/workflows/ci-74.yml delete mode 100644 .github/workflows/ci-80.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .php-cs-fixer.cache create mode 100644 .php-cs-fixer.php delete mode 100644 .php_cs create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon diff --git a/.env.example b/.env.example index 03ba0d2..eaa0c5c 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,9 @@ -PHP_VERSION=56|73|74|80 -GITHUB_OWNER: Owner of repository -GITHUB_REPO: Name of repository -GITHUB_PR_NUMBER: Number of pull request of repository -GITHUB_TOKEN: Token of the user's github who will post the comment -TEST_LANG: Language -TEST_TITLE: Message to show in title -TEST_FOOTER: Show footer with version of PHP -IMGBB_TOKEN: Token to upload image acceptance test \ No newline at end of file +PHP_VERSION=74|80|81|82|83 +GITHUB_OWNER=Owner of repository +GITHUB_REPO=Name of repository +GITHUB_PR_NUMBER=Number of pull request of repository +GITHUB_TOKEN=Token of the user's github who will post the comment +TEST_LANG=Language +TEST_TITLE=Message to show in title +TEST_FOOTER=Show footer with version of PHP +IMGBB_TOKEN=Token to upload image acceptance test \ No newline at end of file diff --git a/.github/workflows/ci-56.yml b/.github/workflows/ci-56.yml deleted file mode 100644 index bd69417..0000000 --- a/.github/workflows/ci-56.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PHP 5.6 - -on: - push: - branches: - - master - - pull_request: - -jobs: - - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Prepare code - run: | - touch .env - echo "GITHUB_OWNER=likesistemas" >> .env - echo "GITHUB_REPO=codeception-github-reporter" >> .env - echo "GITHUB_PR_NUMBER=${{github.event.number}}" >> .env - echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> .env - echo "IMGBB_TOKEN=${{ secrets.IMGBB_TOKEN }}" >> .env - echo "PHP_VERSION=56" >> .env - - - name: Run tests - run: | - docker-compose up -d - echo $(docker run -t --network github jwilder/dockerize -wait http://nginx/ -timeout 60s) - docker-compose ps - docker-compose logs php - docker-compose exec -T php composer test:ci - docker-compose down - \ No newline at end of file diff --git a/.github/workflows/ci-73.yml b/.github/workflows/ci-73.yml deleted file mode 100644 index e21676a..0000000 --- a/.github/workflows/ci-73.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PHP 7.3 - -on: - - push: - branches: - - master - - pull_request: - -jobs: - - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Prepare code - run: | - touch .env - echo "GITHUB_OWNER=likesistemas" >> .env - echo "GITHUB_REPO=codeception-github-reporter" >> .env - echo "GITHUB_PR_NUMBER=${{github.event.number}}" >> .env - echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> .env - echo "IMGBB_TOKEN=${{ secrets.IMGBB_TOKEN }}" >> .env - echo "PHP_VERSION=73" >> .env - - - name: Run tests - run: | - docker-compose up -d - echo $(docker run -t --network github jwilder/dockerize -wait http://nginx/ -timeout 60s) - docker-compose ps - docker-compose logs php - docker-compose exec -T php composer test:ci - docker-compose down \ No newline at end of file diff --git a/.github/workflows/ci-74.yml b/.github/workflows/ci-74.yml deleted file mode 100644 index e3638d8..0000000 --- a/.github/workflows/ci-74.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PHP 7.4 - -on: - - push: - branches: - - master - - pull_request: - -jobs: - - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Prepare code - run: | - touch .env - echo "GITHUB_OWNER=likesistemas" >> .env - echo "GITHUB_REPO=codeception-github-reporter" >> .env - echo "GITHUB_PR_NUMBER=${{github.event.number}}" >> .env - echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> .env - echo "IMGBB_TOKEN=${{ secrets.IMGBB_TOKEN }}" >> .env - echo "PHP_VERSION=74" >> .env - - - name: Run tests - run: | - docker-compose up -d - echo $(docker run -t --network github jwilder/dockerize -wait http://nginx/ -timeout 60s) - docker-compose ps - docker-compose logs php - docker-compose exec -T php composer test:ci - docker-compose down \ No newline at end of file diff --git a/.github/workflows/ci-80.yml b/.github/workflows/ci-80.yml deleted file mode 100644 index 6b2c4cd..0000000 --- a/.github/workflows/ci-80.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PHP 8.0 - -on: - - push: - branches: - - master - - pull_request: - -jobs: - - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Prepare code - run: | - touch .env - echo "GITHUB_OWNER=likesistemas" >> .env - echo "GITHUB_REPO=codeception-github-reporter" >> .env - echo "GITHUB_PR_NUMBER=${{github.event.number}}" >> .env - echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> .env - echo "IMGBB_TOKEN=${{ secrets.IMGBB_TOKEN }}" >> .env - echo "PHP_VERSION=80" >> .env - - - name: Run tests - run: | - docker-compose up -d - echo $(docker run -t --network github jwilder/dockerize -wait http://nginx/ -timeout 60s) - docker-compose ps - docker-compose logs php - docker-compose exec -T php composer test:ci - docker-compose down \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3b72af2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: + - master + + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + + test: + strategy: + matrix: + PHP: [74, 80, 81, 82, 83] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Prepare code + env: + PHP_VERSION: ${{ matrix.PHP }} + run: | + touch .env + echo "GITHUB_TOKEN=${{ secrets.GH_TOKEN }}" >> .env + echo "PHP_VERSION=$PHP_VERSION" >> .env + + - name: Up environment + run: | + docker compose up -d + + - name: Wait environment + run: | + echo $(docker compose -f docker-compose.wait.yml run --rm wait) + + - name: Environment logs + run: | + docker compose ps + docker compose logs php + + - name: Run Lint + run: | + docker compose exec -T php composer lint + + - name: Run PHP Unit + run: | + docker compose exec -T php composer test + + - name: Run PHP Stan + run: | + docker compose exec -T php composer analyse + + - name: Run PHP CS Fixer + run: | + docker compose exec -T php composer fix:ci + + - name: Desligando ambiente + if: ${{ always() }} + run: | + docker compose exec -T php rm -Rf vendor/ .env + docker compose down --remove-orphans \ No newline at end of file diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache new file mode 100644 index 0000000..9d9f76e --- /dev/null +++ b/.php-cs-fixer.cache @@ -0,0 +1 @@ +{"php":"8.3.4","version":"3.95.1:v3.95.1#a9727678fbd12997f1d9de8f4a37824ed9df1065","indent":"\t","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_anonymous_functions":false,"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"new_with_parentheses":{"anonymous_class":true},"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"none","imports_order":["const","class","function"]},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":{"closure_fn_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"after_heredoc":false,"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"no_useless_else":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_indent":true,"phpdoc_no_package":true,"phpdoc_order":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_trim":true,"phpdoc_var_without_name":true,"phpdoc_to_comment":true,"single_quote":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"curly_braces_position":{"classes_opening_brace":"same_line","functions_opening_brace":"same_line"},"visibility_required":{"elements":["property","method"]}},"ruleCustomisationPolicyVersion":"null-policy","hashes":{"public\/index.php":"64bd7d8bbc79f9846945aa0f9f78337d","src\/Console.php":"d6bee423ce6c8c13c600f05d9862710a","src\/GitHubReporter.php":"0b4379691bb8b5cee4649b72b6fe4707","src\/Lang.php":"7460c3a3f5fa47be907fc39e7968758a","src\/StackTrace.php":"0407ccb2fc6b43811a11f2ab98a3099e","src\/UploadImage.php":"0fa810ddeaf086a171192003b392747d","tests\/_support\/AcceptanceTester.php":"3284b54dab2163cbaa52226a359a8bcf","tests\/_support\/ApiTester.php":"400af54a0b1f029032e35a2ad35c8d86","tests\/_support\/Helper\/Acceptance.php":"be46dbbaebb56ff37c53d56213c54c66","tests\/_support\/Helper\/Api.php":"ea0f86719d1935258970b4914b88be00","tests\/_support\/_generated\/AcceptanceTesterActions.php":"b61f1d4fc6cf6c72fa2804541e47840a","tests\/_support\/_generated\/ApiTesterActions.php":"cd229fbba353e997b4271b5075531f91","tests\/acceptance\/LoginCest.php":"8c4d41c709cd7b34a97a484590cd675e","tests\/api\/ApiCest.php":"22754b2380ec4b0d034d4ad3ace9ac11","tests\/unit\/GitHubReporterTest.php":"70d5b65c37580e85075e6c605bff935d"}} \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..880fff1 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,52 @@ + true, + 'array_syntax' => ['syntax' => 'short'], + 'multiline_whitespace_before_semicolons' => false, + 'echo_tag_syntax' => false, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'no_useless_else' => true, + 'ordered_imports' => ['sort_algorithm' => 'none', 'imports_order' => ['const', 'class', 'function']], + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_trim' => true, + 'phpdoc_var_without_name' => true, + 'phpdoc_to_comment' => true, + 'single_quote' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline' => true, + 'trim_array_spaces' => true, + 'curly_braces_position' => [ + 'classes_opening_brace' => 'same_line', + 'functions_opening_brace' => 'same_line', + ], + 'visibility_required' => ['elements' => ['property', 'method']], +]; + +$excludes = [ + 'vendor', + '.vscode', + '.github', + '.devcontainer', +]; + +$finder = PhpCsFixer\Finder::create() + ->in(__DIR__) + ->exclude($excludes) + ->notName('README.md') + ->notName('*.xml') + ->notName('*.yml') + ->notName('_ide_helper.php') +; + +return (new PhpCsFixer\Config()) + ->setRules($rules) + ->setFinder($finder) + ->setIndent("\t") +; diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 1698abd..0000000 --- a/.php_cs +++ /dev/null @@ -1,43 +0,0 @@ - true, - 'array_syntax' => ['syntax' => 'short'], - 'no_multiline_whitespace_before_semicolons' => true, - 'no_short_echo_tag' => true, - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'no_useless_else' => true, - 'ordered_imports' => ['sort_algorithm' => 'none', 'imports_order' => ['const', 'class', 'function']], - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_indent' => true, - 'phpdoc_no_package' => true, - 'phpdoc_order' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_trim' => true, - 'phpdoc_var_without_name' => true, - 'phpdoc_to_comment' => true, - 'single_quote' => true, - 'ternary_operator_spaces' => true, - 'trailing_comma_in_multiline_array' => true, - 'trim_array_spaces' => true -]; - -$excludes = [ - 'vendor' -]; - -$finder = PhpCsFixer\Finder::create() - ->in(__DIR__) - ->exclude($excludes) - ->notName('README.md') - ->notName('*.xml') - ->notName('*.yml') - ->notName('_ide_helper.php') -; - -return PhpCsFixer\Config::create() - ->setRules($rules) - ->setFinder($finder) -; \ No newline at end of file diff --git a/composer.json b/composer.json index a505f56..12cec24 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": ">=5.6", + "php": ">=7.4", "ext-curl": "*", "guzzlehttp/guzzle": "^6.0 | ^7.0" }, @@ -25,15 +25,24 @@ } }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^9.0", - "codeception/codeception": "^4.1", - "codeception/module-asserts": "^1.0.0", - "codeception/module-webdriver": "^1.2", - "codeception/module-rest": "^1.2", - "codeception/module-phpbrowser": "^1.0", - "codeception/module-db": "^1.1" + "phpunit/phpunit": "^9.0 || ^10.0", + "codeception/codeception": "^4.1 || ^5.0", + "codeception/module-asserts": "^1.0 || ^2.0", + "codeception/module-webdriver": "^1.2 || ^4.0", + "codeception/module-rest": "^1.2 || ^3.0", + "codeception/module-phpbrowser": "^1.0 || ^2.0", + "codeception/module-db": "^1.1 || ^3.0", + "phpstan/phpstan": "^2.1", + "friendsofphp/php-cs-fixer": "^3.95" }, "scripts": { - "test:ci": "codecept run --no-exit --ext \"Like\\Codeception\\GitHubReporter\"" + "fix": "php-cs-fixer fix", + "fix:ci": "php-cs-fixer fix --dry-run --stop-on-violation", + "test": "codecept run --no-exit", + "test:ci": "codecept run --no-exit --ext \"Like\\Codeception\\GitHubReporter\"", + "lint": "parallel-lint --colors --exclude vendor/ .", + "analyse": ["codecept build","phpstan analyse"], + "analyse:baseline": "phpstan analyse --generate-baseline", + "refactor": "rector process" } } diff --git a/docker-compose.yml b/docker-compose.yml index 6940ee6..b49951b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.7' networks: github: name: github @@ -18,13 +17,11 @@ services: - 8081:80 networks: - github - links: - - php depends_on: - php php: - image: likesistemas/php-dev:${PHP_VERSION:-56} + image: likesistemas/php-dev:${PHP_VERSION:-74} environment: - GITHUB_TOKEN=$GITHUB_TOKEN - GITHUB_OWNER=$GITHUB_OWNER @@ -45,9 +42,6 @@ services: - 4444 networks: - github - links: - - php - - nginx depends_on: - php - nginx \ No newline at end of file diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..816cb29 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,31 @@ +parameters: + ignoreErrors: + - + message: '#^Argument of an invalid type string supplied for foreach, only iterables are supported\.$#' + identifier: foreach.nonIterable + count: 1 + path: src/GitHubReporter.php + + - + message: '#^Call to an undefined method Like\\Codeception\\GitHubReporter\:\:printExceptionTrace\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/GitHubReporter.php + + - + message: '#^Dead catch \- InvalidArgumentException is already caught above\.$#' + identifier: catch.alreadyCaught + count: 1 + path: src/GitHubReporter.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with false will always evaluate to false\.$#' + identifier: method.impossibleType + count: 1 + path: tests/unit/GitHubReporterTest.php + + - + message: '#^Method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) invoked with 0 parameters, 1\-2 required\.$#' + identifier: arguments.count + count: 1 + path: tests/unit/GitHubReporterTest.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..35f3633 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,15 @@ +# includes: +# - phpstan-baseline.neon + +parameters: + level: 5 + paths: + - src + - tests + scanDirectories: + - tests/_support/_generated/ + bootstrapFiles: + - vendor/codeception/codeception/autoload.php + excludePaths: + analyse: + - tests/_support/_generated/ \ No newline at end of file diff --git a/public/index.php b/public/index.php index b4a8fbb..fe448ae 100644 --- a/public/index.php +++ b/public/index.php @@ -1,3 +1,3 @@ options['silent'] = false; // turn on printing for this extension - $this->_reconfigure(['settings' => ['silent' => true]]); // turn off printing for everything else - $this->standardReporter = new Console($this->options); - $this->lang = Lang::getLang(getenv('TEST_LANG')); - } - - // we are listening for events - public static $events = [ - Events::SUITE_BEFORE => 'beforeSuite', - Events::SUITE_AFTER => 'afterSuite', - Events::TEST_END => 'after', - Events::TEST_SUCCESS => 'success', - Events::TEST_FAIL => 'fail', - Events::TEST_ERROR => 'error', - Events::TEST_FAIL_PRINT => 'printFailed', - Events::RESULT_PRINT_AFTER => 'result', - ]; - - protected function _write($message) - { - $this->currentTest .= $message; - } - - protected function _writeln($message) - { - $this->currentTest .= $message; - - if (strlen($this->currentTest) > 0) { - $this->tests[$this->currentTestSuit][] = $this->currentTest; - $this->currentTest = ''; - } - } - - public function beforeSuite($e) - { - $this->currentTestSuit = ucfirst($e->getSuite()->getName()) . " Tests ({$e->getSuite()->count()})"; - $this->standardReporter->beforeSuite($e); - } - - public function afterSuite($e) - { - $this->standardReporter->afterSuite($e); - } - - public function success($e) - { - $this->_write(':heavy_check_mark: '); - $this->standardReporter->testSuccess($e); - } - - public function fail($e) - { - $this->_write(':x: '); - $this->standardReporter->testFail($e); - } - - public function error($e) - { - $this->_write(':o: '); - $this->standardReporter->testError($e); - } - - public function skipped() - { - $this->_write('- [ ] :white_circle: '); - $this->standardReporter->testSkipped($e); - } - - public function after(TestEvent $e) - { - $seconds_input = $e->getTime(); - $seconds = (int) ($milliseconds = (int) ($seconds_input * 1000)) / 1000; - $time = ($seconds % 60).(($milliseconds === 0) ? '' : '.'.$milliseconds); - - $this->_write(Descriptor::getTestSignature($e->getTest())); - $this->_writeln(' ('.$time.'s)'); - - $this->standardReporter->endTest($e); - } - - public function printFailed(FailEvent $e) - { - $failedTest = $e->getTest(); - $fail = $e->getFail(); - - $error = []; - $error[] = $e->getCount().') '.Descriptor::getTestAsString($failedTest); - $error[] = Descriptor::getTestFullName($failedTest); - if ($fail->getMessage()) { - $error[] = $fail->getMessage(); - } - - if ($failedTest instanceof ScenarioDriven) { - $reports = $this->getReports($failedTest); - if ($reports) { - $error[] = $reports; - } - } else { - $trace = $this->getExceptionTrace($fail); - if ($trace) { - $error += $trace; - } - } - - $this->errors[] = $error; - - $this->standardReporter->printFail($e); - } - - use StackTrace; - - private function getReports(TestInterface $failedTest) - { - $reports = $failedTest->getMetadata()->getReports(); - if (isset($reports['png'])) { - $token = getenv('IMGBB_TOKEN'); - - try { - if (! $token) { - throw new InvalidArgumentException('To upload it informs the environment variable `TOKEN_IMGBB`.'); - } - - $upload = new UploadImage($token); - $url = $upload->upload($reports['png']); - return sprintf($this->lang['image'], $url); - } catch (RequestException $ex) { - $this->writeln("Error on upload image: {$ex->getMessage()}"); - } catch (LogicException $ex) { - $this->writeln($ex->getMessage()); - } catch (InvalidArgumentException $ex) { - $this->writeln($ex->getMessage()); - } - } - } - - public function result() - { - $TITLE = getenv('TEST_TITLE'); - $FOOTER = (getenv('TEST_FOOTER') ?: 'true') === 'true'; - $OWNER = getenv('GITHUB_OWNER'); - $REPO = getenv('GITHUB_REPO'); - $PR_NUMBER = getenv('GITHUB_PR_NUMBER'); - $TOKEN = getenv('GITHUB_TOKEN'); - - $body = $this->getBodyMessage($this->lang, $TITLE, $FOOTER); - $this->writeln(''); - $this->writeln($body); - - try { - if (! $OWNER) { - throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_OWNER`.'); - } - - if (! $REPO) { - throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_REPO`.'); - } - - if (! $PR_NUMBER) { - throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_PR_NUMBER`.'); - } - - if (! $TOKEN) { - throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_TOKEN`.'); - } - - $URL = "https://api.github.com/repos/{$OWNER}/{$REPO}/issues/${PR_NUMBER}/comments"; - - $client = new Client(); - $client->request('POST', $URL, [ - 'body' => json_encode(['body' => $body]), - 'auth' => ['token', $TOKEN], - ]); - } catch (RequestException $ex) { - $this->writeln("Error on comment in github: {$ex->getMessage()}"); - } catch (InvalidArgumentException $ex) { - $this->writeln("Error on comment in github: {$ex->getMessage()}"); - } - } - - private function getBodyMessage(array $lang, $title = null, $footer = true) - { - $message = ''; - - if ($title) { - $message .= "**$title**\n"; - } - - if (count($this->errors) == 0) { - $message .= "{$lang['success']}\n"; - } else { - $message .= sprintf($lang['fail'], count($this->errors))."\n\n"; - foreach ($this->errors as $error) { - $message .= "```Markdown\n".join("\n", $error)."\n```\n"; - } - $message .= "\n\n"; - } - - foreach ($this->tests as $suiteName => $suiteTests) { - $message .= '
'; - $message .= "{$suiteName}\n"; - $message .= '

' . join('
', $suiteTests) . '

'; - $message .= '
'; - } - - if ($footer) { - $message .= "\n\n*" . sprintf($lang['footer'], 'PHP v' . phpversion()) . '*'; - } - - return $message; - } +class GitHubReporter extends Extension { + use StackTrace; + + /** @var array */ + private $lang; + + /** @var string */ + private $currentTest = ''; + + /** @var string */ + private $currentTestSuit; + + /** @var array */ + private $tests = []; + + /** @var array */ + private $errors = []; + + /** @var Console */ + protected $standardReporter; + + public function _initialize(): void { + $this->options['silent'] = false; // turn on printing for this extension + $this->_reconfigure(['settings' => ['silent' => true]]); // turn off printing for everything else + $this->standardReporter = new Console($this->options); + $this->lang = Lang::getLang(getenv('TEST_LANG')); + } + + // we are listening for events + public static $events = [ + Events::SUITE_BEFORE => 'beforeSuite', + Events::SUITE_AFTER => 'afterSuite', + Events::TEST_END => 'after', + Events::TEST_SUCCESS => 'success', + Events::TEST_FAIL => 'fail', + Events::TEST_ERROR => 'error', + Events::TEST_FAIL_PRINT => 'printFailed', + Events::RESULT_PRINT_AFTER => 'result', + ]; + + protected function _write($message) { + $this->currentTest .= $message; + } + + protected function _writeln($message) { + $this->currentTest .= $message; + + if (strlen($this->currentTest) > 0) { + $this->tests[$this->currentTestSuit][] = $this->currentTest; + $this->currentTest = ''; + } + } + + public function beforeSuite($e) { + $this->currentTestSuit = ucfirst($e->getSuite()->getName()) . " Tests ({$e->getSuite()->count()})"; + $this->standardReporter->beforeSuite($e); + } + + public function afterSuite($e) { + $this->standardReporter->afterSuite($e); + } + + public function success($e) { + $this->_write(':heavy_check_mark: '); + $this->standardReporter->testSuccess($e); + } + + public function fail($e) { + $this->_write(':x: '); + $this->standardReporter->testFail($e); + } + + public function error($e) { + $this->_write(':o: '); + $this->standardReporter->testError($e); + } + + public function skipped($e) { + $this->_write('- [ ] :white_circle: '); + $this->standardReporter->testSkipped($e); + } + + public function after(TestEvent $e) { + $seconds_input = $e->getTime(); + $seconds = (int) ($milliseconds = (int) ($seconds_input * 1000)) / 1000; + $time = ($seconds % 60).(($milliseconds === 0) ? '' : '.'.$milliseconds); + + $this->_write(Descriptor::getTestSignature($e->getTest())); + $this->_writeln(' ('.$time.'s)'); + + $this->standardReporter->endTest($e); + } + + public function printFailed(FailEvent $e, int $eventNumber): void { + $failedTest = $e->getTest(); + $fail = $e->getFail(); + + $error = []; + $error[] = $eventNumber . ') ' . Descriptor::getTestAsString($failedTest); + $error[] = Descriptor::getTestFullName($failedTest); + if ($fail->getMessage()) { + $error[] = $fail->getMessage(); + } + + if ($failedTest instanceof ScenarioDriven) { + $reports = $this->getReports($failedTest); + if ($reports) { + $error[] = $reports; + } + } else { + $trace = $this->getExceptionTrace($fail); + if ($trace) { + $error += $trace; + } + } + + $this->errors[] = $error; + + $this->standardReporter->printFail($e, $eventNumber); + } + + private function getReports(TestInterface $failedTest) { + $reports = $failedTest->getMetadata()->getReports(); + if (isset($reports['png'])) { + $token = getenv('IMGBB_TOKEN'); + + try { + if (! $token) { + throw new InvalidArgumentException('To upload it informs the environment variable `TOKEN_IMGBB`.'); + } + + $upload = new UploadImage($token); + $url = $upload->upload($reports['png']); + return sprintf($this->lang['image'], $url); + } catch (RequestException $ex) { + $this->writeln("Error on upload image: {$ex->getMessage()}"); + } catch (LogicException $ex) { + $this->writeln($ex->getMessage()); + } catch (InvalidArgumentException $ex) { + $this->writeln($ex->getMessage()); + } + } + } + + public function result() { + $TITLE = getenv('TEST_TITLE'); + $FOOTER = (getenv('TEST_FOOTER') ?: 'true') === 'true'; + $OWNER = getenv('GITHUB_OWNER'); + $REPO = getenv('GITHUB_REPO'); + $PR_NUMBER = getenv('GITHUB_PR_NUMBER'); + $TOKEN = getenv('GITHUB_TOKEN'); + + $body = $this->getBodyMessage($this->lang, $TITLE, $FOOTER); + $this->writeln(''); + $this->writeln($body); + + try { + if (! $OWNER) { + throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_OWNER`.'); + } + + if (! $REPO) { + throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_REPO`.'); + } + + if (! $PR_NUMBER) { + throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_PR_NUMBER`.'); + } + + if (! $TOKEN) { + throw new InvalidArgumentException('It is necessary to send the environment variable `GITHUB_TOKEN`.'); + } + + $URL = "https://api.github.com/repos/{$OWNER}/{$REPO}/issues/${PR_NUMBER}/comments"; + + $client = new Client(); + $client->request('POST', $URL, [ + 'body' => json_encode(['body' => $body]), + 'auth' => ['token', $TOKEN], + ]); + } catch (RequestException $ex) { + $this->writeln("Error on comment in github: {$ex->getMessage()}"); + } catch (InvalidArgumentException $ex) { + $this->writeln("Error on comment in github: {$ex->getMessage()}"); + } + } + + private function getBodyMessage(array $lang, $title = null, $footer = true) { + $message = ''; + + if ($title) { + $message .= "**$title**\n"; + } + + if (count($this->errors) == 0) { + $message .= "{$lang['success']}\n"; + } else { + $message .= sprintf($lang['fail'], count($this->errors))."\n\n"; + foreach ($this->errors as $error) { + $message .= "```Markdown\n".join("\n", $error)."\n```\n"; + } + $message .= "\n\n"; + } + + foreach ($this->tests as $suiteName => $suiteTests) { + $message .= '
'; + $message .= "{$suiteName}\n"; + $message .= '

' . join('
', $suiteTests) . '

'; + $message .= '
'; + } + + if ($footer) { + $message .= "\n\n*" . sprintf($lang['footer'], 'PHP v' . phpversion()) . '*'; + } + + return $message; + } } diff --git a/src/Lang.php b/src/Lang.php index 6e887f6..5d930fd 100644 --- a/src/Lang.php +++ b/src/Lang.php @@ -2,36 +2,33 @@ namespace Like\Codeception; -class Lang -{ - const LANG_DEFAULT = 'pt-br'; +class Lang { + public const LANG_DEFAULT = 'pt-br'; - private static $langs = [ - 'pt-br' => [ - 'success' => ':sunglasses: Parabéns, seus testes passaram...', - 'fail' => ':rage: Que pena, ocorreram %u erro(s) em seus testes!', - 'footer' => 'Testes foram realizados usando %s', - 'image' => 'Visualizar imagem em %s', - ], - 'en-us' => [ - 'success' => ':sunglasses: Congratulations, your tests have passed...', - 'fail' => ':rage: Your tests failed, there were %u errors!', - 'footer' => 'Tests were performed using %s', - 'image' => 'To view image in %s', - ], - ]; + private static $langs = [ + 'pt-br' => [ + 'success' => ':sunglasses: Parabéns, seus testes passaram...', + 'fail' => ':rage: Que pena, ocorreram %u erro(s) em seus testes!', + 'footer' => 'Testes foram realizados usando %s', + 'image' => 'Visualizar imagem em %s', + ], + 'en-us' => [ + 'success' => ':sunglasses: Congratulations, your tests have passed...', + 'fail' => ':rage: Your tests failed, there were %u errors!', + 'footer' => 'Tests were performed using %s', + 'image' => 'To view image in %s', + ], + ]; - public static function getLang($lang) - { - if (! isset(self::$langs[$lang])) { - $lang = self::LANG_DEFAULT; - } + public static function getLang($lang) { + if (! isset(self::$langs[$lang])) { + $lang = self::LANG_DEFAULT; + } - return self::$langs[$lang]; - } + return self::$langs[$lang]; + } - public static function add($lang, $data) - { - self::$langs[$lang] = $data; - } + public static function add($lang, $data) { + self::$langs[$lang] = $data; + } } diff --git a/src/StackTrace.php b/src/StackTrace.php index e8fcc6f..a155c65 100644 --- a/src/StackTrace.php +++ b/src/StackTrace.php @@ -3,51 +3,50 @@ namespace Like\Codeception; use Codeception\Lib\Console\Message; - -trait StackTrace -{ - public function getExceptionTrace($e) - { - $lines = []; - - if ($e instanceof \PHPUnit\Framework\SkippedTestCase or $e instanceof \PHPUnit\Framework\IncompleteTestCase) { - return; - } - - $trace = \PHPUnit\Util\Filter::getFilteredStacktrace($e, false); - - $i = 0; - foreach ($trace as $step) { - $i++; - - $message = $this->message($i)->prepend('#')->width(4); - - if (! isset($step['file'])) { - foreach (['class', 'type', 'function'] as $info) { - if (! isset($step[$info])) { - continue; - } - $message->append($step[$info]); - } - $lines[] = $message->getMessage(); - continue; - } - $message->append($step['file'] . ':' . $step['line']); - $lines[] = $message->getMessage(); - } - - if (method_exists($e, 'getPrevious')) { - $prev = $e->getPrevious(); - if ($prev) { - $lines += $this->printExceptionTrace($prev); - } - } - - return $lines; - } - - private function message($message) - { - return new Message($message); - } +use PHPUnit\Event\Test\MarkedIncomplete; +use PHPUnit\Event\Test\Skipped; + +trait StackTrace { + public function getExceptionTrace($e) { + $lines = []; + + if ($e instanceof Skipped or $e instanceof MarkedIncomplete) { + return; + } + + $trace = \PHPUnit\Util\Filter::getFilteredStacktrace($e, false); + + $i = 0; + foreach ($trace as $step) { + $i++; + + $message = $this->message($i)->prepend('#')->width(4); + + if (! isset($step['file'])) { + foreach (['class', 'type', 'function'] as $info) { + if (! isset($step[$info])) { + continue; + } + $message->append($step[$info]); + } + $lines[] = $message->getMessage(); + continue; + } + $message->append($step['file'] . ':' . $step['line']); + $lines[] = $message->getMessage(); + } + + if (method_exists($e, 'getPrevious')) { + $prev = $e->getPrevious(); + if ($prev) { + $lines += $this->printExceptionTrace($prev); + } + } + + return $lines; + } + + private function message($message) { + return new Message($message); + } } diff --git a/src/UploadImage.php b/src/UploadImage.php index 21d6cf3..6826e08 100644 --- a/src/UploadImage.php +++ b/src/UploadImage.php @@ -5,49 +5,46 @@ use GuzzleHttp\Client; use LogicException; -class UploadImage -{ - const URL = 'https://api.imgbb.com/1/upload'; - const EXPIRATION_IN_SECONDS = 10080; // One week - - /** @var string */ - private $token; - - public function __construct($token) - { - $this->token = $token; - } - - public function upload($fileToUpload) - { - $url = self::URL . - '?expiration=' . self::EXPIRATION_IN_SECONDS . - '&key=' . $this->token; - - $client = new Client(); - $response = $client->request('POST', $url, [ - 'multipart' => [ - [ - 'name' => 'image', - 'contents' => fopen($fileToUpload, 'r'), - ], - ], - ]); - - $body = (string) $response->getBody(); - if (! $body) { - throw new LogicException('Body is empty.'); - } - - $json = json_decode($body, true); - if (! is_array($json)) { - throw new LogicException('Body is json. Body: ' . $body); - } - - if (! isset($json['data']) || ! isset($json['data']['url'])) { - throw new LogicException('Body is valid json. Body: ' . $body); - } - - return $json['data']['url']; - } +class UploadImage { + public const URL = 'https://api.imgbb.com/1/upload'; + public const EXPIRATION_IN_SECONDS = 10080; // One week + + /** @var string */ + private $token; + + public function __construct($token) { + $this->token = $token; + } + + public function upload($fileToUpload) { + $url = self::URL . + '?expiration=' . self::EXPIRATION_IN_SECONDS . + '&key=' . $this->token; + + $client = new Client(); + $response = $client->request('POST', $url, [ + 'multipart' => [ + [ + 'name' => 'image', + 'contents' => fopen($fileToUpload, 'r'), + ], + ], + ]); + + $body = (string) $response->getBody(); + if (! $body) { + throw new LogicException('Body is empty.'); + } + + $json = json_decode($body, true); + if (! is_array($json)) { + throw new LogicException('Body is json. Body: ' . $body); + } + + if (! isset($json['data']) || ! isset($json['data']['url'])) { + throw new LogicException('Body is valid json. Body: ' . $body); + } + + return $json['data']['url']; + } } diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index fa78f3d..314afcd 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -2,6 +2,7 @@ /** * Inherited Methods + * * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) @@ -14,12 +15,11 @@ * @method void pause() * * @SuppressWarnings(PHPMD) -*/ -class AcceptanceTester extends \Codeception\Actor -{ - use _generated\AcceptanceTesterActions; + */ +class AcceptanceTester extends \Codeception\Actor { + use _generated\AcceptanceTesterActions; - /** - * Define custom actions here - */ + /* + * Define custom actions here + */ } diff --git a/tests/_support/ApiTester.php b/tests/_support/ApiTester.php index 968d04b..d5d0bf9 100644 --- a/tests/_support/ApiTester.php +++ b/tests/_support/ApiTester.php @@ -3,6 +3,7 @@ /** * Inherited Methods + * * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) @@ -15,12 +16,11 @@ * @method void pause() * * @SuppressWarnings(PHPMD) -*/ -class ApiTester extends \Codeception\Actor -{ - use _generated\ApiTesterActions; + */ +class ApiTester extends \Codeception\Actor { + use _generated\ApiTesterActions; - /** - * Define custom actions here - */ + /* + * Define custom actions here + */ } diff --git a/tests/_support/Helper/Acceptance.php b/tests/_support/Helper/Acceptance.php index 65b9421..ca14117 100644 --- a/tests/_support/Helper/Acceptance.php +++ b/tests/_support/Helper/Acceptance.php @@ -1,10 +1,9 @@ getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args())); + public function debugWebDriverLogs(?\Codeception\TestInterface $test = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * [!] Test won't be stopped on fail. Error won't be logged * Print out latest Selenium Logs in debug mode - * - * @param \Codeception\TestInterface $test * @see \Codeception\Module\WebDriver::debugWebDriverLogs() */ - public function tryToDebugWebDriverLogs($test = NULL) { + public function tryToDebugWebDriverLogs(?\Codeception\TestInterface $test = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('debugWebDriverLogs', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes debugWebDriverLogs and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::debugWebDriverLogs() */ - public function retryDebugWebDriverLogs($test = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDebugWebDriverLogs(?\Codeception\TestInterface $test = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('debugWebDriverLogs', func_get_args(), $retryNum, $retryInterval)); } @@ -60,23 +56,19 @@ public function retryDebugWebDriverLogs($test = NULL) { * * ``` php * amOnSubdomain('user'); * $I->amOnPage('/'); - * // moves to http://user.mysite.com/ - * ?> + * // moves to https://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())); + public function amOnSubdomain(string $subdomain): void { + $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args())); } @@ -93,12 +85,10 @@ public function amOnSubdomain($subdomain) { * $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())); + public function makeScreenshot(?string $name = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('makeScreenshot', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -114,25 +104,23 @@ public function makeScreenshot($name = NULL) { * $I->makeScreenshot(); * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png * ``` - * - * @param $name * @see \Codeception\Module\WebDriver::makeScreenshot() */ - public function tryToMakeScreenshot($name = NULL) { + public function tryToMakeScreenshot(?string $name = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('makeScreenshot', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes makeScreenshot and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::makeScreenshot() */ - public function retryMakeScreenshot($name = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryMakeScreenshot(?string $name = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('makeScreenshot', func_get_args(), $retryNum, $retryInterval)); } @@ -151,11 +139,11 @@ public function retryMakeScreenshot($name = NULL) { * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png * ``` * - * @param $name + * @param WebDriverBy|array $selector * @see \Codeception\Module\WebDriver::makeElementScreenshot() */ - public function makeElementScreenshot($selector, $name = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('makeElementScreenshot', func_get_args())); + public function makeElementScreenshot($selector, ?string $name = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('makeElementScreenshot', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -172,24 +160,24 @@ public function makeElementScreenshot($selector, $name = NULL) { * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png * ``` * - * @param $name + * @param WebDriverBy|array $selector * @see \Codeception\Module\WebDriver::makeElementScreenshot() */ - public function tryToMakeElementScreenshot($selector, $name = NULL) { + public function tryToMakeElementScreenshot($selector, ?string $name = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('makeElementScreenshot', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes makeElementScreenshot and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::makeElementScreenshot() */ - public function retryMakeElementScreenshot($selector, $name = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryMakeElementScreenshot($selector, ?string $name = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('makeElementScreenshot', func_get_args(), $retryNum, $retryInterval)); } @@ -206,12 +194,10 @@ public function retryMakeElementScreenshot($selector, $name = NULL) { * $I->makeHtmlSnapshot(); * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.html * ``` - * - * @param null $name * @see \Codeception\Module\WebDriver::makeHtmlSnapshot() */ - public function makeHtmlSnapshot($name = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('makeHtmlSnapshot', func_get_args())); + public function makeHtmlSnapshot(?string $name = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('makeHtmlSnapshot', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -226,25 +212,23 @@ public function makeHtmlSnapshot($name = NULL) { * $I->makeHtmlSnapshot(); * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.html * ``` - * - * @param null $name * @see \Codeception\Module\WebDriver::makeHtmlSnapshot() */ - public function tryToMakeHtmlSnapshot($name = NULL) { + public function tryToMakeHtmlSnapshot(?string $name = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('makeHtmlSnapshot', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes makeHtmlSnapshot and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::makeHtmlSnapshot() */ - public function retryMakeHtmlSnapshot($name = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryMakeHtmlSnapshot(?string $name = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('makeHtmlSnapshot', func_get_args(), $retryNum, $retryInterval)); } @@ -259,13 +243,10 @@ public function retryMakeHtmlSnapshot($name = NULL) { * $I->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())); + public function resizeWindow(int $width, int $height): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('resizeWindow', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -278,26 +259,23 @@ public function resizeWindow($width, $height) { * $I->resizeWindow(800, 600); * * ``` - * - * @param int $width - * @param int $height * @see \Codeception\Module\WebDriver::resizeWindow() */ - public function tryToResizeWindow($width, $height) { + public function tryToResizeWindow(int $width, int $height): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('resizeWindow', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes resizeWindow and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::resizeWindow() */ - public function retryResizeWindow($width, $height) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryResizeWindow(int $width, int $height) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('resizeWindow', func_get_args(), $retryNum, $retryInterval)); } @@ -308,19 +286,16 @@ public function retryResizeWindow($width, $height) { * 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'); - * ?> * ``` * - * @param $cookie - * @param array $params - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeCookie() */ - public function seeCookie($cookie, $params = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); + public function seeCookie($cookie, array $params = [], bool $showDebug = true): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -329,19 +304,16 @@ 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'); - * ?> * ``` * - * @param $cookie - * @param array $params - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeCookie() */ - public function canSeeCookie($cookie, $params = []) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); + public function canSeeCookie($cookie, array $params = [], bool $showDebug = true): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -350,32 +322,29 @@ public function canSeeCookie($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'); - * ?> * ``` * - * @param $cookie - * @param array $params - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeCookie() */ - public function tryToSeeCookie($cookie, $params = []) { + public function tryToSeeCookie($cookie, array $params = [], bool $showDebug = true): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeCookie', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeCookie and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeCookie() */ - public function retrySeeCookie($cookie, $params = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeCookie($cookie, array $params = [], bool $showDebug = true) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeCookie', func_get_args(), $retryNum, $retryInterval)); } @@ -386,14 +355,11 @@ public function retrySeeCookie($cookie, $params = []) { * 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 + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeCookie() */ - public function dontSeeCookie($cookie, $params = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCookie', func_get_args())); + public function dontSeeCookie($cookie, array $params = [], bool $showDebug = true): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCookie', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -402,14 +368,11 @@ public function dontSeeCookie($cookie, $params = []) { * 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 + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeCookie() */ - public function cantSeeCookie($cookie, $params = []) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); + public function cantSeeCookie($cookie, array $params = [], bool $showDebug = true): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -418,27 +381,24 @@ public function cantSeeCookie($cookie, $params = []) { * 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 + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeCookie() */ - public function tryToDontSeeCookie($cookie, $params = []) { + public function tryToDontSeeCookie($cookie, array $params = [], bool $showDebug = true): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeCookie', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeCookie and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeCookie() */ - public function retryDontSeeCookie($cookie, $params = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeCookie($cookie, array $params = [], bool $showDebug = true) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeCookie', func_get_args(), $retryNum, $retryInterval)); } @@ -449,21 +409,16 @@ public function retryDontSeeCookie($cookie, $params = []) { * 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'); - * ?> * ``` * - * @param $name - * @param $val - * @param array $params - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::setCookie() */ - public function setCookie($cookie, $value, $params = [], $showDebug = true) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); + public function setCookie($name, $value, array $params = [], $showDebug = true): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -472,34 +427,29 @@ public function setCookie($cookie, $value, $params = [], $showDebug = true) { * 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'); - * ?> * ``` * - * @param $name - * @param $val - * @param array $params - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::setCookie() */ - public function tryToSetCookie($cookie, $value, $params = [], $showDebug = true) { + public function tryToSetCookie($name, $value, array $params = [], $showDebug = true): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('setCookie', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes setCookie and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::setCookie() */ - public function retrySetCookie($cookie, $value, $params = [], $showDebug = true) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySetCookie($name, $value, array $params = [], $showDebug = true) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('setCookie', func_get_args(), $retryNum, $retryInterval)); } @@ -510,14 +460,11 @@ public function retrySetCookie($cookie, $value, $params = [], $showDebug = true) * 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 + * @return mixed|void * @see \Codeception\Module\WebDriver::resetCookie() */ - public function resetCookie($cookie, $params = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); + public function resetCookie($cookie, array $params = [], bool $showDebug = true): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -526,27 +473,24 @@ public function resetCookie($cookie, $params = []) { * 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 + * @return mixed|void * @see \Codeception\Module\WebDriver::resetCookie() */ - public function tryToResetCookie($cookie, $params = []) { + public function tryToResetCookie($cookie, array $params = [], bool $showDebug = true): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('resetCookie', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes resetCookie and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::resetCookie() */ - public function retryResetCookie($cookie, $params = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryResetCookie($cookie, array $params = [], bool $showDebug = true) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('resetCookie', func_get_args(), $retryNum, $retryInterval)); } @@ -557,28 +501,23 @@ public function retryResetCookie($cookie, $params = []) { * Grabs a cookie value. * You can set additional cookie params like `domain`, `path` in array passed as last argument. * If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`. - * - * @param $cookie - * - * @param array $params - * @return mixed * @see \Codeception\Module\WebDriver::grabCookie() */ - public function grabCookie($cookie, $params = []) { + public function grabCookie($cookie, array $params = []): mixed { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabCookie and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabCookie() */ - public function retryGrabCookie($cookie, $params = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryGrabCookie($cookie, array $params = []) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabCookie', func_get_args(), $retryNum, $retryInterval)); } @@ -589,25 +528,24 @@ public function retryGrabCookie($cookie, $params = []) { * 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() { + public function grabPageSource(): string { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabPageSource', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabPageSource and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabPageSource() */ public function retryGrabPageSource() { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabPageSource', func_get_args(), $retryNum, $retryInterval)); } @@ -619,14 +557,13 @@ public function retryGrabPageSource() { * * ``` php * amOnUrl('http://codeception.com'); - * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart - * ?> + * $I->amOnUrl('https://codeception.com'); + * $I->amOnPage('/quickstart'); // moves to https://codeception.com/quickstart * ``` * @see \Codeception\Module\WebDriver::amOnUrl() */ - public function amOnUrl($url) { - return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); + public function amOnUrl($url): void { + $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args())); } @@ -635,19 +572,17 @@ public function amOnUrl($url) { * * Opens the page for the given relative URI. * - * ``` php + * ```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())); + public function amOnPage($page): void { + $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args())); } @@ -659,7 +594,7 @@ public function amOnPage($page) { * 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 @@ -681,12 +616,11 @@ public function amOnPage($page) { * * For checking the raw source code, use `seeInSource()`. * - * @param string $text * @param array|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())); + public function see($text, $selector = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -697,7 +631,7 @@ public function see($text, $selector = NULL) { * 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 @@ -719,12 +653,11 @@ public function see($text, $selector = NULL) { * * For checking the raw source code, use `seeInSource()`. * - * @param string $text * @param array|string $selector optional * @see \Codeception\Module\WebDriver::see() */ - public function canSee($text, $selector = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); + public function canSee($text, $selector = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -735,7 +668,7 @@ public function canSee($text, $selector = NULL) { * 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 @@ -757,25 +690,24 @@ public function canSee($text, $selector = NULL) { * * For checking the raw source code, use `seeInSource()`. * - * @param string $text * @param array|string $selector optional * @see \Codeception\Module\WebDriver::see() */ - public function tryToSee($text, $selector = NULL) { + public function tryToSee($text, $selector = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('see', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes see and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::see() */ public function retrySee($text, $selector = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('see', func_get_args(), $retryNum, $retryInterval)); } @@ -808,12 +740,11 @@ public function retrySee($text, $selector = NULL) { * * For checking the raw source code, use `seeInSource()`. * - * @param string $text * @param array|string $selector optional * @see \Codeception\Module\WebDriver::dontSee() */ - public function dontSee($text, $selector = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSee', func_get_args())); + public function dontSee($text, $selector = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSee', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -844,12 +775,11 @@ public function dontSee($text, $selector = NULL) { * * For checking the raw source code, use `seeInSource()`. * - * @param string $text * @param array|string $selector optional * @see \Codeception\Module\WebDriver::dontSee() */ - public function cantSee($text, $selector = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); + public function cantSee($text, $selector = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -880,25 +810,24 @@ public function cantSee($text, $selector = NULL) { * * For checking the raw source code, use `seeInSource()`. * - * @param string $text * @param array|string $selector optional * @see \Codeception\Module\WebDriver::dontSee() */ - public function tryToDontSee($text, $selector = NULL) { + public function tryToDontSee($text, $selector = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSee', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSee and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSee() */ public function retryDontSee($text, $selector = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSee', func_get_args(), $retryNum, $retryInterval)); } @@ -909,16 +838,14 @@ public function retryDontSee($text, $selector = NULL) { * Checks that the current page contains the given string in its * raw source code. * - * ``` php + * ```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())); + public function seeInSource($raw): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -927,16 +854,14 @@ public function seeInSource($raw) { * Checks that the current page contains the given string in its * raw source code. * - * ``` php + * ```php * seeInSource('

Green eggs & ham

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

Green eggs & ham

'); * ``` - * - * @param $raw * @see \Codeception\Module\WebDriver::seeInSource() */ - public function tryToSeeInSource($raw) { + public function tryToSeeInSource($raw): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeInSource', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInSource and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInSource() */ public function retrySeeInSource($raw) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInSource', func_get_args(), $retryNum, $retryInterval)); } @@ -982,12 +905,10 @@ public function retrySeeInSource($raw) { * dontSeeInSource('

Green eggs & ham

'); * ``` - * - * @param $raw * @see \Codeception\Module\WebDriver::dontSeeInSource() */ - public function dontSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInSource', func_get_args())); + public function dontSeeInSource($raw): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1000,12 +921,10 @@ public function dontSeeInSource($raw) { * dontSeeInSource('

Green eggs & ham

'); * ``` - * - * @param $raw * @see \Codeception\Module\WebDriver::dontSeeInSource() */ - public function cantSeeInSource($raw) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args())); + public function cantSeeInSource($raw): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1018,25 +937,23 @@ public function cantSeeInSource($raw) { * dontSeeInSource('

Green eggs & ham

'); * ``` - * - * @param $raw * @see \Codeception\Module\WebDriver::dontSeeInSource() */ - public function tryToDontSeeInSource($raw) { + public function tryToDontSeeInSource($raw): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInSource', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInSource and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInSource() */ public function retryDontSeeInSource($raw) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInSource', func_get_args(), $retryNum, $retryInterval)); } @@ -1050,12 +967,10 @@ public function retryDontSeeInSource($raw) { * seeInPageSource('getScenario()->runStep(new \Codeception\Step\Assertion('seeInPageSource', func_get_args())); + public function seeInPageSource(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPageSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1067,12 +982,10 @@ public function seeInPageSource($text) { * seeInPageSource('getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPageSource', func_get_args())); + public function canSeeInPageSource(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPageSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1084,25 +997,23 @@ public function canSeeInPageSource($text) { * seeInPageSource('getScenario()->runStep(new \Codeception\Step\TryTo('seeInPageSource', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInPageSource and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInPageSource() */ - public function retrySeeInPageSource($text) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeInPageSource(string $text) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInPageSource', func_get_args(), $retryNum, $retryInterval)); } @@ -1111,49 +1022,43 @@ public function retrySeeInPageSource($text) { * [!] 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\Action('dontSeeInPageSource', func_get_args())); + public function dontSeeInPageSource(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInPageSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the page source doesn't contain the given string. - * - * @param $text * @see \Codeception\Module\WebDriver::dontSeeInPageSource() */ - public function cantSeeInPageSource($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPageSource', func_get_args())); + public function cantSeeInPageSource(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPageSource', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * [!] Test won't be stopped on fail. Error won't be logged * Checks that the page source doesn't contain the given string. - * - * @param $text * @see \Codeception\Module\WebDriver::dontSeeInPageSource() */ - public function tryToDontSeeInPageSource($text) { + public function tryToDontSeeInPageSource(string $text): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInPageSource', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInPageSource and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInPageSource() */ - public function retryDontSeeInPageSource($text) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeInPageSource(string $text) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInPageSource', func_get_args(), $retryNum, $retryInterval)); } @@ -1171,7 +1076,7 @@ public function retryDontSeeInPageSource($text) { * * Note that if the locator matches a button of type `submit`, the form will be submitted. * - * ``` php + * ```php * click('Logout'); @@ -1185,15 +1090,12 @@ public function retryDontSeeInPageSource($text) { * $I->click('Logout', '#nav'); * // using strict locator * $I->click(['link' => 'Login']); - * ?> * ``` - * - * @param $link - * @param $context + * @param string|array $link * @see \Codeception\Module\WebDriver::click() */ - public function click($link, $context = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); + public function click($link, $context = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1209,7 +1111,7 @@ public function click($link, $context = NULL) { * * Note that if the locator matches a button of type `submit`, the form will be submitted. * - * ``` php + * ```php * click('Logout'); @@ -1223,28 +1125,25 @@ public function click($link, $context = NULL) { * $I->click('Logout', '#nav'); * // using strict locator * $I->click(['link' => 'Login']); - * ?> * ``` - * - * @param $link - * @param $context + * @param string|array $link * @see \Codeception\Module\WebDriver::click() */ - public function tryToClick($link, $context = NULL) { + public function tryToClick($link, $context = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('click', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes click and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::click() */ public function retryClick($link, $context = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('click', func_get_args(), $retryNum, $retryInterval)); } @@ -1255,19 +1154,15 @@ public function retryClick($link, $context = NULL) { * 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 - * ?> * ``` - * - * @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())); + public function seeLink(string $text, ?string $url = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1276,19 +1171,15 @@ public function seeLink($text, $url = NULL) { * 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 - * ?> * ``` - * - * @param string $text - * @param string $url optional * @see \Codeception\Module\WebDriver::seeLink() */ - public function canSeeLink($text, $url = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); + public function canSeeLink(string $text, ?string $url = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1297,32 +1188,28 @@ public function canSeeLink($text, $url = NULL) { * 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 - * ?> * ``` - * - * @param string $text - * @param string $url optional * @see \Codeception\Module\WebDriver::seeLink() */ - public function tryToSeeLink($text, $url = NULL) { + public function tryToSeeLink(string $text, ?string $url = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeLink', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeLink and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeLink() */ - public function retrySeeLink($text, $url = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeLink(string $text, ?string $url = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeLink', func_get_args(), $retryNum, $retryInterval)); } @@ -1333,19 +1220,15 @@ public function retrySeeLink($text, $url = NULL) { * 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'); - * ?> * ``` - * - * @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\Action('dontSeeLink', func_get_args())); + public function dontSeeLink(string $text, string $url = ""): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeLink', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1354,19 +1237,15 @@ public function dontSeeLink($text, $url = NULL) { * 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'); - * ?> * ``` - * - * @param string $text - * @param string $url optional * @see \Codeception\Module\WebDriver::dontSeeLink() */ - public function cantSeeLink($text, $url = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); + public function cantSeeLink(string $text, string $url = ""): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1375,32 +1254,28 @@ public function cantSeeLink($text, $url = NULL) { * 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'); - * ?> * ``` - * - * @param string $text - * @param string $url optional * @see \Codeception\Module\WebDriver::dontSeeLink() */ - public function tryToDontSeeLink($text, $url = NULL) { + public function tryToDontSeeLink(string $text, string $url = ""): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeLink', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeLink and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeLink() */ - public function retryDontSeeLink($text, $url = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeLink(string $text, string $url = "") { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeLink', func_get_args(), $retryNum, $retryInterval)); } @@ -1410,20 +1285,17 @@ public function retryDontSeeLink($text, $url = NULL) { * * Checks that current URI contains the given string. * - * ``` php + * ```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())); + public function seeInCurrentUrl(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1431,20 +1303,17 @@ public function seeInCurrentUrl($uri) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that current URI contains the given string. * - * ``` php + * ```php * seeInCurrentUrl('home'); * // to match: /users/1 * $I->seeInCurrentUrl('/users/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::seeInCurrentUrl() */ - public function canSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); + public function canSeeInCurrentUrl(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1452,33 +1321,30 @@ public function canSeeInCurrentUrl($uri) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that current URI contains the given string. * - * ``` php + * ```php * seeInCurrentUrl('home'); * // to match: /users/1 * $I->seeInCurrentUrl('/users/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::seeInCurrentUrl() */ - public function tryToSeeInCurrentUrl($uri) { + public function tryToSeeInCurrentUrl(string $uri): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeInCurrentUrl', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInCurrentUrl and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInCurrentUrl() */ - public function retrySeeInCurrentUrl($uri) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeInCurrentUrl(string $uri) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInCurrentUrl', func_get_args(), $retryNum, $retryInterval)); } @@ -1489,18 +1355,15 @@ public function retrySeeInCurrentUrl($uri) { * Checks that the current URL is equal to the given string. * Unlike `seeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```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())); + public function seeCurrentUrlEquals(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1509,18 +1372,15 @@ public function seeCurrentUrlEquals($uri) { * Checks that the current URL is equal to the given string. * Unlike `seeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * seeCurrentUrlEquals('/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() */ - public function canSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); + public function canSeeCurrentUrlEquals(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1529,31 +1389,28 @@ public function canSeeCurrentUrlEquals($uri) { * Checks that the current URL is equal to the given string. * Unlike `seeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * seeCurrentUrlEquals('/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() */ - public function tryToSeeCurrentUrlEquals($uri) { + public function tryToSeeCurrentUrlEquals(string $uri): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeCurrentUrlEquals', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeCurrentUrlEquals and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() */ - public function retrySeeCurrentUrlEquals($uri) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeCurrentUrlEquals(string $uri) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeCurrentUrlEquals', func_get_args(), $retryNum, $retryInterval)); } @@ -1563,18 +1420,15 @@ public function retrySeeCurrentUrlEquals($uri) { * * Checks that the current URL matches the given regular expression. * - * ``` php + * ```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())); + public function seeCurrentUrlMatches(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1582,18 +1436,15 @@ public function seeCurrentUrlMatches($uri) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the current URL matches the given regular expression. * - * ``` php + * ```php * seeCurrentUrlMatches('~^/users/(\d+)~'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() */ - public function canSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); + public function canSeeCurrentUrlMatches(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1601,31 +1452,28 @@ public function canSeeCurrentUrlMatches($uri) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the current URL matches the given regular expression. * - * ``` php + * ```php * seeCurrentUrlMatches('~^/users/(\d+)~'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() */ - public function tryToSeeCurrentUrlMatches($uri) { + public function tryToSeeCurrentUrlMatches(string $uri): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeCurrentUrlMatches', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeCurrentUrlMatches and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() */ - public function retrySeeCurrentUrlMatches($uri) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeCurrentUrlMatches(string $uri) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeCurrentUrlMatches', func_get_args(), $retryNum, $retryInterval)); } @@ -1635,17 +1483,14 @@ public function retrySeeCurrentUrlMatches($uri) { * * Checks that the current URI doesn't contain the given string. * - * ``` php + * ```php * dontSeeInCurrentUrl('/users/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() */ - public function dontSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInCurrentUrl', func_get_args())); + public function dontSeeInCurrentUrl(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInCurrentUrl', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1653,17 +1498,14 @@ public function dontSeeInCurrentUrl($uri) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the current URI doesn't contain the given string. * - * ``` php + * ```php * dontSeeInCurrentUrl('/users/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() */ - public function cantSeeInCurrentUrl($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); + public function cantSeeInCurrentUrl(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1671,30 +1513,27 @@ public function cantSeeInCurrentUrl($uri) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the current URI doesn't contain the given string. * - * ``` php + * ```php * dontSeeInCurrentUrl('/users/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() */ - public function tryToDontSeeInCurrentUrl($uri) { + public function tryToDontSeeInCurrentUrl(string $uri): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInCurrentUrl', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInCurrentUrl and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() */ - public function retryDontSeeInCurrentUrl($uri) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeInCurrentUrl(string $uri) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInCurrentUrl', func_get_args(), $retryNum, $retryInterval)); } @@ -1705,18 +1544,15 @@ public function retryDontSeeInCurrentUrl($uri) { * Checks that the current URL doesn't equal the given string. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * dontSeeCurrentUrlEquals('/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() */ - public function dontSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCurrentUrlEquals', func_get_args())); + public function dontSeeCurrentUrlEquals(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCurrentUrlEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1725,18 +1561,15 @@ public function dontSeeCurrentUrlEquals($uri) { * Checks that the current URL doesn't equal the given string. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * dontSeeCurrentUrlEquals('/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() */ - public function cantSeeCurrentUrlEquals($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); + public function cantSeeCurrentUrlEquals(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1745,31 +1578,28 @@ public function cantSeeCurrentUrlEquals($uri) { * Checks that the current URL doesn't equal the given string. * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. * - * ``` php + * ```php * dontSeeCurrentUrlEquals('/'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() */ - public function tryToDontSeeCurrentUrlEquals($uri) { + public function tryToDontSeeCurrentUrlEquals(string $uri): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeCurrentUrlEquals', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeCurrentUrlEquals and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() */ - public function retryDontSeeCurrentUrlEquals($uri) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeCurrentUrlEquals(string $uri) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeCurrentUrlEquals', func_get_args(), $retryNum, $retryInterval)); } @@ -1779,18 +1609,15 @@ public function retryDontSeeCurrentUrlEquals($uri) { * * Checks that current url doesn't match the given regular expression. * - * ``` php + * ```php * dontSeeCurrentUrlMatches('~^/users/(\d+)~'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() */ - public function dontSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCurrentUrlMatches', func_get_args())); + public function dontSeeCurrentUrlMatches(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCurrentUrlMatches', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1798,18 +1625,15 @@ public function dontSeeCurrentUrlMatches($uri) { * [!] 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+)~'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() */ - public function cantSeeCurrentUrlMatches($uri) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); + public function cantSeeCurrentUrlMatches(string $uri): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1817,31 +1641,28 @@ public function cantSeeCurrentUrlMatches($uri) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that current url doesn't match the given regular expression. * - * ``` php + * ```php * dontSeeCurrentUrlMatches('~^/users/(\d+)~'); - * ?> * ``` - * - * @param string $uri * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() */ - public function tryToDontSeeCurrentUrlMatches($uri) { + public function tryToDontSeeCurrentUrlMatches(string $uri): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeCurrentUrlMatches', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeCurrentUrlMatches and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() */ - public function retryDontSeeCurrentUrlMatches($uri) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeCurrentUrlMatches(string $uri) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeCurrentUrlMatches', func_get_args(), $retryNum, $retryInterval)); } @@ -1852,33 +1673,28 @@ public function retryDontSeeCurrentUrlMatches($uri) { * 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(); - * ?> * ``` - * - * @param string $uri optional - * - * @return mixed * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() */ - public function grabFromCurrentUrl($uri = NULL) { + public function grabFromCurrentUrl($uri = NULL): mixed { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabFromCurrentUrl and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() */ public function retryGrabFromCurrentUrl($uri = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabFromCurrentUrl', func_get_args(), $retryNum, $retryInterval)); } @@ -1888,19 +1704,16 @@ public function retryGrabFromCurrentUrl($uri = NULL) { * * 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. * $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())); + public function seeCheckboxIsChecked($checkbox): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1908,19 +1721,16 @@ public function seeCheckboxIsChecked($checkbox) { * [!] 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. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); - * ?> * ``` - * - * @param $checkbox * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() */ - public function canSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); + public function canSeeCheckboxIsChecked($checkbox): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1928,32 +1738,29 @@ public function canSeeCheckboxIsChecked($checkbox) { * [!] Test won't be stopped on fail. Error won't be logged * 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. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); - * ?> * ``` - * - * @param $checkbox * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() */ - public function tryToSeeCheckboxIsChecked($checkbox) { + public function tryToSeeCheckboxIsChecked($checkbox): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeCheckboxIsChecked', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeCheckboxIsChecked and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() */ public function retrySeeCheckboxIsChecked($checkbox) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeCheckboxIsChecked', func_get_args(), $retryNum, $retryInterval)); } @@ -1963,18 +1770,15 @@ public function retrySeeCheckboxIsChecked($checkbox) { * * 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. - * ?> * ``` - * - * @param $checkbox * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() */ - public function dontSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCheckboxIsChecked', func_get_args())); + public function dontSeeCheckboxIsChecked($checkbox): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeCheckboxIsChecked', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -1982,18 +1786,15 @@ public function dontSeeCheckboxIsChecked($checkbox) { * [!] 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. - * ?> * ``` - * - * @param $checkbox * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() */ - public function cantSeeCheckboxIsChecked($checkbox) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); + public function cantSeeCheckboxIsChecked($checkbox): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2001,31 +1802,28 @@ public function cantSeeCheckboxIsChecked($checkbox) { * [!] Test won't be stopped on fail. Error won't be logged * 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. - * ?> * ``` - * - * @param $checkbox * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() */ - public function tryToDontSeeCheckboxIsChecked($checkbox) { + public function tryToDontSeeCheckboxIsChecked($checkbox): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeCheckboxIsChecked', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeCheckboxIsChecked and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() */ public function retryDontSeeCheckboxIsChecked($checkbox) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeCheckboxIsChecked', func_get_args(), $retryNum, $retryInterval)); } @@ -2036,7 +1834,7 @@ public function retryDontSeeCheckboxIsChecked($checkbox) { * 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'); @@ -2044,15 +1842,13 @@ public function retryDontSeeCheckboxIsChecked($checkbox) { * $I->seeInField('#searchform input','Search'); * $I->seeInField('//form/*[@name=search]','Search'); * $I->seeInField(['name' => 'search'], 'Search'); - * ?> * ``` * - * @param $field - * @param $value + * @param string|array $field * @see \Codeception\Module\WebDriver::seeInField() */ - public function seeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); + public function seeInField($field, $value): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2061,7 +1857,7 @@ public function seeInField($field, $value) { * 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'); @@ -2069,15 +1865,13 @@ public function seeInField($field, $value) { * $I->seeInField('#searchform input','Search'); * $I->seeInField('//form/*[@name=search]','Search'); * $I->seeInField(['name' => 'search'], 'Search'); - * ?> * ``` * - * @param $field - * @param $value + * @param string|array $field * @see \Codeception\Module\WebDriver::seeInField() */ - public function canSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); + public function canSeeInField($field, $value): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2086,7 +1880,7 @@ public function canSeeInField($field, $value) { * 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'); @@ -2094,28 +1888,26 @@ public function canSeeInField($field, $value) { * $I->seeInField('#searchform input','Search'); * $I->seeInField('//form/*[@name=search]','Search'); * $I->seeInField(['name' => 'search'], 'Search'); - * ?> * ``` * - * @param $field - * @param $value + * @param string|array $field * @see \Codeception\Module\WebDriver::seeInField() */ - public function tryToSeeInField($field, $value) { + public function tryToSeeInField($field, $value): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeInField', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInField and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInField() */ public function retrySeeInField($field, $value) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInField', func_get_args(), $retryNum, $retryInterval)); } @@ -2126,7 +1918,7 @@ public function retrySeeInField($field, $value) { * 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'); @@ -2134,15 +1926,12 @@ public function retrySeeInField($field, $value) { * $I->dontSeeInField('#searchform input','Search'); * $I->dontSeeInField('//form/*[@name=search]','Search'); * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> * ``` - * - * @param $field - * @param $value + * @param string|array $field * @see \Codeception\Module\WebDriver::dontSeeInField() */ - public function dontSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInField', func_get_args())); + public function dontSeeInField($field, $value): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInField', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2151,7 +1940,7 @@ public function dontSeeInField($field, $value) { * 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'); @@ -2159,15 +1948,12 @@ public function dontSeeInField($field, $value) { * $I->dontSeeInField('#searchform input','Search'); * $I->dontSeeInField('//form/*[@name=search]','Search'); * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> * ``` - * - * @param $field - * @param $value + * @param string|array $field * @see \Codeception\Module\WebDriver::dontSeeInField() */ - public function cantSeeInField($field, $value) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); + public function cantSeeInField($field, $value): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2176,7 +1962,7 @@ public function cantSeeInField($field, $value) { * 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'); @@ -2184,28 +1970,25 @@ public function cantSeeInField($field, $value) { * $I->dontSeeInField('#searchform input','Search'); * $I->dontSeeInField('//form/*[@name=search]','Search'); * $I->dontSeeInField(['name' => 'search'], 'Search'); - * ?> * ``` - * - * @param $field - * @param $value + * @param string|array $field * @see \Codeception\Module\WebDriver::dontSeeInField() */ - public function tryToDontSeeInField($field, $value) { + public function tryToDontSeeInField($field, $value): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInField', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInField and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInField() */ public function retryDontSeeInField($field, $value) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInField', func_get_args(), $retryNum, $retryInterval)); } @@ -2216,19 +1999,18 @@ public function retryDontSeeInField($field, $value) { * 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', * 'input2' => 'other value', * ]); - * ?> * ``` * * 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' => [ @@ -2240,23 +2022,21 @@ public function retryDontSeeInField($field, $value) { * 'another checked value', * ], * ]); - * ?> * ``` * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * seeInFormFields('#form-id', [ * 'checkbox1' => true, // passes if checked * 'checkbox2' => false, // passes if unchecked * ]); - * ?> * ``` * * Pair this with submitForm for quick testing magic. * - * ``` php + * ```php * 'value', @@ -2264,18 +2044,14 @@ public function retryDontSeeInField($field, $value) { * 'checkbox1' => true, * // ... * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * $I->submitForm('//form[@id=my-form]', string $form, 'submitButton'); * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> + * $I->seeInFormFields('//form[@id=my-form]', string $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())); + public function seeInFormFields($formSelector, array $params): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2284,19 +2060,18 @@ public function seeInFormFields($formSelector, $params) { * 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', * 'input2' => 'other value', * ]); - * ?> * ``` * * 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' => [ @@ -2308,23 +2083,21 @@ public function seeInFormFields($formSelector, $params) { * 'another checked value', * ], * ]); - * ?> * ``` * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * seeInFormFields('#form-id', [ * 'checkbox1' => true, // passes if checked * 'checkbox2' => false, // passes if unchecked * ]); - * ?> * ``` * * Pair this with submitForm for quick testing magic. * - * ``` php + * ```php * 'value', @@ -2332,18 +2105,14 @@ public function seeInFormFields($formSelector, $params) { * 'checkbox1' => true, * // ... * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * $I->submitForm('//form[@id=my-form]', string $form, 'submitButton'); * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> + * $I->seeInFormFields('//form[@id=my-form]', string $form); * ``` - * - * @param $formSelector - * @param $params * @see \Codeception\Module\WebDriver::seeInFormFields() */ - public function canSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); + public function canSeeInFormFields($formSelector, array $params): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2352,19 +2121,18 @@ public function canSeeInFormFields($formSelector, $params) { * 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', * 'input2' => 'other value', * ]); - * ?> * ``` * * 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' => [ @@ -2376,23 +2144,21 @@ public function canSeeInFormFields($formSelector, $params) { * 'another checked value', * ], * ]); - * ?> * ``` * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```php * seeInFormFields('#form-id', [ * 'checkbox1' => true, // passes if checked * 'checkbox2' => false, // passes if unchecked * ]); - * ?> * ``` * * Pair this with submitForm for quick testing magic. * - * ``` php + * ```php * 'value', @@ -2400,31 +2166,27 @@ public function canSeeInFormFields($formSelector, $params) { * 'checkbox1' => true, * // ... * ]; - * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); + * $I->submitForm('//form[@id=my-form]', string $form, 'submitButton'); * // $I->amOnPage('/path/to/form-page') may be needed - * $I->seeInFormFields('//form[@id=my-form]', $form); - * ?> + * $I->seeInFormFields('//form[@id=my-form]', string $form); * ``` - * - * @param $formSelector - * @param $params * @see \Codeception\Module\WebDriver::seeInFormFields() */ - public function tryToSeeInFormFields($formSelector, $params) { + public function tryToSeeInFormFields($formSelector, array $params): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeInFormFields', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInFormFields and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInFormFields() */ - public function retrySeeInFormFields($formSelector, $params) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeInFormFields($formSelector, array $params) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInFormFields', func_get_args(), $retryNum, $retryInterval)); } @@ -2435,19 +2197,18 @@ public function retrySeeInFormFields($formSelector, $params) { * 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', * '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 + * ```php * dontSeeInFormFields('.form-class', [ * 'fieldName' => [ @@ -2455,26 +2216,21 @@ public function retrySeeInFormFields($formSelector, $params) { * 'And this value shouldn\'t be set', * ], * ]); - * ?> * ``` * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```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\Action('dontSeeInFormFields', func_get_args())); + public function dontSeeInFormFields($formSelector, array $params): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInFormFields', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2483,19 +2239,18 @@ public function dontSeeInFormFields($formSelector, $params) { * 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', * '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 + * ```php * dontSeeInFormFields('.form-class', [ * 'fieldName' => [ @@ -2503,26 +2258,21 @@ public function dontSeeInFormFields($formSelector, $params) { * 'And this value shouldn\'t be set', * ], * ]); - * ?> * ``` * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```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 cantSeeInFormFields($formSelector, $params) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); + public function cantSeeInFormFields($formSelector, array $params): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2531,19 +2281,18 @@ public function cantSeeInFormFields($formSelector, $params) { * 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', * '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 + * ```php * dontSeeInFormFields('.form-class', [ * 'fieldName' => [ @@ -2551,39 +2300,34 @@ public function cantSeeInFormFields($formSelector, $params) { * 'And this value shouldn\'t be set', * ], * ]); - * ?> * ``` * * Additionally, checkbox values can be checked with a boolean. * - * ``` php + * ```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 tryToDontSeeInFormFields($formSelector, $params) { + public function tryToDontSeeInFormFields($formSelector, array $params): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInFormFields', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInFormFields and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInFormFields() */ - public function retryDontSeeInFormFields($formSelector, $params) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeInFormFields($formSelector, array $params) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInFormFields', func_get_args(), $retryNum, $retryInterval)); } @@ -2593,37 +2337,31 @@ public function retryDontSeeInFormFields($formSelector, $params) { * * 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'); * $I->selectOption('//form/select[@name=account]', 'Monthly'); - * ?> * ``` * * Provide an array for the second argument to select multiple options: * - * ``` php + * ```php * selectOption('Which OS do you use?', array('Windows','Linux')); - * ?> + * $I->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?', array('text' => 'Windows')); // Only search by text 'Windows' - * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' - * ?> + * $I->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' * ``` - * - * @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())); + public function selectOption($select, $option): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2631,50 +2369,44 @@ public function selectOption($select, $option) { * [!] Test won't be stopped on fail. Error won't be logged * 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'); * $I->selectOption('//form/select[@name=account]', 'Monthly'); - * ?> * ``` * * Provide an array for the second argument to select multiple options: * - * ``` php + * ```php * selectOption('Which OS do you use?', array('Windows','Linux')); - * ?> + * $I->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?', array('text' => 'Windows')); // Only search by text 'Windows' - * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' - * ?> + * $I->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' * ``` - * - * @param $select - * @param $option * @see \Codeception\Module\WebDriver::selectOption() */ - public function tryToSelectOption($select, $option) { + public function tryToSelectOption($select, $option): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('selectOption', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes selectOption and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::selectOption() */ public function retrySelectOption($select, $option) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('selectOption', func_get_args(), $retryNum, $retryInterval)); } @@ -2684,12 +2416,12 @@ public function retrySelectOption($select, $option) { * * Unselect an option in the given select box. * - * @param $select - * @param $option + * @param string|array|WebDriverBy $select + * @param string|array|WebDriverBy $option * @see \Codeception\Module\WebDriver::unselectOption() */ - public function unselectOption($select, $option) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('unselectOption', func_get_args())); + public function unselectOption($select, $option): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('unselectOption', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2697,25 +2429,25 @@ public function unselectOption($select, $option) { * [!] Test won't be stopped on fail. Error won't be logged * Unselect an option in the given select box. * - * @param $select - * @param $option + * @param string|array|WebDriverBy $select + * @param string|array|WebDriverBy $option * @see \Codeception\Module\WebDriver::unselectOption() */ - public function tryToUnselectOption($select, $option) { + public function tryToUnselectOption($select, $option): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('unselectOption', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes unselectOption and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::unselectOption() */ public function retryUnselectOption($select, $option) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('unselectOption', func_get_args(), $retryNum, $retryInterval)); } @@ -2725,17 +2457,14 @@ public function retryUnselectOption($select, $option) { * * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. * - * ``` php + * ```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())); + public function checkOption($option): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2743,30 +2472,27 @@ public function checkOption($option) { * [!] Test won't be stopped on fail. Error won't be logged * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. * - * ``` php + * ```php * checkOption('#agree'); - * ?> * ``` - * - * @param $option * @see \Codeception\Module\WebDriver::checkOption() */ - public function tryToCheckOption($option) { + public function tryToCheckOption($option): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('checkOption', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes checkOption and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::checkOption() */ public function retryCheckOption($option) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('checkOption', func_get_args(), $retryNum, $retryInterval)); } @@ -2776,17 +2502,14 @@ public function retryCheckOption($option) { * * Unticks a checkbox. * - * ``` php + * ```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())); + public function uncheckOption($option): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2794,30 +2517,27 @@ public function uncheckOption($option) { * [!] Test won't be stopped on fail. Error won't be logged * Unticks a checkbox. * - * ``` php + * ```php * uncheckOption('#notify'); - * ?> * ``` - * - * @param $option * @see \Codeception\Module\WebDriver::uncheckOption() */ - public function tryToUncheckOption($option) { + public function tryToUncheckOption($option): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('uncheckOption', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes uncheckOption and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::uncheckOption() */ public function retryUncheckOption($option) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('uncheckOption', func_get_args(), $retryNum, $retryInterval)); } @@ -2827,19 +2547,15 @@ public function retryUncheckOption($option) { * * Fills a text field or textarea with the given string. * - * ``` php + * ```php * fillField("//input[@type='text']", "Hello World!"); - * $I->fillField(['name' => 'email'], 'jon@mail.com'); - * ?> + * $I->fillField(['name' => 'email'], 'jon@example.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())); + public function fillField($field, $value): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2847,32 +2563,28 @@ public function fillField($field, $value) { * [!] Test won't be stopped on fail. Error won't be logged * Fills a text field or textarea with the given string. * - * ``` php + * ```php * fillField("//input[@type='text']", "Hello World!"); - * $I->fillField(['name' => 'email'], 'jon@mail.com'); - * ?> + * $I->fillField(['name' => 'email'], 'jon@example.com'); * ``` - * - * @param $field - * @param $value * @see \Codeception\Module\WebDriver::fillField() */ - public function tryToFillField($field, $value) { + public function tryToFillField($field, $value): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('fillField', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes fillField and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::fillField() */ public function retryFillField($field, $value) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('fillField', func_get_args(), $retryNum, $retryInterval)); } @@ -2887,11 +2599,11 @@ public function retryFillField($field, $value) { * $I->clearField('#username'); * ``` * - * @param $field + * @param string|array|WebDriverBy $field * @see \Codeception\Module\WebDriver::clearField() */ - public function clearField($field) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('clearField', func_get_args())); + public function clearField($field): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('clearField', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2904,46 +2616,113 @@ public function clearField($field) { * $I->clearField('#username'); * ``` * - * @param $field + * @param string|array|WebDriverBy $field * @see \Codeception\Module\WebDriver::clearField() */ - public function tryToClearField($field) { + public function tryToClearField($field): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('clearField', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes clearField and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::clearField() */ public function retryClearField($field) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('clearField', func_get_args(), $retryNum, $retryInterval)); } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Type in characters on active element. + * With a second parameter you can specify delay between key presses. + * + * ```php + * click('#input'); + * + * // type text in active element + * $I->type('Hello world'); + * + * // type text with a 1sec delay between chars + * $I->type('Hello World', 1); + * ``` + * + * This might be useful when you an input reacts to typing and you need to slow it down to emulate human behavior. + * For instance, this is how Credit Card fields can be filled in. + * + * @param int $delay [sec] + * @see \Codeception\Module\WebDriver::type() + */ + public function type(string $text, int $delay = 0): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('type', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Test won't be stopped on fail. Error won't be logged + * Type in characters on active element. + * With a second parameter you can specify delay between key presses. + * + * ```php + * click('#input'); + * + * // type text in active element + * $I->type('Hello world'); + * + * // type text with a 1sec delay between chars + * $I->type('Hello World', 1); + * ``` + * + * This might be useful when you an input reacts to typing and you need to slow it down to emulate human behavior. + * For instance, this is how Credit Card fields can be filled in. + * + * @param int $delay [sec] + * @see \Codeception\Module\WebDriver::type() + */ + public function tryToType(string $text, int $delay = 0): bool { + return $this->getScenario()->runStep(new \Codeception\Step\TryTo('type', func_get_args())); + } + /** + * [!] Method is generated. + * + * * Executes type and retries on failure. + * + * Retry number and interval set by $I->retry(); + * + * @see \Codeception\Module\WebDriver::type() + */ + public function retryType(string $text, int $delay = 0) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; + return $this->getScenario()->runStep(new \Codeception\Step\Retry('type', func_get_args(), $retryNum, $retryInterval)); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * * Attaches a file relative to the Codeception `_data` directory to the given file upload field. * - * ``` php + * ```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())); + public function attachFile($field, string $filename): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -2951,32 +2730,28 @@ public function attachFile($field, $filename) { * [!] Test won't be stopped on fail. Error won't be logged * Attaches a file relative to the Codeception `_data` directory to the given file upload field. * - * ``` php + * ```php * attachFile('input[@type="file"]', 'prices.xls'); - * ?> * ``` - * - * @param $field - * @param $filename * @see \Codeception\Module\WebDriver::attachFile() */ - public function tryToAttachFile($field, $filename) { + public function tryToAttachFile($field, string $filename): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('attachFile', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes attachFile and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::attachFile() */ - public function retryAttachFile($field, $filename) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryAttachFile($field, string $filename) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('attachFile', func_get_args(), $retryNum, $retryInterval)); } @@ -2988,34 +2763,29 @@ public function retryAttachFile($field, $filename) { * 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'); * $value = $I->grabTextFrom('~ * ``` - * - * @param $cssOrXPathOrRegex - * - * @return mixed * @see \Codeception\Module\WebDriver::grabTextFrom() */ - public function grabTextFrom($cssOrXPathOrRegex) { + public function grabTextFrom($cssOrXPathOrRegex): mixed { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabTextFrom and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabTextFrom() */ public function retryGrabTextFrom($cssOrXPathOrRegex) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabTextFrom', func_get_args(), $retryNum, $retryInterval)); } @@ -3023,37 +2793,30 @@ public function retryGrabTextFrom($cssOrXPathOrRegex) { /** * [!] 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'); - * ?> * ``` - * - * - * @param $cssOrXpath - * @param $attribute - * - * @return mixed * @see \Codeception\Module\WebDriver::grabAttributeFrom() */ - public function grabAttributeFrom($cssOrXpath, $attribute) { + public function grabAttributeFrom($cssOrXpath, $attribute): ?string { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabAttributeFrom and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabAttributeFrom() */ public function retryGrabAttributeFrom($cssOrXpath, $attribute) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabAttributeFrom', func_get_args(), $retryNum, $retryInterval)); } @@ -3064,35 +2827,30 @@ public function retryGrabAttributeFrom($cssOrXpath, $attribute) { * 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]'); * $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) { + public function grabValueFrom($field): ?string { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabValueFrom and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabValueFrom() */ public function retryGrabValueFrom($field) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabValueFrom', func_get_args(), $retryNum, $retryInterval)); } @@ -3116,29 +2874,26 @@ public function retryGrabValueFrom($field) { * * // 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) { + public function grabMultiple($cssOrXpath, $attribute = NULL): array { return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes grabMultiple and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::grabMultiple() */ public function retryGrabMultiple($cssOrXpath, $attribute = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('grabMultiple', func_get_args(), $retryNum, $retryInterval)); } @@ -3148,8 +2903,9 @@ public function retryGrabMultiple($cssOrXpath, $attribute = NULL) { * * Checks that the given element exists on the page and is visible. * You can also specify expected attributes of this element. + * Only works if `` tag is present. * - * ``` php + * ```php * seeElement('.error'); * $I->seeElement('//form/input[1]'); @@ -3158,16 +2914,11 @@ public function retryGrabMultiple($cssOrXpath, $attribute = NULL) { * * // 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 = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); + public function seeElement($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3175,8 +2926,9 @@ public function seeElement($selector, $attributes = []) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the given element exists on the page and is visible. * You can also specify expected attributes of this element. + * Only works if `` tag is present. * - * ``` php + * ```php * seeElement('.error'); * $I->seeElement('//form/input[1]'); @@ -3185,16 +2937,11 @@ public function seeElement($selector, $attributes = []) { * * // 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 canSeeElement($selector, $attributes = []) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); + public function canSeeElement($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3202,8 +2949,9 @@ public function canSeeElement($selector, $attributes = []) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the given element exists on the page and is visible. * You can also specify expected attributes of this element. + * Only works if `` tag is present. * - * ``` php + * ```php * seeElement('.error'); * $I->seeElement('//form/input[1]'); @@ -3212,29 +2960,24 @@ public function canSeeElement($selector, $attributes = []) { * * // 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 tryToSeeElement($selector, $attributes = []) { + public function tryToSeeElement($selector, array $attributes = []): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeElement', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeElement and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeElement() */ - public function retrySeeElement($selector, $attributes = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeElement($selector, array $attributes = []) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeElement', func_get_args(), $retryNum, $retryInterval)); } @@ -3245,21 +2988,17 @@ public function retrySeeElement($selector, $attributes = []) { * 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]'); * $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 = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeElement', func_get_args())); + public function dontSeeElement($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeElement', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3268,21 +3007,17 @@ public function dontSeeElement($selector, $attributes = []) { * 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]'); * $I->dontSeeElement('input', ['name' => 'login']); * $I->dontSeeElement('input', ['value' => '123456']); - * ?> * ``` - * - * @param $selector - * @param array $attributes * @see \Codeception\Module\WebDriver::dontSeeElement() */ - public function cantSeeElement($selector, $attributes = []) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); + public function cantSeeElement($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3291,34 +3026,30 @@ public function cantSeeElement($selector, $attributes = []) { * 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]'); * $I->dontSeeElement('input', ['name' => 'login']); * $I->dontSeeElement('input', ['value' => '123456']); - * ?> * ``` - * - * @param $selector - * @param array $attributes * @see \Codeception\Module\WebDriver::dontSeeElement() */ - public function tryToDontSeeElement($selector, $attributes = []) { + public function tryToDontSeeElement($selector, array $attributes = []): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeElement', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeElement and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeElement() */ - public function retryDontSeeElement($selector, $attributes = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeElement($selector, array $attributes = []) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeElement', func_get_args(), $retryNum, $retryInterval)); } @@ -3331,15 +3062,13 @@ public function retryDontSeeElement($selector, $attributes = []) { * ``` php * seeElementInDOM('//form/input[type=hidden]'); - * ?> * ``` * - * @param $selector - * @param array $attributes + * @param string|array|WebDriverBy $selector * @see \Codeception\Module\WebDriver::seeElementInDOM() */ - public function seeElementInDOM($selector, $attributes = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args())); + public function seeElementInDOM($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3350,15 +3079,13 @@ public function seeElementInDOM($selector, $attributes = []) { * ``` php * seeElementInDOM('//form/input[type=hidden]'); - * ?> * ``` * - * @param $selector - * @param array $attributes + * @param string|array|WebDriverBy $selector * @see \Codeception\Module\WebDriver::seeElementInDOM() */ - public function canSeeElementInDOM($selector, $attributes = []) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args())); + public function canSeeElementInDOM($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3369,28 +3096,26 @@ public function canSeeElementInDOM($selector, $attributes = []) { * ``` php * seeElementInDOM('//form/input[type=hidden]'); - * ?> * ``` * - * @param $selector - * @param array $attributes + * @param string|array|WebDriverBy $selector * @see \Codeception\Module\WebDriver::seeElementInDOM() */ - public function tryToSeeElementInDOM($selector, $attributes = []) { + public function tryToSeeElementInDOM($selector, array $attributes = []): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeElementInDOM', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeElementInDOM and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeElementInDOM() */ - public function retrySeeElementInDOM($selector, $attributes = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeElementInDOM($selector, array $attributes = []) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeElementInDOM', func_get_args(), $retryNum, $retryInterval)); } @@ -3400,12 +3125,11 @@ public function retrySeeElementInDOM($selector, $attributes = []) { * * Opposite of `seeElementInDOM`. * - * @param $selector - * @param array $attributes + * @param string|array|WebDriverBy $selector * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() */ - public function dontSeeElementInDOM($selector, $attributes = []) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeElementInDOM', func_get_args())); + public function dontSeeElementInDOM($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeElementInDOM', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3413,12 +3137,11 @@ public function dontSeeElementInDOM($selector, $attributes = []) { * [!] Conditional Assertion: Test won't be stopped on fail * Opposite of `seeElementInDOM`. * - * @param $selector - * @param array $attributes + * @param string|array|WebDriverBy $selector * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() */ - public function cantSeeElementInDOM($selector, $attributes = []) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args())); + public function cantSeeElementInDOM($selector, array $attributes = []): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3426,25 +3149,24 @@ public function cantSeeElementInDOM($selector, $attributes = []) { * [!] Test won't be stopped on fail. Error won't be logged * Opposite of `seeElementInDOM`. * - * @param $selector - * @param array $attributes + * @param string|array|WebDriverBy $selector * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() */ - public function tryToDontSeeElementInDOM($selector, $attributes = []) { + public function tryToDontSeeElementInDOM($selector, array $attributes = []): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeElementInDOM', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeElementInDOM and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() */ - public function retryDontSeeElementInDOM($selector, $attributes = []) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeElementInDOM($selector, array $attributes = []) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeElementInDOM', func_get_args(), $retryNum, $retryInterval)); } @@ -3454,18 +3176,17 @@ public function retryDontSeeElementInDOM($selector, $attributes = []) { * * 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 - * ?> * ``` - * @param $selector - * @param mixed $expected int or int[] + * + * @param int|int[] $expected * @see \Codeception\Module\WebDriver::seeNumberOfElements() */ - public function seeNumberOfElements($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); + public function seeNumberOfElements($selector, $expected): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3473,18 +3194,17 @@ public function seeNumberOfElements($selector, $expected) { * [!] 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 - * ?> * ``` - * @param $selector - * @param mixed $expected int or int[] + * + * @param int|int[] $expected * @see \Codeception\Module\WebDriver::seeNumberOfElements() */ - public function canSeeNumberOfElements($selector, $expected) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); + public function canSeeNumberOfElements($selector, $expected): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3492,31 +3212,30 @@ public function canSeeNumberOfElements($selector, $expected) { * [!] Test won't be stopped on fail. Error won't be logged * 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 - * ?> * ``` - * @param $selector - * @param mixed $expected int or int[] + * + * @param int|int[] $expected * @see \Codeception\Module\WebDriver::seeNumberOfElements() */ - public function tryToSeeNumberOfElements($selector, $expected) { + public function tryToSeeNumberOfElements($selector, $expected): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeNumberOfElements', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeNumberOfElements and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeNumberOfElements() */ public function retrySeeNumberOfElements($selector, $expected) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeNumberOfElements', func_get_args(), $retryNum, $retryInterval)); } @@ -3524,7 +3243,9 @@ public function retrySeeNumberOfElements($selector, $expected) { /** * [!] Method is generated. Documentation taken from corresponding module. * - * + * @param string|array|WebDriverBy $selector + * @param int|array $expected + * @throws ModuleException * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() */ public function seeNumberOfElementsInDOM($selector, $expected) { @@ -3534,7 +3255,9 @@ public function seeNumberOfElementsInDOM($selector, $expected) { * [!] Method is generated. Documentation taken from corresponding module. * * [!] Conditional Assertion: Test won't be stopped on fail - * + * @param string|array|WebDriverBy $selector + * @param int|array $expected + * @throws ModuleException * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() */ public function canSeeNumberOfElementsInDOM($selector, $expected) { @@ -3544,24 +3267,26 @@ public function canSeeNumberOfElementsInDOM($selector, $expected) { * [!] Method is generated. Documentation taken from corresponding module. * * [!] Test won't be stopped on fail. Error won't be logged - * + * @param string|array|WebDriverBy $selector + * @param int|array $expected + * @throws ModuleException * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() */ - public function tryToSeeNumberOfElementsInDOM($selector, $expected) { + public function tryToSeeNumberOfElementsInDOM($selector, $expected): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeNumberOfElementsInDOM', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeNumberOfElementsInDOM and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() */ public function retrySeeNumberOfElementsInDOM($selector, $expected) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeNumberOfElementsInDOM', func_get_args(), $retryNum, $retryInterval)); } @@ -3571,20 +3296,16 @@ public function retrySeeNumberOfElementsInDOM($selector, $expected) { * * Checks that the given option is selected. * - * ``` php + * ```php * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> * ``` * - * @param $selector - * @param $optionText - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeOptionIsSelected() */ - public function seeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); + public function seeOptionIsSelected($selector, $optionText): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3592,20 +3313,16 @@ 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'); - * ?> * ``` * - * @param $selector - * @param $optionText - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeOptionIsSelected() */ - public function canSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); + public function canSeeOptionIsSelected($selector, $optionText): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3613,33 +3330,29 @@ public function canSeeOptionIsSelected($selector, $optionText) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the given option is selected. * - * ``` php + * ```php * seeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> * ``` * - * @param $selector - * @param $optionText - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeOptionIsSelected() */ - public function tryToSeeOptionIsSelected($selector, $optionText) { + public function tryToSeeOptionIsSelected($selector, $optionText): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeOptionIsSelected', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeOptionIsSelected and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeOptionIsSelected() */ public function retrySeeOptionIsSelected($selector, $optionText) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeOptionIsSelected', func_get_args(), $retryNum, $retryInterval)); } @@ -3649,20 +3362,16 @@ public function retrySeeOptionIsSelected($selector, $optionText) { * * Checks that the given option is not selected. * - * ``` php + * ```php * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> * ``` * - * @param $selector - * @param $optionText - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() */ - public function dontSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeOptionIsSelected', func_get_args())); + public function dontSeeOptionIsSelected($selector, $optionText): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeOptionIsSelected', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3670,20 +3379,16 @@ 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'); - * ?> * ``` * - * @param $selector - * @param $optionText - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() */ - public function cantSeeOptionIsSelected($selector, $optionText) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); + public function cantSeeOptionIsSelected($selector, $optionText): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3691,33 +3396,29 @@ public function cantSeeOptionIsSelected($selector, $optionText) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the given option is not selected. * - * ``` php + * ```php * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); - * ?> * ``` * - * @param $selector - * @param $optionText - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() */ - public function tryToDontSeeOptionIsSelected($selector, $optionText) { + public function tryToDontSeeOptionIsSelected($selector, $optionText): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeOptionIsSelected', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeOptionIsSelected and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() */ public function retryDontSeeOptionIsSelected($selector, $optionText) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeOptionIsSelected', func_get_args(), $retryNum, $retryInterval)); } @@ -3727,15 +3428,12 @@ public function retryDontSeeOptionIsSelected($selector, $optionText) { * * Checks that the page title contains the given string. * - * ``` php + * ```php * seeInTitle('Blog - Post #1'); - * ?> * ``` * - * @param $title - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeInTitle() */ public function seeInTitle($title) { @@ -3747,15 +3445,12 @@ 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'); - * ?> * ``` * - * @param $title - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeInTitle() */ public function canSeeInTitle($title) { @@ -3767,32 +3462,29 @@ public function canSeeInTitle($title) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the page title contains the given string. * - * ``` php + * ```php * seeInTitle('Blog - Post #1'); - * ?> * ``` * - * @param $title - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::seeInTitle() */ - public function tryToSeeInTitle($title) { + public function tryToSeeInTitle($title): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeInTitle', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInTitle and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInTitle() */ public function retrySeeInTitle($title) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInTitle', func_get_args(), $retryNum, $retryInterval)); } @@ -3802,9 +3494,7 @@ public function retrySeeInTitle($title) { * * Checks that the page title does not contain the given string. * - * @param $title - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeInTitle() */ public function dontSeeInTitle($title) { @@ -3816,9 +3506,7 @@ public function dontSeeInTitle($title) { * [!] Conditional Assertion: Test won't be stopped on fail * Checks that the page title does not contain the given string. * - * @param $title - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeInTitle() */ public function cantSeeInTitle($title) { @@ -3830,26 +3518,24 @@ public function cantSeeInTitle($title) { * [!] Test won't be stopped on fail. Error won't be logged * Checks that the page title does not contain the given string. * - * @param $title - * - * @return mixed + * @return mixed|void * @see \Codeception\Module\WebDriver::dontSeeInTitle() */ - public function tryToDontSeeInTitle($title) { + public function tryToDontSeeInTitle($title): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInTitle', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInTitle and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInTitle() */ public function retryDontSeeInTitle($title) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInTitle', func_get_args(), $retryNum, $retryInterval)); } @@ -3859,11 +3545,11 @@ public function retryDontSeeInTitle($title) { * * 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). + * as created by [various libraries](https://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())); + public function acceptPopup(): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('acceptPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3871,24 +3557,24 @@ public function acceptPopup() { * [!] Test won't be stopped on fail. Error won't be logged * 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). + * as created by [various libraries](https://jster.net/category/windows-modals-popups). * @see \Codeception\Module\WebDriver::acceptPopup() */ - public function tryToAcceptPopup() { + public function tryToAcceptPopup(): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('acceptPopup', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes acceptPopup and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::acceptPopup() */ public function retryAcceptPopup() { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('acceptPopup', func_get_args(), $retryNum, $retryInterval)); } @@ -3899,8 +3585,8 @@ public function retryAcceptPopup() { * 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())); + public function cancelPopup(): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('cancelPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3909,21 +3595,21 @@ public function cancelPopup() { * Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`. * @see \Codeception\Module\WebDriver::cancelPopup() */ - public function tryToCancelPopup() { + public function tryToCancelPopup(): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('cancelPopup', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes cancelPopup and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::cancelPopup() */ public function retryCancelPopup() { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('cancelPopup', func_get_args(), $retryNum, $retryInterval)); } @@ -3934,13 +3620,11 @@ public function retryCancelPopup() { * 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 + * @throws ModuleException * @see \Codeception\Module\WebDriver::seeInPopup() */ - public function seeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args())); + public function seeInPopup(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3949,13 +3633,11 @@ public function seeInPopup($text) { * 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 + * @throws ModuleException * @see \Codeception\Module\WebDriver::seeInPopup() */ - public function canSeeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args())); + public function canSeeInPopup(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -3964,26 +3646,24 @@ public function canSeeInPopup($text) { * 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 + * @throws ModuleException * @see \Codeception\Module\WebDriver::seeInPopup() */ - public function tryToSeeInPopup($text) { + public function tryToSeeInPopup(string $text): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('seeInPopup', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes seeInPopup and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::seeInPopup() */ - public function retrySeeInPopup($text) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySeeInPopup(string $text) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('seeInPopup', func_get_args(), $retryNum, $retryInterval)); } @@ -3994,13 +3674,11 @@ public function retrySeeInPopup($text) { * Checks that the active JavaScript popup, * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. * - * @param $text - * - * @throws \Codeception\Exception\ModuleException + * @throws ModuleException * @see \Codeception\Module\WebDriver::dontSeeInPopup() */ - public function dontSeeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInPopup', func_get_args())); + public function dontSeeInPopup(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4009,13 +3687,11 @@ public function dontSeeInPopup($text) { * Checks that the active JavaScript popup, * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. * - * @param $text - * - * @throws \Codeception\Exception\ModuleException + * @throws ModuleException * @see \Codeception\Module\WebDriver::dontSeeInPopup() */ - public function cantSeeInPopup($text) { - return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPopup', func_get_args())); + public function cantSeeInPopup(string $text): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4024,26 +3700,24 @@ public function cantSeeInPopup($text) { * Checks that the active JavaScript popup, * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. * - * @param $text - * - * @throws \Codeception\Exception\ModuleException + * @throws ModuleException * @see \Codeception\Module\WebDriver::dontSeeInPopup() */ - public function tryToDontSeeInPopup($text) { + public function tryToDontSeeInPopup(string $text): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('dontSeeInPopup', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes dontSeeInPopup and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::dontSeeInPopup() */ - public function retryDontSeeInPopup($text) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryDontSeeInPopup(string $text) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('dontSeeInPopup', func_get_args(), $retryNum, $retryInterval)); } @@ -4053,13 +3727,11 @@ public function retryDontSeeInPopup($text) { * * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. * - * @param $keys - * - * @throws \Codeception\Exception\ModuleException + * @throws ModuleException * @see \Codeception\Module\WebDriver::typeInPopup() */ - public function typeInPopup($keys) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('typeInPopup', func_get_args())); + public function typeInPopup(string $keys): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('typeInPopup', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4067,26 +3739,24 @@ public function typeInPopup($keys) { * [!] Test won't be stopped on fail. Error won't be logged * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. * - * @param $keys - * - * @throws \Codeception\Exception\ModuleException + * @throws ModuleException * @see \Codeception\Module\WebDriver::typeInPopup() */ - public function tryToTypeInPopup($keys) { + public function tryToTypeInPopup(string $keys): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('typeInPopup', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes typeInPopup and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::typeInPopup() */ - public function retryTypeInPopup($keys) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryTypeInPopup(string $keys) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('typeInPopup', func_get_args(), $retryNum, $retryInterval)); } @@ -4094,34 +3764,34 @@ public function retryTypeInPopup($keys) { /** * [!] Method is generated. Documentation taken from corresponding module. * - * Reloads the current page. + * Reloads the current page. All forms will be reset, so the outcome is as if the user would press Ctrl+F5. * @see \Codeception\Module\WebDriver::reloadPage() */ - public function reloadPage() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('reloadPage', func_get_args())); + public function reloadPage(): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('reloadPage', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * * [!] Test won't be stopped on fail. Error won't be logged - * Reloads the current page. + * Reloads the current page. All forms will be reset, so the outcome is as if the user would press Ctrl+F5. * @see \Codeception\Module\WebDriver::reloadPage() */ - public function tryToReloadPage() { + public function tryToReloadPage(): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('reloadPage', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes reloadPage and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::reloadPage() */ public function retryReloadPage() { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('reloadPage', func_get_args(), $retryNum, $retryInterval)); } @@ -4132,8 +3802,8 @@ public function retryReloadPage() { * Moves back in history. * @see \Codeception\Module\WebDriver::moveBack() */ - public function moveBack() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args())); + public function moveBack(): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4142,21 +3812,21 @@ public function moveBack() { * Moves back in history. * @see \Codeception\Module\WebDriver::moveBack() */ - public function tryToMoveBack() { + public function tryToMoveBack(): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('moveBack', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes moveBack and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::moveBack() */ public function retryMoveBack() { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('moveBack', func_get_args(), $retryNum, $retryInterval)); } @@ -4167,8 +3837,8 @@ public function retryMoveBack() { * Moves forward in history. * @see \Codeception\Module\WebDriver::moveForward() */ - public function moveForward() { - return $this->getScenario()->runStep(new \Codeception\Step\Action('moveForward', func_get_args())); + public function moveForward(): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('moveForward', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4177,21 +3847,21 @@ public function moveForward() { * Moves forward in history. * @see \Codeception\Module\WebDriver::moveForward() */ - public function tryToMoveForward() { + public function tryToMoveForward(): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('moveForward', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes moveForward and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::moveForward() */ public function retryMoveForward() { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('moveForward', func_get_args(), $retryNum, $retryInterval)); } @@ -4233,17 +3903,17 @@ public function retryMoveForward() { * ``` html *
* Login: - *
+ *
* Password: - *
+ *
* Do you agree to our terms? - *
+ *
* Select pricing plan: * - * + * *
* ``` * @@ -4281,7 +3951,6 @@ public function retryMoveForward() { * $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 @@ -4307,7 +3976,6 @@ public function retryMoveForward() { * 'second option value', * ] * ]); - * ?> * ``` * * Mixing string and boolean values for a checkbox's value is not supported @@ -4345,7 +4013,7 @@ public function retryMoveForward() { * For example, given the following HTML: * * ``` html - * + * * ``` * * `$button` could be any one of the following: @@ -4353,13 +4021,12 @@ public function retryMoveForward() { * - ['name' => 'submitButton'] * - WebDriverBy::name('submitButton') * - * @param $selector - * @param $params - * @param $button + * @param string|array|WebDriverBy $selector + * @param string|array|WebDriverBy|null $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())); + public function submitForm($selector, array $params, $button = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4399,17 +4066,17 @@ public function submitForm($selector, $params, $button = NULL) { * ``` html *
* Login: - *
+ *
* Password: - *
+ *
* Do you agree to our terms? - *
+ *
* Select pricing plan: * - * + * *
* ``` * @@ -4447,7 +4114,6 @@ public function submitForm($selector, $params, $button = NULL) { * $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 @@ -4473,7 +4139,6 @@ public function submitForm($selector, $params, $button = NULL) { * 'second option value', * ] * ]); - * ?> * ``` * * Mixing string and boolean values for a checkbox's value is not supported @@ -4511,7 +4176,7 @@ public function submitForm($selector, $params, $button = NULL) { * For example, given the following HTML: * * ``` html - * + * * ``` * * `$button` could be any one of the following: @@ -4519,26 +4184,25 @@ public function submitForm($selector, $params, $button = NULL) { * - ['name' => 'submitButton'] * - WebDriverBy::name('submitButton') * - * @param $selector - * @param $params - * @param $button + * @param string|array|WebDriverBy $selector + * @param string|array|WebDriverBy|null $button * @see \Codeception\Module\WebDriver::submitForm() */ - public function tryToSubmitForm($selector, $params, $button = NULL) { + public function tryToSubmitForm($selector, array $params, $button = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('submitForm', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes submitForm and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::submitForm() */ - public function retrySubmitForm($selector, $params, $button = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySubmitForm($selector, array $params, $button = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('submitForm', func_get_args(), $retryNum, $retryInterval)); } @@ -4546,27 +4210,25 @@ public function retrySubmitForm($selector, $params, $button = NULL) { /** * [!] Method is generated. Documentation taken from corresponding module. * - * Waits up to $timeout seconds for the given element to change. + * 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); - * ?> + * use Facebook\WebDriver\WebDriverElement; + * + * $I->waitForElementChange('#menu', function(WebDriverElement $element) { + * return $element->isDisplayed(); + * }, 5); * ``` * - * @param $element - * @param \Closure $callback - * @param int $timeout seconds - * @throws \Codeception\Exception\ElementNotFound + * @param string|array|WebDriverBy $element + * @throws ElementNotFound * @see \Codeception\Module\WebDriver::waitForElementChange() */ - public function waitForElementChange($element, $callback, $timeout = 30) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementChange', func_get_args())); + public function waitForElementChange($element, \Closure $callback, int $timeout = 30): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementChange', func_get_args())); } @@ -4580,16 +4242,15 @@ public function waitForElementChange($element, $callback, $timeout = 30) { * waitForElement('#agree_button', 30); // secs * $I->click('#agree_button'); - * ?> * ``` * - * @param $element + * @param string|array|WebDriverBy $element * @param int $timeout seconds - * @throws \Exception + * @throws Exception * @see \Codeception\Module\WebDriver::waitForElement() */ - public function waitForElement($element, $timeout = 10) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElement', func_get_args())); + public function waitForElement($element, int $timeout = 10): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElement', func_get_args())); } @@ -4603,16 +4264,15 @@ public function waitForElement($element, $timeout = 10) { * waitForElementVisible('#agree_button', 30); // secs * $I->click('#agree_button'); - * ?> * ``` * - * @param $element + * @param string|array|WebDriverBy $element * @param int $timeout seconds - * @throws \Exception + * @throws Exception * @see \Codeception\Module\WebDriver::waitForElementVisible() */ - public function waitForElementVisible($element, $timeout = 10) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args())); + public function waitForElementVisible($element, int $timeout = 10): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args())); } @@ -4625,16 +4285,15 @@ public function waitForElementVisible($element, $timeout = 10) { * ``` php * waitForElementNotVisible('#agree_button', 30); // secs - * ?> * ``` * - * @param $element + * @param string|array|WebDriverBy $element * @param int $timeout seconds - * @throws \Exception + * @throws Exception * @see \Codeception\Module\WebDriver::waitForElementNotVisible() */ - public function waitForElementNotVisible($element, $timeout = 10) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args())); + public function waitForElementNotVisible($element, int $timeout = 10): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args())); } @@ -4648,16 +4307,15 @@ public function waitForElementNotVisible($element, $timeout = 10) { * waitForElementClickable('#agree_button', 30); // secs * $I->click('#agree_button'); - * ?> * ``` * - * @param $element + * @param string|array|WebDriverBy $element * @param int $timeout seconds - * @throws \Exception + * @throws Exception * @see \Codeception\Module\WebDriver::waitForElementClickable() */ - public function waitForElementClickable($element, $timeout = 10) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementClickable', func_get_args())); + public function waitForElementClickable($element, int $timeout = 10): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementClickable', func_get_args())); } @@ -4674,17 +4332,15 @@ public function waitForElementClickable($element, $timeout = 10) { * waitForText('foo', 30); // secs * $I->waitForText('foo', 30, '.title'); // secs - * ?> * ``` * - * @param string $text * @param int $timeout seconds - * @param string $selector optional - * @throws \Exception + * @param null|string|array|WebDriverBy $selector + * @throws Exception * @see \Codeception\Module\WebDriver::waitForText() */ - public function waitForText($text, $timeout = 10, $selector = NULL) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForText', func_get_args())); + public function waitForText(string $text, int $timeout = 10, $selector = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('waitForText', func_get_args())); } @@ -4694,11 +4350,11 @@ public function waitForText($text, $timeout = 10, $selector = NULL) { * Wait for $timeout seconds. * * @param int|float $timeout secs - * @throws \Codeception\Exception\TestRuntimeException + * @throws TestRuntimeException * @see \Codeception\Module\WebDriver::wait() */ - public function wait($timeout) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('wait', func_get_args())); + public function wait($timeout): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('wait', func_get_args())); } @@ -4710,7 +4366,7 @@ public function wait($timeout) { * * ``` php * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - * $webdriver->get('http://google.com'); + * $webdriver->get('https://google.com'); * }); * ``` * @@ -4719,10 +4375,11 @@ public function wait($timeout) { * 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 + * @param Closure $function + * @return mixed * @see \Codeception\Module\WebDriver::executeInSelenium() */ - public function executeInSelenium($function) { + public function executeInSelenium(\Closure $function) { return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInSelenium', func_get_args())); } /** @@ -4734,7 +4391,7 @@ public function executeInSelenium($function) { * * ``` php * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { - * $webdriver->get('http://google.com'); + * $webdriver->get('https://google.com'); * }); * ``` * @@ -4743,24 +4400,25 @@ public function executeInSelenium($function) { * 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 + * @param Closure $function + * @return mixed * @see \Codeception\Module\WebDriver::executeInSelenium() */ - public function tryToExecuteInSelenium($function) { + public function tryToExecuteInSelenium(\Closure $function): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('executeInSelenium', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes executeInSelenium and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::executeInSelenium() */ - public function retryExecuteInSelenium($function) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retryExecuteInSelenium(\Closure $function) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('executeInSelenium', func_get_args(), $retryNum, $retryInterval)); } @@ -4774,7 +4432,7 @@ public function retryExecuteInSelenium($function) { * * Example: * ``` html - * + * * ``` * * ``` php @@ -4784,7 +4442,6 @@ public function retryExecuteInSelenium($function) { * $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. @@ -4798,14 +4455,11 @@ public function retryExecuteInSelenium($function) { * $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())); + public function switchToWindow(?string $name = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('switchToWindow', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. @@ -4817,7 +4471,7 @@ public function switchToWindow($name = NULL) { * * Example: * ``` html - * + * * ``` * * ``` php @@ -4827,7 +4481,6 @@ public function switchToWindow($name = NULL) { * $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. @@ -4841,27 +4494,24 @@ public function switchToWindow($name = NULL) { * $last_window = end($handles); * $webdriver->switchTo()->window($last_window); * }); - * ?> * ``` - * - * @param string|null $name * @see \Codeception\Module\WebDriver::switchToWindow() */ - public function tryToSwitchToWindow($name = NULL) { + public function tryToSwitchToWindow(?string $name = NULL): bool { return $this->getScenario()->runStep(new \Codeception\Step\TryTo('switchToWindow', func_get_args())); - } + } /** * [!] Method is generated. - * + * * * Executes switchToWindow and retries on failure. - * + * * Retry number and interval set by $I->retry(); * * @see \Codeception\Module\WebDriver::switchToWindow() */ - public function retrySwitchToWindow($name = NULL) { - $retryNum = isset($this->retryNum) ? $this->retryNum : 1; - $retryInterval = isset($this->retryInterval) ? $this->retryInterval : 200; + public function retrySwitchToWindow(?string $name = NULL) { + $retryNum = $this->retryNum ?? 1; + $retryInterval = $this->retryInterval ?? 200; return $this->getScenario()->runStep(new \Codeception\Step\Retry('switchToWindow', func_get_args(), $retryNum, $retryInterval)); } @@ -4873,7 +4523,7 @@ public function retrySwitchToWindow($name = NULL) { * * Example: * ``` html - *