Given I am an anonymous user

Starts the scenario as an anonymous visitor: the step clears all cookies in the current browser context, then navigates to the launch URL configured for the test run and waits for the page to load. Clearing cookies drops any session left over from a previous scenario, so this is the standard way to guarantee that no user is logged in before the scenario begins.

The step takes no parameters and is most useful in a Background section or as the first Given of a scenario. Note that it always lands on the homepage after clearing cookies; if the scenario needs a different starting page, follow it with a navigation step such as When I go to "/user/login". The wait time after navigation honours the configured minimum page wait (3 seconds by default).

Accepted phrasings

Given I am an anonymous user
Given we are an anonymous user
Given an anonymous user

Examples

Given I am an anonymous user
Given we are an anonymous user
Given an anonymous user

In a real scenario

Scenario: Anonymous visitors cannot register themselves on the site
  Given I am an anonymous user
   When I go to "/user/register"
    And wait
   Then I should see "Log in"
    And I should not see "Create new account"
   When I go to "/admin"
    And wait
   Then I should see "Log in"

Related steps

Back to Navigation Steps