Overview
PrestaShop 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/prestashop-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/prestashop-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Given I am logged in to the back office as "admin"
- When I log in to the back office with "admin@example.com" and "wrong-password"
- When I log out of the back office
- Then I should be logged in to the back office
- Then the back office should greet "Shop"
- When I open "Catalog > Products" in the back office menu
- Then I should see "Modules" in the back office menu
- Then the current back office menu item should be "Products"
- Then the back office page title should be "Products"
- Then the back office breadcrumb should be "Catalog > Products"
- When I press the back office toolbar button "Add new category"
- When I open the back office path "improve/modules/manage"
- When I open the back office path "sell/catalog/products/" without the security token
- Then I should see the invalid security token page
- Then I should see the access denied page
- Then I should see the success message "Successful update"
- Then I should not see any error message
- Then I should see the notification "The status has been successfully updated."
- Then I should see the field error "The field name is required at least in your default language."
- Then I should see the confirmation dialog "Duplicate product"
- When I confirm the dialog
- When I cancel the dialog
- Then I should not see a confirmation dialog
- When I filter the list by "Name" with "mug"
- When I reset the list filters
- Then the list should have 5 rows
- Then I should see "Customizable mug" in the list
- Then the first row of the list should contain "Customizable mug"
- Then the "Quantity" of the list row "Customizable mug" should be "300"
- When I open the list row "Customizable mug"
- When I choose "Duplicate" for the list row "Customizable mug"
- When I select the list row "Webship bulk mug"
- When I choose the bulk action "Delete selection"
- When I wait for the bulk action to finish
- When I flip the "Status" switch of the list row "Webship bulk mug"
- Then the "Status" switch of the list row "Webship bulk mug" should be on
- When I sort the list by "Name" in ascending order
- When I show 10 rows per page in the list
- When I go to the next page of the list
- Then the list pagination should read "Viewing 1-10 out of 19 (page 1 / 2)"
- When I fill in the back office field "Name" with "Webship test category"
- Then the back office field "Name" should contain "Webship test category"
- When I choose "Percent (%)" for the back office field "Apply a discount"
- When I open the back office form tab "Actions"
- When I save the back office form
- When I create a "standard" product
- When I set the product name to "Webship test mug"
- Then the product name should be "Webship test mug"
- When I set the product price to "21.50"
- Then the product price should be "21.50"
- When I add 5 items to the product stock
- Then the product stock should be 305
- When I set the product reference to "webship_1"
- When I add the product to the category "Men"
- Then the product should be in the category "Men"
- When I upload the product image "product.png"
- Then the product should have 1 image
- When I put the product online
- Then the product should be online
- When I save the product
- When I delete the product from its page
- When I go back to the catalog
- Given no "Webship test mug" is left in "Catalog > Products"
- When I open the placed order in the back office
- Then I should see the placed order in the list
- Then the order page should be titled "KHWLILZLL from John DOE"
- When I change the order status to "Payment accepted"
- Then the order status should be "Payment accepted"
- Then the latest order history entry should be "Payment accepted"
- Then the order history should have 2 entries
- When I set the order note to "Call the customer before shipping"
- Then the order note should be "Call the customer before shipping"
- Then the order should contain the product "Mug The best is yet to come"
- When I search the modules for "Banner"
- Then I should see the module "Banner"
- When I disable the module "Banner"
- Then the module "Banner" should be enabled
- Given I am signed in to the shop as "customer"
- When I sign in to the shop with "customer@example.com" and "wrong-password"
- When I sign out of the shop
- Then I should be signed in to the shop
- Given I am on the shop "cart" page
- Then I should be on a "category" shop page
- When I open "Clothes" in the shop menu
- Then the shop breadcrumb should be "Home > Accessories"
- Then the product list should show 11 products
- Then the product list should announce "There are 11 products."
- Then I should see the product "Customizable mug" in the product list
- Then the first product of the product list should be "Brown bear cushion"
- When I sort the product list by "Name, A to Z"
- Then the product list should be sorted by "Name, A to Z"
- When I filter the product list by "Categories" with "Stationery"
- Then the active filters should include "Categories: Stationery"
- When I remove the active filter "Categories: Stationery"
- When I go to the next page of the product list
- Then the product list should be on page 2
- When I search the shop for "mug"
- When I type "mug" in the shop search
- Then the search suggestions should include "Customizable mug"
- When I open the product "Hummingbird printed t-shirt"
- When I choose "M" for the product option "Size"
- Then the product option "Size" should be "M"
- When I set the quantity to buy to 2
- Then the price of the product should be "$19.12"
- When I add the product to the cart
- Then the cart dialog should show "Hummingbird printed t-shirt"
- When I continue shopping from the cart dialog
- Given my cart is empty
- Then the cart should contain "Hummingbird printed t-shirt"
- Then the cart should hold 2 items
- When I change the cart quantity of "Hummingbird printed t-shirt" to 3
- Then the cart quantity of "Hummingbird printed t-shirt" should be 3
- When I remove "Hummingbird printed t-shirt" from the cart
- Then the cart should be empty
- When I apply the voucher "WEBSHIP10"
- Then the cart should have the voucher "Webship ten percent"
- When I remove the voucher "Webship ten percent"
- Then the cart summary should show "Total (tax incl.)" as "$45.24"
- When I proceed to checkout
- Then the checkout step should be "Personal Information"
- When I fill in the checkout field "First name" with "Greta"
- When I select "Florida" for the checkout field "State"
- When I tick the checkout box "Customer data privacy"
- When I choose the delivery address "Home"
- When I choose the delivery option "My carrier"
- When I continue the checkout
- When I choose the payment method "Pay by bank wire"
- When I accept the terms of service
- Then the place order button should be disabled
- When I place the order
- Then the order should be confirmed
- Then the order confirmation should show "Payment method: Bank transfer"
- Then my order history should list the placed order
- When I open the placed order in my order history
- Then I should see the address "Home"
- Given I have no address "Office"
- When I delete the address "Office"
- When I fill in the shop field "Alias" with "Office"
- When I select "Florida" for the shop field "State"
- When I tick the shop box "Customer data privacy"
- When I send the shop 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/prestashop-steps.