Commit Graph

489 Commits

Author SHA1 Message Date
Kamil Kokot
6230f2ffdc Merge pull request #51 from FriendsOfBehat/ci/add-cs-fixer-phpstan
Some checks failed
Test / PHP 8.3 + Symfony 7.4.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.4 + Symfony 7.4.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.4 + Symfony 8.0.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.4 + Symfony 8.1.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.5 + Symfony 7.4.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.5 + Symfony 8.0.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.5 + Symfony 8.1.* + Behat 4.x-dev (push) Has been cancelled
Test / PHP 8.3 + Symfony 7.4.* + Behat stable (push) Has been cancelled
Test / PHP 8.4 + Symfony 7.4.* + Behat stable (push) Has been cancelled
Test / PHP 8.5 + Symfony 7.4.* + Behat stable (push) Has been cancelled
Add PHP CS Fixer + PHPStan max to CI; drop GoutteFactory
2026-06-12 18:23:25 +02:00
Kamil Kokot
41bac3c5b7 Remove inline @var annotations; fix spec session name; fix @var placement
- Replace all local-variable @var annotations with proper type guards:
  - MinkExtension configure closure: build inner array directly
    ($sessions[$driverType] = [$driverType => ...]) to avoid mixed offset access
  - MinkExtension loadSessions: add is_array($session) guard inside foreach
    so PHPStan narrows $session from mixed to array before key() call
  - DriverFactory::buildDriver @param broadened from array<string, mixed>
    to array<mixed> — is_array() only narrows to array<mixed> (key type
    unknown), so array<string, mixed> was unreachable at the call site
  - MinkAwareInitializer: move @var from inside constructor parameter list
    to a proper @param on the method docblock
- SessionsListenerSpec: replace 'goutte' (deleted driver) with
  'browserkit_http' as the example default session name

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 18:04:18 +02:00
Kamil Kokot
2947994733 Simplify: fix fallback bug, reduce redundancy, restore step PHPDocs
- FailureShowListener: fix show_tmp_dir fallback '' -> sys_get_temp_dir()
  (bug introduced by duplication with MinkContext::showLastResponse)
- SauceLabsFactory: simplify `is_bool($x) ? $x : (bool) $x` -> `(bool) $x`
- MinkExtension::load: extract $baseUrl/$browserName locals to avoid
  evaluating the same `?? ''` expression twice per line
- EnvironmentCapabilities: store TRAVIS_JOB_NUMBER and JENKINS_HOME
  getenv() results before the switch to avoid double calls per match
- MinkContext: restore PHPDoc comments on all step methods (Example lines
  for discoverability); keep PHP attributes, no @Given/@When/@Then tags

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 17:50:42 +02:00
Kamil Kokot
47a9d45cd1 Add PHP CS Fixer and PHPStan max to CI; remove abandoned GoutteFactory
- Add friendsofphp/php-cs-fixer ^3.75 and phpstan/phpstan ^2.0 to
  require-dev; add .php-cs-fixer.dist.php (@Symfony ruleset with
  phpdoc_to_comment ignored_tags) and phpstan.neon (level max,
  treatPhpDocTypesAsCertain: false)
- Run CS Fixer and PHPStan in every CI matrix job alongside tests
- Add composer scripts: cs, cs-check, phpstan
- Add .php-cs-fixer.cache to .gitignore
- Fix all PHPStan max violations across src/: add return/param types,
  narrow mixed config values with is_string()/is_array() guards,
  use TaggedNodeInterface for scenario tag access in SessionsListener
- Remove GoutteFactory and its spec — the goutte driver and its
  underlying client library are abandoned

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 17:43:01 +02:00
Kamil Kokot
dff5cbd479 Merge pull request #50 from FriendsOfBehat/ci/modernize-php-symfony-versions
Modernize PHP/Symfony requirements, add Symfony 8 + Behat 4 CI support
2026-06-12 17:21:00 +02:00
Kamil Kokot
80b326eb82 Fix MinkContext::getTranslationResources() return type; update checkout action
Behat 4 added ': array' to TranslatableContext::getTranslationResources(),
causing a fatal "must be compatible" error. Add the return type to both
getTranslationResources() and getMinkTranslationResources(); also guard
glob() with ?: [] since it can return false when no files match.

Update actions/checkout to v5 (Node 24 compatible) — v4 breaks on
GitHub Actions after June 16 2026.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 17:17:29 +02:00
Kamil Kokot
a1355134df Add behat-version matrix dimension, fix Behat 4 type errors, unify config
CI matrix now has a behat-version dimension (stable / 4.x-dev) so both
Behat 3.31 and Behat 4 are tested explicitly. Symfony 8.x rows always
use Behat 4; Symfony 7.4 rows test both versions.

behat.dist.php works with Behat 3.31 too (Behat\Config\Config exists as
a bridge since 3.31), so drop behat.yml.dist and always use the PHP
config — removes the if/else branch from CI and unifies local dev too.

SessionsListener: fix type hint on prepareDefaultMinkSession from
ScenarioLikeTested to ScenarioTested — the method uses getSuite() which
is on LifecycleEvent (not ScenarioLikeTested), and the dispatched events
are ScenarioTested subclasses. Also remove now-unused ScenarioLikeTested
import.

ServiceContainer/MinkExtension: add missing return types (: string,
: void) to all interface method overrides to satisfy Behat 4's stricter
interface signatures.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 17:15:15 +02:00
Kamil Kokot
e7f7e3508a Fix duplicate step definitions and SessionsListener return type
MinkContext: drop @Given/@When/@Then docblock annotations now that PHP
attributes are in place — Behat 3.31 reads both, causing each step to
be registered twice and fail with "already defined".

SessionsListener: add ': array' return type to getSubscribedEvents()
to satisfy Symfony 8.x's stricter EventSubscriberInterface signature.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 17:06:38 +02:00
Kamil Kokot
c0d7a8391c Fix CI shell safety, widen Symfony constraints, add Behat 4 step attributes
- lock-symfony-version.sh: replace cat<<<$(jq) with tmp+mv to avoid
  file truncation; add .key as $k capture in with_entries per jq safety rules
- lock-behat-version.sh: new script mirroring lock-symfony-version.sh,
  fixes the Behat 4 lock step which was wrongly targeting require-dev
  instead of require
- CI: actions/checkout@v3 → @v4; composer validate --strict; use
  lock-behat-version.sh in the Behat 4 step
- composer.json: widen symfony/config, symfony/browser-kit,
  symfony/http-client to ^7.4 || ^8.0 so Symfony 8 installs without CI overrides
- MinkContext: add #[\Behat\Step\Given/When/Then] attributes alongside
  existing docblocks so Behat 4 (which ignores docblock annotations)
  can discover all step definitions

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 17:03:13 +02:00
Kamil Kokot
e4ce183e6f Fix MinkAwareInitializer::initializeContext() signature for behat 4.x
behat 4.x added void return type to ContextInitializer::initializeContext().
Also modernize the constructor with property promotion.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 14:14:37 +02:00
Kamil Kokot
2d50420038 Remove symfony/deprecation-contracts direct dep (transitive, breaks version lock)
The lock-symfony-version.sh script pins all symfony/* packages to the
matrix version, but symfony/deprecation-contracts uses its own versioning
(3.x) rather than following Symfony's major/minor scheme. Removing it as
a direct dependency is safe — it is always pulled in transitively via
symfony/config and others.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 14:10:24 +02:00
Kamil Kokot
9037907f2a Modernize PHP and Symfony version requirements; add Symfony 8 CI support
- Drop PHP <8.3 and Symfony <7.4 (both EOL), require PHP ^8.3 and symfony/config ^7.4
- Require behat ^3.31 (first version with PHP 8 attribute and PHP config support)
- Upgrade phpspec to ^8.0 (supports PHP 8.5)
- Add symfony/browser-kit and symfony/http-client to dev deps; switch from deprecated goutte driver to browserkit_http
- Update CI matrix: PHP 8.3/8.4/8.5 × Symfony 7.4 + PHP 8.4/8.5 × Symfony 8.0/8.1
- Add Symfony 8+ CI step: override behat to 4.x-dev as 3.31.0
- Restrict push trigger to master branch only (no duplicate runs on PRs)
- Add behat.dist.php for behat 4.x compatibility (PHP config format)
- Update behat.yml.dist to use FQCN extension name (works in both behat 3.x and 4.x)
- Add lock-symfony-version.sh script for pinning Symfony in CI

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 13:58:59 +02:00
Matthias Pigulla
f5bd8e3d1f Mark Goutte, Selenium, Sahi and Zombie driver/support as abandoned (#39)
* Mark Goutte, Selenium, Sahi and Zombie driver/support as abandoned

This marks the four drivers as abandoned where the driver implementations are no longer maintained.

* Correctly indent notes so they don't break the enumeration list

* Indent a few more notes that are part of a numerated list
2026-01-14 18:30:58 +01:00
Matthias Pigulla
53dc4cec01 Convert documentation from .rst to .md (#45)
* Convert documentation from .rst to .md

* Remove .rst version

* Use special "NOTE" formatting for (GitHub flavored?) Markdown

https://github.com/orgs/community/discussions/16925
2025-12-19 18:00:30 +01:00
Matthias Pigulla
37e6a53e9d Soft-finalize classes that might need to be changed in the future (#41)
* Soft-finalize classes that might need to be changed in the future

* Leave a note in the UPGRADING document

* @internal-ize listener classes
2025-12-19 10:43:53 +01:00
Christophe Coevoet
9037349407 Update GitHub Actions to use latest Ubuntu 2025-12-18 14:56:43 +01:00
Christophe Coevoet
a9653d777b Fix the branch alias for master 2024-10-03 18:17:42 +02:00
Christophe Coevoet
344b081300 Merge pull request #26 from uuf6429/feature/implement-webdriver-classic-extension
Implement WebdriverClassicDriver factory
2024-10-03 18:16:45 +02:00
Christian Sciberras
6134879ff6 Use branch alias version 2024-08-06 20:12:17 +02:00
Christian Sciberras
ea2d7bd352 Apply fix to Selenium4Factory too 2024-08-06 19:28:01 +02:00
Christian Sciberras
4073c2bb38 Respect/prefer user-overriden capabilities 2024-08-06 18:23:05 +02:00
Christian Sciberras
0876261a41 Fix capabilities array bug 2024-08-06 18:21:33 +02:00
Christophe Coevoet
6e785125f9 Merge pull request #28 from uuf6429/chore/update-composer-json
Normalize composer.json
2024-04-15 09:28:04 +02:00
Christian Sciberras
aa631e6b67 Use underscore for driver key 2024-04-12 23:13:30 +02:00
Christian Sciberras
b91dc9cf82 Add back homepage link 2024-04-08 21:00:54 +02:00
Christian Sciberras
dc357af2e6 Normalize composer.json 2024-04-06 14:23:17 +02:00
Christian Sciberras
18a3f770db Implement WebdriverClassicDriver factory 2024-04-06 14:14:22 +02:00
Yozhef
854336030e Merge pull request #25 from FriendsOfBehat/update-composer-deps-Symfony-7
[WIP] Add support Symfony 7 Update composer.json
2024-01-11 11:12:02 +02:00
Yozhef
2715006c39 Update composer.json 2024-01-11 11:10:17 +02:00
Łukasz Chruściel
89cc19afdf [WIP] Test against Behat dev-master 2023-12-09 18:57:25 +01:00
Yozhef
a94621348b Update test.yaml 2023-12-01 10:24:20 +02:00
Yozhef
c0745dbd25 Update test.yaml 2023-12-01 10:20:31 +02:00
Yozhef
7e0cfa971b Update composer.json 2023-12-01 10:18:29 +02:00
Yozhef
18d5a53dff Merge pull request #23 from BastienGarcia/master
Correct BrowserKitFactory to support the 'http_client_parameters' option
2023-10-03 16:15:12 +03:00
Bastien GARCIA
19d2e002d5 Correct BrowserKitFactory to support the 'http_client_parameters' option 2023-09-15 11:52:47 +02:00
Yozhef
b1ccaef913 Merge pull request #22 from BastienGarcia/master
Added support for client configuration when using BrowserKit
2023-09-12 12:50:10 +03:00
Yozhef
41213ecf2b Merge pull request #21 from eDiasoft/selenium4
Support Selenium4
2023-09-12 12:47:30 +03:00
Bastien GARCIA
b30b2ba332 Corrected Behat test after a change to Wikipedia's website 2023-08-18 09:35:12 +02:00
Bastien GARCIA
6477bb6a2f Added support for client configuration when using BrowserKit 2023-07-21 14:27:05 +02:00
Shu Chen
4f03302762 Update 2023-07-10 16:35:29 +08:00
Shu Chen
a846a31b58 Update 2023-07-10 15:43:15 +08:00
Shu Chen
59f3cf104a Support selenium4 2023-07-10 14:19:57 +08:00
Yozhef
ffc5ee88aa Merge pull request #18 from joaocsilva/patch-1
Step attachFileToField has wrong examples
2022-10-17 10:23:22 +03:00
Yozhef
412bdc3d0f Merge pull request #16 from SwenVanZanten/goutte-client-4-compatibility
Add goutte/client 4 compatibility
2022-10-17 10:22:47 +03:00
Swen van Zanten
98e9aa9266 change the way http client is initiated 2022-10-10 11:51:06 +02:00
João Costa Silva
f51585330a Step attachFileToField has wrong examples 2022-08-02 12:36:30 +02:00
Yozhef
c5dccf0bfe Update README.md 2022-07-01 12:40:00 +03:00
Yozhef
9f8bcde32e Merge pull request #17 from FriendsOfBehat/addCheckSymfony6.1
Update test.yaml
2022-07-01 12:37:40 +03:00
Yozhef
b16b2a38fe Update test.yaml 2022-07-01 12:34:01 +03:00
Yozhef
63e05273cc Merge pull request #15 from stof/fix_chrome_prefs
Fix chrome prefs
2022-07-01 12:31:41 +03:00