@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,72 @@
|
|
|
1
|
+
|
|
2
|
+
# Given I am on "specific" page
|
|
3
|
+
|
|
4
|
+
## Step Definition Pattern
|
|
5
|
+
|
|
6
|
+
```gherkin
|
|
7
|
+
Given (I am |we are )*on( the)* "([^"]*)?"( page)*
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
This step definition establishes the initial context for test scenarios by navigating to a designated webpage. Upon execution, it performs the necessary actions to access a specific page, including launching a browser, entering the URL, and allowing the page to fully load.
|
|
13
|
+
|
|
14
|
+
## Usage Examples
|
|
15
|
+
|
|
16
|
+
```gherkin
|
|
17
|
+
Given I am on "contact"
|
|
18
|
+
|
|
19
|
+
Given we are on "user/login"
|
|
20
|
+
|
|
21
|
+
Given I am on the "/about-us" page
|
|
22
|
+
|
|
23
|
+
Given we are on the "/about-us" page
|
|
24
|
+
|
|
25
|
+
Given on "/about-us"
|
|
26
|
+
|
|
27
|
+
Given on the "/about-us" page
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Key Information
|
|
31
|
+
|
|
32
|
+
This step definition is part of the Varbase E2E 2.0.x documentation's Step Definitions section. It supports flexible phrasing patterns, allowing users to specify page locations using various grammatical structures. The pattern accepts optional articles ("the") and the word "page," accommodating different natural language preferences while directing the test to navigate to the specified URL or page identifier.
|
|
33
|
+
|
|
34
|
+
## More examples
|
|
35
|
+
|
|
36
|
+
<!-- generated: extended-examples -->
|
|
37
|
+
|
|
38
|
+
### Example 1
|
|
39
|
+
|
|
40
|
+
```gherkin
|
|
41
|
+
Given I am on "/about"
|
|
42
|
+
Then I should see "Our mission"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 2
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
Given I am on "/products?category=laptops"
|
|
49
|
+
Then I should see 12 ".product-card" elements
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example 3
|
|
53
|
+
|
|
54
|
+
```gherkin
|
|
55
|
+
Given we are on the "/contact" page
|
|
56
|
+
Then "<form>" should be visible
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Example 4
|
|
60
|
+
|
|
61
|
+
```gherkin
|
|
62
|
+
Given I am on "/blog/2026/05/launch"
|
|
63
|
+
Then the page should have exactly one h1
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Example 5
|
|
67
|
+
|
|
68
|
+
```gherkin
|
|
69
|
+
Given on "/admin/users"
|
|
70
|
+
Then I should see "User list"
|
|
71
|
+
```
|
|
72
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
# Then I should be
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This step definition category is designed to verify that navigation functions correctly and users arrive at the intended pages following interactions. As stated on the page: "This step is useful for ensuring that the navigation through a website is working correctly and that the user lands on the intended page after performing certain actions or interactions."
|
|
7
|
+
|
|
8
|
+
## Available Step Definitions
|
|
9
|
+
|
|
10
|
+
The "Then I should be" group contains four primary variations:
|
|
11
|
+
|
|
12
|
+
1. **Then I should be on (the) homepage**
|
|
13
|
+
2. **Then I should not be on (the) homepage**
|
|
14
|
+
3. **Then I should be on "specific page"**
|
|
15
|
+
4. **Then I should not be on "page path"**
|
|
16
|
+
|
|
17
|
+
Each step allows testers to validate whether the current page matches expected navigation outcomes.
|
|
18
|
+
|
|
19
|
+
## Purpose
|
|
20
|
+
|
|
21
|
+
These assertions verify successful navigation by confirming the user's location within the website after executing actions like clicking links, submitting forms, or using browser controls. They serve as validation checkpoints in automated testing workflows.
|
|
22
|
+
|
|
23
|
+
## More examples
|
|
24
|
+
|
|
25
|
+
<!-- generated: extended-examples -->
|
|
26
|
+
|
|
27
|
+
### Example 1
|
|
28
|
+
|
|
29
|
+
```gherkin
|
|
30
|
+
Then I should be on "/dashboard"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Example 2
|
|
34
|
+
|
|
35
|
+
```gherkin
|
|
36
|
+
Then I should be on the homepage
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example 3
|
|
40
|
+
|
|
41
|
+
```gherkin
|
|
42
|
+
And I should not be on the frontpage
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 4
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
Then we should be on "/account"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 5
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
Then I should be on "/auth/callback"
|
|
55
|
+
```
|
|
56
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
# Then I should see
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This step definition enables verification that specific elements or messages display correctly on a webpage or application, confirming expected content visibility for both users and automated tests.
|
|
7
|
+
|
|
8
|
+
## Available Step Definitions
|
|
9
|
+
|
|
10
|
+
The following step variations are available:
|
|
11
|
+
|
|
12
|
+
- Then I should see "text in the page"
|
|
13
|
+
- Then I should not see "text in the page"
|
|
14
|
+
- Then I should see text matching "text pattern"
|
|
15
|
+
- Then I should not see text matching "text pattern"
|
|
16
|
+
- Then I should see text matching "text pattern" in the "element" element
|
|
17
|
+
- Then I should not see text matching "text pattern" in the "element" element
|
|
18
|
+
- Then I should see (a/an) "field" element
|
|
19
|
+
- Then I should not see (a/an) "field" element
|
|
20
|
+
- Then I should see "value" in the "text" element
|
|
21
|
+
- Then I should not see "value" in the "text" element
|
|
22
|
+
- Then I should see "value" in the "text" element by attr
|
|
23
|
+
- Then I should not see "value" in the "text" element by attr
|
|
24
|
+
|
|
25
|
+
## Purpose
|
|
26
|
+
|
|
27
|
+
"This step is useful for verifying that certain elements or messages are displayed correctly on a webpage or application, ensuring that the expected content is visible to the user or the automated tests."
|
|
28
|
+
|
|
29
|
+
## More examples
|
|
30
|
+
|
|
31
|
+
<!-- generated: extended-examples -->
|
|
32
|
+
|
|
33
|
+
### Example 1
|
|
34
|
+
|
|
35
|
+
```gherkin
|
|
36
|
+
Then I should see "Welcome"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example 2
|
|
40
|
+
|
|
41
|
+
```gherkin
|
|
42
|
+
Then I should not see "Access denied"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 3
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
And I should see "Order Confirmed"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 4
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
Then we should see "Sign in"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example 5
|
|
58
|
+
|
|
59
|
+
```gherkin
|
|
60
|
+
Then I should see "Total: $99.00"
|
|
61
|
+
```
|
|
62
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
# Then the "item" checkbox
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This step definition validates whether a checkbox associated with a specified item is in a checked or unchecked state. It serves to confirm expected checkbox behavior during automated testing.
|
|
7
|
+
|
|
8
|
+
## Related Step Definitions
|
|
9
|
+
|
|
10
|
+
The following variations of this step are available:
|
|
11
|
+
|
|
12
|
+
- **Then the "item" checkbox is checked** – Asserts the checkbox is currently checked
|
|
13
|
+
- **Then the "item" checkbox is not checked** – Asserts the checkbox is currently unchecked
|
|
14
|
+
- **Then the "item" checkbox should be checked** – Validates the checkbox should be in a checked state
|
|
15
|
+
- **Then the "item" checkbox should not be checked** – Validates the checkbox should be in an unchecked state
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
This step definition "typically indicates that the associated option or feature is in a checked or unchecked state. It is used to validate the expected behavior."
|
|
20
|
+
|
|
21
|
+
## More examples
|
|
22
|
+
|
|
23
|
+
<!-- generated: extended-examples -->
|
|
24
|
+
|
|
25
|
+
### Example 1
|
|
26
|
+
|
|
27
|
+
```gherkin
|
|
28
|
+
Then the "#privacy-policy" checkbox should be checked
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Example 2
|
|
32
|
+
|
|
33
|
+
```gherkin
|
|
34
|
+
Then the "#newsletter" checkbox should not be checked
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Example 3
|
|
38
|
+
|
|
39
|
+
```gherkin
|
|
40
|
+
And the "#agree" checkbox is checked
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Example 4
|
|
44
|
+
|
|
45
|
+
```gherkin
|
|
46
|
+
Then the checkbox "#subscribe" should be checked
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Example 5
|
|
50
|
+
|
|
51
|
+
```gherkin
|
|
52
|
+
Then the checkbox ".terms" is not checked
|
|
53
|
+
```
|
|
54
|
+
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
# Then the "item" link should contain "url"
|
|
3
|
+
|
|
4
|
+
## Basic Definition
|
|
5
|
+
|
|
6
|
+
This step ensures that the `href` attribute of a link element includes a URL or part of a URL, identified by its link text.
|
|
7
|
+
|
|
8
|
+
**Gherkin Pattern:**
|
|
9
|
+
```
|
|
10
|
+
Then (the )*"([^"]*)?" link should contain "([^"]*)?"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Example:**
|
|
14
|
+
```
|
|
15
|
+
Then the "Login" link should contain "/log-in"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## By Attribute Variant
|
|
19
|
+
|
|
20
|
+
This variation checks a link's href using an attribute selector approach.
|
|
21
|
+
|
|
22
|
+
**Gherkin Pattern:**
|
|
23
|
+
```
|
|
24
|
+
Then (the )*"([^"]*)?" link should contain "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Example 1:**
|
|
28
|
+
```
|
|
29
|
+
Then the "#aboutUsid" link should contain "about" by attr
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Example 2:**
|
|
33
|
+
```
|
|
34
|
+
Then the ".contactUs" link should contain "/contact-" by attr
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## By Specific Attribute Variant
|
|
38
|
+
|
|
39
|
+
Checks link content against a particular attribute type.
|
|
40
|
+
|
|
41
|
+
**Gherkin Pattern:**
|
|
42
|
+
```
|
|
43
|
+
Then the "item" link should contain "url" by its "class" attribute
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Example:**
|
|
47
|
+
```
|
|
48
|
+
Then the "aboutUs" link should contain "about" by its "class" attribute
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## More examples
|
|
52
|
+
|
|
53
|
+
<!-- generated: extended-examples -->
|
|
54
|
+
|
|
55
|
+
### Example 1
|
|
56
|
+
|
|
57
|
+
```gherkin
|
|
58
|
+
Then the "Login" link should contain "/log-in"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Example 2
|
|
62
|
+
|
|
63
|
+
```gherkin
|
|
64
|
+
And the "About Us" link should contain "/about"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Example 3
|
|
68
|
+
|
|
69
|
+
```gherkin
|
|
70
|
+
Then "Home" link should contain "/"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Example 4
|
|
74
|
+
|
|
75
|
+
```gherkin
|
|
76
|
+
Then the "main-nav" link should contain "about" by its "class" attribute
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Example 5
|
|
80
|
+
|
|
81
|
+
```gherkin
|
|
82
|
+
Then the "#contact" link should contain "/contact-us" by attr
|
|
83
|
+
```
|
|
84
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
# Then the item should contain
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
This documentation page describes a collection of step definitions that function as assertions or expectations. They verify whether specific elements contain particular content, text, or CSS styles.
|
|
7
|
+
|
|
8
|
+
## Step Definitions
|
|
9
|
+
|
|
10
|
+
### Field Content Assertions
|
|
11
|
+
|
|
12
|
+
**Then the "item" field should contain "value"**
|
|
13
|
+
- Verifies a field element contains specified text
|
|
14
|
+
|
|
15
|
+
**Then the "item" field should not contain "value"**
|
|
16
|
+
- Confirms a field element does not contain specified text
|
|
17
|
+
|
|
18
|
+
### Response Content Assertions
|
|
19
|
+
|
|
20
|
+
**Then the response should contain "text in the page"**
|
|
21
|
+
- Checks page response includes given text
|
|
22
|
+
|
|
23
|
+
**Then the response should not contain "text in the page"**
|
|
24
|
+
- Confirms page response excludes given text
|
|
25
|
+
|
|
26
|
+
### Element Style Assertions
|
|
27
|
+
|
|
28
|
+
**Then the "item" element should contain "CSS style"**
|
|
29
|
+
- Validates an element possesses specified CSS styling
|
|
30
|
+
|
|
31
|
+
**Then the "item" element should not contain "CSS style"**
|
|
32
|
+
- Ensures an element lacks specified CSS styling
|
|
33
|
+
|
|
34
|
+
## More examples
|
|
35
|
+
|
|
36
|
+
<!-- generated: extended-examples -->
|
|
37
|
+
|
|
38
|
+
### Example 1
|
|
39
|
+
|
|
40
|
+
```gherkin
|
|
41
|
+
Then the "#username" element should contain "color: rgb(0, 0, 0)"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Example 2
|
|
45
|
+
|
|
46
|
+
```gherkin
|
|
47
|
+
Then the "body" element should contain "font-family: Arial"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Example 3
|
|
51
|
+
|
|
52
|
+
```gherkin
|
|
53
|
+
And the "#cta" element should contain "background-color: rgb(255, 0, 0)"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Example 4
|
|
57
|
+
|
|
58
|
+
```gherkin
|
|
59
|
+
Then the ".error" element should not contain "display: none"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Example 5
|
|
63
|
+
|
|
64
|
+
```gherkin
|
|
65
|
+
Then the "#header" element should contain "padding: 16px"
|
|
66
|
+
```
|
|
67
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
# Then the radio button "value" should be selected
|
|
3
|
+
|
|
4
|
+
## Gherkin Step Definition
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
Then( the)* radio button with value "([^"]*)?" should( not)* be selected
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
This step validates whether a radio button matching the specified selector is selected or not selected on the page.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
**Example #1:**
|
|
17
|
+
```
|
|
18
|
+
Then the radio button "#gender-male" should be selected
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Example #2:**
|
|
22
|
+
```
|
|
23
|
+
Then the radio button ".option-1" should be selected
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Example #3 (Negative assertion):**
|
|
27
|
+
```
|
|
28
|
+
Then the radio button "#gender-female" should not be selected
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Purpose
|
|
32
|
+
|
|
33
|
+
The step definition "verifies that the radio button is not selected" or confirms its selected state based on the assertion type used (with or without the `not` modifier).
|
|
34
|
+
|
|
35
|
+
## More examples
|
|
36
|
+
|
|
37
|
+
<!-- generated: extended-examples -->
|
|
38
|
+
|
|
39
|
+
### Example 1
|
|
40
|
+
|
|
41
|
+
```gherkin
|
|
42
|
+
Then the radio button with value "male" should be selected
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 2
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
Then the radio button with value "premium" should be selected
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 3
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
And the radio button with value "monthly" should not be selected
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example 4
|
|
58
|
+
|
|
59
|
+
```gherkin
|
|
60
|
+
Then the radio button with value "yes" should be selected
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example 5
|
|
64
|
+
|
|
65
|
+
```gherkin
|
|
66
|
+
Then the radio button with value "annual" should not be selected
|
|
67
|
+
```
|
|
68
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
# Then the response status code should be {number}
|
|
3
|
+
|
|
4
|
+
## Description
|
|
5
|
+
|
|
6
|
+
"This step definition is used after making a request to the web service under test. Once the response is received, this step definition asserts HTTP status code returned by the server matches the expected code."
|
|
7
|
+
|
|
8
|
+
## Gherkin Syntax
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Then the response status code should( not)* be (\d+)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
### Example 1: Successful Request
|
|
17
|
+
```
|
|
18
|
+
Then the response status code should be 200
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The code 200 indicates a successful request where "the server has processed the request and returned the appropriate response."
|
|
22
|
+
|
|
23
|
+
### Example 2: Resource Not Found
|
|
24
|
+
```
|
|
25
|
+
Then the response status code should not be 404
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The code 404 indicates "the requested resource not found on the server. Meaning a possible error or invalid URL. So that it should not be 404."
|
|
29
|
+
|
|
30
|
+
## Parameters
|
|
31
|
+
|
|
32
|
+
- `{number}`: The expected HTTP status code (numeric value)
|
|
33
|
+
- `not` (optional): Negation modifier to assert the status code should NOT match the specified value
|
|
34
|
+
|
|
35
|
+
## More examples
|
|
36
|
+
|
|
37
|
+
<!-- generated: extended-examples -->
|
|
38
|
+
|
|
39
|
+
### Example 1
|
|
40
|
+
|
|
41
|
+
```gherkin
|
|
42
|
+
Then the response status code should be 200
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 2
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
Then the response status code should be 404
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 3
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
And the response status code should be 301
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example 4
|
|
58
|
+
|
|
59
|
+
```gherkin
|
|
60
|
+
Then the response status code should not be 500
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example 5
|
|
64
|
+
|
|
65
|
+
```gherkin
|
|
66
|
+
When I am on "/admin"
|
|
67
|
+
Then the response status code should be 403
|
|
68
|
+
```
|
|
69
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
# Then the "value" radio button is selected
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
Then (the )"([^"])?" radio button is( not)* selected
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
This step verifies whether a specified radio button is selected or not using Nightwatch's built-in assertion functionality.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
**Example #1:** `Then the "#gender-male" radio button is selected`
|
|
17
|
+
|
|
18
|
+
Confirms that the radio button with the specified selector is currently selected.
|
|
19
|
+
|
|
20
|
+
**Example #2:** `Then the "#gender-female" radio button is not selected`
|
|
21
|
+
|
|
22
|
+
Validates that the radio button is not in a selected state.
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
- **Selector** (required): The radio button identifier, typically a CSS selector or element reference in quotes
|
|
27
|
+
- **Negation** (optional): The phrase "not" can be appended to assert the button is unselected
|
|
28
|
+
|
|
29
|
+
## More examples
|
|
30
|
+
|
|
31
|
+
<!-- generated: extended-examples -->
|
|
32
|
+
|
|
33
|
+
### Example 1
|
|
34
|
+
|
|
35
|
+
```gherkin
|
|
36
|
+
Then the "#gender-male" radio button is selected
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example 2
|
|
40
|
+
|
|
41
|
+
```gherkin
|
|
42
|
+
Then the "#plan-premium" radio button is selected
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 3
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
And the ".option-1" radio button is not selected
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 4
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
Then the "#yes" radio button is selected
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example 5
|
|
58
|
+
|
|
59
|
+
```gherkin
|
|
60
|
+
Then the "#monthly" radio button is not selected
|
|
61
|
+
```
|
|
62
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
# When I attach the file "file name" to "element"
|
|
3
|
+
|
|
4
|
+
## Gherkin Step Phrasing
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
When (I|we)* attach the file "([^"]*)?" to "([^"]*)?"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
This step definition enables test automation for file uploads by attaching files to file input elements. The step allows subsequent actions to be performed on the uploaded files.
|
|
13
|
+
|
|
14
|
+
## Setup Requirements
|
|
15
|
+
|
|
16
|
+
Test files must be organized in the `tests/assets` directory. Files should be placed there in advance with appropriate naming. During feature execution, files are referenced by name and loaded into the file input element identified by the specified selector.
|
|
17
|
+
|
|
18
|
+
For proper configuration of the `tests/assets` folder path, reference the Global Settings documentation.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Create a step that attaches a file to a field using its id, class, name, or label identifier.
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
When I attach the file "profileIcon.jpg" to "#profileIconUpload"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Parameters
|
|
31
|
+
|
|
32
|
+
- **file name**: The name of the file located in `tests/assets`
|
|
33
|
+
- **element**: The target field identifier (id, class, name, or label)
|
|
34
|
+
|
|
35
|
+
## More examples
|
|
36
|
+
|
|
37
|
+
<!-- generated: extended-examples -->
|
|
38
|
+
|
|
39
|
+
### Example 1
|
|
40
|
+
|
|
41
|
+
```gherkin
|
|
42
|
+
When I attach the file "resume.pdf" to "#resume"
|
|
43
|
+
And I press "Upload"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Example 2
|
|
47
|
+
|
|
48
|
+
```gherkin
|
|
49
|
+
When I attach the file "logo.svg" to "input[name=logo]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example 3
|
|
53
|
+
|
|
54
|
+
```gherkin
|
|
55
|
+
When we attach file "report.csv" to "[data-testid=csv-upload]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Example 4
|
|
59
|
+
|
|
60
|
+
```gherkin
|
|
61
|
+
When I attach file "video.mp4" to "#video-input"
|
|
62
|
+
And I wait for AJAX to finish
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Example 5
|
|
66
|
+
|
|
67
|
+
```gherkin
|
|
68
|
+
When I attach the file "profile.jpg" to "#avatar-upload"
|
|
69
|
+
Then I should see "Avatar uploaded"
|
|
70
|
+
```
|
|
71
|
+
|