behat-fail-aid icon indicating copy to clipboard operation
behat-fail-aid copied to clipboard

Drop support for behat/mink-extension in favor of friends-of-behat/mink-extension

Open robertfausk opened this issue 3 years ago • 10 comments

What is the issue?

I can not upgrade to Symfony 5.x respectively I have two versions of mink-extension installed.

docker@94a71a61aa04:/var/www/html$ composer why friends-of-behat/mink-extension
robertfausk/behat-panther-extension  v1.0.6  requires  friends-of-behat/mink-extension (^2.3.0)  
soyuka/contexts                      3.3.3   requires  friends-of-behat/mink-extension (^2.3.1)  

docker@94a71a61aa04:/var/www/html$ composer why behat/mink-extension
genesis/behat-fail-aid  3.7.2  requires  behat/mink-extension (~2.0)  

How did it happen?

https://github.com/Behat/MinkExtension is outdated (last release on 5 Mar 2018). As a drop in replacement https://github.com/FriendsOfBehat/MinkExtension can be used.

What should have happened?

behat-fail-aid automatically uses friends-of-behat/mink-extension instead of behat/mink-extension. I do not know if there is an easy way to support both librarys without introducing a BC.

robertfausk avatar Apr 29 '21 10:04 robertfausk

Hey @robertfausk ,

Thanks for raising this. I'll give this a go soon. I'd appreciate a pull request if you can raise one. It would be ace if the replacement worked out. For BC the other versions are still out there that can be used.

Related issue on behat/mink-extension https://github.com/Behat/MinkExtension/issues/370

forceedge01 avatar Mar 08 '22 10:03 forceedge01

Hey @robertfausk ,

Thanks for raising this. I'll give this a go soon. I'd appreciate a pull request if you can raise one. It would be ace if the replacement worked out. For BC the other versions are still out there that can be used.

Question: Is the travis build still working? The badge in the README points to a 404. If travis is not an option anymore then I would recommend to use Gitbhub Actions and I can provide a PR for the use of GHA instead of travis if you want me to. I would like to have a stable build before replacing behat/mink-extension with friends-of-behat/mink-extension.

behat-fail-aid automatically uses friends-of-behat/mink-extension instead of behat/mink-extension. I do not know if there is an easy way to support both librarys without introducing a BC.

It seems that the replace: in the composer.json of friends-of-behat/mink-extension has solved my issue. forceedge01/behat-fail-aid is now working for me, even in symfony 5.x projects. Nonetheless I think the old repo should be replaced.

https://github.com/FriendsOfBehat/MinkExtension/blob/df04efb3e88833208c3a99a3efa3f7e9f03854db/composer.json#L29-L31

https://stackoverflow.com/questions/18882201/how-does-the-replace-property-work-with-composer

robertfausk avatar Mar 08 '22 17:03 robertfausk

Travis does work, best way to find out I guess is to push a change up. It may be an access related thing or the link may have changed since this last ran (10 months ago). I don't mind a github actions PR if you'd like to push one in (even if travis still runs on the side) just to see how GHA works out compared to Travis.

The friendsofBehat repo doesn't have an official stand point i.e it doesn't say that it replaces the old one neither is the old one abandoned - i'll dig a bit further to see what needs doing soon. Thanks for raising this.

forceedge01 avatar Mar 09 '22 10:03 forceedge01

Any updates on this?

Not sure which package is responsible, but I'm now running into the "Ambiguous class resolution" described here: https://github.com/Behat/MinkExtension/issues/370

FYI, latest releases for drupal/drupal-extension aka https://github.com/jhedstrom/drupalextension and dmore/behat-chrome-extension aka https://gitlab.com/behat-chrome/behat-chrome-extension have switched to using the friends-of-behat package.

aaronbauman avatar Jan 11 '23 21:01 aaronbauman

@aaronbauman thanks for reporting. Can you run the commands in verboae mode and dump the output here?

Also what steps and commands have you executed to get this issue?

forceedge01 avatar Jan 12 '23 06:01 forceedge01

Here's are the packages that (i think) create the conflict:

$ composer why friends-of-behat/mink-extension
You are running Composer with SSL/TLS protection disabled.
dmore/behat-chrome-extension 1.4.0  requires friends-of-behat/mink-extension (^2.0) 
drupal/drupal-extension      v4.2.1 requires friends-of-behat/mink-extension (^2)   

$ composer why behat/mink-extension
You are running Composer with SSL/TLS protection disabled.
genesis/behat-fail-aid      2.5.3      requires                   behat/mink-extension (~2.0@stable) 

And here's the full composer install output:

$ composer install --no-ansi --no-interaction --optimize-autoloader --no-progress -v
You are running Composer with SSL/TLS protection disabled.
> command: Drupal\Composer\Plugin\Scaffold\Plugin->onCommand
> pre-install-cmd: cweagans\Composer\Patches->checkPatches
Gathering patches for root package.
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Dependency resolution completed in 0.001 seconds
Nothing to install, update or remove
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
Warning: Ambiguous class resolution, "Behat\MinkExtension\Listener\SessionsListener" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/Listener/SessionsListener.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Listener/SessionsListener.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\Listener\FailureShowListener" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/Listener/FailureShowListener.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Listener/FailureShowListener.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\Context\MinkAwareContext" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/Context/MinkAwareContext.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Context/MinkAwareContext.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\Context\Initializer\MinkAwareInitializer" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/Context/Initializer/MinkAwareInitializer.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Context/Initializer/MinkAwareInitializer.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\Context\MinkContext" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/Context/MinkContext.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Context/MinkContext.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\Context\RawMinkContext" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\Selenium2Factory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\DriverFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/DriverFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/DriverFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\SeleniumFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/SeleniumFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/SeleniumFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\SauceLabsFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/SauceLabsFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/SauceLabsFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\BrowserStackFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/BrowserStackFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/BrowserStackFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\AppiumFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/AppiumFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/AppiumFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\SahiFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/SahiFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/SahiFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\GoutteFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/GoutteFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/GoutteFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\Driver\ZombieFactory" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/ZombieFactory.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/ZombieFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Behat\MinkExtension\ServiceContainer\MinkExtension" was found in both "./vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/MinkExtension.php" and "./vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/MinkExtension.php", the first will be used.
76 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> post-install-cmd: Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin->onDependenciesChangedEvent
Running PHPCodeSniffer Composer Installer
Nothing to install or update
> post-install-cmd: Drupal\Composer\Plugin\Scaffold\Plugin->postCmd
Scaffolding files for pantheon-systems/drupal-integrations:
  - Skip [web-root]/sites/default/settings.php because it already exists and overwrite is false.
> post-install-cmd: DrupalProject\composer\ScriptHandler::createRequiredFiles

aaronbauman avatar Jan 12 '23 14:01 aaronbauman

I resolved this by explicitly updating the friends-of-behat/mink-extension package:

composer update friends-of-behat/mink-extension

which should pull in the "replace" from the composer.json file linked.

Output:

➜ composer update friends-of-behat/mink-extension
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 1 update, 1 removal
  - Removing behat/mink-extension (2.3.1)
  - Upgrading friends-of-behat/mink-extension (2.3.1 => v2.7.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 1 removal
  - Removing behat/mink-extension (2.3.1)
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Upgrading friends-of-behat/mink-extension (2.3.1 => v2.7.2): Extracting archive

mariacha avatar Feb 08 '23 18:02 mariacha

@aaronbauman its a bit late, but does the above solution work for you? The friends of behat repo does not have an official stand point (well they do which isn't very encouraging) hence I am reluctant on the change unless the old one gets abandoned.

forceedge01 avatar May 04 '23 10:05 forceedge01

@robertfausk thanks for your comment from awhile - it made me look at travis CI and indeed they've moved to a payment plan model since. Will fix this soon.

forceedge01 avatar May 04 '23 10:05 forceedge01

composer install works now, thanks.

behat jobs are still failing, but i don't think it's this package that's causing the failure.

aaronbauman avatar May 04 '23 21:05 aaronbauman