Overview
TYPO3 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/typo3-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/typo3-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": "Introduction!23"
},
"editor": {
"username": "editor",
"password": "Editor!Review23"
}
}
}
}
Steps
- Given I am a logged in user with the "admin" user
- When I log in to the backend as "admin" with password "wrong"
- When I log out
- Given I am not logged in
- Then I should be logged in
- Then I should see a login error
- When I fill in the "Page Title" record field with "News"
- When I select "Center" in the "Alignment" record field
- When I open the "Access" record tab
- When I save the record
- When I close the record
- When I delete the record
- Then the "Page Title" record field should contain "News"
- Then the "Page Title" record field should be marked as invalid
- When I confirm the dialog
- When I press "Delete record (!)" in the dialog
- Then I should see the dialog "Delete this record?"
- When I add a "Header Only" content element to the "Normal" column
- Then I should see the "Welcome" content element in the page module
- When I edit the "Welcome" content element
- Then the "Welcome" content element should be hidden
- Then I should see the "Page Content" table in the list module
- Then I should see the record "Welcome" in the "Page Content" table
- When I edit the record "Welcome" in the "Page Content" table
- Then the record "Welcome" in the "Page Content" table should be hidden
- Given there is no "Congratulations > 404 > Webship test page" page
- When I open the "Page" module
- Then I should see the "Page" module
- Then the "Page" module should be active
- Then I should see "Please select a page" in the module
- Then the module heading should be "Congratulations"
- When I click "Edit page properties" in the module
- When I select the "Congratulations" page in the page tree
- When I expand the "Congratulations" page in the page tree
- Then I should see the "Congratulations" page in the page tree
- Then the "Congratulations > Features" page should not be hidden in the page tree
- When I search the page tree for "Rich Text"
- When I choose "New subpage" from the context menu of the "Congratulations > 404" page
- Then I should see the notification "Record saved"
- Then I should see the info message "Please select a page" in the module
- When I flush the frontend caches
- When I clear the cache of the page
- When I open the "Features" menu item
- Then I should see the "Features" menu item
- When I open the mega menu
- When I open the "Accordion" dropdown link
- Then I should see the "Accordion" dropdown link
- Then I should be viewing the "Accordions" page
- When I open the "Media Left" accordion panel
- Then the "Media Left" accordion panel should be open
- Then I should see "short video" in the "Media Left" accordion panel
- When I open the dropdown of the "Pages" menu item
- Then the "Features" menu item should be current
- When I open the "Login" subnavigation item
- Then I should see the "Forms" subnavigation item
- Then I should see the breadcrumb
- Then the breadcrumb should contain "Content Examples"
- When I switch to the "Deutsch" language
- Then the "Deutsch" language should be available
- Then I should see a "text" content element
- Then I should see 3 "texticon" content elements
- Then I should see "ready to use search" in the "Indexed Search" content element
- When I search the site for "extensions"
- Then I should see search results
- Then I should see "Features" in the search results
- When I submit the "introductionContactForm" form
- Then the "Email" field should be marked as invalid
- Then I should see the error "This field is mandatory." for the "Email" field
- Then I should be on the 404 page
- Then the page generator should start with "TYPO3"
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/typo3-steps.