Overview
WordPress 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/wordpress-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/wordpress-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Then I should see the site title
- Given I am on a page
- Given I am on a post
- Given I am on a category archive
- Then I should see the post title
- Then I should see post entries
- When I search the site for "hello world"
- When I search the site for existing content
- Then I should see search results for "hello world"
- Given I am on the login page
- Then I should see the login form
- Then I should see a login error
- When I log in as "admin" with password "secret"
- Given I am a logged in user with the username "admin"
- Given I am not logged in
- Then I should see the admin bar
- Then I should see the comment form
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/wordpress-steps.