Overview
Astro 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/astro-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/astro-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Then the page should use view transitions
- Then I should see an optimized image
- Then every optimized image should have a width and a height
- Then every optimized image should load lazily
- Then the optimized image should offer the "avif" format
- Then every optimized image should be loaded
- Then the page should have 4 islands
- Then the "client:load" island should be hydrated
- Then I should see a navigation menu with the following links:
- Then all navigation links should resolve successfully
- When I click the link "About" without a full page reload
- When I go back without a full page reload
- Then the "astro:page-load" event should have fired
- Then the last transition should have gone "forward"
- Then the persistent elements should have been kept
- Then the "main" element should have a view transition
- Then the page should have a route announcer
- Then the route announcer should announce "About | Webship Test Site"
- Then the page "/about/" should be prefetched
- Then the page generator should start with "Astro"
- Then the page generator version should start with "7"
- Then the site should be a production build
- Then the page should not ship JavaScript
- Then the page should have scoped styles
- Then the 404 page should be available
- Then the sitemap should list "/about/"
- Then the RSS feed should be valid
- Then the RSS feed should list "The first post"
- Then the page title should end with "| Webship Test Site"
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/astro-steps.