@webship-js/magento-steps 0.0.0-stage → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +399 -2
  3. package/package.json +66 -4
  4. package/scripts/build-site.sh +190 -0
  5. package/scripts/site-accounts.php +119 -0
  6. package/tests/features/01-admin-session.feature +35 -0
  7. package/tests/features/02-admin-menu-pages.feature +54 -0
  8. package/tests/features/03-admin-permissions.feature +51 -0
  9. package/tests/features/04-admin-grids.feature +97 -0
  10. package/tests/features/05-admin-products.feature +87 -0
  11. package/tests/features/06-admin-categories.feature +44 -0
  12. package/tests/features/07-admin-orders.feature +95 -0
  13. package/tests/features/08-admin-customers.feature +55 -0
  14. package/tests/features/09-admin-cart-price-rules.feature +49 -0
  15. package/tests/features/10-admin-content.feature +63 -0
  16. package/tests/features/11-admin-configuration-cache.feature +46 -0
  17. package/tests/features/12-admin-reviews-newsletter.feature +66 -0
  18. package/tests/features/20-storefront-catalog.feature +64 -0
  19. package/tests/features/21-storefront-search.feature +40 -0
  20. package/tests/features/22-storefront-product-cart.feature +68 -0
  21. package/tests/features/23-storefront-checkout.feature +65 -0
  22. package/tests/features/24-storefront-customer.feature +93 -0
  23. package/tests/features/25-storefront-wishlist-compare-contact.feature +50 -0
  24. package/tests/features/90-assertions-must-fail.feature +165 -0
  25. package/tests/fixtures/pixel.png +0 -0
  26. package/tests/step-definitions/README.md +36 -0
  27. package/tests/step-definitions/magento-admin-content.steps.js +818 -0
  28. package/tests/step-definitions/magento-admin.steps.js +856 -0
  29. package/tests/step-definitions/magento-helpers.js +992 -0
  30. package/tests/step-definitions/magento-storefront.steps.js +1797 -0
  31. package/tests/step-definitions/magento.steps.js +158 -0
@@ -0,0 +1,93 @@
1
+ @storefront @customer
2
+ Feature: The customer account
3
+ As a customer
4
+ I want an account in the store
5
+ So that I see my orders and keep my addresses
6
+
7
+ @critical
8
+ Scenario: A customer logs in and sees the account
9
+ Given I am logged in as the customer "customer"
10
+ Then I should be logged in to the store as "Casey Customer"
11
+ And I should see "My Account"
12
+ And I should see "customer@example.com"
13
+ And I should see "100 Main Street"
14
+
15
+ Scenario: A wrong password is refused
16
+ When I log in to the store with the email "customer@example.com" and the password "wrong-password"
17
+ Then I should see the error message "The account sign-in was incorrect or your account is disabled temporarily."
18
+ And I should not be logged in to the store
19
+
20
+ Scenario: Logging out ends the session
21
+ Given I am logged in as the customer "customer"
22
+ When I log out of the store
23
+ Then I should not be logged in to the store
24
+ And I should see "Sign In"
25
+
26
+ Scenario: A visitor who opens the account is asked to sign in
27
+ When I go to my "orders" account page
28
+ Then I should see "Customer Login"
29
+ And I should not be logged in to the store
30
+
31
+ Scenario: The registration form validates
32
+ Given I am on "/customer/account/create/"
33
+ When I press the "Create an Account" store button
34
+ Then I should see the field error "This is a required field." for "First Name"
35
+ And I should see the field error "This is a required field." for "Email"
36
+ And I should see the field error "This is a required field." for "Password"
37
+
38
+ Scenario: A visitor registers and the account is removed again
39
+ Given I am logged in to the admin panel as "admin"
40
+ And there is no customer "mia.newcomer@example.com"
41
+ And I am on "/customer/account/create/"
42
+ When I fill in the "First Name" store field with "Mia"
43
+ And I fill in the "Last Name" store field with "Newcomer"
44
+ And I fill in the "Email" store field with "mia.newcomer@example.com"
45
+ And I fill in the "Password" store field with "Newcomer123456789!"
46
+ And I fill in the "Confirm Password" store field with "Newcomer123456789!"
47
+ And I press the "Create an Account" store button
48
+ Then I should see the success message "Thank you for registering with Main Website Store."
49
+ And I should be logged in to the store as "Mia Newcomer"
50
+ When I go to the "customers" admin page
51
+ And I search the grid for "mia.newcomer@example.com"
52
+ Then the "Name" column of the "mia.newcomer@example.com" grid row should be "Mia Newcomer"
53
+ # A customer a scenario registers is content: the suite removes it.
54
+ Given there is no customer "mia.newcomer@example.com"
55
+ When I go to the "customers" admin page
56
+ And I search the grid for "mia.newcomer@example.com"
57
+ Then the grid should show 0 records
58
+ And I clear the grid filters
59
+
60
+ Scenario: The account pages are opened by name
61
+ Given I am logged in as the customer "customer"
62
+ When I go to my "orders" account page
63
+ Then I should see "My Orders"
64
+ When I go to my "address book" account page
65
+ Then I should see "Default Billing Address"
66
+ When I go to my "account information" account page
67
+ Then I should see "Edit Account Information"
68
+ When I go to my "newsletter subscriptions" account page
69
+ Then I should see "General Subscription"
70
+
71
+ Scenario: An address is added to the address book and deleted
72
+ Given I am logged in as the customer "customer"
73
+ And my address book has no address "9 Webship Road"
74
+ When I add the address:
75
+ | Phone Number | 5125550199 |
76
+ | Street Address | 9 Webship Road |
77
+ | Country | United States |
78
+ | State/Province | Texas |
79
+ | City | Dallas |
80
+ | Zip/Postal Code | 75001 |
81
+ Then I should see the success message "You saved the address."
82
+ And my address book should contain "9 Webship Road"
83
+ When I delete the address "9 Webship Road"
84
+ Then I should see the success message "You deleted the address."
85
+ And my address book should not contain "9 Webship Road"
86
+ But my address book should contain "100 Main Street"
87
+
88
+ Scenario: An address needs a street
89
+ Given I am logged in as the customer "customer"
90
+ When I add the address:
91
+ | City | Dallas |
92
+ Then I should see the field error "This is a required field." for "Street Address"
93
+ And I should see the field error "This is a required field." for "Phone Number"
@@ -0,0 +1,50 @@
1
+ @storefront @lists
2
+ Feature: The wish list, the comparison list and the contact form
3
+ As a customer
4
+ I want to keep products for later, compare them and write to the store
5
+ So that I decide what to buy
6
+
7
+ Scenario: A product is added to the wish list and removed
8
+ Given I am logged in as the customer "customer"
9
+ And I remove "Push It Messenger Bag" from my wish list
10
+ And I am on "/push-it-messenger-bag.html"
11
+ When I add the product to my wish list
12
+ Then I should see the success message "Push It Messenger Bag has been added to your Wish List."
13
+ And my wish list should contain "Push It Messenger Bag"
14
+ When I remove "Push It Messenger Bag" from my wish list
15
+ Then I should see the success message "Push It Messenger Bag has been removed from your Wish List."
16
+ And my wish list should not contain "Push It Messenger Bag"
17
+
18
+ Scenario: A guest is asked to sign in before using the wish list
19
+ Given I am on "/push-it-messenger-bag.html"
20
+ When I add the product to my wish list
21
+ Then I should see the error message "You must login or register to add items to your wishlist."
22
+ And I should see "Customer Login"
23
+
24
+ Scenario: Products are compared and the list is emptied
25
+ Given I am on "/push-it-messenger-bag.html"
26
+ When I add the product to the comparison list
27
+ Then I should see the success message "You added product Push It Messenger Bag to the comparison list."
28
+ Given I am on "/joust-duffle-bag.html"
29
+ When I add the product to the comparison list
30
+ Then the comparison list should contain "Push It Messenger Bag"
31
+ And the comparison list should contain "Joust Duffle Bag"
32
+ But the comparison list should not contain "Radiant Tee"
33
+ When I empty the comparison list
34
+ Then the comparison list should not contain "Joust Duffle Bag"
35
+ And I should see "You have no items to compare."
36
+
37
+ Scenario: The contact form validates
38
+ Given I am on "/contact/"
39
+ When I press the "Submit" store button
40
+ Then I should see the field error "This is a required field." for "Name"
41
+ And I should see the field error "This is a required field." for "Email"
42
+ And I should not see a success message
43
+
44
+ Scenario: The contact form is sent
45
+ Given I am on "/contact/"
46
+ When I fill in the "Name" store field with "Gail Guest"
47
+ And I fill in the "Email" store field with "gail.guest@example.com"
48
+ And I fill in the "What’s on your mind?" store field with "A question from the test suite."
49
+ And I press the "Submit" store button
50
+ Then I should see the success message "Thanks for contacting us with your comments and questions."
@@ -0,0 +1,165 @@
1
+ @must-fail
2
+ Feature: Assertions that must fail
3
+ Every scenario here states something false about the site. A step pack whose
4
+ assertions cannot fail proves nothing: `npm run test:must-fail` runs these
5
+ scenarios and passes only when each of them fails at its last step.
6
+
7
+ Scenario: A message that is not on the page
8
+ Given I am logged in to the admin panel as "admin"
9
+ Then I should see the success message "You saved the unicorn."
10
+
11
+ Scenario: Nobody is logged in to the admin panel
12
+ Given I am not logged in to the admin panel
13
+ Then I should be logged in to the admin panel
14
+
15
+ Scenario: The wrong admin user
16
+ Given I am logged in to the admin panel as "sales"
17
+ Then I should be logged in to the admin panel as "admin"
18
+
19
+ Scenario: The wrong admin page title
20
+ Given I am logged in to the admin panel as "admin"
21
+ When I go to the "products" admin page
22
+ Then the admin page title should be "Orders"
23
+
24
+ Scenario: An administrator sees no access denied page
25
+ Given I am logged in to the admin panel as "admin"
26
+ When I go to the "products" admin page
27
+ Then I should see the access denied page
28
+
29
+ Scenario: A menu the role does not have
30
+ Given I am logged in to the admin panel as "sales"
31
+ Then I should see the "Catalog" admin menu
32
+
33
+ Scenario: The wrong number of records
34
+ Given I am logged in to the admin panel as "admin"
35
+ And I am on the "products" admin page
36
+ When I search the grid for "Joust Duffle Bag"
37
+ Then the grid should show 7 records
38
+
39
+ Scenario: A grid row that is not there
40
+ Given I am logged in to the admin panel as "admin"
41
+ And I am on the "products" admin page
42
+ When I search the grid for "Joust Duffle Bag"
43
+ Then I should see the "Radiant Tee" grid row
44
+
45
+ Scenario: The wrong value in a grid column
46
+ Given I am logged in to the admin panel as "admin"
47
+ And I am on the "products" admin page
48
+ When I search the grid for "Joust Duffle Bag"
49
+ Then the "Price" column of the "Joust Duffle Bag" grid row should be "$1.00"
50
+
51
+ Scenario: A grid that is not sorted that way
52
+ Given I am logged in to the admin panel as "admin"
53
+ And I am on the "products" admin page
54
+ When I sort the grid by "ID" ascending
55
+ Then the grid should be sorted by "ID" descending
56
+
57
+ Scenario: The wrong value in a form field
58
+ Given I am logged in to the admin panel as "admin"
59
+ When I open the product "24-MB01" in the admin panel
60
+ Then the "SKU" form field should be "NOT-THE-SKU"
61
+
62
+ Scenario: A form error that is not shown
63
+ Given I am logged in to the admin panel as "admin"
64
+ When I open the product "24-MB01" in the admin panel
65
+ Then I should see the form error "This is a required field." for the "SKU" field
66
+
67
+ Scenario: A category that is not in the tree
68
+ Given I am logged in to the admin panel as "admin"
69
+ And I am on the "categories" admin page
70
+ Then I should see the "No Such Category" category in the tree
71
+
72
+ Scenario: Valid caches are not invalidated
73
+ Given I am logged in to the admin panel as "admin"
74
+ When I flush the cache
75
+ Then some cache types should be invalidated
76
+
77
+ Scenario: The wrong configuration value
78
+ Given I am logged in to the admin panel as "admin"
79
+ And I am on the "general" configuration section
80
+ Then the "Store Name" configuration field of "Store Information" should be "Not The Name"
81
+
82
+ Scenario: No customer is logged in to the store
83
+ Given I am on the homepage
84
+ Then I should be logged in to the store
85
+
86
+ Scenario: The wrong customer name
87
+ Given I am logged in as the customer "customer"
88
+ Then I should be logged in to the store as "Sam Shopper"
89
+
90
+ Scenario: The wrong breadcrumbs
91
+ Given I am on "/gear/bags.html"
92
+ Then the breadcrumbs should be "Home > Bags"
93
+
94
+ Scenario: The wrong number of products
95
+ Given I am on "/gear/bags.html"
96
+ Then the product list should have 99 products
97
+
98
+ Scenario: A product that is not in the list
99
+ Given I am on "/gear/bags.html"
100
+ Then I should see the product "Radiant Tee" in the product list
101
+
102
+ Scenario: A list that is not ordered that way
103
+ Given I am on "/gear/bags.html"
104
+ When I sort the product list by "Price"
105
+ Then the product list should be ordered by price descending
106
+
107
+ Scenario: A filter that is not in use
108
+ Given I am on "/gear/bags.html"
109
+ Then the product list should be filtered by "Activity" with "Yoga"
110
+
111
+ Scenario: A suggestion that is not offered
112
+ Given I am on the homepage
113
+ When I type "yog" in the store search
114
+ Then I should see the search suggestion "zzzqqqxxx"
115
+
116
+ Scenario: The wrong product price
117
+ Given I am on "/joust-duffle-bag.html"
118
+ Then the product price should be "$1.00"
119
+
120
+ Scenario: An option that is not selected
121
+ Given I am on "/radiant-tee.html"
122
+ When I choose the "Size" option "M"
123
+ Then the "Size" option should be "XL"
124
+
125
+ Scenario: An empty mini cart does not show an item
126
+ Given I am on "/joust-duffle-bag.html"
127
+ Then the mini cart should show 1 item
128
+
129
+ Scenario: A product that is not in the cart
130
+ Given I am on "/joust-duffle-bag.html"
131
+ When I add the product to the cart
132
+ And I go to the cart
133
+ Then the cart should contain "Radiant Tee"
134
+
135
+ Scenario: The wrong cart total
136
+ Given I am on "/joust-duffle-bag.html"
137
+ When I add the product to the cart
138
+ And I go to the cart
139
+ Then the cart order total should be "$1.00"
140
+
141
+ Scenario: The checkout is not on the payment step
142
+ Given I am on "/joust-duffle-bag.html"
143
+ When I add the product to the cart
144
+ And I go to the checkout
145
+ Then the checkout should be on the payment step
146
+
147
+ Scenario: No order was confirmed
148
+ Given I am on the homepage
149
+ Then I should see the order confirmation
150
+
151
+ Scenario: A field error that is not shown
152
+ Given I am on "/contact/"
153
+ Then I should see the field error "This is a required field." for "Name"
154
+
155
+ Scenario: An address that is not in the address book
156
+ Given I am logged in as the customer "customer"
157
+ Then my address book should contain "1 Nowhere Lane"
158
+
159
+ Scenario: A product that is not in the wish list
160
+ Given I am logged in as the customer "customer"
161
+ Then my wish list should contain "Radiant Tee"
162
+
163
+ Scenario: A product that is not in the comparison list
164
+ Given I am on the homepage
165
+ Then the comparison list should contain "Radiant Tee"
Binary file
@@ -0,0 +1,36 @@
1
+ # Step definitions
2
+
3
+ | File | Covers |
4
+ | --- | --- |
5
+ | `magento.steps.js` | Both sides: the messages (success, error, warning, notice), the confirmation dialogs, the settled wait. |
6
+ | `magento-admin.steps.js` | The admin panel: log in by account handle, log out, the session, named pages and the page title, the menu, the access denied page, page buttons, grids (keyword search, filters, sorting, paging, page size, row selection, actions, cell values), forms (fields by label, switches, the category chooser, sections, tabs, field errors, save). |
7
+ | `magento-admin-content.steps.js` | Admin content: a product by SKU and its gallery, the category tree, orders (open, status, comments, hold, invoice, ship, credit memo, cancel), a customer by email, the configuration, the cache and index state, the clean-up of records. |
8
+ | `magento-storefront.steps.js` | The storefront: the customer session, the top menu, breadcrumbs, the product list (amount, sorting, direction, list and grid, paging, layered navigation), search and suggestions, the product page (options, quantity, add to cart, price), the mini cart, the cart (quantity, remove, totals, coupon, shipping estimate), the checkout through to the order number, the account pages, the order history, the address book, the wish list, the comparison list, reviews, the newsletter, field errors. |
9
+ | `magento-helpers.js` | Shared plumbing: the wait budget, the settled signal, presence and value assertions, URLs, the users registry, messages, dialogs, named admin pages, both kinds of admin grid, admin form fields and sections. It registers no step. |
10
+
11
+ ## Rules for a new step
12
+
13
+ - Open the screen in a real browser first and write the step from what is
14
+ there: the roles and labels, the stable attributes, what the page does while
15
+ it loads or saves. Several things here are not what they look like in the
16
+ source (see "What the pages really do" in the main README).
17
+ - Check `node_modules/webship-js/tests/step-definitions/` first: a step that the
18
+ generic click, fill and see vocabulary already covers is not added here.
19
+ - No platform name in a step phrase. The regular expression starts with the
20
+ pronoun group `(I |we )*`, and an assertion takes `should( not)*`, so one
21
+ definition reads both polarities.
22
+ - A JSDoc block above the step holds at least five `Example #N:` lines. Run
23
+ `npm run test:examples`: every example must match its own step and no step of
24
+ webship-js.
25
+ - Never a fixed sleep. Wait for the settled signal (`settle`, `actAndSettle`)
26
+ and assert through `assertPresence` or `assertValue`, which poll; fail with
27
+ `friendly({ message, hint })` so the failure names what was expected, what was
28
+ found and where to look.
29
+ - A step that names a record opens its list itself, searched for the record, so
30
+ it does not depend on the page the scenario was on.
31
+ - A step never creates or deletes an account of the users registry: accounts
32
+ are configuration, named in `cucumber.js` and created by
33
+ `scripts/build-site.sh`. What a scenario creates, it removes (`there is no
34
+ product "…"`).
35
+ - Add a scenario to `90-assertions-must-fail.feature` for a new assertion, so
36
+ `npm run test:must-fail` proves it can fail.