Overview
Joomla 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/joomla-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/joomla-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": {
"admin": {
"username": "admin",
"password": "Admin123456789!"
},
"manager": {
"username": "manager",
"password": "Manager123456789!"
},
"editor": {
"username": "editor",
"password": "Editor123456789!"
},
"member": {
"username": "member",
"password": "Member123456789!"
}
}
}
}
Steps
- When I log in to the administrator panel as "admin" with password "Admin123456789!"
- Given I am a logged in user with the "admin" user
- When I log in to the site as "member" with password "Member123456789!"
- Given I am logged in to the site with the "member" user
- Given I am on the administrator login page
- Given I am not logged in
- When I log out of the administrator panel
- Then I should see an invalid login error in the administrator panel
- Then I should be on the administrator login page
- Then I should be logged in to the administrator panel
- When I log out of the site
- Then I should be logged in to the site
- Then I should see an invalid login error on the site
- Given I am on the login page
- Then I should see the login form
- Then I should see the administrator dashboard
- Given I am on the administrator "Articles" page
- Then I should be on the administrator "Articles" page
- Then I should see the administrator page title "Articles"
- Then I should see the administrator menu
- When I open the administrator menu item "Content > Articles"
- Then I should see the administrator menu item "Content > Articles"
- When I click the "New" toolbar button
- Then I should see the "New" toolbar button
- Then I should see the "Logged-in Users" dashboard module
- Then the CMS version should start with "6"
- When I search the list for "Welcome"
- When I filter the list by "Select Status" with "Trashed"
- When I select the row "Welcome to your blog"
- When I select all rows
- Then I should see the row "Typography" in the list
- Then I should see an empty list
- When I publish the article "Review article"
- When I delete the article "Review article" permanently
- When I open the article "Typography" for editing
- Then the article "Typography" should exist
- Given the article "Review article" is removed
- Then the article "Review article" should be published
- When I create an article titled "Review article"
- When I create a category titled "Review category"
- When I create a menu titled "Review menu"
- When I delete the menu "Review menu"
- When I create a menu item titled "Review item" in the "Main Menu Blog" menu of the type "Articles > Featured Articles"
- When I create a "Custom" site module titled "Review module" with the text "Review text." in the "sidebar-right" position
- When I fill in the rich text editor with "<p>Hello</p>"
- Then the rich text editor should contain "Hello"
- When I choose "Blog" in the "Category" field
- When I switch "Featured" to "Yes"
- When I open the "Publishing" tab
- Then the field labelled "Title" should have the value "Typography"
- When I set the field labelled "Site Name" to "Review Site"
- When I upload the file "tests/fixtures/pixel.png" to the media manager
- Then I should see the media file "pixel.png"
- When I delete the media file "pixel.png"
- When I open the "Blog" menu item
- When I open the mobile menu
- Then I should see the "Blog" menu item
- When I read more of "Joomla"
- Then I should be viewing the "Joomla" article
- Then the breadcrumb should show "Home > Blog"
- Then I should see a success message "Article saved."
- Then I should see no system messages
- When I search the site for "template"
- When I search the site for a word from the first article
- Then I should see that word in the search results
- Then I should see no search results
- Then I should see "Your Template" in the search results
- Then I should see at least 1 search result
- When I open the search result "Your Template"
- Then I should be on the 404 page
- Then the page generator should contain "Joomla"
- Then I should see the "Popular Tags" module
- Then I should see the language switcher
- When I switch the site language to "Français"
- Then the user "member" should be in the "Registered" group
- Then the access level "Registered" should include the "Registered" group
- Then the group "Registered" should have 1 enabled user
- When I clear all caches
- When I clear the expired cache
- When I check in all items
- Then there should be checked out items
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/joomla-steps.