MageTest / BehatMage

Behat for Magento
MIT License
85 stars 31 forks source link

AfterScenarioListener does not fire #76

Open dwickstrom opened 9 years ago

dwickstrom commented 9 years ago

Hello,

I noticed that when running my test a second time, the fixtures from the previous run isn't cleaned and I get an "sql-duplicate-key-warning". Going through the code it looks like the AfterScenarioLister isn´t registered anywhere and subsequently never fires after the test suite is run.

dwickstrom commented 9 years ago

Thinking more closely, this is perhaps something i should register myself in my BaseContext, no?

dwickstrom commented 9 years ago

"require": { "magetest/magento-behat-extension": "dev-develop", "behat/mink-extension": "", "behat/mink-goutte-driver": "", "behat/mink-selenium2-driver": "*" },

jamescowie commented 9 years ago

I am testing a pull request that has been submitted that looks to resolve the afterScenario issue. Once this is merged it should resolve the issue we have here.

Can you provide the fixture you are using in the form on a sample scenario and step definitions and I will run this to ensure its all resolved.

dwickstrom commented 9 years ago

I just used the standard one from the "How to"-section:

#@javascript
#Scenario: Test behat even works ok
 #   Given I am on the homepage
  #  Then I should see text "Home page"

  Scenario: Test if the fixtures work ok
    Given the following products exist:
      | sku      | name           |
      | Ottoman3344 | Ottoman        |
    And "Ottoman1" has existing reviews
    When I turn reviews off for "Ottoman1" product
    Then no review should be displayed for "Ottoman1"

First time the test fails, and upon running it again it complains about "sql-duplicate-key-warning".