0

In JUnit, I would have done this in an @Before method but I don't see that in Mink. Does anyone know how to do this for all the tests instead of having to do $this->getSession()->maximize() in every function? Thanks

macserv
  • 3,546
  • 1
  • 26
  • 36
ihossain
  • 343
  • 1
  • 8
  • 19

1 Answers1

3

You can use backgrounds or feature hooks. Both work similarly to the setUp method used in xUnit frameworks.

Backgrounds are more explicit:

Feature: your feature

Background:
    Given the window is maximized

Scenario: Log in
    Given I press the login button
    Then I should see "logged in"

And with hooks, you can have a FeatureContext method executed. Maybe this is more appropiate:

/** @BeforeFeature */
public static function setupFeature(FeatureEvent $event)
{
}

Read more at the docs:

gontrollez
  • 6,372
  • 2
  • 28
  • 36