MinkExtension
MinkExtension copied to clipboard
Scenarios not isolated
My scenarios are not isolated in terms of URL and page content.
In order to demonstrate isolation failure
As an issue reporter
I need to show that the same scenario fails if it comes first but passes if last.
Scenario:
Then I should see "Search"
Scenario:
Given I am on "http://www.google.com"
Scenario:
Then I should see "Search"
3 scenarios (2 passed, 1 failed)
3 steps (2 passed, 1 failed)
The first scenario fails ("Unable to access the request before visiting a page") as it should, but the third passes.
This is just using the bare Mink extension:
autoload:
- %paths.base%/features/build/contexts
suites:
default:
paths:
- %paths.base%/features
contexts:
- Behat\MinkExtension\Context\MinkContext
extensions:
Behat\MinkExtension:
sessions:
default:
goutte: ~
base_url: http://localhost:80
Using @isolated makes no difference. Using $this->mink->restartSessions() in an @BeforeScenario or @BeforeStep hook makes no difference.
What on earth is happening?
For isolating environment responsible IsolatingScenarioTester, there are method test that started with:
$isolatedEnvironment = $this->envManager->isolateEnvironment($env, $scenario);
I don't know if it will help you, but at list you can debug it.