Overview
HubSpot CMS 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/hubspot-cms-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/hubspot-cms-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Then the blog should list at least 1 post
- When I open the blog post titled "Why BDD testing matters for marketing sites"
- When I go to page 2 of the blog
- Then the blog should have pagination
- Then the blog should have the tag "Testing"
- When I open the blog tag "Testing"
- Then the blog post should be written by "Jane Doe"
- When I accept the cookie banner
- When I decline the cookie banner
- When I dismiss the cookie banner
- Then the cookie banner should be visible
- Then the cookie consent should be accepted
- Given the cookie consent is accepted
- Then the page should have a form
- Then the form should have a field "email"
- When I fill in the form field "email" with "jane@example.com"
- When I tick the form checkbox "I agree to receive other communications"
- When I submit the form
- Then the form field "email" should be required
- Then the form field "email" should show an error
- Then the form should show an error
- Then the form should show a success message
- Then the menu should have a link labeled "Pricing"
- Then the menu link "Pricing" should link to "/pricing"
- Then the menu item "Services" should have a submenu link "Google Ads Management"
- When I open the menu item "Services"
- When I click the menu link "Pricing"
- Then the menu link "Pricing" should be active
- When I click the CTA "See Pricing"
- Then the CTA "Get Started" should be visible
- Then the CTA "See Pricing" should link to "/pricing"
- Then the page should have a site search
- When I search the site for "pricing"
- Then the search results should list at least 1 result
- Then the search should find no results
- Then the search results should include "Pricing"
- When I open the search result "Pricing"
- Then the page should be a website page
- Then the page generator should be "HubSpot"
- Then the tracking code should be installed
- Then the chat widget should be present
- Then the page should have a meetings embed
- Then the page should have a language switcher
- Then the page should be available in the language "de"
- When I switch the language to "de"
- Then the page should have the canonical address "/pricing"
- Then the page should be hidden from search engines
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/hubspot-cms-steps.