Overview
Laravel Steps adds step definitions to Webship-js 2.0.x for the markup the platform itself renders, regardless of theme or distribution, so scenarios read as plain sentences instead of CSS selectors. It is a plugin for Webship-js: it ships one file of step definitions you drop into an existing test project, and it composes with the built-in steps rather than duplicating them.
Install
npm install --save-dev @webship-js/laravel-steps
Then add its step file to cucumber.js beside the Webship-js steps:
require: [
'node_modules/webship-js/tests/step-definitions/**/*.js',
'node_modules/@webship-js/laravel-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Test users
The steps that log in use accounts that already exist on the site, by the handle a feature names (Given I am a logged in user with the "admin" user). The site build creates them; a feature never creates or deletes an account. They are listed in cucumber.js under worldParameters. These are the test accounts of the pack's own test site: put the accounts of your site in your project, and keep real passwords in environment variables.
{
"worldParameters": {
"users": {
"member": {
"email": "member@example.com",
"password": "Member-Pass-2026!",
"name": "Mia Member"
},
"unverified": {
"email": "unverified@example.com",
"password": "Member-Pass-2026!",
"name": "Uma Unverified"
}
}
}
}
Steps
- Given I am a logged in user with the "member" user
- When I log in as "member" with the login form
- When I log in with the email "member@example.com" and the password "wrong-password"
- When I try to log in 6 times with the email "guess@example.com" and a wrong password
- When I log out
- Then I should be logged in
- Then I should be logged in as "member"
- Then I should see the login form
- When I ask for a password reset link for "member"
- Then an email with the subject "Reset your password" should be sent to "member"
- Then no email should be sent to "nobody@example.com"
- Then the email with the subject "Reset your password" to "member" should contain "This password reset link will expire in 60 minutes."
- When I open the "Reset Password" link of the email to "member"
- Then I should see the email verification notice
- Then I should be asked to confirm my password
- When I confirm my password as "member"
- When I confirm my password with "wrong-password"
- When I open "Settings" from the user menu
- Then the user menu should offer "Settings"
- Then the user menu should name "member"
- Then the navigation should have the item "Dashboard"
- Then the navigation should show "Dashboard" as the current page
- When I choose the "Dark" appearance
- Then the chosen appearance should be "Dark"
- Then the page should be shown in the dark appearance
- Then I should see the 404 error page
- Then the page should not show debug information
- When a page of another site sends a form to "/login"
- When I use the maintenance bypass
- When I fill in "Password" with the password of "member"
- Then the "Name" field should hold the name of "member"
- Then the "Email address" field should have the error "These credentials do not match our records."
- Then the "Name" field should have no error
- Then the "Name" field should block submission as required
- Then I should see the status message "We have emailed your password reset link."
- Then I should see the notification "Profile updated."
- Then I should not see a notification
- When I show the value of the "Password" field
- Then the "Password" field should show its value
Every assertion step reads both polarities from one definition: should see and should not see are the same step. Source and issues: github.com/webship/laravel-steps.