Overview
Shopify 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/shopify-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/shopify-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Then the page should be a storefront page
- Then the page should belong to the store "webship-demo-store.example"
- Then the page type should be "product"
- Then the store should use the theme "Webship demo"
- When I close any pop-ups
- Then no pop-up should cover the page
- When I filter the products by "In stock" under "Availability"
- When I remove the "In stock" filter
- When I clear all filters
- Then the products should be filtered by "In stock" under "Availability"
- When I filter the products by price from 10 to 30
- Then the price filter should be from 10 to 30
- When I sort the products by "Price, low to high"
- Then the products should be sorted by "Price, low to high"
- Then the product list should include "Canvas Tote"
- Then the product list should show 6 products
- Then the product list should show these products in order:
- When I go to page 2 of the product list
- When I go to the next page of the product list
- Then the product list should be on page 2
- When I choose "Navy" for "Color"
- Then "Navy" should be chosen for "Color"
- Then the selected variant should be "S/M / Navy"
- Then the selected variant should be available
- When I set the quantity to 3
- When I increase the quantity
- Then the quantity should be 3
- When I add the product to the cart
- Then the product should be sold out
- Then I should be able to add the product to the cart
- Then adding to the cart should be refused
- Then I should see the dynamic checkout button
- When I press the dynamic checkout button
- Then the product price should be "$24.00"
- When I open the cart drawer
- When I close the cart drawer
- Then the cart drawer should be open
- Then the cart drawer should list "Wool Beanie"
- Then the cart drawer should be empty
- When I go to the cart page
- Then I should be on the cart page
- When I change the quantity of "Wool Beanie" to 2 in the cart
- When I remove "Wool Beanie" from the cart
- When I write the cart note "Gift wrap, please"
- Then the cart should be empty
- Then the cart should hold 2 items
- Then the cart should contain "Wool Beanie"
- Then the cart should contain 2 of "Wool Beanie"
- Then the cart total should be "$48.00"
- Then the cart count should be 2
- Given the cart holds 2 of the product "wool-beanie"
- When I check out
- Then I should be on the checkout
- Then the cart note should be "Gift wrap, please"
- When I type "tote" in the search box
- Then the search suggestions should be shown
- Then the search suggestions should list "Canvas Tote"
- When I choose the search suggestion "Canvas Tote"
- When I close the search suggestions
- When I search the store for "tote"
- When I choose "Canada" as the country
- Then the store country should be "Canada"
- Then the store language should be "Français"
- Then the store currency should be "CAD"
- Then the country selector should list "Canada"
- Then the country selector should show the current country
- Then I should see the newsletter form
- Then the newsletter email field should be required
- When I sign up for the newsletter with "not-an-email"
- Then the newsletter sign-up should be refused
- Then I should see the store password page
- When I enter the store with the password "webship-demo"
- Then the store password should be refused
- Then I should be in the store
- Then I should see the cookie banner
- When I accept the cookies
- When I open the cookie preferences
- When I allow the "Analytics" cookies
- When I save the cookie preferences
- Then the tracking consent for "analytics" should be "yes"
- Then the visitor's tracking consent should be decided
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/shopify-steps.