Overview
Penpot 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/penpot-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/penpot-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": {
"owner": {
"email": "owner@example.com",
"password": "dD.123123ddd",
"name": "Owner Test"
},
"admin": {
"email": "admin@example.com",
"password": "dD.123123ddd",
"name": "Admin Test"
},
"editor": {
"email": "editor@example.com",
"password": "dD.123123ddd",
"name": "Editor Test"
},
"viewer": {
"email": "viewer@example.com",
"password": "dD.123123ddd",
"name": "Viewer Test"
}
}
}
}
Steps
- Given I am a logged in user with the "owner" user
- When I log in as "editor" with the login form
- When I log in with the email "editor@example.com" and the password "Wrong-password-1"
- Then the login should be refused with "Email or password is incorrect."
- Given I am not logged in
- When I log out
- Then I should be logged in as "editor"
- Then I should be logged in
- Then I should be on the login page
- Then I should be on the registration page
- When I ask for a password reset link for "editor"
- When I set the password of "editor" on the reset page
- When I try to register with the name "Webship test", the email "owner@example.com" and the password "dD.123123ddd"
- Then the registration should be refused with "Email already used"
- Given "viewer" has not done the onboarding yet
- Then the onboarding should ask "Help us get to know you"
- When I choose "Personal" in the onboarding
- When I answer "Webship test" in the box "Other (specify)" of the onboarding
- When I press "Next" in the onboarding
- Then the button "Next" of the onboarding should be disabled
- Then the onboarding should be over
- When I open the team "Design team"
- When I go to "Drafts" in the dashboard
- Then the page heading should be "Projects"
- Then the dashboard should show the project "Website redesign"
- Then the project "Website redesign" should list the file "Homepage"
- When I create the project "Webship test project"
- When I rename the project "Webship test project" to "Webship test renamed project"
- When I open the options of the project "Website redesign"
- Then the menu should offer "Rename"
- When I choose "Rename" in the menu
- When I choose "Delete" in the options of the project "Webship test project"
- Then the options of the project "Website redesign" should offer "Rename"
- Then the site should say "Your project has been deleted successfully"
- Then the site should ask "Are you sure you want to delete this file?"
- Then the dialog should say "2 of 2 elements selected"
- Then the button "Export" of the dialog should be disabled
- When I press "Delete file" in the dialog
- When I close the dialog
- When I close the menu
- Then no dialog should be open
- When I create a file in the project "Webship test project"
- When I open the file "Homepage" from the dashboard
- When I rename the file "New File 1" to "Webship test file"
- When I select the files "Homepage" and "Pricing page"
- When I right-click the selected file "Homepage"
- When I search the dashboard for "Homepage"
- Then the page should list the file "Homepage"
- Then the trash should list the file "Webship test file"
- Then the pinned projects should list "Website redesign"
- Then the page should offer the button "+ New project"
- When I create the team "Webship test team"
- Then the team switch should list "Design team"
- When I choose "Delete team" in the team options
- Then the team options should offer "Delete team"
- Then the member "editor" should have the role "Editor"
- Then the role of the member "owner" should not be changeable
- When I change the role of the member "viewer" to "Editor"
- When I invite "webship-test-invite@example.com" to the team as "Viewer"
- When I start an invitation to "editor"
- When I add "webship-test-invite@example.com" to the invitation
- Then the invitations should list "webship-test-invite@example.com" as "Pending"
- When I select the invitation to "webship-test-invite@example.com"
- When I delete the invitation to "webship-test-invite@example.com"
- When I open the file "Homepage"
- When I open the file "Homepage" at a page that does not exist
- Then the open page should be "Page 1"
- Then the pages should list "Page 1"
- When I add a page
- When I open the page "Page 1"
- When I rename the page "Page 2" to "Webship test page"
- When I draw a "Board" on the canvas
- When I draw a "Rectangle" in the board "Board"
- When I write the text "Webship test text" on the canvas
- When I draw a path on the canvas
- Then the layers should list "Board"
- Then the layer "Board" should be selected
- When I select the layer "Board"
- When I rename the layer "Board" to "Webship test board"
- When I delete the layer "Ellipse"
- When I group the selection
- When I make the selection a component
- Then the layer "Rectangle" should be a component
- When I undo the last change
- Then the design value "Width" should be "300"
- When I set the design value "Width" to "300"
- Then the selection should measure "300 x 200"
- When I add a "stroke" to the selection
- Then the main menu "File" should offer "Add as Shared Library"
- When I choose "Export boards as PDF" in the main menu "File"
- Then the workspace should show the drawing tools
- When I open the "Inspect" tab
- Then the side panel should offer the tab "Design"
- Then the assets should list the component "Rectangle"
- Then the assets should show "Local library"
- When I connect the library "Style guide"
- When I disconnect the library "Style guide"
- Given "editor" has the file "Homepage" open
- When "editor" closes the file
- Then the file should show "editor" among its users
- When I save a version named "Webship test version"
- Then the history should list the version "Webship test version"
- When I restore the version "Webship test version"
- When I press "Export" in the dialog to download a file
- When I press the button "Export 1 element" to download a file
- When I download the open file
- Then the downloaded file should be a PDF of 1 page
- Then the downloaded file should be a PNG image of 300 by 200 pixels
- When I add the comment "Webship test comment" on the board "Footer"
- Then the comments should list "Can the hero be taller?"
- When I close the comments panel
- Then the page should show 1 comment bubble
- Then the inspect panel "Size and position" should show "Width" as "300px"
- When I switch the inspect panel to "Code"
- Then the inspect code should contain "width: 120px;"
- When I create a "Color" token "webship.test.red" with the value "#ff0000"
- When I try to create a "Color" token "webship.test.red" with the value "1"
- Then the tokens should list "webship.test.red"
- When I apply the token "webship.test.red" to the selection as "Fill"
- Then the token "webship.test.red" should be applied to the "Fill"
- Then the token set "Global" should be active
- When I open the view mode
- Then the view mode should show the board "Footer"
- Then the view mode should show the board 1 of 2
- When I go to the next board
- When I set the zoom of the view mode to "Fit"
- When I open the "Comments" section of the view mode
- When I add an export in the view mode
- When I create a share link
- When I destroy the share link
- Then a visitor should see the file "Homepage" with the share link
- When I go back to the dashboard from the view mode
- When I open the profile menu
- When I point at "Help & Learning" in the profile menu
- When I choose "Your account" in the profile menu
- Then the profile menu should offer "Help Center"
- Then the release notes should show "Version 2.19"
- When I read the release notes to the end
- When I go to "Settings" in my account
- Then the setting "UI theme" should be "Penpot Dark (default)"
- When I search the shortcuts for "Rectangle"
- Then the shortcuts should list "Rectangle"
- Then an email with the subject "Password reset" should have been sent to "editor"
- Then the email with the subject "Password reset" to "editor" should say "We received a request to reset your password"
- When I open the link of the email with the subject "Password reset" to "editor"
- Given there is no project "Webship test project"
- Given there is a project "Webship test project"
- Given there is no file "Webship test file"
- Given there is a new file "Webship test file" in the project "Webship test project"
- Given there is no team "Webship test team"
- Given there is no invitation to "webship-test-invite@example.com"
- Given there is no comment that says "Webship test comment" on the file "Homepage"
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/penpot-steps.