Behat / MinkExtension

Mink extension (tight integration and configuration) for Behat
MIT License
636 stars 277 forks source link

Scenarios not isolated #285

Open jonathanjfshaw opened 7 years ago

jonathanjfshaw commented 7 years ago

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?

spolischook commented 7 years ago

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.