Overview
Filament 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/filament-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/filament-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": {
"administrator": {
"email": "administrator@example.com",
"password": "dD.123123ddd",
"name": "Ada Administrator"
},
"unverified": {
"email": "unverified@example.com",
"password": "dD.123123ddd",
"name": "Uma Unverified"
}
}
}
}
Steps
This pack loads Laravel Steps itself, so every Laravel step (the login, the user menu, the messages, the field errors, the mail and the error pages) is a step of a panel project too. They are listed here after the pack's own steps: one place to look for a tester or a developer working on a Filament panel.
- 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
- Given I am on the "Products" list
- When I open "Shop Dashboard" from the sidebar
- Then the sidebar should list "Products"
- Then the "Orders" item of the sidebar should show a badge
- Then the sidebar should show "Products" as the current page
- When I collapse the "Shop" group of the sidebar
- Then the "Shop" group of the sidebar should be collapsed
- Then the page heading should be "Products"
- Then the breadcrumbs should read "Products › List"
- Then I should be on the "Products" list
- When I open "Webship Test Kettle" from the list
- When I create a new record from the list
- When I open the "Edit" page of the record
- Then the "View" page of the record should be the current one
- Then the list should count 3 records
- Then the list should show "Webship Test Kettle"
- Then the list should have 10 rows
- Then the "Webship Test Kettle" row should show "Webship Brand Alpha" in the "Brand" column
- Then the first row of the list should be "Webship Test Teapot"
- Then the list should be empty
- When I search the list for "Webship Test"
- When I clear the search of the list
- When I sort the list by "Price"
- Then the list should be sorted by "Price" in ascending order
- When I choose "Only deleted records" in the "Deleted records" filter
- Then the "Deleted records" filter should be set to "Only deleted records"
- Then the list should have the filter "Only deleted records"
- When I remove the filter "Only deleted records"
- When I clear all filters
- When I choose the "Processing" tab of the list
- Then the "Processing" tab of the list should be chosen
- When I hide the "SKU" column
- Then the list should have the column "SKU"
- When I go to page 2 of the list
- Then the list should be on page 2
- When I show 25 records per page
- When I select "Webship Test Kettle" in the list
- Then the selection should read "1 record selected"
- When I run the bulk action "Delete selected"
- Then the bulk actions should offer "Delete selected"
- When I group the list by "Order date"
- Then the list should show the group "Processing"
- When I turn reordering of the list on
- When I move "Webship Brand Beta" above "Webship Brand Alpha" in the list
- Then "Webship Brand Beta" should come before "Webship Brand Alpha" in the list
- When I run the "Replicate" action of the page
- Then the page should offer the "Replicate" action
- When I run the "New address" action of the "Addresses" list
- When I run the "Ship" action on the "WS-TEST-0001" row
- Then the "WS-TEST-0001" row should offer the "Process" action
- Then the "Send email" modal should be open
- When I confirm the modal
- When I press "Ship & notify customer" in the modal footer
- When I close the open modal
- Then the modal should ask "Are you sure you would like to do this?"
- When I set "Name" to "Webship test lamp"
- When I set these fields:
- Then "Name" should be set to "Webship test lamp"
- Then the "Slug" field should be read only
- Then the form should show the field "Salary"
- When I upload "test-panel-photo.jpg" to the "Images" field
- Then the "Images" field should hold the file "test-panel-photo.jpg"
- When I remove the file "test-panel-photo.jpg" from the "Images" field
- When I add a row to "Order items"
- When I add the "Milestone" block to "Plan"
- Then "Order items" should have 2 rows
- Then the rows of "Plan" should be "Milestone" and "Task group"
- When I set "Quantity" to "2" in row 1 of "Order items"
- Then "Quantity" should be set to "2" in row 1 of "Order items"
- When I move row 2 of "Plan" up
- When I remove row 2 of "Plan"
- When I add the property "badge" with the value "blue" to "Metadata"
- Then "Metadata" should hold the property "badge" with the value "blue"
- When I remove the property "badge" from "Metadata"
- When I open the "Employment" tab
- Then the "Employment" tab should be open
- When I go to the next step of the wizard
- Then the wizard should be on the "Order Details" step
- When I save the form
- When I create the record
- When I delete the record
- Given there is no "Webship form task" in the "Tasks" list
- Then the stat "Revenue / Customer" should show a value
- Then the page should show the widget "Customer Growth"
- Then the "Customer Growth" chart should be drawn
- Then the "Flagged Orders" widget should list 5 records
- Then the "Title" entry should read "Webship test post"
- When I search the panel for "Webship Test"
- Then the global search should find "Webship Test Kettle"
- Then the global search should show the group "products"
- When I open "Webship Test Kettle" from the global search
- When I open the notifications drawer
- When I close the notifications drawer
- Then the notifications drawer should list "New order"
- When I mark all notifications as read
- Then the notifications button should show 1 unread
- When I switch the admin theme to "dark"
- Then the admin theme should be "dark"
- When I switch the current tenant to "Webship Second Team"
- Then the current tenant should be "Webship Team"
- Then the tenant menu should offer "Webship Second Team"
- 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/filament-steps.