Behat error: MinkExtension 1.3 only supports Goutte 1.x for MinkGoutteDriver, not Goutte 2.x - behat

I've been going round in circles, so I'll start with where I started:
I'm running behat with the following:
composer.json:
{
"require": {
"behat/behat": "2.5.*#stable",
"behat/symfony2-extension": "#stable",
"behat/mink": "#stable",
"behat/mink-extension": "#stable",
"behat/mink-browserkit-driver": "#stable",
"behat/mink-goutte-driver": "1.*#stable",
"behat/mink-selenium2-driver": "#stable",
"phpunit/php-code-coverage": "#stable",
"phpunit/phpunit-mock-objects": "#stable",
"phpunit/phpunit": "#stable",
},
"config": {
"bin-dir": "bin/"
}
}
behat.yml:
default:
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2: ~
which gives me this error:
[RuntimeException]
MinkExtension 1.3 only supports Goutte 1.x for MinkGoutteDriver, not Goutte 2.x.
I need to use behat 2.5.* but other than that, I don't care. How can I get it working?
Thanks

Ugh.. so obvious.
Add this to the requirements in composer.json:
"fabpot/goutte": "1.*#stable",
(I thought composer would have realised it needed goutte 1.* but obviously not)

Related

Updating from Laravel 5.8 to 6.0 fails due to dependencies

I'm trying to update from 5.8 to any version 6 Laravel. I've updated the PHP code, but the composer update is problematic for me. I've tried composer update, composer update --with-dependencies, composer install.
Composer isn't something I work with often. Any help is very appreciate! How do I decipher the composer error message to an actionable task? Is there a command that will install the dependencies for Laravel 6?
The error message after composer update:
- Conclusion: don't install laravel/framework v6.0.0
- arcanedev/support 4.5.0 requires illuminate/support ~5.8.0 -> satisfiable by laravel/framework[v5.8.38], illuminate/support[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].
- arcanedev/support 4.5.0 requires illuminate/support ~5.8.0 -> satisfiable by laravel/framework[v5.8.38], illuminate/support[5.8.x-dev, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].
- Can only install one of: laravel/framework[6.x-dev, v5.8.38].
- don't install illuminate/support 5.8.x-dev|don't install laravel/framework 6.x-dev
- don't install illuminate/support v5.8.9|don't install laravel/framework 6.x-dev
- Installation request for laravel/framework ^6.0 -> satisfiable by laravel/framework[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.10.1, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.27, v6.18.28, v6.18.29, v6.18.3, v6.18.30, v6.18.31, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0, v6.9.0].
- Installation request for arcanedev/support ~4.5 -> satisfiable by arcanedev/support[4.5.0].
The composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"laravel/framework": "^6.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"illuminate/support": "~5.8.0|^6.0",
"intervention/image": "^2.4",
"laravel/tinker": "^1.0",
"spatie/laravel-permission": "^3.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.6",
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0",
"barryvdh/laravel-debugbar": "^3.2",
"arcanedev/log-viewer": "^4.7",
"arcanedev/support": "~4.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Just have a look at the error message you've shared: your configuration requires arcanedev/support with the version constraint ~4.5. By peeking into the version list of that package, you can see that there is only one version that can be used, which is 4.5.0, and this package requires illuminate/support with the version constraint ~5.8.0. Obviously, this excludes any later versions of Laravel.
By also updating arcanedev/support to some later version (^5.0 should be fine), you are able to update Laravel. Packagist can help you to inspect the constraints for different versions of that package.

behat 3 with chrome

I want to run behat 3 with chrome but unable to run the --init
my behat.yml
default:
extensions:
Behat\MinkExtension\Extension:
base_url: 'http://someurl.com'
javascript_session: selenium2
selenium2:
browser: chrome
goutte: ~
my composer.json file is as following:
{
"require-dev": {
"behat/behat": "3.*#stable",
"behat/mink": "1.6.*#stable",
"behat/mink-extension": "#stable",
"behat/mink-goutte-driver": "#stable",
"behat/mink-selenium2-driver": "*",
"peridot-php/webdriver-manager": "dev-master",
"bossa/phpspec2-expect": "*"
},
"config": {
"bin-dir": "bin"
}
}
getting the following error
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
Behat\MinkExtension\Extension extension file or class could not be located.
As it seems
Behat\MinkExtension\Extension extension file or class could not be located.
You need to remove Extension from behat.yml
Replace Behat\MinkExtension\Extension: with Behat\MinkExtension:
After this it should work.
Try changing your extensions block in the yml configurations file to something like this:
extensions:
Behat\MinkExtension:
base_url: "http://www.your-web.com/"
sessions:
chrome_mac:
selenium2:
browser: "chrome"
wd_host: http://xxx.xxx.xxx.xxx:4444/wd/hub
capabilities:
platform: WINDOWS
browser: chrome
version: ""
extra_capabilities:
chromeOptions:
args:
- "--start-maximized"
The "extra_capabilities section is optional.
This should do the trick!
thanks all i have fixed with the followings:
Behat.yml
default:
extensions:
Behat\MinkExtension:
base_url: myURL.com
selenium2: ~
browser_name: 'chrome'
suites:
defaults:
contexts:
- FeatureContext
- Behat\MinkExtension\Context\MinkContext
composer.json
{
"require": {
"behat/mink-extension": "^2.2",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "^1.3"
}
}
Java in CLI
java -jar -Dwebdriver.gecko.driver=geckodriver.exe seleneiumversionhere
I use default chrome browser only, I think may work to you, cause I do this every in my project test.
default:
autoload:
'': %paths.base%/features/bootstrap
extensions:
Behat\MinkExtension:
base_url: https://www.test your url.com
default_session: selenium2
files_path: features/Resources
show_cmd: 'open %s'
selenium2:
browser: chrome
wd_host: http://localhost:4444/wd/hub

WebDriver: Current url is blank, no page was opened

We are trying to add testing as part of update deployment on our live site. The tests ran fine the last time we worked on them which was a week back but now all of them throw that error. We have tried to figure it out but haven't found anything worthwhile.
Update 1: We have found that the functionality breaks due to a package getting updated. Here is the list of updated packages;
barryvdh/laravel-debugbar 2.0.6 -> 2.1.1
barryvdh/laravel-ide-helper 2.1.0 -> 2.1.2
codeception/codeception 2.1.4 -> 2.1.5
doctrine/cache 1.5.2 -> 1.6.0
laravel/framework 5.1.26 -> 5.1.28
league/flysystem 1.0.15 -> 1.0.16
maximebf/debugbar 1.10.5 -> 1.11.0
phpspec/phpspec 2.4.0 -> 2.4.1
phpunit/phpunit 4.8.20 -> 4.8.21
symfony/browser-kit 2.8.0 -> 2.8.1
symfony/class-loader 2.8.0 -> 2.8.1
symfony/console 2.7.7 -> 2.7.8
symfony/css-selector 2.7.7 -> 2.7.8
symfony/debug 2.7.7 -> 2.7.8
symfony/dom-crawler 2.7.7 -> 2.7.8
symfony/event-dispatcher 2.8.0 -> 2.8.1
symfony/finder 2.7.7 -> 2.7.8
symfony/http-foundation 2.7.7 -> 2.7.8
symfony/http-kernel 2.7.7 -> 2.7.8
symfony/polyfill-php56 1.0.0 -> 1.0.1
symfony/polyfill-util 1.0.0 -> 1.0.1
symfony/process 2.7.7 -> 2.7.8
symfony/routing 2.7.7 -> 2.7.8
symfony/translation 2.7.7 -> 2.7.8
symfony/var-dumper 2.7.7 -> 2.7.8
symfony/yaml 2.8.0 -> 3.0.1
Update 2: We have tried downgrading laravel and codeception but to no avail. It is strange as the machines which have been updated once will always throw that error even if they are downgraded till codeception 2.1.0. While the machine which passed all tests was on codeception 2.1.4 and webdriver 1.1.0.
Update 3: Installed selenium just to check and it works so maybe its phantomJS / ghost-driver which has conflict.
Example Test
public function test(AcceptanceTester $I)
{
$I->amOnUrl('http://swaggable.com');
$I->canSeeCurrentUrlEquals('/');
}
Example Output
Failed to check correct credentials in _001PlatformSignupCest::checkCorrectCredentials (tests\acceptance\_001PlatformSIgnupCest.php)
[ModuleException] WebDriver: Current url is blank, no page was opened
Scenario Steps:
3. $I->canSeeCurrentUrlEquals("/signup")
2. $I->amOnUrl("http://platform.work.com/signup")
1. $I->resizeWindow(1280,720)
Acceptance Configuration:
modules:
enabled:
- Asserts
- WebDriver:
url: http://platform.work.com
browser: firefox
http_proxy: direct
- \Helper\Acceptance
Setup:
Laravel 5.1.28
Codeception 2.1.5
PhantomJS 2.0.0
Composer
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"barryvdh/laravel-ide-helper": "^2.0",
"sboo/multiauth": "4.0.*",
"dingo/api": "0.10.*",
"doctrine/dbal": "2.3.*",
"rtconner/laravel-kint": "~2.0",
"factual/factual-php-driver": "dev-master",
"weblee/mandrill": "dev-master",
"barryvdh/laravel-debugbar": "^2.0",
"laravel/envoy": "~1.0",
"jeremeamia/superclosure": "~2.0",
"illuminate/html": "~5.0",
"predis/predis": "^1.0",
"guzzlehttp/guzzle": "~5.3|~6.0",
"laravelcollective/html": "5.1.*",
"exeu/apai-io": "dev-master",
"codeception/codeception": "*"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"fzaninotto/faker": "~1.0"
},
Hello I have the same issue.
I have downgraded the phantomjs to the 1.9.7 version
...
"jonnyw/php-phantomjs": "3.*",
"site5/phantoman": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"PhantomInstaller\\Installer::installPhantomJS",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"PhantomInstaller\\Installer::installPhantomJS",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist",
"bin-dir": "bin"
}
}
And it working now, but I know is a workaround

What is the cause of this exception .?

I am trying to run Behat\mink using this code "bin\behat --format html --out report.html --profile firefox" . But i am getting this error .
[RuntimeException]
MinkExtension 1.3 only supports Goutte 1.x for MinkGoutteDriver, not Goutte 2.x.
composer.json looks like this
{
"require": {
"behat/behat": "2.5.*#stable",
"behat/mink": "1.6.*#stable",
"behat/mink-extension": "*",
"behat/mink":"~1.5#dev",
"behat/mink":"~1.6#dev",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium2-driver": "*"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
behat.yml
firefox:
context:
parameters:
Browser_Name: firefox
extensions:
Behat\MinkExtension\Extension:
base_url: https://google.com
javascript_session: selenium2
browser_name: firefox
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
It would be so helpful if you could tell me where i have gone wrong .
I would say that your first problem lies within your composer.json file. It would appear as though you are attempting to load both developmental and stable versions of the same library.
Unless you are attempting to test / load some dev code you can simplify your require section to:
"require": {
"behat/mink-selenium2-driver" : "~1.2",
"behat/mink-goutte-driver" : "~1.1",
"behat/mink-extension" : "~2.0"
}
Your behat/behat, and behat/mink libraries will automatically be pulled in by composer to fulfil the requirements for those libraries.
Information on the tilde operator, within your composer.json file can be found within composers documentation
Again, unless you are using dev based releases you might want to look at omitting:
"minimum-stability": "dev",

app.user.username in twig returns unable to add global

as per the documentation:
http://symfony.com/doc/current/book/security.html#retrieving-the-user-object
I am trying to use twig to check to see if the user is authenticated
when i put in my twig templates:
{{ app.user.username }}
I get the error
LogicException: Unable to add global "app" as the runtime or the extensions have already been initialized.
EDIT: Please find as per below the composer.json contents
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*#dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
"doctrine/data-fixtures": "dev-master",
"doctrine/doctrine-fixtures-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
Its hard to answer to this question without more details.
First, please notice that there have been such a similar exception in the past, due to a Symfony2.1 bug which has been solved with a recent release: see here for more details.
Then, notice that the error seems to be thrown in addGlobal function of class Twig_Environment. Did you installed such Twig Extension?
Without reading your composer.json, I can suggest to try to:
Clear the cache.
update the code in your composer.json, to avoid the presence of up to date bundles.
Create the composer.phar.
Then compile it to get the composer.phar.
php composer.phar install or php composer.phar update, whatever be your case.
Hope it helps.