laracasts / Behat-Laravel-Extension

Laravel extension for Behat functional testing.
MIT License
260 stars 73 forks source link

Fix switching between js/non-js supported drivers #57

Closed peterfox closed 7 years ago

peterfox commented 8 years ago

I've found an issue in the extension when using the Selenium 2 driver for Javascript tests along side the Laravel extension for non javascript tests. This breaks because it will call the reboot method on the wrong driver type after the tests using the Selenium 2 driver have run.

An example snippet of the MinkExtension configuration is below.

    Behat\MinkExtension:
        default_session: laravel
        base_url: http://localhost:8000
        laravel: ~
        selenium2:
          wd_host: "http://localhost:8643/wd/hub"
alnutile commented 7 years ago

@peterfox can you give me an example? Like when one scenario is @javascript and another is not in the same Feature file?

peterfox commented 7 years ago

@alnutile

Feature: example

  @javascript
  Scenario:
    When I go to "Home"
    Then I should see "Login"
    And I should see "Register"

  Scenario:
    When I go to "Home"
    Then I should see "Login"
    And I should see "Register"

The problem is the rebootKernel function is called no matter what. Using the @javascript tag before a scenario means that a driver with Javascript support should be used over the preferred Laravel Behat driver.

To be fair I've just noticed recent changes to the class so it might not be an issue anymore.

peterfox commented 7 years ago

@alnutile I've just tried the master branch and this is no longer a problem now that the context is checked before the code in rebootKernel is run

alnutile commented 7 years ago

k closing issue then. thanks