webship-js 2.0.11 → 2.0.12
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/.circleci/config.yml +10 -1
- package/.drone.yml +7 -7
- package/.github/workflows/github-actions.yml +45 -0
- package/.gitlab-ci.yml +9 -4
- package/.harness/webship-js-pipeline.yml +5 -6
- package/.semaphore/semaphore.yml +6 -9
- package/.teamcity/settings.kts +7 -6
- package/.travis.yml +6 -1
- package/AGENTS.md +1 -1
- package/CLAUDE.md +65 -23
- package/Jenkinsfile +5 -3
- package/azure-pipelines.yml +17 -8
- package/bamboo-specs/bamboo.yml +9 -15
- package/bin/init-webship.js +44 -8
- package/bitbucket-pipelines.yml +5 -1
- package/buildspec.yml +6 -7
- package/cloudbuild.yaml +28 -12
- package/codefresh.yml +6 -6
- package/cucumber.js +17 -10
- package/docs/00-quick-start.md +8 -0
- package/docs/02-bbr-smart-waits.md +15 -10
- package/docs/03-selector-registry.md +24 -0
- package/docs/04-step-reference.md +51 -25
- package/docs/05-web-first-assertions.md +6 -0
- package/docs/07-auth-state.md +1 -1
- package/docs/08-clock-mocking.md +21 -2
- package/docs/09-api-testing.md +40 -2
- package/docs/10-accessibility.md +2 -0
- package/docs/11-debugging.md +3 -1
- package/docs/12-ai-agent-guide.md +5 -0
- package/docs/13-faq.md +72 -1
- package/docs/14-recipes-cookbook.md +2 -0
- package/docs/15-tag-conventions.md +2 -1
- package/docs/16-ci-cd.md +140 -119
- package/docs/README.md +5 -5
- package/docs/advanced-screenshots.md +3 -1
- package/docs/api-step-definitions.md +16 -2
- package/docs/global-settings.md +69 -17
- package/docs/install-webship-js.md +2 -0
- package/docs/step-definitions/then-i-should-see.md +14 -1
- package/docs/step-definitions/then-item-checkbox.md +2 -0
- package/docs/step-definitions/when-i-fill.md +4 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +2 -0
- package/examples/choice-controls.html +29 -0
- package/examples/datetime-fields.html +52 -0
- package/examples/element-selector-hint.html +16 -0
- package/examples/field-states.html +27 -0
- package/examples/fill-in-empty.html +26 -0
- package/examples/fill-unreachable.html +27 -0
- package/examples/iframe-inner.html +20 -0
- package/examples/iframe-nested.html +16 -0
- package/examples/iframe-outer.html +15 -0
- package/examples/multi-value-fields.html +54 -0
- package/examples/registered-names.html +15 -0
- package/examples/select-by-label.html +33 -0
- package/examples/settle-budget.html +21 -0
- package/examples/sorted-tables.html +38 -0
- package/examples/text-matching.html +48 -0
- package/examples/text-order.html +25 -0
- package/examples/touch.html +22 -0
- package/examples/viewport-top.html +36 -0
- package/package.json +16 -1
- package/playwright.config.ts +3 -1
- package/tests/check-api-launch-url.js +106 -0
- package/tests/check-assets.js +103 -0
- package/tests/check-attachments.js +105 -0
- package/tests/check-breakpoints.js +117 -0
- package/tests/check-clock.js +143 -0
- package/tests/check-config.js +90 -0
- package/tests/check-context.js +215 -0
- package/tests/check-dry-run.js +104 -0
- package/tests/check-examples.js +10 -4
- package/tests/check-exit-report.js +141 -0
- package/tests/check-javascript-errors.js +105 -0
- package/tests/check-must-fail.js +5 -4
- package/tests/check-scaffold.js +36 -1
- package/tests/check-screenshots.js +117 -0
- package/tests/check-settle-verbs.js +137 -0
- package/tests/check-time-limit.js +104 -0
- package/tests/check-video.js +156 -0
- package/tests/check-world.js +167 -0
- package/tests/features/api-base-url.feature +25 -0
- package/tests/features/api-form-data.feature +18 -0
- package/tests/features/api-json-paths.feature +24 -0
- package/tests/features/api-response-contains.feature +21 -0
- package/tests/features/api-response-header-presence.feature +17 -0
- package/tests/features/api-response-header.feature +17 -0
- package/tests/features/api-saved-placeholders.feature +37 -0
- package/tests/features/api-step-definitions-individual.feature +1 -1
- package/tests/features/api-tables.feature +40 -0
- package/tests/features/breakpoints.feature +25 -0
- package/tests/features/choice-controls.feature +35 -0
- package/tests/features/complete-api-testing-examples.feature +1 -1
- package/tests/features/datetime-field-lookup.feature +29 -0
- package/tests/features/element-selector-hint.feature +14 -0
- package/tests/features/field-state.feature +21 -0
- package/tests/features/fill-in-empty-value.feature +41 -0
- package/tests/features/fill-reachable.feature +13 -0
- package/tests/features/iframe-nested.feature +43 -0
- package/tests/features/javascript-tolerated-errors.feature +20 -0
- package/tests/features/modal-open.feature +13 -0
- package/tests/features/multi-value-field-lookup.feature +30 -0
- package/tests/features/registered-names.feature +14 -0
- package/tests/features/select-by-label.feature +31 -0
- package/tests/features/selector-files.feature +14 -0
- package/tests/features/selectors-table-header.feature +35 -0
- package/tests/features/settle-budget.feature +11 -0
- package/tests/features/sorted-tables.feature +19 -0
- package/tests/features/storage-quoted-values.feature +26 -0
- package/tests/features/text-matching.feature +38 -0
- package/tests/features/text-order.feature +14 -0
- package/tests/features/touch.feature +21 -0
- package/tests/features/viewport-top.feature +13 -0
- package/tests/features/xml-namespaces.feature +34 -0
- package/tests/must-fail/api-json-paths.feature +21 -0
- package/tests/must-fail/api-response-contains.feature +23 -0
- package/tests/must-fail/api-response-header-presence.feature +17 -0
- package/tests/must-fail/api-response-header.feature +21 -0
- package/tests/must-fail/api-without-base-url.feature +11 -0
- package/tests/must-fail/breakpoints.feature +15 -0
- package/tests/must-fail/choice-controls.feature +25 -0
- package/tests/must-fail/clock.feature +11 -0
- package/tests/must-fail/datetime-field.feature +10 -0
- package/tests/must-fail/element-selector-hint.feature +17 -0
- package/tests/must-fail/field-state.feature +20 -0
- package/tests/must-fail/fill-field.feature +30 -0
- package/tests/must-fail/iframe-text.feature +17 -0
- package/tests/must-fail/modal-open.feature +26 -0
- package/tests/must-fail/multi-value-field.feature +18 -0
- package/tests/must-fail/registered-names.feature +25 -0
- package/tests/must-fail/select-list.feature +15 -0
- package/tests/must-fail/selector-files.feature +10 -0
- package/tests/must-fail/sorted-tables.feature +20 -0
- package/tests/must-fail/storage-before-a-page.feature +13 -0
- package/tests/must-fail/text-matching.feature +16 -0
- package/tests/must-fail/text-order.feature +15 -0
- package/tests/must-fail/viewport-top.feature +20 -0
- package/tests/must-fail/yaml-numbers.feature +48 -0
- package/tests/step-definitions/a11y.steps.js +24 -15
- package/tests/step-definitions/action.steps.js +22 -8
- package/tests/step-definitions/api.steps.js +349 -67
- package/tests/step-definitions/assertion.steps.js +100 -10
- package/tests/step-definitions/auth.steps.js +15 -18
- package/tests/step-definitions/clock.steps.js +22 -0
- package/tests/step-definitions/debug.steps.js +8 -0
- package/tests/step-definitions/dialog.steps.js +7 -0
- package/tests/step-definitions/element.steps.js +132 -17
- package/tests/step-definitions/field.steps.js +409 -96
- package/tests/step-definitions/form.steps.js +76 -29
- package/tests/step-definitions/iframe.steps.js +89 -29
- package/tests/step-definitions/input.steps.js +26 -7
- package/tests/step-definitions/javascript.steps.js +64 -22
- package/tests/step-definitions/modal.steps.js +79 -13
- package/tests/step-definitions/navigation.steps.js +14 -0
- package/tests/step-definitions/network.steps.js +15 -5
- package/tests/step-definitions/response.steps.js +6 -4
- package/tests/step-definitions/responsive.steps.js +26 -33
- package/tests/step-definitions/screenshot.steps.js +25 -8
- package/tests/step-definitions/scroll.steps.js +20 -0
- package/tests/step-definitions/selectors.steps.js +95 -48
- package/tests/step-definitions/storage.steps.js +38 -13
- package/tests/step-definitions/table.steps.js +81 -6
- package/tests/step-definitions/video.steps.js +52 -55
- package/tests/step-definitions/wait.steps.js +88 -23
- package/tests/step-definitions/web-first.steps.js +69 -35
- package/tests/step-definitions/webship.js +681 -143
- package/tests/step-definitions/xml.steps.js +49 -15
- package/tests/step-definitions/yaml.steps.js +45 -20
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Feature: One breakpoint registry for every step and tag
|
|
2
|
+
The viewing-the-site step, the set-the-viewport step and the tags for
|
|
3
|
+
mobile and desktop read the same named sizes: the built-in names, the
|
|
4
|
+
project's worldParameters.selectors.breakpoints,
|
|
5
|
+
WEBSHIP_SELECTORS_BREAKPOINTS and the names a scenario adds.
|
|
6
|
+
tests/check-breakpoints.js covers the environment variable and the
|
|
7
|
+
breakpoint marked default.
|
|
8
|
+
|
|
9
|
+
Scenario: The viewing-the-site step knows the built-in mobile, tablet and desktop
|
|
10
|
+
Given I am on "/viewport-size.html"
|
|
11
|
+
When I am viewing the site on a "mobile" screen
|
|
12
|
+
Then "#viewport-size" should have text "Viewport is 375 by 667"
|
|
13
|
+
When I am viewing the site on a tablet device
|
|
14
|
+
Then "#viewport-size" should have text "Viewport is 768 by 1024"
|
|
15
|
+
When I am viewing the site on a "desktop" screen
|
|
16
|
+
Then "#viewport-size" should have text "Viewport is 1200 by 900"
|
|
17
|
+
|
|
18
|
+
Scenario: A breakpoint a scenario adds reaches the viewing-the-site step
|
|
19
|
+
Given I am on "/viewport-size.html"
|
|
20
|
+
And the following responsive breakpoints:
|
|
21
|
+
| pocket | 320 | 480 |
|
|
22
|
+
When I am viewing the site on a "pocket" screen
|
|
23
|
+
Then "#viewport-size" should have text "Viewport is 320 by 480"
|
|
24
|
+
When I set the viewport to the "xxl" breakpoint
|
|
25
|
+
Then "#viewport-size" should have text "Viewport is 1400 by 900"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Feature: Checkboxes, radio buttons and fields named by their label, name or id
|
|
2
|
+
As a tester,
|
|
3
|
+
I want the checkbox, radio button and field steps to find a control the way the check steps do,
|
|
4
|
+
so that a scenario names a control by what the form shows.
|
|
5
|
+
|
|
6
|
+
Scenario: The state of a checkbox named by its label, its name or its id
|
|
7
|
+
Given I am on "/choice-controls.html"
|
|
8
|
+
Then the "Newsletter" checkbox should be checked
|
|
9
|
+
And the "#opt-news" checkbox should be checked
|
|
10
|
+
And the checkbox "terms" should not be checked
|
|
11
|
+
And the "opt-terms" checkbox is not checked
|
|
12
|
+
And the checkbox "Accept the terms" is not checked
|
|
13
|
+
|
|
14
|
+
Scenario: Check and uncheck a checkbox named by its label or its name
|
|
15
|
+
Given I am on "/choice-controls.html"
|
|
16
|
+
When I check the checkbox "Accept the terms"
|
|
17
|
+
And I uncheck the checkbox "newsletter"
|
|
18
|
+
Then the checkbox "terms" is checked
|
|
19
|
+
And the "Newsletter" checkbox should not be checked
|
|
20
|
+
|
|
21
|
+
Scenario: The state of a radio button named by its label, its id or its value
|
|
22
|
+
Given I am on "/choice-controls.html"
|
|
23
|
+
Then the radio button "Premium" should be selected
|
|
24
|
+
And the "plan-basic" radio button is not selected
|
|
25
|
+
And the radio button "basic" should not be selected
|
|
26
|
+
When I choose the radio button "Basic"
|
|
27
|
+
Then the radio button "basic" should be selected
|
|
28
|
+
And the "Premium" radio button is not selected
|
|
29
|
+
|
|
30
|
+
Scenario: Fill a field named by its label or its name
|
|
31
|
+
Given I am on "/choice-controls.html"
|
|
32
|
+
When I fill in the field "City" with "Amman"
|
|
33
|
+
And I fill in the field "nickname" with "Ali"
|
|
34
|
+
Then "#city" should have value "Amman"
|
|
35
|
+
And "#nick" should have value "Ali"
|
|
@@ -130,7 +130,7 @@ Feature: Complete API Testing Examples - All Step Definitions
|
|
|
130
130
|
Scenario: Response Header Validation
|
|
131
131
|
When I send a GET request to "/posts/1"
|
|
132
132
|
Then the API response code should be 200
|
|
133
|
-
And the response header "Content-Type" should be "application/json"
|
|
133
|
+
And the response header "Content-Type" should be "application/json; charset=utf-8"
|
|
134
134
|
|
|
135
135
|
Scenario: Placeholder Usage
|
|
136
136
|
Given I set placeholder "{{postId}}" to "1"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Feature: Find the inputs of a datetime field by its own label
|
|
2
|
+
As a tester,
|
|
3
|
+
I want a datetime step to fill the inputs of the field it names and no other,
|
|
4
|
+
so that a form with several date fields is filled in the right places.
|
|
5
|
+
|
|
6
|
+
Scenario: A label that contains the text of another one is not taken for it
|
|
7
|
+
Given I am on "/datetime-fields.html"
|
|
8
|
+
When I fill in the date part of the datetime field "Start" with "2026-05-08"
|
|
9
|
+
Then "#start-date" should have value "2026-05-08"
|
|
10
|
+
And "#restart-date" should have value ""
|
|
11
|
+
|
|
12
|
+
Scenario: Two fields in one paragraph
|
|
13
|
+
Given I am on "/datetime-fields.html"
|
|
14
|
+
When I fill in the datetime field "Closing" with date "2026-06-30" and time "18:00"
|
|
15
|
+
And I fill in the date part of the datetime field "Opening" with "2026-06-01"
|
|
16
|
+
Then "#closing-date" should have value "2026-06-30"
|
|
17
|
+
And "#closing-time" should have value "18:00"
|
|
18
|
+
And "#opening-date" should have value "2026-06-01"
|
|
19
|
+
|
|
20
|
+
Scenario: A label alone in its wrapper
|
|
21
|
+
Given I am on "/datetime-fields.html"
|
|
22
|
+
When I fill in the datetime field "Arrival" with date "2026-07-04" and time "08:30"
|
|
23
|
+
Then "#arrival-date" should have value "2026-07-04"
|
|
24
|
+
And "#arrival-time" should have value "08:30"
|
|
25
|
+
And "#leaving-date" should have value ""
|
|
26
|
+
And "#leaving-time" should have value ""
|
|
27
|
+
When I fill in the time part of the datetime field "Leaving" with "20:15"
|
|
28
|
+
Then "#leaving-time" should have value "20:15"
|
|
29
|
+
And "#arrival-time" should have value "08:30"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: An element named by its text, next to the same element named by a selector
|
|
2
|
+
`I should see a "…" element` reads its argument as the exact text of an
|
|
3
|
+
element or of a label; the web-first steps read a CSS selector.
|
|
4
|
+
|
|
5
|
+
Scenario: The text of an element and its selector
|
|
6
|
+
Given I am on "/element-selector-hint.html"
|
|
7
|
+
Then I should see a "First news item" element
|
|
8
|
+
And ".news-item" should be visible
|
|
9
|
+
And "header" should be visible
|
|
10
|
+
|
|
11
|
+
Scenario: A selector given to the negative is read as a text
|
|
12
|
+
Given I am on "/element-selector-hint.html"
|
|
13
|
+
Then I should not see a ".news-item" element
|
|
14
|
+
And I should not see a "Third news item" element
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Feature: The state of a field
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to check that a field is enabled, disabled, editable or read-only,
|
|
4
|
+
so that a form shows the right fields as locked.
|
|
5
|
+
|
|
6
|
+
Scenario: An enabled field that can be edited
|
|
7
|
+
Given I am on "/field-states.html"
|
|
8
|
+
Then the field "Username" should have "enabled" state
|
|
9
|
+
And the field "Username" should have "editable" state
|
|
10
|
+
|
|
11
|
+
Scenario: A disabled field
|
|
12
|
+
Given I am on "/field-states.html"
|
|
13
|
+
Then the field "Account ID" should have "disabled" state
|
|
14
|
+
And the field "account_id" should have "disabled" state
|
|
15
|
+
|
|
16
|
+
Scenario: A read-only field is enabled but cannot be edited
|
|
17
|
+
Given I am on "/field-states.html"
|
|
18
|
+
Then the field "Reference" should have "read-only" state
|
|
19
|
+
And the field "Reference" should have "readonly" state
|
|
20
|
+
And the field "Reference" should have "enabled" state
|
|
21
|
+
And the field "Notes" should have "read-only" state
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Feature: Fill in a field with an empty value
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to fill a field with "" in every form of the fill step,
|
|
4
|
+
so that a scenario can clear a field the way it fills one.
|
|
5
|
+
|
|
6
|
+
Scenario: Fill a field with an empty value by its label
|
|
7
|
+
Given I am on "/fill-in-empty.html"
|
|
8
|
+
Then the field "title" should not be empty
|
|
9
|
+
When I fill in "Title" with ""
|
|
10
|
+
Then the field "title" should be empty
|
|
11
|
+
|
|
12
|
+
Scenario: Fill in an empty value for a field by its label
|
|
13
|
+
Given I am on "/fill-in-empty.html"
|
|
14
|
+
Then the field "summary" should not be empty
|
|
15
|
+
When I fill in "" for "Summary"
|
|
16
|
+
Then the field "summary" should be empty
|
|
17
|
+
|
|
18
|
+
Scenario: Fill a field with an empty value by its placeholder
|
|
19
|
+
Given I am on "/fill-in-empty.html"
|
|
20
|
+
When I fill in "Comma separated" with ""
|
|
21
|
+
Then the field "keywords" should be empty
|
|
22
|
+
|
|
23
|
+
Scenario: Fill a field with an empty value by attribute
|
|
24
|
+
Given I am on "/fill-in-empty.html"
|
|
25
|
+
When I fill in "#title" with "" by attr
|
|
26
|
+
And I fill in "keywords-field" with "" by its "class" attribute
|
|
27
|
+
Then the field "title" should be empty
|
|
28
|
+
And the field "keywords" should be empty
|
|
29
|
+
|
|
30
|
+
Scenario: Fill in an empty value for a field by attribute
|
|
31
|
+
Given I am on "/fill-in-empty.html"
|
|
32
|
+
When I fill in "" for "summary" by its "name" attribute
|
|
33
|
+
Then the field "summary" should be empty
|
|
34
|
+
|
|
35
|
+
Scenario: An empty cell of the fill table empties its field
|
|
36
|
+
Given I am on "/fill-in-empty.html"
|
|
37
|
+
When I fill in the following:
|
|
38
|
+
| Title | |
|
|
39
|
+
| Summary | New words |
|
|
40
|
+
Then the field "title" should be empty
|
|
41
|
+
And the field "summary" should not be empty
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Fill a field that can be filled, next to fields that cannot
|
|
2
|
+
As a tester,
|
|
3
|
+
I want the fill steps to fill a visible, enabled field as before,
|
|
4
|
+
so that the plain messages for the other fields change nothing else.
|
|
5
|
+
|
|
6
|
+
Scenario: Fill a visible field by its label, its placeholder and by attribute
|
|
7
|
+
Given I am on "/fill-unreachable.html"
|
|
8
|
+
When I fill in "Your name" with "Alice"
|
|
9
|
+
Then "#visible-name" should have value "Alice"
|
|
10
|
+
When I fill in "Full name" with "Bob"
|
|
11
|
+
Then "#visible-name" should have value "Bob"
|
|
12
|
+
When I fill in "visible_name" with "Carol" by its "name" attribute
|
|
13
|
+
Then "#visible-name" should have value "Carol"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Feature: Nested iframes, and finding elements and text inside an iframe like on the page
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to switch into an iframe inside an iframe, and to find its fields,
|
|
4
|
+
buttons and text the way the page steps do,
|
|
5
|
+
so that embedded widgets are tested like the rest of the page.
|
|
6
|
+
|
|
7
|
+
Scenario: Switch to an iframe inside the iframe that is active
|
|
8
|
+
Given I am on "/iframe-nested.html"
|
|
9
|
+
When I switch to iframe "#outer-frame"
|
|
10
|
+
Then I should see "Text of the outer frame" inside the iframe
|
|
11
|
+
When I switch to iframe "#inner-frame"
|
|
12
|
+
Then I should see "Text of the inner frame" inside the iframe
|
|
13
|
+
And I should not see "Text of the outer frame" inside the iframe
|
|
14
|
+
|
|
15
|
+
Scenario: Switch to a nested iframe by its name, and back to the root
|
|
16
|
+
Given I am on "/iframe-nested.html"
|
|
17
|
+
When I switch to the iframe with name "outer"
|
|
18
|
+
And I switch to the iframe with title "Inner frame"
|
|
19
|
+
Then I should see "two levels down" inside the iframe
|
|
20
|
+
When I switch to the root document
|
|
21
|
+
Then I should see "This text is in the root document of the nested example"
|
|
22
|
+
|
|
23
|
+
Scenario: Fill a field by its label or its placeholder inside the iframe
|
|
24
|
+
Given I am on "/iframe-nested.html"
|
|
25
|
+
When I switch to iframe "#outer-frame"
|
|
26
|
+
And I switch to iframe "#inner-frame"
|
|
27
|
+
And I fill in "Coupon code" with "SAVE10" inside the iframe
|
|
28
|
+
And I fill in "Gift note" with "Happy birthday" inside the iframe
|
|
29
|
+
And I click "Apply the coupon" by attr inside the iframe
|
|
30
|
+
Then I should see "Coupon SAVE10 applied" inside the iframe
|
|
31
|
+
|
|
32
|
+
Scenario: Click an element by its title inside the iframe
|
|
33
|
+
Given I am on "/iframe-nested.html"
|
|
34
|
+
When I switch to iframe "#outer-frame"
|
|
35
|
+
And I switch to iframe "#inner-frame"
|
|
36
|
+
And I click "Remove the coupon" by attr inside the iframe
|
|
37
|
+
Then I should see "Coupon removed" inside the iframe
|
|
38
|
+
|
|
39
|
+
Scenario: Text that arrives late inside the iframe
|
|
40
|
+
Given I am on "/iframe-nested.html"
|
|
41
|
+
When I switch to iframe "#outer-frame"
|
|
42
|
+
And I switch to iframe "#inner-frame"
|
|
43
|
+
Then I should see "A late message from the inner frame" inside the iframe
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Feature: JavaScript errors a scenario tolerates
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to tolerate the errors of a noisy page while one pattern must never appear,
|
|
4
|
+
so that a run in "fail" mode fails only on what the scenario does not accept.
|
|
5
|
+
|
|
6
|
+
# "@js-fail" fails a scenario on any JavaScript error it does not handle.
|
|
7
|
+
# "JavaScript errors should not match" handles the errors it checked.
|
|
8
|
+
@js-fail
|
|
9
|
+
Scenario: Errors that do not match the pattern do not fail the scenario
|
|
10
|
+
Given I am on "/javascript-errors.html"
|
|
11
|
+
When I press "Throw an error"
|
|
12
|
+
Then I should see "An error was thrown"
|
|
13
|
+
And JavaScript errors should not match "TypeError"
|
|
14
|
+
|
|
15
|
+
@js-fail
|
|
16
|
+
Scenario: A logged error that does not match the pattern does not fail the scenario
|
|
17
|
+
Given I am on "/javascript-errors.html"
|
|
18
|
+
When I press "Log an error"
|
|
19
|
+
Then I should see "An error was logged"
|
|
20
|
+
And JavaScript errors should not match "is not defined"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Act in an open modal
|
|
2
|
+
As a tester,
|
|
3
|
+
I want the steps that act in a modal to work on the modal that is open,
|
|
4
|
+
so that a scenario can click and close it as before.
|
|
5
|
+
|
|
6
|
+
Scenario: Click a button of the open modal by its text, then close it
|
|
7
|
+
Given I am on "/modal.html"
|
|
8
|
+
When I click on the element "#open"
|
|
9
|
+
And I click "X" in the modal
|
|
10
|
+
Then I should not see the modal
|
|
11
|
+
When I click on the element "#open"
|
|
12
|
+
And I close the modal
|
|
13
|
+
Then I should not see the modal
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Feature: Fill a multi-value field named by its inputs, its label or its legend
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to fill the inputs of a multi-value field however the form names them,
|
|
4
|
+
so that a scenario can fill a list of values in one step.
|
|
5
|
+
|
|
6
|
+
Scenario: A multi-value field named by the legend of its fieldset
|
|
7
|
+
Given I am on "/multi-value-fields.html"
|
|
8
|
+
When I fill in the multi-value field "Phone numbers" with the following values:
|
|
9
|
+
| 0790000000 |
|
|
10
|
+
| 0791111111 |
|
|
11
|
+
Then "#phone-a" should have value "0790000000"
|
|
12
|
+
And "#phone-b" should have value "0791111111"
|
|
13
|
+
|
|
14
|
+
Scenario: A multi-value field named by its label
|
|
15
|
+
Given I am on "/multi-value-fields.html"
|
|
16
|
+
When I fill in the multi-value field "Skills" with the following values:
|
|
17
|
+
| testing |
|
|
18
|
+
| design |
|
|
19
|
+
Then "#skill-1" should have value "testing"
|
|
20
|
+
And "#skill-2" should have value "design"
|
|
21
|
+
And "#skill-3" should have value ""
|
|
22
|
+
And "#website-1" should have value ""
|
|
23
|
+
|
|
24
|
+
Scenario: A multi-value field whose inputs are named field[0][value]
|
|
25
|
+
Given I am on "/multi-value-fields.html"
|
|
26
|
+
When I fill in the multi-value field "field_topics" with the following values:
|
|
27
|
+
| news |
|
|
28
|
+
| events |
|
|
29
|
+
Then "#topics-0" should have value "news"
|
|
30
|
+
And "#topics-1" should have value "events"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Names of the selector registry are read by the bare-name steps
|
|
2
|
+
A name added to the selector registry is read by the bare-name steps of the
|
|
3
|
+
selector family (`I see visible <name>`, `I click <name>`). The steps that
|
|
4
|
+
take a text, a label or a CSS selector in quotes read their argument as it
|
|
5
|
+
is written, so they are given the selector itself.
|
|
6
|
+
|
|
7
|
+
Scenario: The bare-name steps and the selector itself
|
|
8
|
+
Given I am on "/registered-names.html"
|
|
9
|
+
When I add "premium-banner" selector for ".promo-banner" css selector
|
|
10
|
+
And I add "search box" selector for ".search-box input" css selector
|
|
11
|
+
Then I see visible premium-banner
|
|
12
|
+
And ".promo-banner" should be visible
|
|
13
|
+
When I fill in the field ".search-box input" with "laptops"
|
|
14
|
+
Then ".search-box input" should have value "laptops"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Feature: Select an option from a select list named by its label, name or id
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to name a select list by the text of its label, whatever its length,
|
|
4
|
+
so that a scenario reads the way the form reads.
|
|
5
|
+
|
|
6
|
+
Scenario: A select list named by a one-word label
|
|
7
|
+
Given I am on "/select-by-label.html"
|
|
8
|
+
When I select "Saab" from "Cars"
|
|
9
|
+
Then the option "Saab" should be selected within the select element "#vehicle-list"
|
|
10
|
+
|
|
11
|
+
Scenario: An option named by its value, in a select list named by its label
|
|
12
|
+
Given I am on "/select-by-label.html"
|
|
13
|
+
When I select "mercedes" from "Cars"
|
|
14
|
+
Then the option "Mercedes" should be selected within the select element "#vehicle-list"
|
|
15
|
+
|
|
16
|
+
Scenario: A select list named by a name with brackets
|
|
17
|
+
Given I am on "/select-by-label.html"
|
|
18
|
+
When I select "Red" from "filters[colour]"
|
|
19
|
+
Then the option "Red" should be selected within the select element "#filters-colour"
|
|
20
|
+
|
|
21
|
+
Scenario: A select list named by its id
|
|
22
|
+
Given I am on "/select-by-label.html"
|
|
23
|
+
When I select "Volvo" from "vehicle-list"
|
|
24
|
+
Then the option "Volvo" should be selected within the select element "#vehicle-list"
|
|
25
|
+
|
|
26
|
+
Scenario: A select list named by its label, next to another one
|
|
27
|
+
Given I am on "/select-by-label.html"
|
|
28
|
+
When I select "Blue" from "Colour"
|
|
29
|
+
And I select "Saab" from "Cars"
|
|
30
|
+
Then the option "Blue" should be selected within the select element "#filters-colour"
|
|
31
|
+
And the option "Saab" should be selected within the select element "#vehicle-list"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Selector files named from the project root or by their name
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to name a selector file the way I see it in the project,
|
|
4
|
+
so that the same name works in worldParameters.selectors.files and in a step.
|
|
5
|
+
|
|
6
|
+
Scenario: A selector file named from the project root
|
|
7
|
+
Given I am on homepage
|
|
8
|
+
When I add selectors from "tests/selectors/homepage-selectors.json" file
|
|
9
|
+
Then I see visible homepage heading
|
|
10
|
+
|
|
11
|
+
Scenario: A selector file named by its name in the selectors folder
|
|
12
|
+
Given I am on homepage
|
|
13
|
+
When I add selectors from "homepage-selectors.json" file
|
|
14
|
+
Then I see visible homepage heading
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Feature: The header row of a selectors table
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to write a selectors table with a header row, as the docs show it,
|
|
4
|
+
so that the header names the columns and is never registered as a selector.
|
|
5
|
+
|
|
6
|
+
Scenario: The header row of a CSS selectors table registers no selector
|
|
7
|
+
Given I am on homepage
|
|
8
|
+
And I add "name" selector for "h1" css selector
|
|
9
|
+
When I define css selectors:
|
|
10
|
+
| name | css selector |
|
|
11
|
+
| table list | ul |
|
|
12
|
+
Then I see visible name, table list
|
|
13
|
+
|
|
14
|
+
Scenario: The header row of an XPath selectors table registers no selector
|
|
15
|
+
Given I am on homepage
|
|
16
|
+
And I add "name" selector for "//h1[1]" xpath selector
|
|
17
|
+
When I define xpath selectors:
|
|
18
|
+
| name | xpath selector |
|
|
19
|
+
| table xp list | //ul[1] |
|
|
20
|
+
Then I see visible name, table xp list
|
|
21
|
+
|
|
22
|
+
Scenario: The short header row of the hint is a header too
|
|
23
|
+
Given I am on homepage
|
|
24
|
+
And I add "name" selector for "h1" css selector
|
|
25
|
+
When I define css selectors:
|
|
26
|
+
| name | css |
|
|
27
|
+
| short heading | h3 |
|
|
28
|
+
Then I see visible name, short heading
|
|
29
|
+
|
|
30
|
+
Scenario: A table without a header row registers every row
|
|
31
|
+
Given I am on homepage
|
|
32
|
+
When I define css selectors:
|
|
33
|
+
| first row heading | h1 |
|
|
34
|
+
| second row list | ul |
|
|
35
|
+
Then I see visible first row heading, second row list
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: The settle after a step waits for the page as long as its budget allows
|
|
2
|
+
After a step that changes the page, webship-js waits for the page to settle
|
|
3
|
+
for up to 1.5 seconds. The last phase of that wait (the requests, the
|
|
4
|
+
timers and the DOM falling quiet) may use every millisecond the earlier
|
|
5
|
+
phases left, so a page that answers one second after a press is settled
|
|
6
|
+
before the next step reads it.
|
|
7
|
+
|
|
8
|
+
Scenario: A press whose answer comes one second later
|
|
9
|
+
Given I am on "/settle-budget.html"
|
|
10
|
+
When I press "Load"
|
|
11
|
+
Then I should see "Loaded" in the "#status" element
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Feature: A sorted table column is read the way a reader orders it
|
|
2
|
+
The cells are compared as numbers when every cell reads as a number, as
|
|
3
|
+
dates when every cell reads as a date, else as text with letter case
|
|
4
|
+
ignored and the numbers inside the text in number order.
|
|
5
|
+
|
|
6
|
+
Scenario: Prices, quantities and dates in ascending order
|
|
7
|
+
Given I am on "/sorted-tables.html"
|
|
8
|
+
Then the table "#prices" should be sorted by "Price" in "ascending" order
|
|
9
|
+
And the table "#prices" should be sorted by "Stock" in "asc" order
|
|
10
|
+
And the table "#prices" should be sorted by "Released" in "ascending" order
|
|
11
|
+
|
|
12
|
+
Scenario: Text with letter case ignored
|
|
13
|
+
Given I am on "/sorted-tables.html"
|
|
14
|
+
Then the table "#prices" should be sorted by "Product" in "ascending" order
|
|
15
|
+
|
|
16
|
+
Scenario: Numbers inside a text, descending, and equal cells
|
|
17
|
+
Given I am on "/sorted-tables.html"
|
|
18
|
+
Then the table "#items" should be sorted by "Item" in "descending" order
|
|
19
|
+
And the table "#items" should be sorted by "Discount" in "asc" order
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Feature: Storage and cookie values with a double quote
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to set a value that holds a double quote, such as JSON,
|
|
4
|
+
so that a page can start with the state it reads from local storage, session storage or a cookie.
|
|
5
|
+
|
|
6
|
+
Scenario: A local storage value that holds JSON
|
|
7
|
+
Given I am on "/storage.html"
|
|
8
|
+
When the local storage "prefs" is set to "{\"theme\":\"dark\"}"
|
|
9
|
+
And I reload the page
|
|
10
|
+
Then I should see text matching "prefs = \{\x22theme\x22:\x22dark\x22\}"
|
|
11
|
+
|
|
12
|
+
Scenario: A session storage key and value with double quotes
|
|
13
|
+
Given I am on "/storage.html"
|
|
14
|
+
When the session storage "the \"last\" note" is set to "say \"hi\""
|
|
15
|
+
And I reload the page
|
|
16
|
+
Then I should see text matching "the \x22last\x22 note = say \x22hi\x22"
|
|
17
|
+
When the session storage "the \"last\" note" is removed
|
|
18
|
+
And I reload the page
|
|
19
|
+
Then "#session-storage" should have text "Session storage is empty"
|
|
20
|
+
|
|
21
|
+
Scenario: A cookie value wrapped in double quotes
|
|
22
|
+
Given I am on "/storage.html"
|
|
23
|
+
When the cookie "wrapped" is set to "\"dark\""
|
|
24
|
+
Then a cookie with the name "wrapped" and the value "\"dark\"" should exist
|
|
25
|
+
When the cookie "wrapped" is removed
|
|
26
|
+
Then a cookie with the name "wrapped" should not exist
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Feature: The page-text steps read the page the same way
|
|
2
|
+
`I should see`, `I should not see` and `eventually I should see` read the
|
|
3
|
+
text of the page with one matcher: letter case ignored, white space
|
|
4
|
+
collapsed, the text of hidden elements included, the text of <script> and
|
|
5
|
+
<style> left out. On the page, "Saving draft" goes away and "Draft saved"
|
|
6
|
+
arrives about two seconds after it opens, on a timer the smart waits do not
|
|
7
|
+
wait for.
|
|
8
|
+
|
|
9
|
+
Scenario: Letter case does not matter, in either polarity
|
|
10
|
+
Given I am on "/text-matching.html"
|
|
11
|
+
Then I should see "next page"
|
|
12
|
+
And I should see "NEXT PAGE"
|
|
13
|
+
And I should not see "previous page"
|
|
14
|
+
|
|
15
|
+
Scenario: The text of a hidden element is page text
|
|
16
|
+
Given I am on "/text-matching.html"
|
|
17
|
+
Then I should see "Members save 10 percent"
|
|
18
|
+
And I should see "members save 10 percent"
|
|
19
|
+
|
|
20
|
+
Scenario: The text of a script or a style is not page text
|
|
21
|
+
Given I am on "/text-matching.html"
|
|
22
|
+
Then I should not see "inlineScriptMarker"
|
|
23
|
+
And I should not see "only a script reads this"
|
|
24
|
+
And I should not see "styleRuleMarker"
|
|
25
|
+
|
|
26
|
+
Scenario: White space is collapsed
|
|
27
|
+
Given I am on "/text-matching.html"
|
|
28
|
+
Then I should see "Order total: 42 items"
|
|
29
|
+
|
|
30
|
+
Scenario: The negative waits for a text that goes away
|
|
31
|
+
Given I am on "/text-matching.html"
|
|
32
|
+
Then I should not see "Saving draft"
|
|
33
|
+
|
|
34
|
+
Scenario: Eventually reads the page text the same way
|
|
35
|
+
Given I am on "/text-matching.html"
|
|
36
|
+
Then eventually I should see "draft saved" within 5 seconds
|
|
37
|
+
And eventually I should see "saved as version 2"
|
|
38
|
+
And eventually we should see "NEXT PAGE"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: One text after another, on the page or inside one element
|
|
2
|
+
`the text "A" should appear after the text "B"` compares the first place
|
|
3
|
+
each text appears in the visible text of the whole page; adding
|
|
4
|
+
`in the "<selector>" element` compares them inside that element.
|
|
5
|
+
|
|
6
|
+
Scenario: The whole page: the menu holds the first "Products"
|
|
7
|
+
Given I am on "/text-order.html"
|
|
8
|
+
Then the text "Total" should appear after the text "Subtotal"
|
|
9
|
+
And the text "Home" should appear after the text "Products"
|
|
10
|
+
|
|
11
|
+
Scenario: Inside the breadcrumb
|
|
12
|
+
Given I am on "/text-order.html"
|
|
13
|
+
Then the text "Products" should appear after the text "Home" in the "nav.breadcrumb" element
|
|
14
|
+
And the text "Laptops" should appear after the text "Products" in the "nav.breadcrumb" element
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Feature: Taps in a browser context with touch
|
|
2
|
+
A scenario tagged @touch opens with touch on, so "I tap on" fires the
|
|
3
|
+
touch events a mobile control listens to. Without the tag the browser
|
|
4
|
+
context has no touch, and a tap is a click.
|
|
5
|
+
|
|
6
|
+
@touch
|
|
7
|
+
Scenario: A tap with touch on reaches a control that listens to touch only
|
|
8
|
+
Given I am on "/touch.html"
|
|
9
|
+
When I tap on "#touch-card"
|
|
10
|
+
Then "#result" should have text "Touched the card"
|
|
11
|
+
|
|
12
|
+
@mobile @touch
|
|
13
|
+
Scenario: A phone with touch
|
|
14
|
+
Given I am on "/touch.html"
|
|
15
|
+
When I tap on "#touch-card"
|
|
16
|
+
Then "#result" should have text "Touched the card"
|
|
17
|
+
|
|
18
|
+
Scenario: Without touch a tap is a click
|
|
19
|
+
Given I am on "/touch.html"
|
|
20
|
+
When I tap on "#click-card"
|
|
21
|
+
Then "#result" should have text "Clicked the card"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: An element at the top of the viewport
|
|
2
|
+
`the element "<selector>" should be at the top of the viewport` passes when
|
|
3
|
+
the top of the element is between 0 and 100 pixels from the top of the
|
|
4
|
+
viewport, and looks again for up to 5 seconds.
|
|
5
|
+
|
|
6
|
+
Scenario: An element already at the top
|
|
7
|
+
Given I am on "/viewport-top.html"
|
|
8
|
+
Then the element "#section-1" should be at the top of the viewport
|
|
9
|
+
|
|
10
|
+
Scenario: An element that gets there a moment after the click
|
|
11
|
+
Given I am on "/viewport-top.html"
|
|
12
|
+
When I click "Go to section 3"
|
|
13
|
+
Then the element "#section-3" should be at the top of the viewport
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Feature: The namespaces of an XML document
|
|
2
|
+
As a tester,
|
|
3
|
+
I want to check the namespaces an XML response uses, wherever it declares them,
|
|
4
|
+
so that a SOAP body or a feed extension is checked as well as the root element.
|
|
5
|
+
|
|
6
|
+
Scenario: A namespace declared below the root element
|
|
7
|
+
Given the response content is the following:
|
|
8
|
+
"""
|
|
9
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
|
10
|
+
<soap:Body>
|
|
11
|
+
<m:GetPriceResponse xmlns:m="https://www.example.org/stock">
|
|
12
|
+
<m:Price>34.5</m:Price>
|
|
13
|
+
</m:GetPriceResponse>
|
|
14
|
+
</soap:Body>
|
|
15
|
+
</soap:Envelope>
|
|
16
|
+
"""
|
|
17
|
+
Then the XML should use the namespace "http://schemas.xmlsoap.org/soap/envelope/"
|
|
18
|
+
And the XML should use the namespace "https://www.example.org/stock"
|
|
19
|
+
And the XML should not use the namespace "http://www.w3.org/2005/Atom"
|
|
20
|
+
|
|
21
|
+
Scenario: A default namespace declared on a child element
|
|
22
|
+
Given the response content is the following:
|
|
23
|
+
"""
|
|
24
|
+
<page><content xmlns="http://www.w3.org/1999/xhtml"><p>Hello</p></content></page>
|
|
25
|
+
"""
|
|
26
|
+
Then the XML should use the namespace "http://www.w3.org/1999/xhtml"
|
|
27
|
+
|
|
28
|
+
Scenario: An attribute whose value is a URI is not a namespace
|
|
29
|
+
Given the response content is the following:
|
|
30
|
+
"""
|
|
31
|
+
<links home="http://www.w3.org/1999/xhtml"><link href="http://www.w3.org/2005/Atom">Atom</link></links>
|
|
32
|
+
"""
|
|
33
|
+
Then the XML should not use the namespace "http://www.w3.org/1999/xhtml"
|
|
34
|
+
And the XML should not use the namespace "http://www.w3.org/2005/Atom"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: API JSON property checks that must fail, and what they say
|
|
3
|
+
Every scenario names a property of /example-api.json wrongly or asserts a
|
|
4
|
+
wrong value. tests/check-must-fail.js checks the message, the request and
|
|
5
|
+
the hint.
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given the API base URL is "/"
|
|
9
|
+
When I send a GET request to "/example-api.json"
|
|
10
|
+
|
|
11
|
+
Scenario: A JSON Pointer to a property that is there, asserted absent
|
|
12
|
+
Fails with: The JSON response has "/data/0/type", but it should not.
|
|
13
|
+
Then the JSON response should not have property "/data/0/type"
|
|
14
|
+
|
|
15
|
+
Scenario: A path whose last part is missing
|
|
16
|
+
Fails with: The JSON response has no "data.0.discount": "data.0" has no "discount".
|
|
17
|
+
Then the JSON response should have "data.0.discount" equal to 10
|
|
18
|
+
|
|
19
|
+
Scenario: A wrong value
|
|
20
|
+
Fails with: The JSON response has "data.0.type" equal to "articles", not "people".
|
|
21
|
+
Then the JSON response should have "data.0.type" equal to "people"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: API response text checks that must fail, and what they say
|
|
3
|
+
Every scenario asserts something about /example-api.json that is not true.
|
|
4
|
+
tests/check-must-fail.js runs them and checks that each one fails at its
|
|
5
|
+
last step with the message its description announces, the request it was
|
|
6
|
+
sent with and a hint.
|
|
7
|
+
|
|
8
|
+
Background:
|
|
9
|
+
Given the API base URL is "/"
|
|
10
|
+
When I send a GET request to "/example-api.json"
|
|
11
|
+
|
|
12
|
+
Scenario: A text that is in the response in another letter case
|
|
13
|
+
Fails with: The API response contains "json:api paints my bikeshed", but it should not.
|
|
14
|
+
Then the API response should not contain "json:api paints my bikeshed"
|
|
15
|
+
|
|
16
|
+
Scenario: A placeholder whose value is in the response
|
|
17
|
+
Fails with: The API response contains "John", but it should not.
|
|
18
|
+
Given I set placeholder "{{author}}" to "John"
|
|
19
|
+
Then the API response should not contain "{{author}}"
|
|
20
|
+
|
|
21
|
+
Scenario: A text that is not in the response
|
|
22
|
+
Fails with: The API response does not contain "Completely different words".
|
|
23
|
+
Then the API response should contain "Completely different words"
|