Given I am logged in to the admin panel as "admin"

Log in to the admin panel as an account of the users registry in cucumber.js (worldParameters.users), by its handle. A session of the same user is reused; another user is logged out first. The step ends when the admin header shows the username: an account with a restricted role does not land on the Dashboard.

Examples

Given I am logged in to the admin panel as "admin"
Given I am logged in to the admin panel as "sales"
When I log in to the admin panel as "admin"
Given we are logged in to the admin panel as "admin"
When we log in to the admin panel as "sales"

Pattern

Given(/^(?:(?:I am |we are )+logged in|(?:I |we )*log in) to the admin panel as "([^"]*)"$/, …)

Part of @webship-js/magento-steps (github.com/webship/magento-steps), a step pack for Webship-js 2.0.x.