@vardot/varbase-e2e 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/AGENTS.md +148 -0
- package/CLAUDE.md +544 -0
- package/README.md +22 -0
- package/bin/generate-reports.js +363 -0
- package/bin/init-varbase-e2e.js +330 -0
- package/bin/postinstall.js +26 -0
- package/cucumber.js +125 -0
- package/docs/00-quick-start.md +102 -0
- package/docs/01-getting-started.md +102 -0
- package/docs/02-bbr-smart-waits.md +77 -0
- package/docs/03-selector-registry.md +95 -0
- package/docs/04-step-reference.md +801 -0
- package/docs/05-web-first-assertions.md +91 -0
- package/docs/06-network-and-dialogs.md +83 -0
- package/docs/07-auth-state.md +75 -0
- package/docs/08-clock-mocking.md +59 -0
- package/docs/09-api-testing.md +114 -0
- package/docs/10-accessibility.md +167 -0
- package/docs/11-debugging.md +129 -0
- package/docs/12-ai-agent-guide.md +338 -0
- package/docs/13-faq.md +236 -0
- package/docs/14-recipes-cookbook.md +255 -0
- package/docs/15-tag-conventions.md +76 -0
- package/docs/16-ci-cd.md +90 -0
- package/docs/README.md +125 -0
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
- package/docs/advanced-screenshots.md +52 -0
- package/docs/advanced-selectors.md +18 -0
- package/docs/api-step-definitions.md +45 -0
- package/docs/global-settings.md +267 -0
- package/docs/install-varbase-e2e/ddev-varbase-e2e.md +52 -0
- package/docs/install-varbase-e2e.md +34 -0
- package/docs/overview.md +40 -0
- package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
- package/docs/step-definitions/given-i-am-homepage.md +68 -0
- package/docs/step-definitions/given-i-am-specific-page.md +72 -0
- package/docs/step-definitions/then-i-should-be.md +56 -0
- package/docs/step-definitions/then-i-should-see.md +62 -0
- package/docs/step-definitions/then-item-checkbox.md +54 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
- package/docs/step-definitions/then-item-should-contain.md +67 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
- package/docs/step-definitions/when-i-check-checkbox.md +60 -0
- package/docs/step-definitions/when-i-click-link.md +51 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
- package/docs/step-definitions/when-i-fill.md +59 -0
- package/docs/step-definitions/when-i-go-homepage.md +60 -0
- package/docs/step-definitions/when-i-go-specific-page.md +67 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
- package/docs/step-definitions/when-i-press-button.md +58 -0
- package/docs/step-definitions/when-i-reload-page.md +51 -0
- package/docs/step-definitions/when-i-scroll.md +73 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
- package/docs/step-definitions/when-i-wait.md +62 -0
- package/docs/step-definitions.md +82 -0
- package/docs/steps/README.md +137 -0
- package/docs/steps/a11y.md +731 -0
- package/docs/steps/action.md +181 -0
- package/docs/steps/api.md +679 -0
- package/docs/steps/assertion.md +328 -0
- package/docs/steps/auth.md +108 -0
- package/docs/steps/clock.md +171 -0
- package/docs/steps/cookie.md +293 -0
- package/docs/steps/debug.md +52 -0
- package/docs/steps/dialog.md +226 -0
- package/docs/steps/drupal-canvas.md +414 -0
- package/docs/steps/drupal-ckeditor.md +118 -0
- package/docs/steps/drupal-core.md +688 -0
- package/docs/steps/drupal-layout-builder.md +437 -0
- package/docs/steps/drupal-media.md +107 -0
- package/docs/steps/drupal-moderation.md +81 -0
- package/docs/steps/drupal-paragraphs.md +36 -0
- package/docs/steps/element.md +455 -0
- package/docs/steps/field.md +648 -0
- package/docs/steps/file-download.md +235 -0
- package/docs/steps/form.md +344 -0
- package/docs/steps/iframe.md +248 -0
- package/docs/steps/input.md +220 -0
- package/docs/steps/javascript.md +111 -0
- package/docs/steps/keyboard.md +107 -0
- package/docs/steps/link.md +217 -0
- package/docs/steps/metatag.md +99 -0
- package/docs/steps/modal.md +232 -0
- package/docs/steps/navigation.md +275 -0
- package/docs/steps/network.md +284 -0
- package/docs/steps/path.md +203 -0
- package/docs/steps/response.md +102 -0
- package/docs/steps/responsive.md +139 -0
- package/docs/steps/rest.md +140 -0
- package/docs/steps/screenshot.md +211 -0
- package/docs/steps/scroll.md +266 -0
- package/docs/steps/selectors.md +848 -0
- package/docs/steps/storage.md +254 -0
- package/docs/steps/table.md +216 -0
- package/docs/steps/varbase.md +391 -0
- package/docs/steps/video.md +111 -0
- package/docs/steps/wait.md +553 -0
- package/docs/steps/web-first.md +289 -0
- package/docs/steps/xml.md +505 -0
- package/docs/steps/yaml.md +951 -0
- package/examples/a11y.html +31 -0
- package/examples/about-us.html +11 -0
- package/examples/account.html +32 -0
- package/examples/ajax-wait-examples.html +147 -0
- package/examples/contact-us.html +10 -0
- package/examples/cookies.html +10 -0
- package/examples/date.html +12 -0
- package/examples/dynamic-examples.html +498 -0
- package/examples/element.html +11 -0
- package/examples/example-api.json +28 -0
- package/examples/existing-page.html +11 -0
- package/examples/field.html +24 -0
- package/examples/index.html +37 -0
- package/examples/keyboard.html +11 -0
- package/examples/links.html +9 -0
- package/examples/modal.html +14 -0
- package/examples/path.html +3 -0
- package/examples/table.html +13 -0
- package/examples/test--modal-dialogs.html +252 -0
- package/examples/test--then--i-should--not--see-text-in-element.html +48 -0
- package/examples/test--then--i-should--see-text-in-element.html +48 -0
- package/examples/test--then--i-should--see-text-matching-pattern.html +31 -0
- package/examples/test--then--i-should-see-text-in-table-row.html +232 -0
- package/examples/test--then--the-checkbox-checked.html +68 -0
- package/examples/test--then--the-element-should_not-contain-cssproperty.html +47 -0
- package/examples/test--then--the-link-should-contain.html +21 -0
- package/examples/test--when--i-additionally-select.html +27 -0
- package/examples/test--when--i-attach-file-to-feild.html +50 -0
- package/examples/test--when--i-check-uncheck-checkbox.html +47 -0
- package/examples/test--when--i-click-link.html +18 -0
- package/examples/test--when--i-click-text-in-table-row.html +178 -0
- package/examples/test--when--i-fill-in.html +48 -0
- package/examples/test--when--i-press-button.html +31 -0
- package/examples/test--when--i-reload-page.html +27 -0
- package/examples/test--when--i-scroll-functionality.html +177 -0
- package/examples/test--when--i-scroll-left-right-functionality.html +149 -0
- package/examples/test--when--i-select-option-from-dropdownlist.html +35 -0
- package/examples/test--when--i-select-radio-button.html +95 -0
- package/examples/test--when-i-wait-max-of-time.html +39 -0
- package/examples/test--when-i-wait-page-until-is-loaded.html +47 -0
- package/examples/test--when-i-wait-specific-time.html +39 -0
- package/examples/test-acceptable-url-path.html +11 -0
- package/examples/video-demo.html +43 -0
- package/package.json +56 -0
- package/playwright.config.ts +39 -0
- package/tests/assets/test-document.pdf +14 -0
- package/tests/assets/vardot.png +0 -0
- package/tests/features/a11y.feature +39 -0
- package/tests/features/ajax-wait-examples.feature +24 -0
- package/tests/features/api-step-definitions-individual.feature +185 -0
- package/tests/features/complete-api-testing-examples.feature +205 -0
- package/tests/features/cookie.feature +13 -0
- package/tests/features/date.feature +11 -0
- package/tests/features/dynamic-content-examples.feature +156 -0
- package/tests/features/element.feature +16 -0
- package/tests/features/field.feature +25 -0
- package/tests/features/keyboard.feature +10 -0
- package/tests/features/link.feature +11 -0
- package/tests/features/modal-advanced-example.feature +54 -0
- package/tests/features/modal-basic-example.feature +42 -0
- package/tests/features/modal-error-handling-example.feature +37 -0
- package/tests/features/modal.feature +11 -0
- package/tests/features/path.feature +16 -0
- package/tests/features/response.feature +8 -0
- package/tests/features/responsive.feature +10 -0
- package/tests/features/table.feature +18 -0
- package/tests/features/test--given--i-am-an-anonymous-user.feature +10 -0
- package/tests/features/test--given--i-am-on-homepage.feature +16 -0
- package/tests/features/test--then--i-save-screenshot.feature +33 -0
- package/tests/features/test--then--i-see-locator.feature +320 -0
- package/tests/features/test--then--i-should--not--see-text-in-element.feature +13 -0
- package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +10 -0
- package/tests/features/test--then--i-should--see-text-in-element.feature +10 -0
- package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +13 -0
- package/tests/features/test--then--i-should--see-text-matching-pattern.feature +18 -0
- package/tests/features/test--then--i-should-be-on-page.feature +10 -0
- package/tests/features/test--then--i-should-be-on-the-homepage.feature +10 -0
- package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +8 -0
- package/tests/features/test--then--i-should-not-see-an-element.feature +8 -0
- package/tests/features/test--then--i-should-see-an-element-by-attr.feature +8 -0
- package/tests/features/test--then--i-should-see-an-element.feature +8 -0
- package/tests/features/test--then--i-should-see-n-elements.feature +24 -0
- package/tests/features/test--then--i-should-see-text-in-table-row.feature +96 -0
- package/tests/features/test--then--print-current-url-and-response.feature +21 -0
- package/tests/features/test--then--the-checkbox-is-checked.feature +18 -0
- package/tests/features/test--then--the-checkbox-should-be-checked.feature +16 -0
- package/tests/features/test--then--the-element-should-contain-cssproperty.feature +9 -0
- package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +10 -0
- package/tests/features/test--then--the-field-should-contain-value.feature +11 -0
- package/tests/features/test--then--the-response-should-contain.feature +11 -0
- package/tests/features/test--then--the-response-status-code-should-be.feature +31 -0
- package/tests/features/test--then--the-url-should-match.feature +7 -0
- package/tests/features/test--then-the-link-should-contain-by-attribute.feature +18 -0
- package/tests/features/test--then-the-link-should-contain.feature +7 -0
- package/tests/features/test--when--i-additionally-select.feature +30 -0
- package/tests/features/test--when--i-attach-file-to-feild.feature +9 -0
- package/tests/features/test--when--i-check-checkbox.feature +21 -0
- package/tests/features/test--when--i-click-link-by-attribute.feature +21 -0
- package/tests/features/test--when--i-click-link.feature +9 -0
- package/tests/features/test--when--i-click-text-in-table-row.feature +37 -0
- package/tests/features/test--when--i-fill-in-by-attr.feature +31 -0
- package/tests/features/test--when--i-fill-in-table-by-attr.feature +19 -0
- package/tests/features/test--when--i-fill-in.feature +32 -0
- package/tests/features/test--when--i-follow.feature +22 -0
- package/tests/features/test--when--i-go-to-homepage.feature +9 -0
- package/tests/features/test--when--i-move-forward-backward-one-page.feature +14 -0
- package/tests/features/test--when--i-press-button-by-attribute.feature +18 -0
- package/tests/features/test--when--i-press-button.feature +13 -0
- package/tests/features/test--when--i-reload-page.feature +11 -0
- package/tests/features/test--when--i-scroll-left-right.feature +48 -0
- package/tests/features/test--when--i-scroll.feature +48 -0
- package/tests/features/test--when--i-select-option-from-dropdownlist.feature +21 -0
- package/tests/features/test--when--i-select-radio-button.feature +37 -0
- package/tests/features/test--when--i-wait-page-is-loaded.feature +8 -0
- package/tests/features/test--when--i-wait-time.feature +21 -0
- package/tests/features/video.feature +18 -0
- package/tests/features/wait.feature +7 -0
- package/tests/features/yaml.feature +102 -0
- package/tests/selectors/_canonical-keys.json +113 -0
- package/tests/selectors/back-end-selectors.json +19 -0
- package/tests/selectors/cms-contentful-admin.json +35 -0
- package/tests/selectors/cms-craft-admin.json +39 -0
- package/tests/selectors/cms-drupal-cms-gin.json +56 -0
- package/tests/selectors/cms-drupal-core-claro.json +50 -0
- package/tests/selectors/cms-generic-admin.json +34 -0
- package/tests/selectors/cms-ghost-admin.json +34 -0
- package/tests/selectors/cms-joomla-admin.json +41 -0
- package/tests/selectors/cms-magento2-admin.json +32 -0
- package/tests/selectors/cms-prestashop-admin.json +38 -0
- package/tests/selectors/cms-shopify-admin.json +25 -0
- package/tests/selectors/cms-strapi-admin.json +42 -0
- package/tests/selectors/cms-typo3-admin.json +41 -0
- package/tests/selectors/cms-woocommerce-front.json +50 -0
- package/tests/selectors/cms-wordpress-admin.json +31 -0
- package/tests/selectors/framework-ant-design.json +80 -0
- package/tests/selectors/framework-bootstrap.json +86 -0
- package/tests/selectors/framework-bulma.json +74 -0
- package/tests/selectors/framework-chakra.json +58 -0
- package/tests/selectors/framework-foundation.json +51 -0
- package/tests/selectors/framework-material-ui.json +72 -0
- package/tests/selectors/framework-shadcn.json +51 -0
- package/tests/selectors/framework-tailwind.json +40 -0
- package/tests/selectors/framework-vuetify.json +61 -0
- package/tests/selectors/front-end-selectors.json +16 -0
- package/tests/selectors/homepage-selectors.json +13 -0
- package/tests/step-definitions/a11y.steps.js +800 -0
- package/tests/step-definitions/action.steps.js +167 -0
- package/tests/step-definitions/api.steps.js +732 -0
- package/tests/step-definitions/assertion.steps.js +352 -0
- package/tests/step-definitions/auth.steps.js +126 -0
- package/tests/step-definitions/clock.steps.js +128 -0
- package/tests/step-definitions/cookie.steps.js +216 -0
- package/tests/step-definitions/debug.steps.js +39 -0
- package/tests/step-definitions/dialog.steps.js +193 -0
- package/tests/step-definitions/drupal-canvas.steps.js +764 -0
- package/tests/step-definitions/drupal-ckeditor.steps.js +108 -0
- package/tests/step-definitions/drupal-core.steps.js +665 -0
- package/tests/step-definitions/drupal-helpers.js +371 -0
- package/tests/step-definitions/drupal-layout-builder.steps.js +466 -0
- package/tests/step-definitions/drupal-media.steps.js +99 -0
- package/tests/step-definitions/drupal-moderation.steps.js +71 -0
- package/tests/step-definitions/drupal-paragraphs.steps.js +50 -0
- package/tests/step-definitions/element.steps.js +356 -0
- package/tests/step-definitions/field.steps.js +653 -0
- package/tests/step-definitions/file-download.steps.js +211 -0
- package/tests/step-definitions/form.steps.js +333 -0
- package/tests/step-definitions/iframe.steps.js +228 -0
- package/tests/step-definitions/input.steps.js +202 -0
- package/tests/step-definitions/javascript.steps.js +232 -0
- package/tests/step-definitions/keyboard.steps.js +112 -0
- package/tests/step-definitions/link.steps.js +142 -0
- package/tests/step-definitions/metatag.steps.js +91 -0
- package/tests/step-definitions/modal.steps.js +244 -0
- package/tests/step-definitions/navigation.steps.js +218 -0
- package/tests/step-definitions/network.steps.js +280 -0
- package/tests/step-definitions/path.steps.js +141 -0
- package/tests/step-definitions/response.steps.js +98 -0
- package/tests/step-definitions/responsive.steps.js +125 -0
- package/tests/step-definitions/rest.steps.js +111 -0
- package/tests/step-definitions/screenshot.steps.js +423 -0
- package/tests/step-definitions/scroll.steps.js +189 -0
- package/tests/step-definitions/selectors.steps.js +1003 -0
- package/tests/step-definitions/storage.steps.js +194 -0
- package/tests/step-definitions/table.steps.js +181 -0
- package/tests/step-definitions/varbase-e2e.js +897 -0
- package/tests/step-definitions/varbase.steps.js +458 -0
- package/tests/step-definitions/video.steps.js +178 -0
- package/tests/step-definitions/wait.steps.js +400 -0
- package/tests/step-definitions/web-first.steps.js +298 -0
- package/tests/step-definitions/xml.steps.js +411 -0
- package/tests/step-definitions/yaml.steps.js +913 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Assertions steps
|
|
2
|
+
|
|
3
|
+
14 steps, defined in `tests/step-definitions/assertion.steps.js`.
|
|
4
|
+
|
|
5
|
+
Cucumber-js loads every `*.steps.js` in that directory automatically — you never `require()` a step file from a feature.
|
|
6
|
+
|
|
7
|
+
| # | Step |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 1 | `Then I should see "Welcome"` |
|
|
10
|
+
| 2 | `Then I should see text matching "^T\w+"` |
|
|
11
|
+
| 3 | `Then I should see "Active" in the "John Smith" row` |
|
|
12
|
+
| 4 | `Then I should see a "Username" element` |
|
|
13
|
+
| 5 | `Then I should see a "uname" element by its "id" attr` |
|
|
14
|
+
| 6 | `Then I should see "John Smith" in the "Username" element` |
|
|
15
|
+
| 7 | `Then I should see "John Smith" in the "uname" element by its "id" attr` |
|
|
16
|
+
| 8 | `Then I should see text matching "\d{4}" in the "#year" element` |
|
|
17
|
+
| 9 | `Then the "body" element should contain "color:white;"` |
|
|
18
|
+
| 10 | `Then I should see 3 "li" elements` |
|
|
19
|
+
| 11 | `Then the "Login" link should contain "/log-in"` |
|
|
20
|
+
| 12 | `Then the "#about-us-id" link should contain "about" by attr` |
|
|
21
|
+
| 13 | `Then the response should contain "Welcome visitor"` |
|
|
22
|
+
| 14 | `Then the response status code should be 200` |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 1. Then I should see "Welcome"
|
|
27
|
+
|
|
28
|
+
Assert that text is or is not present on the page.
|
|
29
|
+
|
|
30
|
+
**Keyword**: `Then`
|
|
31
|
+
|
|
32
|
+
**Pattern**
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
/^(I |we )*should( not)* see "([^"]*)?"$/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Examples**
|
|
39
|
+
|
|
40
|
+
```gherkin
|
|
41
|
+
Then I should see "Welcome"
|
|
42
|
+
Then we should see "Your accounts for the group is public"
|
|
43
|
+
Then I should not see "Access denied"
|
|
44
|
+
Then we should not see "Edit layout"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 2. Then I should see text matching "^T\w+"
|
|
48
|
+
|
|
49
|
+
Assert that page contains or does not contain text matching a regex pattern.
|
|
50
|
+
|
|
51
|
+
**Keyword**: `Then`
|
|
52
|
+
|
|
53
|
+
**Pattern**
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
/^(I |we )*should( not)* see text matching "([^"]*)?"$/
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Examples**
|
|
60
|
+
|
|
61
|
+
```gherkin
|
|
62
|
+
Then I should see text matching "^T\w+"
|
|
63
|
+
Then I should not see text matching "^O\w+"
|
|
64
|
+
And we should see text matching "\d{4}"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 3. Then I should see "Active" in the "John Smith" row
|
|
68
|
+
|
|
69
|
+
Assert text is or is not visible inside a table row identified by text.
|
|
70
|
+
|
|
71
|
+
**Keyword**: `Then`
|
|
72
|
+
|
|
73
|
+
**Pattern**
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
/^(I |we )*should( not)* see "([^"]*)?" in( the)* "([^"]*)?" row$/
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Examples**
|
|
80
|
+
|
|
81
|
+
```gherkin
|
|
82
|
+
Then I should see "Active" in the "John Smith" row
|
|
83
|
+
Then I should see "In Stock" in the "Product A" row
|
|
84
|
+
Then we should see "Processing" in the "Order #12345" row
|
|
85
|
+
And I should see "Admin" in the "john.smith@example.com" row
|
|
86
|
+
Then I should not see "Admin" in the "Jane Doe" row
|
|
87
|
+
Then I should not see "Out of Stock" in the "Product A" row
|
|
88
|
+
And I should not see "Inactive" in the "john.smith@example.com" row
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 4. Then I should see a "Username" element
|
|
92
|
+
|
|
93
|
+
Assert that an element with a given label exists (or does not) on the page.
|
|
94
|
+
|
|
95
|
+
**Keyword**: `Then`
|
|
96
|
+
|
|
97
|
+
**Pattern**
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
/^(I |we )*should( not)* see (a|an) "([^"]*)?" element$/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Examples**
|
|
104
|
+
|
|
105
|
+
```gherkin
|
|
106
|
+
Then I should see a "Username" element
|
|
107
|
+
Then I should not see a "Username" element
|
|
108
|
+
And we should see an "Email" element
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 5. Then I should see a "uname" element by its "id" attr
|
|
112
|
+
|
|
113
|
+
Assert that an element, identified by attribute, exists (or does not) on the page.
|
|
114
|
+
|
|
115
|
+
**Keyword**: `Then`
|
|
116
|
+
|
|
117
|
+
**Pattern**
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
/^(I |we )*should( not)* see (a|an) "([^"]*)?" element by( its)*(?: "([^"]*)?")* (attribute|attr)$/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Examples**
|
|
124
|
+
|
|
125
|
+
```gherkin
|
|
126
|
+
Then I should see a "uname" element by its "id" attr
|
|
127
|
+
Then I should see a "pwordcss" element by attr
|
|
128
|
+
Then I should not see an "emailId" element by its "id" attr
|
|
129
|
+
And I should not see a "countryCss" element by attr
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 6. Then I should see "John Smith" in the "Username" element
|
|
133
|
+
|
|
134
|
+
Assert that an element (found by its label) contains or does not contain text.
|
|
135
|
+
|
|
136
|
+
**Keyword**: `Then`
|
|
137
|
+
|
|
138
|
+
**Pattern**
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
/^(I |we )*should( not)* see "([^"]*)?" in( the)* "([^"]*)?" element$/
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Examples**
|
|
145
|
+
|
|
146
|
+
```gherkin
|
|
147
|
+
Then I should see "John Smith" in the "Username" element
|
|
148
|
+
Then I should not see "Joe Smith" in the "Username" element
|
|
149
|
+
And we should see "1234" in the "Password" element
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 7. Then I should see "John Smith" in the "uname" element by its "id" attr
|
|
153
|
+
|
|
154
|
+
Assert that an element (found by its attribute) contains or does not contain text.
|
|
155
|
+
|
|
156
|
+
**Keyword**: `Then`
|
|
157
|
+
|
|
158
|
+
**Pattern**
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
/^(I |we )*should( not)* see "([^"]*)?" in( the)* "([^"]*)?" element by( its)*(?: "([^"]*)?")* (attribute|attr)$/
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Examples**
|
|
165
|
+
|
|
166
|
+
```gherkin
|
|
167
|
+
Then I should see "John Smith" in the "uname" element by its "id" attr
|
|
168
|
+
Then I should see "1234" in the "pwordcss" element by attr
|
|
169
|
+
Then I should not see "John Smith" in the "uname" element by its "id" attr
|
|
170
|
+
Then I should not see "1234" in the "pwordcss" element by attr
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 8. Then I should see text matching "\d{4}" in the "#year" element
|
|
174
|
+
|
|
175
|
+
Assert that an element's text content does or does not match a regex.
|
|
176
|
+
|
|
177
|
+
**Keyword**: `Then`
|
|
178
|
+
|
|
179
|
+
**Pattern**
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
/^(I |we )*should( not)* see text matching "([^"]*)?" in( the)* "([^"]*)?" element$/
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Examples**
|
|
186
|
+
|
|
187
|
+
```gherkin
|
|
188
|
+
Then I should see text matching "\d{4}" in the "#year" element
|
|
189
|
+
Then I should see text matching "\$\d+\.\d{2}" in the "#price" element
|
|
190
|
+
Then I should not see text matching "Error" in the "#status" element
|
|
191
|
+
Then we should see text matching "^[A-Z][a-z]+ [A-Z][a-z]+$" in the "#full-name" element
|
|
192
|
+
Then I should see text matching "(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}" in the "#date" element
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 9. Then the "body" element should contain "color:white;"
|
|
196
|
+
|
|
197
|
+
Assert that an element has or does not have a specific CSS property.
|
|
198
|
+
|
|
199
|
+
**Keyword**: `Then`
|
|
200
|
+
|
|
201
|
+
**Pattern**
|
|
202
|
+
|
|
203
|
+
```js
|
|
204
|
+
/^(the )*"([^"]*)?" element should( not)* contain "([^"]*)?"$/
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Examples**
|
|
208
|
+
|
|
209
|
+
```gherkin
|
|
210
|
+
Then the "body" element should contain "color:white;"
|
|
211
|
+
Then the "body" element should not contain "color:white;"
|
|
212
|
+
Then the "#uname" element should not contain "border:solid 5px red;"
|
|
213
|
+
Then the "pword" element should not contain "font-size: 26px;"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## 10. Then I should see 3 "li" elements
|
|
217
|
+
|
|
218
|
+
Assert the exact number of elements matching a CSS selector.
|
|
219
|
+
|
|
220
|
+
**Keyword**: `Then`
|
|
221
|
+
|
|
222
|
+
**Pattern**
|
|
223
|
+
|
|
224
|
+
```js
|
|
225
|
+
/^(I |we )*should see (\d+) "([^"]*)" elements?$/
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Examples**
|
|
229
|
+
|
|
230
|
+
```gherkin
|
|
231
|
+
Then I should see 3 "li" elements
|
|
232
|
+
Then I should see 1 "h1" element
|
|
233
|
+
Then we should see 5 ".card" elements
|
|
234
|
+
Then I should see 0 ".error" elements
|
|
235
|
+
And I should see 10 "table tr" elements
|
|
236
|
+
Then I should see 2 "nav a" elements
|
|
237
|
+
Then we should see 4 "ul li" elements
|
|
238
|
+
Then I should see 1 "form" element
|
|
239
|
+
And should see 6 ".product" elements
|
|
240
|
+
Then I should see 8 "[data-testid='row']" elements
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## 11. Then the "Login" link should contain "/log-in"
|
|
244
|
+
|
|
245
|
+
Assert that a link (located by its visible text) contains the given URL.
|
|
246
|
+
|
|
247
|
+
**Keyword**: `Then`
|
|
248
|
+
|
|
249
|
+
**Pattern**
|
|
250
|
+
|
|
251
|
+
```js
|
|
252
|
+
/^(the )*"([^"]*)?" link should contain "([^"]*)?"$/
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Examples**
|
|
256
|
+
|
|
257
|
+
```gherkin
|
|
258
|
+
Then the "Login" link should contain "/log-in"
|
|
259
|
+
And the "About Us" link should contain "/about"
|
|
260
|
+
Then "Home" link should contain "/"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 12. Then the "#about-us-id" link should contain "about" by attr
|
|
264
|
+
|
|
265
|
+
Assert that a link located by its attribute contains the given URL.
|
|
266
|
+
|
|
267
|
+
**Keyword**: `Then`
|
|
268
|
+
|
|
269
|
+
**Pattern**
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
/^(the )*"([^"]*)?" link should contain "([^"]*)?" by( its)*(?: "([^"]*)?")* (attribute|attr)$/
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Examples**
|
|
276
|
+
|
|
277
|
+
```gherkin
|
|
278
|
+
Then the "#about-us-id" link should contain "about" by attr
|
|
279
|
+
And the "aboutUs" link should contain "about" by its "class" attribute
|
|
280
|
+
And the ".contactUs" link should contain "/contact-" by attr
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## 13. Then the response should contain "Welcome visitor"
|
|
284
|
+
|
|
285
|
+
Assert that the rendered HTML response contains or does not contain text.
|
|
286
|
+
|
|
287
|
+
Reads the entire `<html>` text — useful for checking text that lives in
|
|
288
|
+
`<head>` (meta descriptions, JSON-LD), `<noscript>`, or hidden regions.
|
|
289
|
+
|
|
290
|
+
**Keyword**: `Then`
|
|
291
|
+
|
|
292
|
+
**Pattern**
|
|
293
|
+
|
|
294
|
+
```js
|
|
295
|
+
/^(the )*response should( not)* contain "([^"]*)?"$/
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Examples**
|
|
299
|
+
|
|
300
|
+
```gherkin
|
|
301
|
+
Then the response should contain "Welcome visitor"
|
|
302
|
+
Then the response should not contain "Access denied"
|
|
303
|
+
And the response should contain "<title>Home</title>"
|
|
304
|
+
Then the response should contain "<html"
|
|
305
|
+
When I am on "/about"
|
|
306
|
+
Then the response should contain "Our mission"
|
|
307
|
+
And the response should not contain "TODO"
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## 14. Then the response status code should be 200
|
|
311
|
+
|
|
312
|
+
Assert that the current page's response status is or is not a given code.
|
|
313
|
+
|
|
314
|
+
**Keyword**: `Then`
|
|
315
|
+
|
|
316
|
+
**Pattern**
|
|
317
|
+
|
|
318
|
+
```js
|
|
319
|
+
/^(the )*response status code should( not)* be (\d+)$/
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Examples**
|
|
323
|
+
|
|
324
|
+
```gherkin
|
|
325
|
+
Then the response status code should be 200
|
|
326
|
+
And the response status code should not be 404
|
|
327
|
+
Then the response status code should be 301
|
|
328
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Auth state steps
|
|
2
|
+
|
|
3
|
+
3 steps, defined in `tests/step-definitions/auth.steps.js`.
|
|
4
|
+
|
|
5
|
+
Cucumber-js loads every `*.steps.js` in that directory automatically — you never `require()` a step file from a feature.
|
|
6
|
+
|
|
7
|
+
| # | Step |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 1 | `When I save the auth state to "tests/auth/admin.json"` |
|
|
10
|
+
| 2 | `Given I restore the auth state from "tests/auth/admin.json"` |
|
|
11
|
+
| 3 | `Given I clear the auth state` |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. When I save the auth state to "tests/auth/admin.json"
|
|
16
|
+
|
|
17
|
+
Save the current browser context's cookies + localStorage to a JSON file.
|
|
18
|
+
|
|
19
|
+
Run this AFTER a successful interactive login. The destination file is
|
|
20
|
+
created (with parent directories) if it does not exist; existing files are
|
|
21
|
+
overwritten.
|
|
22
|
+
|
|
23
|
+
**Keyword**: `When`
|
|
24
|
+
|
|
25
|
+
**Pattern**
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
/^(I |we )*save the auth state to "([^"]*)"$/
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Examples**
|
|
32
|
+
|
|
33
|
+
```gherkin
|
|
34
|
+
When I save the auth state to "tests/auth/admin.json"
|
|
35
|
+
Given I am on "/login"
|
|
36
|
+
When I fill in "admin@example.com" for "Email"
|
|
37
|
+
And I fill in "secret" for "Password"
|
|
38
|
+
And I press "Sign in"
|
|
39
|
+
And I wait until the URL contains "/dashboard"
|
|
40
|
+
Then I save the auth state to "tests/auth/admin.json"
|
|
41
|
+
When I save the auth state to "tests/auth/editor.json"
|
|
42
|
+
When we save the auth state to "tests/auth/customer.json"
|
|
43
|
+
When I save the auth state to "/tmp/admin-state.json"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 2. Given I restore the auth state from "tests/auth/admin.json"
|
|
47
|
+
|
|
48
|
+
Restore cookies + localStorage from a previously saved JSON file.
|
|
49
|
+
|
|
50
|
+
The current browser context is closed and a fresh one is opened with the
|
|
51
|
+
saved state. The varbase-e2e init script (AJAX/timer/mutation tracker) is
|
|
52
|
+
re-installed automatically so smart waits keep working. Subsequent steps
|
|
53
|
+
proceed against the restored, authenticated session.
|
|
54
|
+
|
|
55
|
+
**Keyword**: `Given`
|
|
56
|
+
|
|
57
|
+
**Pattern**
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
/^(I |we )*restore the auth state from "([^"]*)"$/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Examples**
|
|
64
|
+
|
|
65
|
+
```gherkin
|
|
66
|
+
Given I restore the auth state from "tests/auth/admin.json"
|
|
67
|
+
Given I restore the auth state from "tests/auth/editor.json"
|
|
68
|
+
And I am on "/admin/products"
|
|
69
|
+
Given I restore the auth state from "tests/auth/customer.json"
|
|
70
|
+
And I am on "/account/orders"
|
|
71
|
+
Given we restore the auth state from "tests/auth/admin.json"
|
|
72
|
+
Given I restore the auth state from "tests/auth/admin.json"
|
|
73
|
+
And I am on "/dashboard"
|
|
74
|
+
Then "<#user-list>" should have a count of 5 within 5 seconds
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 3. Given I clear the auth state
|
|
78
|
+
|
|
79
|
+
Clear cookies and localStorage / sessionStorage for the current context.
|
|
80
|
+
|
|
81
|
+
Use to anonymize a session mid-scenario, e.g. after asserting a logged-in
|
|
82
|
+
action you may want to verify the same path returns 302 / login form for
|
|
83
|
+
an anonymous visitor.
|
|
84
|
+
|
|
85
|
+
**Keyword**: `Given`
|
|
86
|
+
|
|
87
|
+
**Pattern**
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
/^(I |we )*clear the auth state$/
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Examples**
|
|
94
|
+
|
|
95
|
+
```gherkin
|
|
96
|
+
Given I clear the auth state
|
|
97
|
+
Given I restore the auth state from "tests/auth/admin.json"
|
|
98
|
+
And I am on "/dashboard"
|
|
99
|
+
Given I clear the auth state
|
|
100
|
+
When I am on "/dashboard"
|
|
101
|
+
Then I should see "Sign in"
|
|
102
|
+
Given we clear the auth state
|
|
103
|
+
When I press "Logout"
|
|
104
|
+
And I clear the auth state
|
|
105
|
+
Given I clear the auth state
|
|
106
|
+
When I am on the homepage
|
|
107
|
+
Then I should see "Login"
|
|
108
|
+
```
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Clock steps
|
|
2
|
+
|
|
3
|
+
7 steps, defined in `tests/step-definitions/clock.steps.js`.
|
|
4
|
+
|
|
5
|
+
Cucumber-js loads every `*.steps.js` in that directory automatically — you never `require()` a step file from a feature.
|
|
6
|
+
|
|
7
|
+
| # | Step |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 1 | `Given the system time is "2026-05-08T10:00:00Z"` |
|
|
10
|
+
| 2 | `When I advance the clock by 500 ms` |
|
|
11
|
+
| 3 | `When I advance the clock by 30 seconds` |
|
|
12
|
+
| 4 | `When I advance the clock by 5 minutes` |
|
|
13
|
+
| 5 | `When I pause the clock` |
|
|
14
|
+
| 6 | `When I resume the clock` |
|
|
15
|
+
| 7 | `When I set the system time to "2026-05-08T12:30:00Z"` |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. Given the system time is "2026-05-08T10:00:00Z"
|
|
20
|
+
|
|
21
|
+
Install a fake clock anchored at an ISO 8601 instant.
|
|
22
|
+
|
|
23
|
+
**Keyword**: `Given`
|
|
24
|
+
|
|
25
|
+
**Pattern**
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
/^the system time is "([^"]*)"$/
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Examples**
|
|
32
|
+
|
|
33
|
+
```gherkin
|
|
34
|
+
Given the system time is "2026-05-08T10:00:00Z"
|
|
35
|
+
Given the system time is "2026-01-01T00:00:00Z"
|
|
36
|
+
Given the system time is "2026-12-31T23:59:55Z"
|
|
37
|
+
Given the system time is "2026-05-08T10:00:00Z"
|
|
38
|
+
Given the system time is "2026-07-04T12:00:00-04:00"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 2. When I advance the clock by 500 ms
|
|
42
|
+
|
|
43
|
+
Advance the fake clock forward by N milliseconds.
|
|
44
|
+
|
|
45
|
+
**Keyword**: `When`
|
|
46
|
+
|
|
47
|
+
**Pattern**
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
/^(I |we )*advance the clock by (\d+) ?ms$/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Examples**
|
|
54
|
+
|
|
55
|
+
```gherkin
|
|
56
|
+
When I advance the clock by 500 ms
|
|
57
|
+
When I advance the clock by 1500 ms
|
|
58
|
+
When we advance the clock by 250 ms
|
|
59
|
+
And I advance the clock by 100 ms
|
|
60
|
+
When I advance the clock by 60000 ms
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 3. When I advance the clock by 30 seconds
|
|
64
|
+
|
|
65
|
+
Advance the fake clock forward by N seconds.
|
|
66
|
+
|
|
67
|
+
**Keyword**: `When`
|
|
68
|
+
|
|
69
|
+
**Pattern**
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
/^(I |we )*advance the clock by (\d+) seconds?$/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Examples**
|
|
76
|
+
|
|
77
|
+
```gherkin
|
|
78
|
+
When I advance the clock by 30 seconds
|
|
79
|
+
When I advance the clock by 5 seconds
|
|
80
|
+
When we advance the clock by 1 second
|
|
81
|
+
And I advance the clock by 10 seconds
|
|
82
|
+
When I advance the clock by 90 seconds
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 4. When I advance the clock by 5 minutes
|
|
86
|
+
|
|
87
|
+
Advance the fake clock forward by N minutes.
|
|
88
|
+
|
|
89
|
+
**Keyword**: `When`
|
|
90
|
+
|
|
91
|
+
**Pattern**
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
/^(I |we )*advance the clock by (\d+) minutes?$/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Examples**
|
|
98
|
+
|
|
99
|
+
```gherkin
|
|
100
|
+
When I advance the clock by 5 minutes
|
|
101
|
+
When I advance the clock by 1 minute
|
|
102
|
+
When we advance the clock by 14 minutes
|
|
103
|
+
And I advance the clock by 30 minutes
|
|
104
|
+
When I advance the clock by 60 minutes
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 5. When I pause the clock
|
|
108
|
+
|
|
109
|
+
Pause the fake clock.
|
|
110
|
+
|
|
111
|
+
**Keyword**: `When`
|
|
112
|
+
|
|
113
|
+
**Pattern**
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
/^(I |we )*pause the clock$/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Examples**
|
|
120
|
+
|
|
121
|
+
```gherkin
|
|
122
|
+
When I pause the clock
|
|
123
|
+
When I pause the clock
|
|
124
|
+
When we pause the clock
|
|
125
|
+
And I pause the clock
|
|
126
|
+
When I pause the clock
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 6. When I resume the clock
|
|
130
|
+
|
|
131
|
+
Resume the fake clock.
|
|
132
|
+
|
|
133
|
+
**Keyword**: `When`
|
|
134
|
+
|
|
135
|
+
**Pattern**
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
/^(I |we )*resume the clock$/
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Examples**
|
|
142
|
+
|
|
143
|
+
```gherkin
|
|
144
|
+
When I resume the clock
|
|
145
|
+
When I resume the clock
|
|
146
|
+
When we resume the clock
|
|
147
|
+
And I resume the clock
|
|
148
|
+
When I resume the clock
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 7. When I set the system time to "2026-05-08T12:30:00Z"
|
|
152
|
+
|
|
153
|
+
Set the fake clock to a specific time.
|
|
154
|
+
|
|
155
|
+
**Keyword**: `When`
|
|
156
|
+
|
|
157
|
+
**Pattern**
|
|
158
|
+
|
|
159
|
+
```js
|
|
160
|
+
/^(I |we )*set the system time to "([^"]*)"$/
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Examples**
|
|
164
|
+
|
|
165
|
+
```gherkin
|
|
166
|
+
When I set the system time to "2026-05-08T12:30:00Z"
|
|
167
|
+
When I set the system time to "2026-12-31T23:59:55Z"
|
|
168
|
+
When we set the system time to "2026-01-01T00:00:00Z"
|
|
169
|
+
And I set the system time to "2026-07-04T08:00:00-04:00"
|
|
170
|
+
When I set the system time to "2027-01-01T00:00:00Z"
|
|
171
|
+
```
|