Log in to the backend as a user from the worldParameters.users registry in cucumber.js, by its handle, so no feature file carries credentials:
users: {
admin: { username: 'admin', password: process.env.TYPO3_ADMIN_PASS },
editor: { username: 'editor', password: process.env.TYPO3_EDITOR_PASS },
}
Opens /typo3/login, fills #t3-username and #t3-password, submits with #t3-login-submit and waits for the backend shell (.scaffold). A refused login fails the step with the message of the login form.
Accounts are configuration: create them once when the site is built (vendor/bin/typo3 backend:user:create), never from a feature.
Examples
Given I am a logged in user with the "admin" user
Given I am a logged in user with the username "editor"
Given we are a logged in user with "admin"
Given a logged in backend user with the "editor" user
And I am a logged in backend user with the "admin" user
Pattern
Given(/^(I am |we are )*a logged in( backend)* user with( the)*( username)* "([^"]*)?"( user)*$/, …)
Part of @webship-js/typo3-steps (github.com/webship/typo3-steps), a step pack for Webship-js 2.0.x.