webship-js 2.0.1 → 2.0.3
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 +109 -0
- package/CLAUDE.md +317 -0
- package/bin/generate-reports.js +363 -0
- package/bin/init-webship.js +343 -0
- package/bin/postinstall.js +8 -74
- package/cucumber.js +66 -2
- 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 +728 -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/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/diffy-step-definitions/then-compare-diffy-env1-env2.md +30 -0
- package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +21 -0
- package/docs/diffy-step-definitions/then-create-diffy-comparison.md +25 -0
- package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +35 -0
- package/docs/diffy-step-definitions/then-i-take-screenshot.md +21 -0
- package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +27 -0
- package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +27 -0
- package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +28 -0
- package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +21 -0
- package/docs/diffy-step-definitions/when-i-resize-window-number.md +29 -0
- package/docs/diffy-step-definitions.md +21 -0
- package/docs/global-settings.md +244 -0
- package/docs/index.md +104 -0
- package/docs/install-webship-js/ddev-webship-js.md +52 -0
- package/docs/install-webship-js.md +35 -0
- package/docs/overview.md +41 -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 +50 -0
- package/examples/a11y.html +31 -0
- package/examples/cookies.html +10 -0
- package/examples/date.html +12 -0
- package/examples/diffy/baseline.html +54 -0
- package/examples/diffy/changed.html +63 -0
- package/examples/diffy/index.html +52 -0
- package/examples/element.html +11 -0
- package/examples/field.html +24 -0
- package/examples/index.html +6 -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--when--i-additionally-select.html +27 -0
- package/package.json +19 -6
- package/playwright.config.ts +3 -2
- package/tests/features/a11y.feature +39 -0
- package/tests/features/cookie.feature +13 -0
- package/tests/features/date.feature +11 -0
- package/tests/features/diffy/test--diffy-01-example-demo.feature +22 -0
- package/tests/features/diffy/test--diffy-02-all-steps.feature +52 -0
- package/tests/features/diffy/test--diffy-03-real-api.feature +21 -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 +1 -1
- 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--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-see-n-elements.feature +24 -0
- package/tests/features/test--then--print-current-url-and-response.feature +21 -0
- package/tests/features/test--when--i-additionally-select.feature +30 -0
- package/tests/features/test--when--i-follow.feature +22 -0
- package/tests/features/wait.feature +7 -0
- package/tests/features/yaml.feature +102 -0
- package/tests/reports/README.md +55 -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 +798 -0
- package/tests/step-definitions/action.steps.js +167 -0
- package/tests/step-definitions/{webship-api.js → api.steps.js} +254 -44
- package/tests/step-definitions/assertion.steps.js +352 -0
- package/tests/step-definitions/auth.steps.js +124 -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 +31 -0
- package/tests/step-definitions/dialog.steps.js +193 -0
- package/tests/step-definitions/element.steps.js +314 -0
- package/tests/step-definitions/field.steps.js +653 -0
- package/tests/step-definitions/file-download.steps.js +193 -0
- package/tests/step-definitions/form.steps.js +333 -0
- package/tests/step-definitions/iframe.steps.js +178 -0
- package/tests/step-definitions/input.steps.js +163 -0
- package/tests/step-definitions/javascript.steps.js +71 -0
- package/tests/step-definitions/keyboard.steps.js +78 -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 +219 -0
- package/tests/step-definitions/navigation.steps.js +218 -0
- package/tests/step-definitions/network.steps.js +238 -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 +123 -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 +996 -0
- package/tests/step-definitions/storage.steps.js +194 -0
- package/tests/step-definitions/table.steps.js +181 -0
- package/tests/step-definitions/wait.steps.js +400 -0
- package/tests/step-definitions/web-first.steps.js +296 -0
- package/tests/step-definitions/webship.js +567 -923
- package/tests/step-definitions/xml.steps.js +409 -0
- package/tests/step-definitions/yaml.steps.js +911 -0
- package/tests/step-definitions-diffy/README.md +329 -0
- package/tests/step-definitions-diffy/mock-diffy-api/server.js +84 -0
- package/tests/step-definitions-diffy/webship-diffy-mock.js +31 -0
- package/tests/step-definitions-diffy/webship-diffy.js +459 -0
- package/tsconfig.json +19 -3
- package/generate-reports.js +0 -22
- package/required/cucumber.js +0 -37
- package/required/generate-reports.js +0 -22
- package/required/package.json +0 -18
- package/required/playwright.config.ts +0 -37
- package/required/tests/features/README.md +0 -1
- package/required/tests/features/check-homepage.feature +0 -8
- package/required/tests/reports/README.md +0 -1
- package/required/tests/step-definitions/README.md +0 -1
- package/required/tests/step-definitions/custom.js +0 -4
- package/required/tsconfig.json +0 -12
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
# When I reload the page
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```gherkin
|
|
7
|
+
When (I|we)* reload( the)* page
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
This step definition is employed in website testing to signal that the user is refreshing the current page. It's typically used after executing an event on the page, when results are expected to appear following a page reload.
|
|
13
|
+
|
|
14
|
+
## Usage Examples
|
|
15
|
+
|
|
16
|
+
```gherkin
|
|
17
|
+
When I reload the page
|
|
18
|
+
When we reload page
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Context
|
|
22
|
+
|
|
23
|
+
The step definition supports flexible phrasing with optional words, allowing testers to write natural language scenarios. It's part of the Webship JS 2.0.x testing framework and appears within the broader "Step Definitions" documentation section alongside other navigation and interaction steps.
|
|
24
|
+
|
|
25
|
+
## More examples
|
|
26
|
+
|
|
27
|
+
<!-- generated: extended-examples -->
|
|
28
|
+
|
|
29
|
+
### Example 1
|
|
30
|
+
|
|
31
|
+
```gherkin
|
|
32
|
+
When I reload
|
|
33
|
+
Then I should see "Welcome"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Example 2
|
|
37
|
+
|
|
38
|
+
```gherkin
|
|
39
|
+
When I press "Save"
|
|
40
|
+
And I reload the page
|
|
41
|
+
Then I should see "Saved"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Example 3
|
|
45
|
+
|
|
46
|
+
```gherkin
|
|
47
|
+
When we reload page
|
|
48
|
+
And I wait for AJAX to finish
|
|
49
|
+
Then "<.spinner>" should not be visible
|
|
50
|
+
```
|
|
51
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
# When I Scroll
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
"Use this step when you want to simulate a scroll action on the page during your automated testing scenario. It can be helpful to test lazy-loaded elements, infinite scroll areas, or to simply bring specific elements into view."
|
|
7
|
+
|
|
8
|
+
## Available Scroll Step Definitions
|
|
9
|
+
|
|
10
|
+
The following scroll-related steps are available in Webship JS 2.0.x:
|
|
11
|
+
|
|
12
|
+
- When I scroll down
|
|
13
|
+
- When I scroll up
|
|
14
|
+
- When I scroll to top
|
|
15
|
+
- When I scroll to the bottom
|
|
16
|
+
- When I scroll to top of "<selector>"
|
|
17
|
+
- When I scroll to bottom of "<selector>"
|
|
18
|
+
- When I scroll right
|
|
19
|
+
- When I scroll left
|
|
20
|
+
- When I scroll to start
|
|
21
|
+
- When I scroll to the end
|
|
22
|
+
- When I scroll to start of "<selector>"
|
|
23
|
+
- When I scroll to end of "<selector>"
|
|
24
|
+
|
|
25
|
+
Each step enables testing of different scrolling behaviors to validate page functionality, element visibility, and lazy-loading mechanisms within automated testing scenarios.
|
|
26
|
+
|
|
27
|
+
## More examples
|
|
28
|
+
|
|
29
|
+
<!-- generated: extended-examples -->
|
|
30
|
+
|
|
31
|
+
### Example 1
|
|
32
|
+
|
|
33
|
+
```gherkin
|
|
34
|
+
When I scroll down
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Example 2
|
|
38
|
+
|
|
39
|
+
```gherkin
|
|
40
|
+
When I scroll down 800
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Example 3
|
|
44
|
+
|
|
45
|
+
```gherkin
|
|
46
|
+
And I scroll to the top
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Example 4
|
|
50
|
+
|
|
51
|
+
```gherkin
|
|
52
|
+
When I scroll to the bottom
|
|
53
|
+
And I wait for AJAX to finish
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Example 5
|
|
57
|
+
|
|
58
|
+
```gherkin
|
|
59
|
+
When I scroll to top of "#sidebar"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Example 6
|
|
63
|
+
|
|
64
|
+
```gherkin
|
|
65
|
+
And we scroll to bottom of "#log-panel"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Example 7
|
|
69
|
+
|
|
70
|
+
```gherkin
|
|
71
|
+
When I scroll right 500
|
|
72
|
+
```
|
|
73
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
# When I select "option" from "select list"
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
When (I|we)* select "([^"]*)?" from "([^"]*)?"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
"This step definition acts as a command to select an option from a dropdown list." The mechanism identifies a select element by its associated label, then selects the matching option based on its displayed text.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
**Selection by label:**
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
When we select "Mercedes" from "Cars"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This syntax allows test authors to select dropdown values using human-readable option names and field labels rather than technical selectors.
|
|
23
|
+
|
|
24
|
+
## More examples
|
|
25
|
+
|
|
26
|
+
<!-- generated: extended-examples -->
|
|
27
|
+
|
|
28
|
+
### Example 1
|
|
29
|
+
|
|
30
|
+
```gherkin
|
|
31
|
+
When I select "Mercedes" from "Cars"
|
|
32
|
+
Then I should see "Mercedes selected"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Example 2
|
|
36
|
+
|
|
37
|
+
```gherkin
|
|
38
|
+
When I select "saab" from "#cars"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Example 3
|
|
42
|
+
|
|
43
|
+
```gherkin
|
|
44
|
+
When we select "English" from "Language"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Example 4
|
|
48
|
+
|
|
49
|
+
```gherkin
|
|
50
|
+
When I select "Premium" from "Plan"
|
|
51
|
+
And I press "Continue"
|
|
52
|
+
```
|
|
53
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
# When I select radio button "value"
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
When (I |we ) select radio button "([^"]*)?"`
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
Selects the radio button specified by label text, value, or selector.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
When I select radio button "Male"
|
|
18
|
+
When I select radio button "female"
|
|
19
|
+
When I select radio button "#gender-male"
|
|
20
|
+
When we select radio button "option1"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage Notes
|
|
24
|
+
|
|
25
|
+
The step accepts multiple input types: label text, value attributes, or CSS selectors to identify and select the target radio button element.
|
|
26
|
+
|
|
27
|
+
## More examples
|
|
28
|
+
|
|
29
|
+
<!-- generated: extended-examples -->
|
|
30
|
+
|
|
31
|
+
### Example 1
|
|
32
|
+
|
|
33
|
+
```gherkin
|
|
34
|
+
When I select radio button "Male"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Example 2
|
|
38
|
+
|
|
39
|
+
```gherkin
|
|
40
|
+
When I select radio button "#gender-female"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Example 3
|
|
44
|
+
|
|
45
|
+
```gherkin
|
|
46
|
+
And we select radio button "Premium"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Example 4
|
|
50
|
+
|
|
51
|
+
```gherkin
|
|
52
|
+
When I select radio button "monthly"
|
|
53
|
+
Then the radio button with value "monthly" should be selected
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Example 5
|
|
57
|
+
|
|
58
|
+
```gherkin
|
|
59
|
+
When I select radio button "Yes"
|
|
60
|
+
And I press "Continue"
|
|
61
|
+
```
|
|
62
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
# When I uncheck "checkbox"
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
This step definition serves as a command to clear/deselect a checkbox element.
|
|
6
|
+
|
|
7
|
+
## Gherkin Syntax
|
|
8
|
+
```
|
|
9
|
+
When (I|we)* uncheck "([^"]*)?"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
Define the step of unchecking the checkbox element specified by id|class|name|label.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
**Example (1): label**
|
|
18
|
+
```
|
|
19
|
+
When we uncheck "Remember me"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Example (2): id/class**
|
|
23
|
+
```
|
|
24
|
+
When I uncheck "rememberme"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## More examples
|
|
28
|
+
|
|
29
|
+
<!-- generated: extended-examples -->
|
|
30
|
+
|
|
31
|
+
### Example 1
|
|
32
|
+
|
|
33
|
+
```gherkin
|
|
34
|
+
When I uncheck "Remember me"
|
|
35
|
+
And I press "Sign in"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Example 2
|
|
39
|
+
|
|
40
|
+
```gherkin
|
|
41
|
+
When I uncheck "#newsletter"
|
|
42
|
+
Then the "#newsletter" checkbox should not be checked
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 3
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
When we uncheck ".terms"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 4
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
When I uncheck "Subscribe to updates"
|
|
55
|
+
Then the checkbox "#subscribe" is not checked
|
|
56
|
+
```
|
|
57
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
# When I wait for AJAX to finish
|
|
3
|
+
|
|
4
|
+
## Step Definition
|
|
5
|
+
|
|
6
|
+
```gherkin
|
|
7
|
+
'When (I |we )*wait for AJAX to finish'
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
|
|
12
|
+
"This step waits for an active XMLHttpRequest and Fetch API requests to complete."
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```gherkin
|
|
17
|
+
When I wait for AJAX to finish
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```gherkin
|
|
21
|
+
And I wait for AJAX to finish
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```gherkin
|
|
25
|
+
When we wait for AJAX to finish
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```gherkin
|
|
29
|
+
And wait for AJAX to finish
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## More examples
|
|
33
|
+
|
|
34
|
+
<!-- generated: extended-examples -->
|
|
35
|
+
|
|
36
|
+
### Example 1
|
|
37
|
+
|
|
38
|
+
```gherkin
|
|
39
|
+
When I press "Search"
|
|
40
|
+
And I wait for AJAX to finish
|
|
41
|
+
Then I should see "Results"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Example 2
|
|
45
|
+
|
|
46
|
+
```gherkin
|
|
47
|
+
When I follow "Inbox"
|
|
48
|
+
And I wait for AJAX to finish
|
|
49
|
+
Then I should see at least 1 ".message" element
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example 3
|
|
53
|
+
|
|
54
|
+
```gherkin
|
|
55
|
+
And I wait for AJAX to finish
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Example 4
|
|
59
|
+
|
|
60
|
+
```gherkin
|
|
61
|
+
When we wait for AJAX to finish
|
|
62
|
+
Then "<.toast-success>" should be visible
|
|
63
|
+
```
|
|
64
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
# When I Wait
|
|
3
|
+
|
|
4
|
+
## Description
|
|
5
|
+
|
|
6
|
+
"This step definition indicates that the user will pause or wait for the specified number of seconds/minutes or the maximum number of seconds/minutes before moving to the next step." The functionality is designed for scenarios requiring time-based delays or expected pauses during test execution.
|
|
7
|
+
|
|
8
|
+
## Available Step Definitions
|
|
9
|
+
|
|
10
|
+
The "When I wait" category encompasses five distinct variations:
|
|
11
|
+
|
|
12
|
+
1. **When I wait until the page loaded** - Pauses execution until page load completion
|
|
13
|
+
|
|
14
|
+
2. **When I wait {number} seconds** - Implements a fixed pause for the specified seconds duration
|
|
15
|
+
|
|
16
|
+
3. **When I wait max {number} seconds** - Establishes a maximum wait period in seconds with early completion upon condition satisfaction
|
|
17
|
+
|
|
18
|
+
4. **When I wait {number} minutes** - Creates a fixed pause measured in minutes
|
|
19
|
+
|
|
20
|
+
5. **When I wait max {number} minutes** - Sets a maximum wait period in minutes, allowing early termination when conditions are met
|
|
21
|
+
|
|
22
|
+
## Use Cases
|
|
23
|
+
|
|
24
|
+
These steps prove particularly useful in automated testing scenarios where applications require time-dependent behavior verification or asynchronous operations demand explicit wait periods before proceeding with subsequent test steps.
|
|
25
|
+
|
|
26
|
+
## More examples
|
|
27
|
+
|
|
28
|
+
<!-- generated: extended-examples -->
|
|
29
|
+
|
|
30
|
+
### Example 1
|
|
31
|
+
|
|
32
|
+
```gherkin
|
|
33
|
+
When I press "Save"
|
|
34
|
+
And I wait 2 seconds
|
|
35
|
+
Then I should see "Saved"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Example 2
|
|
39
|
+
|
|
40
|
+
```gherkin
|
|
41
|
+
When I follow "Pricing"
|
|
42
|
+
And I wait until the page is loaded
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Example 3
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
And I wait 1 second
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example 4
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
When I wait max of 5 seconds
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example 5
|
|
58
|
+
|
|
59
|
+
```gherkin
|
|
60
|
+
And I wait until pending timers settle
|
|
61
|
+
```
|
|
62
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
# Step Definitions
|
|
3
|
+
|
|
4
|
+
Step definitions serve as a critical connector in automated testing frameworks employing behavior-driven development (BDD) or test-driven development (TDD) methodologies. They function as "the bridge between the test scenarios or feature files written in a human-readable format and the actual implementation code."
|
|
5
|
+
|
|
6
|
+
## Example Feature
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
Feature: Example test for "Then I should be on 'page'"
|
|
10
|
+
As a tester
|
|
11
|
+
I want to be sure I am on "page"
|
|
12
|
+
|
|
13
|
+
Scenario: Check "Then I should be on the 'page'" step definition
|
|
14
|
+
Given I am on the homepage
|
|
15
|
+
When I follow "About Us"
|
|
16
|
+
Then I should be on "about-us.html"
|
|
17
|
+
When I move backward one page
|
|
18
|
+
Then I should be on "/"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Available Step Definition Sub-pages
|
|
22
|
+
|
|
23
|
+
- [Given I am on homepage](/docs/webship-js/2.0.x/step-definitions/given-i-am-homepage)
|
|
24
|
+
- [Given I am on "specific" page](/docs/webship-js/2.0.x/step-definitions/given-i-am-specific-page)
|
|
25
|
+
- [When I go to the homepage](/docs/webship-js/2.0.x/step-definitions/when-i-go-homepage)
|
|
26
|
+
- [Given I am an anonymous user](/docs/webship-js/2.0.x/step-definitions/given-i-am-anonymous-user)
|
|
27
|
+
- [When I go to "specific page"](/docs/webship-js/2.0.x/step-definitions/when-i-go-specific-page)
|
|
28
|
+
- [When I reload the page](/docs/webship-js/2.0.x/step-definitions/when-i-reload-page)
|
|
29
|
+
- [When I move backward one page](/docs/webship-js/2.0.x/step-definitions/when-i-move-backward-one-page)
|
|
30
|
+
- [When I move forward one page](/docs/webship-js/2.0.x/step-definitions/when-i-move-forward-one-page)
|
|
31
|
+
- [When I fill in](/docs/webship-js/2.0.x/step-definitions/when-i-fill)
|
|
32
|
+
- [When I press "button"](/docs/webship-js/2.0.x/step-definitions/when-i-press-button)
|
|
33
|
+
- [When I click "link"](/docs/webship-js/2.0.x/step-definitions/when-i-click-link)
|
|
34
|
+
- [When I check "checkbox"](/docs/webship-js/2.0.x/step-definitions/when-i-check-checkbox)
|
|
35
|
+
- [When I uncheck "checkbox"](/docs/webship-js/2.0.x/step-definitions/when-i-uncheck-checkbox)
|
|
36
|
+
- [When I select "option" from "select list"](/docs/webship-js/2.0.x/step-definitions/when-i-select-option-select-list)
|
|
37
|
+
- [When I click "operation" in "text" row](/docs/webship-js/2.0.x/step-definitions/when-i-click-operation-text-row)
|
|
38
|
+
- [When I wait](/docs/webship-js/2.0.x/step-definitions/when-i-wait)
|
|
39
|
+
- [Then I should see](/docs/webship-js/2.0.x/step-definitions/then-i-should-see)
|
|
40
|
+
- [Then I should be](/docs/webship-js/2.0.x/step-definitions/then-i-should-be)
|
|
41
|
+
- [Then the "item" checkbox](/docs/webship-js/2.0.x/step-definitions/then-item-checkbox)
|
|
42
|
+
- [Then the item should contain](/docs/webship-js/2.0.x/step-definitions/then-item-should-contain)
|
|
43
|
+
- [Then the "item" link should contain "url"](/docs/webship-js/2.0.x/step-definitions/then-item-link-should-contain-url)
|
|
44
|
+
- [Then the "value" radio button is selected](/docs/webship-js/2.0.x/step-definitions/then-value-radio-button-selected)
|
|
45
|
+
- [Then the radio button "value" should be selected](/docs/webship-js/2.0.x/step-definitions/then-radio-button-value-should-be-selected)
|
|
46
|
+
- [Then the response status code should be {number}](/docs/webship-js/2.0.x/step-definitions/then-response-status-code-should-be-number)
|
|
47
|
+
- [When I attach the file "file name" to "element"](/docs/webship-js/2.0.x/step-definitions/when-i-attach-file-file-name-element)
|
|
48
|
+
- [When I scroll](/docs/webship-js/2.0.x/step-definitions/when-i-scroll)
|
|
49
|
+
- [When I select radio button "value"](/docs/webship-js/2.0.x/step-definitions/when-i-select-radio-button-value)
|
|
50
|
+
- [When I wait for AJAX to finish](/docs/webship-js/2.0.x/step-definitions/when-i-wait-ajax-finish)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Accessibility Demo</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<header>
|
|
9
|
+
<nav aria-label="Primary"><ul><li><a href="/">Home</a></li></ul></nav>
|
|
10
|
+
</header>
|
|
11
|
+
<main>
|
|
12
|
+
<h1>Accessibility Demo</h1>
|
|
13
|
+
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Pixel">
|
|
14
|
+
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="" role="presentation">
|
|
15
|
+
<form>
|
|
16
|
+
<label for="email">Email</label>
|
|
17
|
+
<input id="email" type="email" name="email">
|
|
18
|
+
|
|
19
|
+
<label for="message">Message</label>
|
|
20
|
+
<textarea id="message" name="message"></textarea>
|
|
21
|
+
|
|
22
|
+
<label>
|
|
23
|
+
<input type="checkbox" name="agree"> I agree
|
|
24
|
+
</label>
|
|
25
|
+
|
|
26
|
+
<button type="submit">Submit</button>
|
|
27
|
+
</form>
|
|
28
|
+
</main>
|
|
29
|
+
<footer><small>© 2026</small></footer>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Cookies Demo</title></head>
|
|
3
|
+
<body>
|
|
4
|
+
<script>
|
|
5
|
+
document.cookie = "session_id=abc123; path=/";
|
|
6
|
+
document.cookie = "language=en; path=/";
|
|
7
|
+
document.cookie = "preferences=darkmode-enabled; path=/";
|
|
8
|
+
</script>
|
|
9
|
+
<h1>Cookies set</h1>
|
|
10
|
+
</body></html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html><head><title>Date demo</title></head>
|
|
3
|
+
<body>
|
|
4
|
+
<h1>Date</h1>
|
|
5
|
+
<p id="year"></p>
|
|
6
|
+
<p id="month"></p>
|
|
7
|
+
<script>
|
|
8
|
+
var now = new Date();
|
|
9
|
+
document.getElementById('year').textContent = String(now.getFullYear());
|
|
10
|
+
document.getElementById('month').textContent = String(now.getMonth() + 1).padStart(2, '0');
|
|
11
|
+
</script>
|
|
12
|
+
</body></html>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Diffy Example — Baseline</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; margin: 0; color: #222; }
|
|
9
|
+
header { background: #1e40af; color: #fff; padding: 24px 32px; }
|
|
10
|
+
header h1 { margin: 0; font-size: 28px; }
|
|
11
|
+
nav { background: #eef2ff; padding: 12px 32px; }
|
|
12
|
+
nav a { margin-right: 16px; color: #1e40af; text-decoration: none; }
|
|
13
|
+
main { padding: 32px; max-width: 960px; margin: 0 auto; }
|
|
14
|
+
.card {
|
|
15
|
+
background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
|
|
16
|
+
padding: 20px; margin-bottom: 16px;
|
|
17
|
+
}
|
|
18
|
+
.card h2 { margin-top: 0; color: #1e40af; }
|
|
19
|
+
.cta {
|
|
20
|
+
display: inline-block; background: #1e40af; color: #fff;
|
|
21
|
+
padding: 10px 20px; border-radius: 6px; text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
footer { background: #f3f4f6; padding: 16px 32px; color: #6b7280; font-size: 14px; }
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<header>
|
|
28
|
+
<h1>Webship-JS — Diffy Baseline</h1>
|
|
29
|
+
<p>Stable layout captured as the reference snapshot.</p>
|
|
30
|
+
</header>
|
|
31
|
+
<nav>
|
|
32
|
+
<a href="../index.html">Home</a>
|
|
33
|
+
<a href="index.html">Diffy index</a>
|
|
34
|
+
<a href="baseline.html">Baseline</a>
|
|
35
|
+
<a href="changed.html">Changed</a>
|
|
36
|
+
</nav>
|
|
37
|
+
<main>
|
|
38
|
+
<div class="card">
|
|
39
|
+
<h2>Feature A</h2>
|
|
40
|
+
<p>Baseline copy for feature A. This block is unchanged between versions.</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="card">
|
|
43
|
+
<h2>Feature B</h2>
|
|
44
|
+
<p>Original baseline copy. Diffy should flag differences on the changed page.</p>
|
|
45
|
+
<a class="cta" href="#">Call to action</a>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="card">
|
|
48
|
+
<h2>Pricing</h2>
|
|
49
|
+
<p>Plan: <strong>$19/month</strong></p>
|
|
50
|
+
</div>
|
|
51
|
+
</main>
|
|
52
|
+
<footer>© 2026 Webship-JS Diffy example — baseline</footer>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Diffy Example — Changed</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; margin: 0; color: #222; }
|
|
9
|
+
header { background: #b91c1c; color: #fff; padding: 24px 32px; }
|
|
10
|
+
header h1 { margin: 0; font-size: 32px; }
|
|
11
|
+
nav { background: #fee2e2; padding: 12px 32px; }
|
|
12
|
+
nav a { margin-right: 16px; color: #b91c1c; text-decoration: none; }
|
|
13
|
+
main { padding: 32px; max-width: 960px; margin: 0 auto; }
|
|
14
|
+
.card {
|
|
15
|
+
background: #fff; border: 2px solid #fca5a5; border-radius: 12px;
|
|
16
|
+
padding: 24px; margin-bottom: 20px;
|
|
17
|
+
}
|
|
18
|
+
.card h2 { margin-top: 0; color: #b91c1c; }
|
|
19
|
+
.cta {
|
|
20
|
+
display: inline-block; background: #b91c1c; color: #fff;
|
|
21
|
+
padding: 12px 28px; border-radius: 999px; text-decoration: none;
|
|
22
|
+
font-weight: bold;
|
|
23
|
+
}
|
|
24
|
+
.badge {
|
|
25
|
+
display: inline-block; background: #fbbf24; color: #7c2d12;
|
|
26
|
+
padding: 4px 10px; border-radius: 4px; font-size: 13px; margin-left: 8px;
|
|
27
|
+
}
|
|
28
|
+
footer { background: #fef2f2; padding: 16px 32px; color: #7f1d1d; font-size: 14px; }
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<header>
|
|
33
|
+
<h1>Webship-JS — Diffy Changed <span style="font-size:14px;">(v2)</span></h1>
|
|
34
|
+
<p>Layout + palette shifted. Diffy should report regressions vs baseline.</p>
|
|
35
|
+
</header>
|
|
36
|
+
<nav>
|
|
37
|
+
<a href="../index.html">Home</a>
|
|
38
|
+
<a href="index.html">Diffy index</a>
|
|
39
|
+
<a href="baseline.html">Baseline</a>
|
|
40
|
+
<a href="changed.html">Changed</a>
|
|
41
|
+
</nav>
|
|
42
|
+
<main>
|
|
43
|
+
<div class="card">
|
|
44
|
+
<h2>Feature A</h2>
|
|
45
|
+
<p>Baseline copy for feature A. This block is unchanged between versions.</p>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="card">
|
|
48
|
+
<h2>Feature B <span class="badge">NEW</span></h2>
|
|
49
|
+
<p><strong>Redesigned</strong> copy with a new badge and fatter card padding.</p>
|
|
50
|
+
<a class="cta" href="#">Buy now</a>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="card">
|
|
53
|
+
<h2>Pricing</h2>
|
|
54
|
+
<p>Plan: <strong>$29/month</strong> (was $19)</p>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="card">
|
|
57
|
+
<h2>Testimonials</h2>
|
|
58
|
+
<p>Entirely new section — Diffy should flag this as added content.</p>
|
|
59
|
+
</div>
|
|
60
|
+
</main>
|
|
61
|
+
<footer>© 2026 Webship-JS Diffy example — changed build</footer>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|