Overview
Docusaurus 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/docusaurus-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/docusaurus-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- When I wait for the page to be ready
- Then I should see a hydrated page
- Then there should be no hydration errors
- Then the site should be served as a production build
- Then the page generator should contain "v3"
- Then the page generator version should start with "3"
- Then I should be on a 404 page
- Then the keyboard focus should be at the start of the page
- When I click the link "Installation" without a full page reload
- When I go back without a full page reload
- When I click "Installation" in the sidebar
- Then I should see "Installation" in the sidebar
- Then the navbar link "Blog" should be active
- Then the navbar link "Source" should open "https://example.com/source" in a new tab
- When I open the "Community" menu of the navbar
- When I choose "Support" in the "Community" menu of the navbar
- Then the "Community" menu of the navbar should list "Support, Forum"
- Then the version menu should show "2.0"
- When I open the navigation menu
- Then the navigation menu should be open
- When I go back to the main menu
- When I expand the "Guides" category in the sidebar
- Then the "Getting Started" category in the sidebar should be expanded
- Then the active page in the sidebar should be "Installation"
- When I scroll to the heading "Links"
- Then the heading "Headings" should be in view
- When I click the anchor link of the heading "Getting help"
- Then the address should point to the heading "Getting help"
- Then the table of contents should highlight "Links"
- Then the next page should be "Configuration"
- Then there should be no previous page
- When I go to the next page
- Then the breadcrumbs should be "Home page, Guides, Writing Content"
- Then the page should have an edit link ending with "docs/intro.mdx"
- Then the page should show a version banner
- Then the version banner should link to "/docs/intro"
- Then the page should belong to the version "2.0"
- Then I should see a "note" admonition
- Then I should see a "tip" admonition titled "Keep it short"
- Then the "danger" admonition should say "Never put a password or a key in a page."
- When I choose the "macOS" tab
- Then the "macOS" tab should be selected
- Then the selected tab should show "brew install example"
- Then the code block "example.config.js" should highlight the lines "2, 4-5"
- Then the code block "example.config.js" should show line numbers
- Then the code block "example.config.js" should be written in "js"
- When I copy the code block "example.config.js"
- Then the clipboard should hold the code of "example.config.js"
- When I search for "firewall"
- Then the search should suggest "Behind a firewall"
- Then the search should find nothing
- When I open the search suggestion "Behind a firewall"
- When I open the page of all the search results
- Then the search results page should list "Behind a firewall"
- When I open the search result "Behind a firewall"
- Then the words "firewall" should be marked on the page
- Then the blog should list the post "Version 2.0"
- Then the blog should list the posts "What Comes Next, Version 2.0"
- When I open the blog post "Version 2.0"
- Then the blog post should be tagged "Release"
- Then the blog post should be by "Alex Example"
- When I open the tag "Release"
- When I go to the older posts
- Then there should be no older posts
- Then the blog archive should list "Version 2.0"
- Then the RSS feed should list "Version 2.0"
- Then the sitemap should list "/docs/intro"
- Given the browser prefers a dark colour scheme
- When I switch the colour mode to "dark"
- Then the colour mode should be "dark"
- Then the colour mode should follow the system
- Then I should see the announcement bar
- When I close the announcement bar
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/docusaurus-steps.