Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony session parameters are not passed to AbstractBrowser #124

Open
n1coh opened this issue May 12, 2020 · 3 comments
Open

Symfony session parameters are not passed to AbstractBrowser #124

n1coh opened this issue May 12, 2020 · 3 comments

Comments

@n1coh
Copy link

n1coh commented May 12, 2020

I try to migrate to Symfony 5 with latest FOB dependencies.
I defined the a default behat config :

behat.yml

    Behat\MinkExtension:
        base_url: http://localhost
        files_path: 'tests/Behat/Features'
        default_session: symfony
        sessions:
            symfony:
                symfony: ~
    FriendsOfBehat\SymfonyExtension: null

But I got this error :
Argument 2 passed to Symfony\Component\BrowserKit\AbstractBrowser::setServerParameter() must be of the type string, null given, called in /app/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php on line 58

I don't know if I'm doing bad or if this is a bug ...
Can you help me please.

@CocoJr
Copy link

CocoJr commented May 30, 2020

Same errors !

To fix it, I had to change my Behat\MinkExtension and remove the "base_url".

So now I have this configuration in my behat.yml.dist:

default:
    suites:
        default:
            paths:
                features: tests/features/
            contexts:
                - App\Tests\Behat\FixtureContext
                - behatch:context:browser
                - behatch:context:debug
                - behatch:context:system
                - behatch:context:json
                - behatch:context:table
                - behatch:context:rest
                - behatch:context:xml
    extensions:
        FriendsOfBehat\SymfonyExtension: ~
        Behat\MinkExtension:
            sessions:
                symfony:
                    symfony: ~
        Behatch\Extension: ~

and my composer looks like:

    "require-dev": {
        "behatch/contexts": "^3.3",
        "friends-of-behat/mink": "^1.8",
        "friends-of-behat/mink-browserkit-driver": "^1.4",
        "friends-of-behat/mink-extension": "^2.4",
        "friends-of-behat/symfony-extension": "^2.0",
        "hautelook/alice-bundle": "^2.7",
        "symfony/maker-bundle": "^1.15"
    },

EDIT: I think the documentation need to be completed and insist in the fact that the base_url for mink has to be omitted !

@n1coh
Copy link
Author

n1coh commented Jun 1, 2020

I found that the typed parameter of method setServerParameter was the problem and just adding a "/" is a solution :
base_url: http://localhost/

@pamil
Copy link
Member

pamil commented Jun 1, 2020

@n1coh nice catch! Indeed, it works for us at Sylius with / at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants