Overview
Magento 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/magento-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/magento-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- When I open the product "24-MB01" in the admin panel
- When I add the image "pixel.png" to the product gallery
- Then the product gallery should have 1 image
- When I select the "Gear" category in the tree
- Then I should see the "Gear" category in the tree
- When I open the order "000000003" in the admin panel
- Then I should see the last placed order in the orders grid
- Then the order status should be "Pending"
- When I add the order comment "Checked by the test suite"
- Then I should see the order comment "Checked by the test suite"
- When I invoice the order
- When I put the order on hold
- When I open the customer "customer@example.com" in the admin panel
- When I go to the "general" configuration section
- When I set the "Store Name" configuration field of "Store Information" to "Test Store"
- Then the "Store Name" configuration field of "Store Information" should be "Test Store"
- Then no cache type should be invalidated
- When I flush the cache
- Then every index should be ready
- When I rebuild the invalid indexes
- Given there is no product "TEST-SKU-1"
- Given there is no category "Test Category"
- Then the confirmation should be closed
- Given I am logged in to the admin panel as "admin"
- When I log in to the admin panel with the username "admin" and the password "wrong-password"
- When I log out of the admin panel
- Given I am not logged in to the admin panel
- Then I should be logged in to the admin panel
- When I go to the "products" admin page
- Then the admin page title should be "Products"
- Then I should see the "Sales" admin menu
- When I open the "Catalog > Products" admin menu item
- Then I should see the access denied page
- When I click the "Add New Page" page action
- When I search the grid for "Joust Duffle Bag"
- When I filter the grid by "Name" with "Tank"
- When I clear the grid filters
- Then the grid should show 19 records
- Then the grid should have 20 rows
- Then I should see the "Joust Duffle Bag" grid row
- Then the "Status" column of the "Joust Duffle Bag" grid row should be "Enabled"
- When I sort the grid by "Name" ascending
- Then the grid should be sorted by "Name" ascending
- When I go to the next page of the grid
- Then the grid should be on page 2
- When I show 50 grid rows per page
- When I select the "Joust Duffle Bag" grid row
- When I run the "Delete" grid action
- When I open the "Joust Duffle Bag" grid row
- When I set the "Product Name" form field to "Test Bag"
- When I turn the "Enable Product" form switch off
- Then the "SKU" form field should be "TEST-SKU-1"
- When I choose "Bags" in the "Categories" form field
- When I open the "Images And Videos" form section
- When I open the "Invoices" admin tab
- Then I should see the form error "This is a required field." for the "Product Name" field
- When I save the form
- Then I should see the success message "You saved the product."
- Then I should see a success message
- Then I should see the confirmation "Are you sure you want to delete this category?"
- When I confirm the action
- When I dismiss the confirmation
- When I wait for the page to settle
- Given I am logged in as the customer "customer"
- When I log in to the store with the email "customer@example.com" and the password "wrong"
- When I log out of the store
- Then I should be logged in to the store
- When I open the "Gear > Bags" store menu item
- Then the breadcrumbs should be "Home > Gear > Bags"
- Then the product list should have 15 products
- Then I should see the product "Joust Duffle Bag" in the product list
- When I open the product "Joust Duffle Bag" from the product list
- When I sort the product list by "Price"
- When I set the product list direction to descending
- Then the product list should be ordered by price ascending
- When I view the product list as a list
- Then the product list should be shown as a list
- When I go to the next page of the product list
- Then the product list should be on page 2
- When I filter the product list by "Activity" with "Yoga"
- Then the product list should be filtered by "Activity" with "Yoga"
- When I clear the product list filters
- When I search the store for "yoga"
- When I type "yog" in the store search
- Then I should see the search suggestion "yoga"
- When I choose the "Size" option "M"
- Then the "Size" option should be "M"
- When I set the product quantity to 2
- When I add the product to the cart
- Then the product price should be "$34.00"
- When I open the "Reviews" product tab
- Then the mini cart should show 1 item
- When I open the mini cart
- Then the mini cart should contain "Joust Duffle Bag"
- When I go to the cart
- Given my cart is empty
- Then the cart should contain "Joust Duffle Bag"
- When I change the cart quantity of "Joust Duffle Bag" to 3
- Then the cart quantity of "Joust Duffle Bag" should be 3
- When I remove "Joust Duffle Bag" from the cart
- Then the cart subtotal should be "$34.00"
- When I apply the coupon "TEST10"
- When I cancel the coupon
- When I estimate shipping to "United States", "Texas", "78701"
- When I choose the "Flat Rate" shipping method
- When I fill in the checkout email with "guest@example.com"
- When I fill in the shipping address:
- When I continue to the payment step
- Then the checkout should be on the shipping step
- When I choose the "Check / Money order" payment method
- When I place the order
- Then I should see the order confirmation
- When I go to my "orders" account page
- Then my order history should list the last placed order
- When I add the address:
- Then my address book should contain "9 Test Road"
- When I delete the address "9 Test Road"
- Given my address book has no address "9 Test Road"
- When I add the product to my wish list
- Then my wish list should contain "Joust Duffle Bag"
- When I remove "Joust Duffle Bag" from my wish list
- Then the comparison list should contain "Joust Duffle Bag"
- When I empty the comparison list
- When I review the product with 4 stars, the summary "Good bag" and the text "It holds everything."
- When I subscribe "reader@example.com" to the newsletter
- When I fill in the "First Name" store field with "Mia"
- When I press the "Create an Account" store button
- Then I should see the field error "This is a required field."
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/magento-steps.