@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.
- package/LICENSE +21 -0
- package/README.md +399 -2
- package/package.json +66 -4
- package/scripts/build-site.sh +190 -0
- package/scripts/site-accounts.php +119 -0
- package/tests/features/01-admin-session.feature +35 -0
- package/tests/features/02-admin-menu-pages.feature +54 -0
- package/tests/features/03-admin-permissions.feature +51 -0
- package/tests/features/04-admin-grids.feature +97 -0
- package/tests/features/05-admin-products.feature +87 -0
- package/tests/features/06-admin-categories.feature +44 -0
- package/tests/features/07-admin-orders.feature +95 -0
- package/tests/features/08-admin-customers.feature +55 -0
- package/tests/features/09-admin-cart-price-rules.feature +49 -0
- package/tests/features/10-admin-content.feature +63 -0
- package/tests/features/11-admin-configuration-cache.feature +46 -0
- package/tests/features/12-admin-reviews-newsletter.feature +66 -0
- package/tests/features/20-storefront-catalog.feature +64 -0
- package/tests/features/21-storefront-search.feature +40 -0
- package/tests/features/22-storefront-product-cart.feature +68 -0
- package/tests/features/23-storefront-checkout.feature +65 -0
- package/tests/features/24-storefront-customer.feature +93 -0
- package/tests/features/25-storefront-wishlist-compare-contact.feature +50 -0
- package/tests/features/90-assertions-must-fail.feature +165 -0
- package/tests/fixtures/pixel.png +0 -0
- package/tests/step-definitions/README.md +36 -0
- package/tests/step-definitions/magento-admin-content.steps.js +818 -0
- package/tests/step-definitions/magento-admin.steps.js +856 -0
- package/tests/step-definitions/magento-helpers.js +992 -0
- package/tests/step-definitions/magento-storefront.steps.js +1797 -0
- package/tests/step-definitions/magento.steps.js +158 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Webship.co
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,400 @@
|
|
|
1
|
-
#
|
|
1
|
+
# magento-steps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Cucumber step definitions for testing Magento Open Source stores with
|
|
4
|
+
[webship-js](https://webship.co/docs/webship-js/2.0.x), a BDD browser automation
|
|
5
|
+
harness built on Playwright and Cucumber-js.
|
|
6
|
+
|
|
7
|
+
`@webship-js/magento-steps` covers the admin panel (log in by account handle,
|
|
8
|
+
the menu and the pages, the grids, the forms, products, categories, orders from
|
|
9
|
+
the invoice to the credit memo, customers, cart price rules, pages and blocks,
|
|
10
|
+
the configuration, the cache and index state, what a restricted role may open)
|
|
11
|
+
and the storefront of the default theme (the menu, categories with layered
|
|
12
|
+
navigation, sorting and paging, search and its suggestions, the product page
|
|
13
|
+
with its options, the mini cart, the cart, the checkout through to the order
|
|
14
|
+
number, the customer account, the wish list, the comparison list, reviews, the
|
|
15
|
+
newsletter, field errors).
|
|
16
|
+
|
|
17
|
+
Every step was written from a round of testing the real pages in a browser, and
|
|
18
|
+
the whole suite runs against a real store: CI builds Magento Open Source 2.4.9
|
|
19
|
+
with its sample data in [DDEV](https://ddev.com) on every push and pull request;
|
|
20
|
+
see [`.github/workflows/test.yml`](.github/workflows/test.yml). No step phrase
|
|
21
|
+
carries the name of the platform.
|
|
22
|
+
|
|
23
|
+
The pack is for **Magento Open Source**, the community edition. It needs no
|
|
24
|
+
account, no access key and no paid or external service.
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- Node.js 20 or later
|
|
29
|
+
- A webship-js 2.0 test project (`webship-js` 2.0.10 or later)
|
|
30
|
+
- A Magento Open Source 2.4 store to test, with the default storefront theme
|
|
31
|
+
and the default admin theme, in English
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install --save-dev @webship-js/magento-steps
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick start
|
|
40
|
+
|
|
41
|
+
1. Add the step files to the `require` list of your webship-js `cucumber.js`:
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
require: [
|
|
45
|
+
'node_modules/webship-js/tests/step-definitions/**/*.js',
|
|
46
|
+
'node_modules/@webship-js/magento-steps/tests/step-definitions/*.js',
|
|
47
|
+
'tests/step-definitions/**/*.js',
|
|
48
|
+
],
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. Point `launchUrl` at the store, give the admin path and name the accounts
|
|
52
|
+
the suite logs in with (see [Accounts](#accounts)):
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
worldParameters: {
|
|
56
|
+
launchUrl: process.env.LAUNCH_URL || 'https://your-store.example',
|
|
57
|
+
adminPath: 'admin',
|
|
58
|
+
users: {
|
|
59
|
+
admin: { username: 'admin', password: process.env.ADMIN_PASSWORD },
|
|
60
|
+
customer: { email: 'customer@example.com', password: process.env.CUSTOMER_PASSWORD, name: 'Casey Customer' },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
3. Copy a feature file from [`tests/features/`](tests/features/) into your
|
|
66
|
+
project and adjust the products, categories and texts to your catalog.
|
|
67
|
+
|
|
68
|
+
4. Run the suite:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx cucumber-js
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## What is included
|
|
75
|
+
|
|
76
|
+
| Path | Purpose |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `tests/step-definitions/magento.steps.js` | Both sides: messages, confirmation dialogs, the settled wait. |
|
|
79
|
+
| `tests/step-definitions/magento-admin.steps.js` | Admin panel: session, named pages, page title, menu, access denied, page buttons, grids, forms, tabs. |
|
|
80
|
+
| `tests/step-definitions/magento-admin-content.steps.js` | Admin content: products, the category tree, orders, customers, configuration, cache and index, clean-up. |
|
|
81
|
+
| `tests/step-definitions/magento-storefront.steps.js` | Storefront: customer session, menu, breadcrumbs, product list, search, product page, mini cart, cart, checkout, account, wish list, compare, reviews, newsletter, field errors. |
|
|
82
|
+
| `tests/step-definitions/magento-helpers.js` | Shared plumbing. It registers no step. |
|
|
83
|
+
| `tests/features/*.feature` | Reference features for a store with the sample data. |
|
|
84
|
+
| `tests/features/90-assertions-must-fail.feature` | Scenarios that state something false: `npm run test:must-fail` passes only when every one of them fails with a helpful message. |
|
|
85
|
+
| `scripts/build-site.sh`, `scripts/site-accounts.php` | Build the test store with DDEV and create the test accounts. |
|
|
86
|
+
| `tests/check-examples.js` | Checks every `Example #n:` line and every feature step against the step patterns. |
|
|
87
|
+
|
|
88
|
+
## Steps
|
|
89
|
+
|
|
90
|
+
128 step definitions. The JSDoc block above each one holds five examples.
|
|
91
|
+
|
|
92
|
+
### Both sides
|
|
93
|
+
|
|
94
|
+
```gherkin
|
|
95
|
+
Then I should see the success message "You saved the product."
|
|
96
|
+
Then I should not see an error message
|
|
97
|
+
Then I should see the confirmation "Are you sure you want to delete this category?"
|
|
98
|
+
When I confirm the action
|
|
99
|
+
When I dismiss the confirmation
|
|
100
|
+
When I wait for the page to settle
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Admin panel: session, pages, menu
|
|
104
|
+
|
|
105
|
+
```gherkin
|
|
106
|
+
Given I am logged in to the admin panel as "admin"
|
|
107
|
+
When I log in to the admin panel with the username "admin" and the password "wrong-password"
|
|
108
|
+
When I log out of the admin panel
|
|
109
|
+
Given I am not logged in to the admin panel
|
|
110
|
+
Then I should be logged in to the admin panel as "sales"
|
|
111
|
+
When I go to the "products" admin page
|
|
112
|
+
Then the admin page title should be "Products"
|
|
113
|
+
Then I should see the "Sales > Orders" admin menu
|
|
114
|
+
When I open the "Catalog > Products" admin menu item
|
|
115
|
+
Then I should see the access denied page
|
|
116
|
+
When I click the "Add New Page" page action
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Named pages: dashboard, orders, invoices, shipments, credit memos, products, new
|
|
120
|
+
product, categories, customers, customer groups, cart price rules, new cart
|
|
121
|
+
price rule, catalog price rules, newsletter subscribers, reviews, pending
|
|
122
|
+
reviews, pages, new page, blocks, configuration, cache management, index
|
|
123
|
+
management, users, roles, product attributes, order statuses, my account; or a
|
|
124
|
+
route such as `sales/order`.
|
|
125
|
+
|
|
126
|
+
### Admin panel: grids
|
|
127
|
+
|
|
128
|
+
```gherkin
|
|
129
|
+
When I search the grid for "Joust Duffle Bag"
|
|
130
|
+
When I filter the grid by "Type" with "Configurable Product"
|
|
131
|
+
When I clear the grid filters
|
|
132
|
+
Then the grid should show 19 records
|
|
133
|
+
Then the grid should have 20 rows
|
|
134
|
+
Then I should see the "Joust Duffle Bag" grid row
|
|
135
|
+
Then the "Status" column of the "Joust Duffle Bag" grid row should be "Enabled"
|
|
136
|
+
When I sort the grid by "Name" ascending
|
|
137
|
+
Then the grid should be sorted by "Name" ascending
|
|
138
|
+
When I go to the next page of the grid
|
|
139
|
+
Then the grid should be on page 2
|
|
140
|
+
When I show 50 grid rows per page
|
|
141
|
+
When I select the "WS-TEST-BAG" grid row
|
|
142
|
+
When I run the "Change status > Disable" grid action
|
|
143
|
+
When I open the "Home Page" grid row
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The steps work on both kinds of grid of the admin panel: the listing with a
|
|
147
|
+
keyword search and a Filters panel (products, orders, customers, pages) and the
|
|
148
|
+
older grid with a filter row (cart price rules, reviews, newsletter
|
|
149
|
+
subscribers, cache, index).
|
|
150
|
+
|
|
151
|
+
### Admin panel: forms
|
|
152
|
+
|
|
153
|
+
```gherkin
|
|
154
|
+
When I set the "Product Name" form field to "Test Bag"
|
|
155
|
+
When I set the "Visibility" form field to "Catalog, Search"
|
|
156
|
+
When I turn the "Enable Product" form switch off
|
|
157
|
+
Then the "SKU" form field should be "TEST-SKU-1"
|
|
158
|
+
When I choose "Bags" in the "Categories" form field
|
|
159
|
+
When I open the "Images And Videos" form section
|
|
160
|
+
When I open the "Account Information" admin tab
|
|
161
|
+
Then I should see the form error "This is a required field." for the "Product Name" field
|
|
162
|
+
When I save the form
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Admin panel: catalog, orders, customers, settings
|
|
166
|
+
|
|
167
|
+
```gherkin
|
|
168
|
+
When I open the product "24-MB01" in the admin panel
|
|
169
|
+
When I add the image "pixel.png" to the product gallery
|
|
170
|
+
Then the product gallery should have 1 image
|
|
171
|
+
When I select the "Gear" category in the tree
|
|
172
|
+
Then I should see the "Bags" category in the tree
|
|
173
|
+
When I open the last placed order in the admin panel
|
|
174
|
+
Then I should see the last placed order in the orders grid
|
|
175
|
+
Then the order status should be "Pending"
|
|
176
|
+
When I add the order comment "Checked by the test suite"
|
|
177
|
+
When I put the order on hold
|
|
178
|
+
When I invoice the order
|
|
179
|
+
When I ship the order
|
|
180
|
+
When I refund the order
|
|
181
|
+
When I cancel the order
|
|
182
|
+
When I open the customer "customer@example.com" in the admin panel
|
|
183
|
+
When I go to the "general" configuration section
|
|
184
|
+
When I set the "Store Name" configuration field of "Store Information" to "Test Store"
|
|
185
|
+
Then some cache types should be invalidated
|
|
186
|
+
When I flush the cache
|
|
187
|
+
Then no cache type should be invalidated
|
|
188
|
+
When I rebuild the invalid indexes
|
|
189
|
+
Then every index should be ready
|
|
190
|
+
Given there is no product "TEST-SKU-1"
|
|
191
|
+
Given there is no category "Test Category"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`there is no …` deletes what it finds, through the admin panel: a product, a
|
|
195
|
+
customer, a page, a block, a cart price rule, a review, a newsletter subscriber
|
|
196
|
+
or a category. It is how a scenario removes what it created.
|
|
197
|
+
|
|
198
|
+
### Storefront
|
|
199
|
+
|
|
200
|
+
```gherkin
|
|
201
|
+
Given I am logged in as the customer "customer"
|
|
202
|
+
When I log out of the store
|
|
203
|
+
Then I should be logged in to the store as "Casey Customer"
|
|
204
|
+
When I open the "Gear > Bags" store menu item
|
|
205
|
+
Then the breadcrumbs should be "Home > Gear > Bags"
|
|
206
|
+
Then the product list should have 14 products
|
|
207
|
+
When I filter the product list by "Activity" with "Yoga"
|
|
208
|
+
When I sort the product list by "Price"
|
|
209
|
+
When I set the product list direction to descending
|
|
210
|
+
Then the product list should be ordered by price descending
|
|
211
|
+
When I view the product list as a list
|
|
212
|
+
When I go to the next page of the product list
|
|
213
|
+
When I search the store for "yoga"
|
|
214
|
+
When I type "yog" in the store search
|
|
215
|
+
Then I should see the search suggestion "yoga"
|
|
216
|
+
When I choose the "Size" option "M"
|
|
217
|
+
When I set the product quantity to 2
|
|
218
|
+
When I add the product to the cart
|
|
219
|
+
When I open the "Reviews" product tab
|
|
220
|
+
Then the mini cart should show 2 items
|
|
221
|
+
When I go to the cart
|
|
222
|
+
When I change the cart quantity of "Joust Duffle Bag" to 3
|
|
223
|
+
Then the cart order total should be "$117.00"
|
|
224
|
+
When I apply the coupon "TEST10"
|
|
225
|
+
When I estimate shipping to "United States", "Texas", "78701"
|
|
226
|
+
When I choose the "Flat Rate" shipping method
|
|
227
|
+
When I go to the checkout
|
|
228
|
+
When I fill in the checkout email with "guest@example.com"
|
|
229
|
+
When I fill in the shipping address:
|
|
230
|
+
When I continue to the payment step
|
|
231
|
+
When I choose the "Check / Money order" payment method
|
|
232
|
+
When I place the order
|
|
233
|
+
Then I should see the order confirmation
|
|
234
|
+
Then my order history should list the last placed order as "Pending"
|
|
235
|
+
When I add the address:
|
|
236
|
+
Then my address book should contain "9 Test Road"
|
|
237
|
+
When I add the product to my wish list
|
|
238
|
+
When I add the product to the comparison list
|
|
239
|
+
When I review the product with 4 stars, the summary "Good bag" and the text "It holds everything."
|
|
240
|
+
When I subscribe "reader@example.com" to the newsletter
|
|
241
|
+
When I fill in the "Password" store field with "Secret123456789!"
|
|
242
|
+
When I press the "Create an Account" store button
|
|
243
|
+
Then I should see the field error "This is a required field." for "First Name"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Every store page also holds a hidden sign-in popup with an "Email" and a
|
|
247
|
+
"Password" of its own, and the header repeats the texts of several buttons: the
|
|
248
|
+
two `store field` and `store button` steps take the field and the button of
|
|
249
|
+
the form a person sees.
|
|
250
|
+
|
|
251
|
+
`I place the order` remembers the order number of the success page: "the last
|
|
252
|
+
placed order" is then found in the orders grid of the admin panel and in the
|
|
253
|
+
order history of the customer, in the same scenario.
|
|
254
|
+
|
|
255
|
+
## Accounts
|
|
256
|
+
|
|
257
|
+
The accounts are configuration, not test data. They are named in
|
|
258
|
+
`worldParameters.users` of `cucumber.js` and created once on the site; a
|
|
259
|
+
feature never creates or deletes one of them.
|
|
260
|
+
|
|
261
|
+
| Handle | Kind | What it is |
|
|
262
|
+
| --- | --- | --- |
|
|
263
|
+
| `admin` | admin user (`username`) | An administrator with every resource. |
|
|
264
|
+
| `sales` | admin user (`username`) | An admin user with a role that allows Sales only. |
|
|
265
|
+
| `customer` | customer (`email`) | A customer with a default billing and shipping address. |
|
|
266
|
+
| `shopper` | customer (`email`) | A second customer with an address. |
|
|
267
|
+
|
|
268
|
+
A customer that a scenario registers is content: the scenario removes it
|
|
269
|
+
(`Given there is no customer "…"`). Orders cannot be deleted in the admin
|
|
270
|
+
panel: every run leaves its orders behind, closed or cancelled.
|
|
271
|
+
|
|
272
|
+
## The test store
|
|
273
|
+
|
|
274
|
+
`scripts/build-site.sh` builds the store the suite runs against, without a
|
|
275
|
+
question asked, in one DDEV project (`magentosteps`,
|
|
276
|
+
`https://magentosteps.ddev.site`):
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
scripts/build-site.sh # the site goes to ../magento-site, or to $SITE_DIR
|
|
280
|
+
npm test
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- **Edition.** Magento Open Source 2.4.9 (`magento/project-community-edition`),
|
|
284
|
+
PHP 8.4, MariaDB 11.4, OpenSearch 3 through the `ddev/ddev-opensearch` add-on
|
|
285
|
+
(its dashboards service is left out), the sample data.
|
|
286
|
+
- **Where the packages come from.** The build uses the public Mage-OS mirror of
|
|
287
|
+
the Magento Open Source packages, `https://mirror.mage-os.org/`. It serves
|
|
288
|
+
the same releases as the vendor's repository without access keys, so the
|
|
289
|
+
build needs no account anywhere. `MIRROR_URL` points it at another Composer
|
|
290
|
+
repository.
|
|
291
|
+
- **Mode.** Production mode with the static content deployed: the pages answer
|
|
292
|
+
fast and the same way every time, which a test suite needs. On this
|
|
293
|
+
hardware compiling and deploying takes about 30 seconds.
|
|
294
|
+
- **Two-factor authentication is off.** The build installs without the modules
|
|
295
|
+
`Magento_TwoFactorAuth` and `Magento_AdminAdobeImsTwoFactorAuth`, the
|
|
296
|
+
supported way to log in to a local test site without a second factor. Never
|
|
297
|
+
do this on a site that is on the internet.
|
|
298
|
+
- **Nothing calls out.** The admin notification feed, the usage-data question
|
|
299
|
+
and the release notification are left out (`Magento_AdminNotification`,
|
|
300
|
+
`Magento_AdminAnalytics`, `Magento_ReleaseNotification`), as are the CAPTCHAs.
|
|
301
|
+
With the notification module off the admin panel has no system message bar:
|
|
302
|
+
the suite reads the cache and index state on Cache Management and Index
|
|
303
|
+
Management instead.
|
|
304
|
+
- **The bundled gateway extensions are off.** The edition ships payment gateway
|
|
305
|
+
and data-export extensions (`PayPal_Braintree*`, `Magento_PaymentServices*`,
|
|
306
|
+
`Magento_ServiceProxy`, `Magento_Services*`, `Magento_SaaSCommon`,
|
|
307
|
+
`Magento_*DataExporter`). Not configured, they still made every storefront
|
|
308
|
+
page load two scripts from the gateway's servers and the checkout an asset of
|
|
309
|
+
the payment provider (seen in the browser round). The build leaves them out
|
|
310
|
+
at install time (`setup:install --disable-modules`; disabling them later
|
|
311
|
+
leaves their database triggers behind and orders fail): the storefront, the
|
|
312
|
+
checkout and the admin pages the suite opens then request nothing outside
|
|
313
|
+
the site. One admin page still does, Stores >
|
|
314
|
+
Configuration > Sales > Payment Methods (a core module); the suite never
|
|
315
|
+
opens it.
|
|
316
|
+
- **Deterministic sign-in.** The admin session lasts, the secret key in admin
|
|
317
|
+
addresses is off (`admin/security/use_form_key`), one admin account may be
|
|
318
|
+
used from two browsers (`admin/security/admin_account_sharing`), no account is
|
|
319
|
+
locked after failed sign-ins.
|
|
320
|
+
- **Indexes.** The indexers run on "Update on Save": a product a scenario saves
|
|
321
|
+
is in the store at once and no cron is needed. Cron is run once by the build
|
|
322
|
+
and is not left running.
|
|
323
|
+
- **Methods.** Check / Money order, Flat Rate, Free Shipping and the table rate
|
|
324
|
+
of the sample data: the offline methods the edition ships with. No payment
|
|
325
|
+
gateway, no carrier API.
|
|
326
|
+
- **Mail** goes to DDEV's Mailpit.
|
|
327
|
+
|
|
328
|
+
Footprint, measured: about 1.9 GB of memory for the three containers (web 550
|
|
329
|
+
to 700 MB, database 260 to 310 MB, search 1 GB), 1.4 GB for the project folder,
|
|
330
|
+
3.5 GB of container images. The build takes about three minutes once the
|
|
331
|
+
packages are downloaded (four more for the first download) and under six
|
|
332
|
+
minutes on a GitHub runner; one run of the suite takes about 16 minutes locally
|
|
333
|
+
and 19 minutes on the runner.
|
|
334
|
+
|
|
335
|
+
## What the pages really do
|
|
336
|
+
|
|
337
|
+
Things the browser round showed, which the steps are built on:
|
|
338
|
+
|
|
339
|
+
- A page is "loaded" long before it works. `document.readyState` is `complete`
|
|
340
|
+
about 60 ms in, while RequireJS still loads 20 to 130 modules and the init
|
|
341
|
+
blocks are unprocessed; a "Sort By" change made then is swallowed. The steps
|
|
342
|
+
wait for the settled signal instead: no requested RequireJS module pending,
|
|
343
|
+
no `text/x-magento-init` block left, no request in flight, no loading mask,
|
|
344
|
+
three readings in a row.
|
|
345
|
+
- The admin forms are KnockoutJS models that read an input on its `change`
|
|
346
|
+
event. A value typed with Playwright's `fill()` shows in the field while the
|
|
347
|
+
form still holds nothing, and Save answers "This is a required field.". The
|
|
348
|
+
form steps fill, dispatch `change` and read the value back.
|
|
349
|
+
- Labels are not always the accessible name. Several admin selects carry
|
|
350
|
+
`aria-label="notice-…"`; on the customer sign-in page the "Password" label
|
|
351
|
+
points at the field of a hidden popup. The steps find a field by the label
|
|
352
|
+
text of its wrapper.
|
|
353
|
+
- An admin grid keeps a hidden copy of its header first in the DOM, remembers
|
|
354
|
+
its filters, sorting and page size for the admin user, and saves them two
|
|
355
|
+
seconds after a change. A grid opened by name starts unfiltered; the steps
|
|
356
|
+
that set what must not leak wait for the save.
|
|
357
|
+
- The checkout shows its fields under a loading mask for a second; the star
|
|
358
|
+
labels of the review form lie on top of each other; the "Remove item" link of
|
|
359
|
+
the wish list shows on hover only; the store redirects to the home page five
|
|
360
|
+
seconds after a customer logs out.
|
|
361
|
+
|
|
362
|
+
## Checks
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
npm test # the whole suite (not the @must-fail scenarios)
|
|
366
|
+
npm run test:admin # the admin panel lane
|
|
367
|
+
npm run test:storefront # the storefront lane
|
|
368
|
+
npm run test:must-fail # every false statement must fail with a helpful message
|
|
369
|
+
npm run test:examples # the JSDoc examples and the feature steps against the patterns
|
|
370
|
+
npm run test:dry # undefined and ambiguous steps
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
The suite leaves the site as it found it, apart from the orders: run it twice
|
|
374
|
+
in a row.
|
|
375
|
+
|
|
376
|
+
`BROWSER=firefox npm test` runs the suite in Firefox (`npx playwright install
|
|
377
|
+
firefox` once). Use it on a machine where other container projects start and
|
|
378
|
+
stop while the suite runs: Chromium aborts every request in flight with
|
|
379
|
+
`net::ERR_NETWORK_CHANGED` when a container network comes or goes, and Firefox
|
|
380
|
+
is started here with `network.notify.changed` off. `CUCUMBER_RETRY=1` runs a
|
|
381
|
+
failed scenario once more.
|
|
382
|
+
|
|
383
|
+
## What is not covered
|
|
384
|
+
|
|
385
|
+
- The paid edition and its features, B2B, marketplace extensions, payment gateways and
|
|
386
|
+
carrier services: this pack is for the community edition and its offline
|
|
387
|
+
methods.
|
|
388
|
+
- The Page Builder stage (drag and drop): a page is created with its title,
|
|
389
|
+
heading and URL key; its body is not edited.
|
|
390
|
+
- The cookie restriction notice (off in a default installation), multiple
|
|
391
|
+
websites, stores and currencies, other languages than English, other themes
|
|
392
|
+
than the default ones, the mobile menu.
|
|
393
|
+
- The "Comments History" tab of an order: it stays empty in 2.4.9; the suite
|
|
394
|
+
reads the notes on the Information tab.
|
|
395
|
+
- Moving a category in the tree, bundle, grouped, virtual and downloadable
|
|
396
|
+
products, creating an order in the admin panel, tax rules.
|
|
397
|
+
|
|
398
|
+
## License
|
|
399
|
+
|
|
400
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webship-js/magento-steps",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Cucumber step definitions for testing Magento Open Source stores with webship-js: the admin panel (session, menu, grids, forms, catalog, orders, customers, cart price rules, content, configuration, cache and index, permissions) and the storefront (catalog, layered navigation, search, product page, cart, checkout, customer account, wish list, compare, reviews, newsletter).",
|
|
5
|
+
"main": "tests/step-definitions/magento.steps.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"tests/step-definitions/*.js",
|
|
8
|
+
"tests/step-definitions/README.md",
|
|
9
|
+
"tests/features",
|
|
10
|
+
"tests/fixtures",
|
|
11
|
+
"scripts",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "cucumber-js --config cucumber.js",
|
|
17
|
+
"test:dry": "cucumber-js --config cucumber.js --dry-run",
|
|
18
|
+
"test:admin": "CUCUMBER_TAGS='@admin and not @wip and not @must-fail' cucumber-js --config cucumber.js",
|
|
19
|
+
"test:storefront": "CUCUMBER_TAGS='@storefront and not @wip and not @must-fail' cucumber-js --config cucumber.js",
|
|
20
|
+
"test:must-fail": "node tests/check-must-fail.js",
|
|
21
|
+
"test:chromium": "BROWSER=chromium cucumber-js --config cucumber.js",
|
|
22
|
+
"test:firefox": "BROWSER=firefox cucumber-js --config cucumber.js",
|
|
23
|
+
"test:webkit": "BROWSER=webkit cucumber-js --config cucumber.js",
|
|
24
|
+
"test:headed": "HEADLESS=false cucumber-js --config cucumber.js",
|
|
25
|
+
"test:examples": "node tests/check-examples.js",
|
|
26
|
+
"generate-reports": "generate-reports"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"magento",
|
|
30
|
+
"magento2",
|
|
31
|
+
"magento-open-source",
|
|
32
|
+
"e-commerce",
|
|
33
|
+
"webship-js",
|
|
34
|
+
"cucumber",
|
|
35
|
+
"cucumber-js",
|
|
36
|
+
"playwright",
|
|
37
|
+
"bdd",
|
|
38
|
+
"testing",
|
|
39
|
+
"e2e",
|
|
40
|
+
"gherkin"
|
|
41
|
+
],
|
|
42
|
+
"author": "Webship.co",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/webship/magento-steps.git"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/webship/magento-steps/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/webship/magento-steps#readme",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">= 20.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"webship-js": "^2.0.10"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"tsx": "^4.23.0",
|
|
63
|
+
"webship-js": "^2.0.10"
|
|
64
|
+
},
|
|
65
|
+
"overrides": {
|
|
66
|
+
"@cucumber/cucumber": "^12"
|
|
67
|
+
}
|
|
68
|
+
}
|