@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,52 @@
|
|
|
1
|
+
|
|
2
|
+
# Advanced Screenshots
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This documentation page covers screenshot capture functionality in Varbase E2E 2.0.x. The feature enables testers to capture PNG screenshots during Cucumber scenarios using Playwright, supporting fullscreen, custom viewport, and named captures.
|
|
7
|
+
|
|
8
|
+
## Key Features
|
|
9
|
+
|
|
10
|
+
**Auto-capture hooks** activate screenshots in two scenarios:
|
|
11
|
+
- On failed steps (with `failedPrefix` prepended)
|
|
12
|
+
- On every step when scenarios are tagged `@screenshots`
|
|
13
|
+
|
|
14
|
+
**Filename tokens** can be used in `with name "..."` steps or configuration keys like `filenamePattern` and `filenamePatternFailed`.
|
|
15
|
+
|
|
16
|
+
## Configuration
|
|
17
|
+
|
|
18
|
+
Settings reside in `cucumber.js` under `worldParameters.screenshot`. Each key accepts environment variable overrides:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
worldParameters: {
|
|
22
|
+
screenshot: {
|
|
23
|
+
dir: './screenshots',
|
|
24
|
+
purge: false,
|
|
25
|
+
onFailed: true,
|
|
26
|
+
onEveryStep: false,
|
|
27
|
+
alwaysFullscreen: false,
|
|
28
|
+
failedPrefix: 'failed_',
|
|
29
|
+
filenamePattern: '{datetime}.{feature_file}.feature_{step_line}.{ext}',
|
|
30
|
+
filenamePatternFailed: '{failed_prefix}{datetime}.{feature_file}.feature_{step_line}.{ext}',
|
|
31
|
+
infoTypes: '',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Priority Chain
|
|
37
|
+
|
|
38
|
+
1. Environment variables (`VARBASE_E2E_SCREENSHOT_*`)
|
|
39
|
+
2. cucumber.js project defaults
|
|
40
|
+
3. Built-in defaults
|
|
41
|
+
|
|
42
|
+
## Output
|
|
43
|
+
|
|
44
|
+
Each capture generates two files:
|
|
45
|
+
- `.png` — Screenshot via Playwright
|
|
46
|
+
- `.html` — Raw page HTML with optional metadata
|
|
47
|
+
|
|
48
|
+
## Sub-pages
|
|
49
|
+
|
|
50
|
+
- [Then I save "width" x "height" screenshot](/docs/varbase-e2e/2.0.x/advanced-screenshots/then-i-save-width-x-height-screenshot)
|
|
51
|
+
- [Then I save fullscreen screenshot](/docs/varbase-e2e/2.0.x/advanced-screenshots/then-i-save-fullscreen-screenshot)
|
|
52
|
+
- [When I save screenshot with name "filename"](/docs/varbase-e2e/2.0.x/advanced-screenshots/when-i-save-screenshot-name-filename)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
# Advanced Selectors
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This documentation page describes a unified selector system for Varbase E2E 2.0.x that consolidates CSS selectors, XPath selectors, layout components, viewport breakpoints, and relative-position assertions into a single module.
|
|
7
|
+
|
|
8
|
+
## Key Features
|
|
9
|
+
|
|
10
|
+
The advanced selectors system unifies multiple selector types through these capabilities:
|
|
11
|
+
|
|
12
|
+
- **Unified Resolution**: Combines CSS and XPath selectors with consistent priority ordering where "css → xpath" applies, with latest registration overriding previous entries for identical names.
|
|
13
|
+
|
|
14
|
+
- **Auto-Retrying Assertions**: Replaces manual visibility checks with "Playwright's auto-retrying wait states" rather than legacy DOM inspection methods.
|
|
15
|
+
|
|
16
|
+
- **Accessibility-First Locators**: Leverages Playwright semantic helpers like `getByLabel`, `getByPlaceholder`, and `getByRole()` chained via `.or()` to match user interaction patterns.
|
|
17
|
+
|
|
18
|
+
- **Standardized Breakpoints**: Implements xs/sm/md/lg/xl/xxl/xxxl viewport scales aligned with Bootstrap 5.3 conventions.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# API Step Definitions
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
varbase-e2e ships native HTTP / REST API step definitions powered by
|
|
7
|
+
Playwright's request fixture and `axios`. They share the browser
|
|
8
|
+
context's cookie jar so the same scenario can mix UI actions and
|
|
9
|
+
direct API calls.
|
|
10
|
+
|
|
11
|
+
## Available API Step Definitions
|
|
12
|
+
|
|
13
|
+
The documentation lists 22 distinct step definition categories:
|
|
14
|
+
|
|
15
|
+
**Authentication & Headers:**
|
|
16
|
+
- Given I am authenticating as "username" with "pa$$word" password
|
|
17
|
+
- Given I set header "Header-Name" with value "Some-Value"
|
|
18
|
+
- Given I set the following headers
|
|
19
|
+
- Given I set the header "Header-Name" to "Header-Value"
|
|
20
|
+
|
|
21
|
+
**Request Configuration:**
|
|
22
|
+
- Given I set placeholder "{{placeholder}}" to "value"
|
|
23
|
+
- Given I set the request body to 'JSON-data'
|
|
24
|
+
- Given I set the request body with
|
|
25
|
+
- Given the API base URL is "url"
|
|
26
|
+
|
|
27
|
+
**HTTP Methods:**
|
|
28
|
+
- When I send a METHOD request to "endpoint"
|
|
29
|
+
- When I send a METHOD request to "endpoint" with body
|
|
30
|
+
- When I send a METHOD request to "endpoint" with form data
|
|
31
|
+
- When I send a METHOD request to "endpoint" with values
|
|
32
|
+
|
|
33
|
+
**Response Assertions:**
|
|
34
|
+
- Then print API response
|
|
35
|
+
- Then the API response code should be {number}
|
|
36
|
+
- Then the API response should contain "text"
|
|
37
|
+
- Then the API response should contain json
|
|
38
|
+
- Then the API response should not contain "text"
|
|
39
|
+
- Then the response should be valid JSON
|
|
40
|
+
- Then the response header "response header" should be "value"
|
|
41
|
+
|
|
42
|
+
**JSON Response Validation:**
|
|
43
|
+
- Then the JSON response should have "propertyPath" equal to "value"
|
|
44
|
+
- Then the JSON response should have property "propertyPath"
|
|
45
|
+
- Then the JSON response should not have property "propertyPath"
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Global Settings
|
|
2
|
+
|
|
3
|
+
Varbase E2E draws settings from three layers, evaluated in this order:
|
|
4
|
+
|
|
5
|
+
1. **Environment variables** (CI / shell) — highest precedence.
|
|
6
|
+
2. **`worldParameters` in `cucumber.js`** — project-level defaults.
|
|
7
|
+
3. **Built-in defaults** — sane fallbacks shipped with the library.
|
|
8
|
+
|
|
9
|
+
This page documents every supported setting plus its env-var override.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Top-level `cucumber.js` keys
|
|
14
|
+
|
|
15
|
+
| Key | Type | Default | Notes |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `timeout` | int (ms) | `30000` | Per-step timeout enforced by `setDefaultTimeout`. |
|
|
18
|
+
| `requireModule` | array | `['ts-node/register']` | TypeScript runtime support. |
|
|
19
|
+
| `require` | array | step-definition globs | Files Cucumber-js loads at startup. |
|
|
20
|
+
| `paths` | array | `['tests/features/**/*.feature']` | Where to find feature files. |
|
|
21
|
+
| `format` | array | pretty + JSON report | Output formatters. |
|
|
22
|
+
| `formatOptions` | object | colour theme | Pretty-formatter colours. |
|
|
23
|
+
| `worldParameters` | object | (sections below) | Everything passed to the Playwright World. |
|
|
24
|
+
|
|
25
|
+
Single profile: `default`. Run with:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx cucumber-js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To enable `parallel`, `retry`, or `retryTagFilter`, add them inside the
|
|
32
|
+
`default` block (or pass `--parallel N`, `--retry N`, `--retry-tag-filter @flaky`
|
|
33
|
+
on the command line).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## `worldParameters` — runtime configuration
|
|
38
|
+
|
|
39
|
+
### `launchUrl`
|
|
40
|
+
|
|
41
|
+
| Type | Default | Env override |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| string | `http://localhost:8080` | `LAUNCH_URL` |
|
|
44
|
+
|
|
45
|
+
Base URL prepended to every relative path in `Given I am on "/path"`.
|
|
46
|
+
|
|
47
|
+
### `assetsFolder`
|
|
48
|
+
|
|
49
|
+
Resolved automatically to `tests/assets/`. Used by `When I attach the
|
|
50
|
+
file "...".`. Override per-World by extending the world constructor;
|
|
51
|
+
no env var.
|
|
52
|
+
|
|
53
|
+
### `minWaitTime` — pacing knobs
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
minWaitTime: {
|
|
57
|
+
page: 3000, // ms — page-settle budget for navigation steps
|
|
58
|
+
before_scenario: 0, // ms — sleep before each Scenario starts
|
|
59
|
+
after_scenario: 0, // ms — sleep after each Scenario ends
|
|
60
|
+
before_step: 0, // ms — sleep before each Step
|
|
61
|
+
after_step: 0, // ms — sleep after each Step
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
| Key | Default | Purpose |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `page` | `3000` | Per-navigation budget for `smartSettle`. Bump for slow CI. |
|
|
68
|
+
| `before_scenario` | `0` | Forces a fixed delay before each Scenario. Default off — BBR auto-settle replaces it. |
|
|
69
|
+
| `after_scenario` | `0` | Same, after Scenario ends. |
|
|
70
|
+
| `before_step` | `0` | Per-step sleep. Use only for visual debugging. |
|
|
71
|
+
| `after_step` | `0` | Same, after each step. |
|
|
72
|
+
|
|
73
|
+
> Best practice: leave the four `*_scenario` / `*_step` keys at `0` —
|
|
74
|
+
> the BBR auto-settle hook handles real timing. Only raise them when
|
|
75
|
+
> demoing a recording in headed mode.
|
|
76
|
+
|
|
77
|
+
### `selectors` — named selector registry
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
selectors: {
|
|
81
|
+
css: { /* name → CSS selector */ },
|
|
82
|
+
xpath: { /* name → XPath expression */ },
|
|
83
|
+
filesPath: './tests/selectors/', // base path for JSON presets
|
|
84
|
+
files: [], // JSON files to auto-load per scenario
|
|
85
|
+
offset: 60, // px — scroll offset for relative-position assertions
|
|
86
|
+
breakpoints: { // viewport sizes (used by responsive.steps.js)
|
|
87
|
+
xs: { width: 375, height: 667 },
|
|
88
|
+
sm: { width: 576, height: 800 },
|
|
89
|
+
md: { width: 768, height: 1024 },
|
|
90
|
+
lg: { width: 992, height: 768 },
|
|
91
|
+
xl: { width: 1200, height: 900, default: true },
|
|
92
|
+
xxl: { width: 1400, height: 900 },
|
|
93
|
+
xxxl: { width: 1920, height: 1080 },
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| Key | Default | Env override |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `css` | `{}` | — |
|
|
101
|
+
| `xpath` | `{}` | — |
|
|
102
|
+
| `filesPath` | `./tests/selectors/` | — |
|
|
103
|
+
| `files` | `[]` | — |
|
|
104
|
+
| `offset` | `60` | `VARBASE_E2E_SELECTORS_OFFSET` |
|
|
105
|
+
| `breakpoints` | xs..xxxl | `VARBASE_E2E_SELECTORS_BREAKPOINTS` (JSON string) |
|
|
106
|
+
|
|
107
|
+
### `screenshot` — capture configuration
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
screenshot: {
|
|
111
|
+
dir: './screenshots',
|
|
112
|
+
purge: false,
|
|
113
|
+
onFailed: true,
|
|
114
|
+
onEveryStep: false,
|
|
115
|
+
alwaysFullscreen: false,
|
|
116
|
+
failedPrefix: 'failed_',
|
|
117
|
+
filenamePattern: '{datetime}.{feature_file}.feature_{step_line}.{ext}',
|
|
118
|
+
filenamePatternFailed: '{failed_prefix}{datetime}.{feature_file}.feature_{step_line}.{ext}',
|
|
119
|
+
infoTypes: '',
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
| Key | Default | Env override |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| `dir` | `./screenshots` | `VARBASE_E2E_SCREENSHOT_DIR` |
|
|
126
|
+
| `purge` | `false` | `VARBASE_E2E_SCREENSHOT_PURGE` |
|
|
127
|
+
| `onFailed` | `true` | `VARBASE_E2E_SCREENSHOT_ON_FAILED` |
|
|
128
|
+
| `onEveryStep` | `false` | `VARBASE_E2E_SCREENSHOT_ON_EVERY_STEP` |
|
|
129
|
+
| `alwaysFullscreen` | `false` | `VARBASE_E2E_SCREENSHOT_FULLSCREEN` |
|
|
130
|
+
| `failedPrefix` | `failed_` | `VARBASE_E2E_SCREENSHOT_FAILED_PREFIX` |
|
|
131
|
+
| `filenamePattern` | `{datetime}...` | `VARBASE_E2E_SCREENSHOT_PATTERN` |
|
|
132
|
+
| `filenamePatternFailed` | `{failed_prefix}...` | `VARBASE_E2E_SCREENSHOT_PATTERN_FAIL` |
|
|
133
|
+
| `infoTypes` | `''` | `VARBASE_E2E_SCREENSHOT_INFO_TYPES` (e.g. `"url,feature,step,datetime"`) |
|
|
134
|
+
|
|
135
|
+
Filename pattern tokens: `{datetime}`, `{date}`, `{time}`, `{feature_file}`,
|
|
136
|
+
`{feature}`, `{scenario}`, `{step_line}`, `{ext}`, `{failed_prefix}`,
|
|
137
|
+
`{url}`, `{host}`, `{path}`.
|
|
138
|
+
|
|
139
|
+
### `video` — Playwright video recording
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
video: {
|
|
143
|
+
mode: 'off', // VARBASE_E2E_VIDEO — 'off' | 'on' | 'on-failure' | 'tag'
|
|
144
|
+
dir: './videos', // VARBASE_E2E_VIDEO_DIR
|
|
145
|
+
size: { width: 1280, height: 720 }, // recording viewport
|
|
146
|
+
filenamePattern: '{datetime}.{feature_file}.{scenario}.{status}.{ext}',
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Tag overrides per scenario:
|
|
151
|
+
|
|
152
|
+
| Tag | Effect |
|
|
153
|
+
| --- | --- |
|
|
154
|
+
| `@video` | Force recording on. |
|
|
155
|
+
| `@no-video` | Suppress recording. |
|
|
156
|
+
|
|
157
|
+
Modes:
|
|
158
|
+
|
|
159
|
+
| Mode | Behaviour |
|
|
160
|
+
| --- | --- |
|
|
161
|
+
| `off` (default) | No recording. |
|
|
162
|
+
| `on` | Record every scenario. |
|
|
163
|
+
| `on-failure` | Record every scenario, keep only failures. |
|
|
164
|
+
| `tag` | Record only scenarios tagged `@video`. |
|
|
165
|
+
|
|
166
|
+
Mid-scenario start / stop steps live in `video.steps.js`. Recording starts at context creation only — `When I start video recording` closes + reopens the context, losing page state. Call before any navigation.
|
|
167
|
+
|
|
168
|
+
### `javascript` — page-error / console capture
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
javascript: {
|
|
172
|
+
mode: 'warn', // VARBASE_E2E_JS_ERROR_MODE — 'warn' | 'fail' | 'off'
|
|
173
|
+
levels: ['error'], // VARBASE_E2E_JS_ERROR_LEVELS (csv) — console levels to capture
|
|
174
|
+
ignore: '', // VARBASE_E2E_JS_ERROR_IGNORE — regex of messages to drop
|
|
175
|
+
beforeScenario: false, // VARBASE_E2E_JS_ERROR_BEFORE — snapshot pre-existing errors
|
|
176
|
+
afterScenario: true, // VARBASE_E2E_JS_ERROR_AFTER — report at scenario end
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Tags override `mode` per scenario:
|
|
181
|
+
|
|
182
|
+
| Tag | Effect |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| `@js-fail` / `@javascript` (legacy) | force `fail` |
|
|
185
|
+
| `@js-warn` | force `warn` |
|
|
186
|
+
| `@js-off` / `@js-errors` (legacy) | force `off` |
|
|
187
|
+
|
|
188
|
+
The explicit step `Then there should be no JavaScript errors` always asserts (independent of mode).
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## `playwright.config.ts` — browser launch
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
const config = {
|
|
196
|
+
browser: process.env.BROWSER || 'chromium',
|
|
197
|
+
launchOptions: {
|
|
198
|
+
headless: process.env.HEADLESS !== 'false',
|
|
199
|
+
slowMo: parseInt(process.env.SLOW_MO || '300', 10),
|
|
200
|
+
args: [...],
|
|
201
|
+
},
|
|
202
|
+
contextOptions: {
|
|
203
|
+
viewport: null,
|
|
204
|
+
ignoreHTTPSErrors: true,
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| Key | Default | Env override |
|
|
210
|
+
| --- | --- | --- |
|
|
211
|
+
| `browser` | `chromium` | `BROWSER` (`chromium` / `firefox` / `webkit`) |
|
|
212
|
+
| `launchOptions.headless` | `true` | `HEADLESS=false` for headed |
|
|
213
|
+
| `launchOptions.slowMo` | `300` headed: `800` | `SLOW_MO` (ms) |
|
|
214
|
+
| `launchOptions.args` | chromium-only flags | edit file directly |
|
|
215
|
+
| `contextOptions.viewport` | `null` (use browser default) | edit file directly |
|
|
216
|
+
| `contextOptions.ignoreHTTPSErrors` | `true` | edit file directly |
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Behaviour toggles
|
|
221
|
+
|
|
222
|
+
| Env var | Effect |
|
|
223
|
+
| --- | --- |
|
|
224
|
+
| `VARBASE_E2E_AUTO_SETTLE` | Set to `off` to disable the BBR auto-settle hook (`smartSettle(page, 1500)` after every state-changing step). |
|
|
225
|
+
| `VARBASE_E2E_REPORT_DISABLE` | Set to `1` to skip auto-generating the HTML report on cucumber-js process exit. |
|
|
226
|
+
| `VARBASE_E2E_REPORT_ARGS` | Extra CLI flags forwarded to `bin/generate-reports.js`. e.g. `--theme hierarchy --layout 2`. |
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Run / pacing env vars
|
|
231
|
+
|
|
232
|
+
| Env var | Default | Effect |
|
|
233
|
+
| --- | --- | --- |
|
|
234
|
+
| `LAUNCH_URL` | `http://localhost:8080` | Base URL for navigation steps. |
|
|
235
|
+
| `BROWSER` | `chromium` | Browser engine. |
|
|
236
|
+
| `HEADLESS` | `true` | `false` opens a visible browser. |
|
|
237
|
+
| `SLOW_MO` | `300` (headed: `800`) | Per-action delay (ms). Set to `0` for fast runs. |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## npm scripts
|
|
242
|
+
|
|
243
|
+
| Script | Description |
|
|
244
|
+
| --- | --- |
|
|
245
|
+
| `npm test` | Default profile, full pretty output, slow-mo on. |
|
|
246
|
+
| `npm run test:headed` | `HEADLESS=false`. Watches the browser. |
|
|
247
|
+
| `npm run test:fast` | `SLOW_MO=0` on the default profile. |
|
|
248
|
+
| `npm run test:chromium` | `BROWSER=chromium npm test`. |
|
|
249
|
+
| `npm run test:firefox` | `BROWSER=firefox npm test`. |
|
|
250
|
+
| `npm run test:webkit` | `BROWSER=webkit npm test`. |
|
|
251
|
+
| `npm start` | Static dev server on port 8080 (`http-server examples`). |
|
|
252
|
+
| `npm run generate-reports` | Manually rebuild the HTML report from the JSON output. |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Recipe — typical CI lane
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
LAUNCH_URL=https://staging.example.com \
|
|
260
|
+
SLOW_MO=0 \
|
|
261
|
+
BROWSER=chromium \
|
|
262
|
+
VARBASE_E2E_SCREENSHOT_PURGE=1 \
|
|
263
|
+
npx cucumber-js --tags "@critical and not @wip" --parallel 4 --retry 1 --retry-tag-filter @flaky
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Translation: zero slow-mo, 4 parallel processes, retry `@flaky` once,
|
|
267
|
+
fresh `screenshots/` each run, only `@critical` (excluding work-in-progress).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
# DDEV Varbase E2E
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This add-on integrates "Varbase E2E — a Playwright + Cucumber-JS Automated Functional Acceptance Testing framework" into DDEV projects, enabling automated browser testing via Gherkin `.feature` files within the DDEV environment.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Execute the command to add and configure the tool:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
ddev add-on get Vardot/ddev-varbase-e2e
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The installation automatically scaffolds required configuration files, creates a starter feature file, installs Playwright browsers, and restarts the DDEV environment.
|
|
17
|
+
|
|
18
|
+
### Install Dependencies
|
|
19
|
+
|
|
20
|
+
**Using npm:**
|
|
21
|
+
```
|
|
22
|
+
ddev npm install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Using yarn:**
|
|
26
|
+
```
|
|
27
|
+
ddev yarn install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Running Tests
|
|
31
|
+
|
|
32
|
+
### With npm
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
ddev npm run test:chromium # Run all tests with Chromium
|
|
36
|
+
ddev npm run test:firefox # Run all tests with Firefox
|
|
37
|
+
ddev npm run test:webkit # Run all tests with WebKit
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### With yarn
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
ddev yarn test:chromium # Run all tests with Chromium
|
|
44
|
+
ddev yarn test:firefox # Run all tests with Firefox
|
|
45
|
+
ddev yarn test:webkit # Run all tests with WebKit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Running Specific Tests
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
ddev exec npx cucumber-js --config cucumber.js tests/features/example.feature
|
|
52
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# Install Varbase E2E
|
|
3
|
+
|
|
4
|
+
**Install Varbase E2E on your project. Simply execute the following command:**
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
npm add varbase-e2e
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Automated Functional Acceptance Testing
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm test
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Boost your site's success with automated testing
|
|
17
|
+
|
|
18
|
+
#### For Commercial Professional Support
|
|
19
|
+
|
|
20
|
+
[Contact Us](/contact)
|
|
21
|
+
|
|
22
|
+
## Documentation Structure
|
|
23
|
+
|
|
24
|
+
The page is part of the Varbase E2E 2.0.x documentation section, which includes:
|
|
25
|
+
|
|
26
|
+
- Global Settings
|
|
27
|
+
- Step Definitions
|
|
28
|
+
- API Step Definitions
|
|
29
|
+
- Advanced Screenshots
|
|
30
|
+
- Advanced Selectors
|
|
31
|
+
- Assertions
|
|
32
|
+
- Commands
|
|
33
|
+
|
|
34
|
+
There is also a subsection on "[DDEV Varbase E2E](/docs/varbase-e2e/2.0.x/install-varbase-e2e/ddev-varbase-e2e)" available under the installation guide.
|
package/docs/overview.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
# Varbase E2E 2.0.x
|
|
3
|
+
|
|
4
|
+
Varbase E2E is an Automated Functional Acceptance Testing tool that streamlines end-to-end testing for web applications. It combines [Playwright](https://playwright.dev/) and [Cucumber-js](https://github.com/cucumber/cucumber-js) with custom step definitions.
|
|
5
|
+
|
|
6
|
+
## Key Features
|
|
7
|
+
|
|
8
|
+
**Test Script Creation:** Users can write scenarios mimicking real user interactions:
|
|
9
|
+
|
|
10
|
+
```gherkin
|
|
11
|
+
Feature: Login page
|
|
12
|
+
Scenario: Successful Login with Valid entries
|
|
13
|
+
Given I am on homepage
|
|
14
|
+
When I go to "login.html"
|
|
15
|
+
And I fill in "Username" with "Smith"
|
|
16
|
+
And I fill in "Password" with "1$34"
|
|
17
|
+
And I press "Login"
|
|
18
|
+
Then I should see "Welcome Smith"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Test Execution:** The tool automates test script execution and verifies outcomes against actual results.
|
|
22
|
+
|
|
23
|
+
**Test Data Management:** Functionality for defining and manipulating input data sets across different test scenarios.
|
|
24
|
+
|
|
25
|
+
**Reporting and Analysis:** Generates detailed reports with passed/failed cases and exception documentation.
|
|
26
|
+
|
|
27
|
+
## Benefits
|
|
28
|
+
|
|
29
|
+
Varbase E2E offers "increased testing efficiency, reduced human error, improved test coverage, and faster time-to-market."
|
|
30
|
+
|
|
31
|
+
## Documentation Sub-pages
|
|
32
|
+
|
|
33
|
+
- [Install Varbase E2E](/docs/varbase-e2e/2.0.x/install-varbase-e2e)
|
|
34
|
+
- [Global Settings](/docs/varbase-e2e/2.0.x/global-settings)
|
|
35
|
+
- [Step Definitions](/docs/varbase-e2e/2.0.x/step-definitions)
|
|
36
|
+
- [API Step Definitions](/docs/varbase-e2e/2.0.x/api-step-definitions)
|
|
37
|
+
- [Advanced Screenshots](/docs/varbase-e2e/2.0.x/advanced-screenshots)
|
|
38
|
+
- [Advanced Selectors](/docs/varbase-e2e/2.0.x/advanced-selectors)
|
|
39
|
+
- [Assertions](/docs/varbase-e2e/2.0.x/assertions)
|
|
40
|
+
- [Commands](/docs/varbase-e2e/2.0.x/commands)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
# Given I am an anonymous user
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```gherkin
|
|
7
|
+
Given(/^(I am |we are )?an anonymous user)
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
"This step ensures that the current user is not logged in." It configures the browser to simulate a guest visitor state without active session or authentication credentials.
|
|
13
|
+
|
|
14
|
+
## Usage Examples
|
|
15
|
+
|
|
16
|
+
```gherkin
|
|
17
|
+
Given I am an anonymous user
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```gherkin
|
|
21
|
+
Given we are an anonymous user
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```gherkin
|
|
25
|
+
Given an anonymous user
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Purpose
|
|
29
|
+
|
|
30
|
+
The step definition supports three syntactic variations to accommodate different BDD writing styles while accomplishing the same objective: establishing an unauthenticated user context for test execution.
|
|
31
|
+
|
|
32
|
+
## More examples
|
|
33
|
+
|
|
34
|
+
<!-- generated: extended-examples -->
|
|
35
|
+
|
|
36
|
+
### Example 1
|
|
37
|
+
|
|
38
|
+
```gherkin
|
|
39
|
+
Given I am an anonymous user
|
|
40
|
+
When I am on "/dashboard"
|
|
41
|
+
Then I should see "Sign in"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Example 2
|
|
45
|
+
|
|
46
|
+
```gherkin
|
|
47
|
+
Given I am an anonymous user
|
|
48
|
+
When I am on the homepage
|
|
49
|
+
Then I should not see "Logout"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example 3
|
|
53
|
+
|
|
54
|
+
```gherkin
|
|
55
|
+
Given I am an anonymous user
|
|
56
|
+
When I am on "/checkout"
|
|
57
|
+
Then I should be on "/login"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Example 4
|
|
61
|
+
|
|
62
|
+
```gherkin
|
|
63
|
+
Given an anonymous user
|
|
64
|
+
When I am on "/admin"
|
|
65
|
+
Then the response status code should be 403
|
|
66
|
+
```
|
|
67
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
# Given I am on homepage
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
Given (I am |we are )?on( the)* (homepage|frontpage)
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
This step definition establishes the initial context for test scenarios by specifying that a user is currently viewing the website's homepage. When executed, it performs necessary actions to navigate to the homepage, which may include opening a browser, entering the URL, and waiting for the page to fully load. Implementation details vary based on the testing framework and application being tested.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Given I am on homepage
|
|
18
|
+
|
|
19
|
+
Given I am on the homepage
|
|
20
|
+
|
|
21
|
+
Given I am on frontpage
|
|
22
|
+
|
|
23
|
+
Given I am on the frontpage
|
|
24
|
+
|
|
25
|
+
Given we are on homepage
|
|
26
|
+
|
|
27
|
+
Given on the homepage
|
|
28
|
+
|
|
29
|
+
Given on homepage
|
|
30
|
+
|
|
31
|
+
Given we are on the frontpage
|
|
32
|
+
|
|
33
|
+
Given on frontpage
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## More examples
|
|
37
|
+
|
|
38
|
+
<!-- generated: extended-examples -->
|
|
39
|
+
|
|
40
|
+
### Example 1
|
|
41
|
+
|
|
42
|
+
```gherkin
|
|
43
|
+
Given I am on the homepage
|
|
44
|
+
Then I should see "Welcome"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Example 2
|
|
48
|
+
|
|
49
|
+
```gherkin
|
|
50
|
+
Given we are on homepage
|
|
51
|
+
Then "<header>" should be visible
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Example 3
|
|
55
|
+
|
|
56
|
+
```gherkin
|
|
57
|
+
Given on the frontpage
|
|
58
|
+
Then the page should have a main landmark
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Example 4
|
|
62
|
+
|
|
63
|
+
```gherkin
|
|
64
|
+
Given I am on the homepage
|
|
65
|
+
When I follow "About"
|
|
66
|
+
Then I should be on "/about"
|
|
67
|
+
```
|
|
68
|
+
|