webship-js 2.0.11 → 2.0.13
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 +48 -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 +53 -10
- 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/check-switch.html +37 -0
- package/examples/choice-controls.html +29 -0
- package/examples/click-whitespace.html +37 -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/follow-hidden-first.html +29 -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 +17 -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-network-changed.js +137 -0
- package/tests/check-scaffold.js +54 -2
- 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/check-switch.feature +28 -0
- package/tests/features/choice-controls.feature +35 -0
- package/tests/features/click-whitespace.feature +29 -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/follow-hidden-first.feature +9 -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 +53 -20
- 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 +412 -96
- package/tests/step-definitions/form.steps.js +88 -37
- 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 +741 -145
- package/tests/step-definitions/xml.steps.js +49 -15
- package/tests/step-definitions/yaml.steps.js +45 -20
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Feature: Follow the link a person sees when a collapsed menu repeats it first
|
|
2
|
+
As a tester
|
|
3
|
+
I want to follow a link by its text
|
|
4
|
+
So that a hidden copy of it in a closed menu is not the one the step waits on
|
|
5
|
+
|
|
6
|
+
Scenario: Follow a link whose hidden copy comes first in the page
|
|
7
|
+
Given I am on "/follow-hidden-first.html"
|
|
8
|
+
When I follow "Bags"
|
|
9
|
+
Then the url should match "#bags$"
|
|
@@ -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"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: API response header presence checks that must fail, and what they say
|
|
3
|
+
Every scenario asserts a header of /example-api.json is there, or is not,
|
|
4
|
+
when the opposite is true. tests/check-must-fail.js checks the message, the
|
|
5
|
+
request and 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 header the response does not have
|
|
12
|
+
Fails with: The API response has no "X-Powered-By" header.
|
|
13
|
+
Then the API response should contain the header "X-Powered-By"
|
|
14
|
+
|
|
15
|
+
Scenario: A header the response has
|
|
16
|
+
Fails with: The API response has the header "ETag", but it should not.
|
|
17
|
+
Then the API response should not contain the header "ETag"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: API response header checks that must fail, and what they say
|
|
3
|
+
Every scenario asserts something about the headers of /example-api.json
|
|
4
|
+
that is not true. tests/check-must-fail.js checks the message, the request
|
|
5
|
+
and 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: "should be" given a part of the value
|
|
12
|
+
Fails with: The response header "Content-Type" is "application/json; charset=UTF-8", not "json".
|
|
13
|
+
Then the response header "Content-Type" should be "json"
|
|
14
|
+
|
|
15
|
+
Scenario: "should contain" given a text the value does not hold
|
|
16
|
+
Fails with: The response header "Content-Type" does not contain "text/html".
|
|
17
|
+
Then the response header "Content-Type" should contain "text/html"
|
|
18
|
+
|
|
19
|
+
Scenario: A header the response does not have
|
|
20
|
+
Fails with: The API response has no "X-Not-Sent" header.
|
|
21
|
+
Then the header "X-Not-Sent" should be "anything"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: An API request without a base URL must fail, and say why
|
|
3
|
+
The API base URL belongs to the scenario that sets it. A scenario that sets
|
|
4
|
+
none fails at its first request with a path, even when another scenario of
|
|
5
|
+
the run set one before it (the scenarios of api-response-contains.feature
|
|
6
|
+
run first and set "/"). tests/check-must-fail.js checks the message, the
|
|
7
|
+
request and the hint.
|
|
8
|
+
|
|
9
|
+
Scenario: A request to a path in a scenario that set no base URL
|
|
10
|
+
Fails with: No API base URL is set, so "/example-api.json" has no address.
|
|
11
|
+
When I send a GET request to "/example-api.json"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: Breakpoints that must fail, and what they say
|
|
3
|
+
tests/check-must-fail.js runs these scenarios and checks that each one fails
|
|
4
|
+
at its last step with the message its description announces, the address
|
|
5
|
+
of the page and a hint.
|
|
6
|
+
|
|
7
|
+
Scenario: A breakpoint nobody named
|
|
8
|
+
Fails with: There is no breakpoint named "watch".
|
|
9
|
+
Given I am on "/viewport-size.html"
|
|
10
|
+
When I set the viewport to the "watch" breakpoint
|
|
11
|
+
|
|
12
|
+
Scenario: A breakpoint nobody named, by the viewing-the-site step
|
|
13
|
+
Fails with: There is no breakpoint named "phablet".
|
|
14
|
+
Given I am on "/viewport-size.html"
|
|
15
|
+
When I am viewing the site on a "phablet" screen
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: Checkbox, radio button and field steps that must fail, and what they say
|
|
3
|
+
tests/check-must-fail.js runs these scenarios and checks that each one
|
|
4
|
+
fails at its last step with the message its description announces, the
|
|
5
|
+
address of the page and a hint, within a few seconds.
|
|
6
|
+
|
|
7
|
+
Scenario: A checkbox that is not on the page
|
|
8
|
+
Fails with: No checkbox with the label, the name, the id or the selector "Subscribe" was found after 5 seconds.
|
|
9
|
+
Given I am on "/choice-controls.html"
|
|
10
|
+
Then the "Subscribe" checkbox should be checked
|
|
11
|
+
|
|
12
|
+
Scenario: A checkbox that is not checked
|
|
13
|
+
Fails with: The checkbox "Accept the terms" is not checked.
|
|
14
|
+
Given I am on "/choice-controls.html"
|
|
15
|
+
Then the checkbox "Accept the terms" should be checked
|
|
16
|
+
|
|
17
|
+
Scenario: A radio button that is selected
|
|
18
|
+
Fails with: The radio button "Premium" is selected, but it should not be.
|
|
19
|
+
Given I am on "/choice-controls.html"
|
|
20
|
+
Then the radio button "Premium" should not be selected
|
|
21
|
+
|
|
22
|
+
Scenario: A field that is not on the page
|
|
23
|
+
Fails with: No field with the label, the name, the id or the selector "Country" was found after 5 seconds.
|
|
24
|
+
Given I am on "/choice-controls.html"
|
|
25
|
+
When I fill in the field "Country" with "Jordan"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: Clock steps that must fail, and what they say
|
|
3
|
+
tests/check-must-fail.js runs these scenarios and checks that each one fails
|
|
4
|
+
at its last step with the message its description announces, the address
|
|
5
|
+
of the page and a hint.
|
|
6
|
+
|
|
7
|
+
Scenario: Waiting for the timers of the page under a fake clock
|
|
8
|
+
Fails with: A fake clock is installed, so the timers of the page run only when the clock moves.
|
|
9
|
+
Given I am on "/clock.html"
|
|
10
|
+
And the system time is "2026-05-08T10:00:00Z"
|
|
11
|
+
When I wait until pending timers settle
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: Datetime steps that must fail, and what they say
|
|
3
|
+
tests/check-must-fail.js runs these scenarios and checks that each one
|
|
4
|
+
fails at its last step with the message its description announces, the
|
|
5
|
+
address of the page and a hint.
|
|
6
|
+
|
|
7
|
+
Scenario: A datetime field that has no time input
|
|
8
|
+
Fails with: The datetime field "Opening" has no time input.
|
|
9
|
+
Given I am on "/datetime-fields.html"
|
|
10
|
+
When I fill in the time part of the datetime field "Opening" with "09:00"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: An element named by a selector where the step reads a text
|
|
3
|
+
`I should see a "…" element` names the element by its exact visible text or
|
|
4
|
+
by its label. tests/check-must-fail.js runs these scenarios and checks that
|
|
5
|
+
each one fails at its last step with the message its description announces
|
|
6
|
+
(here: the hint that the argument looks like a selector), the address of the
|
|
7
|
+
page and a hint.
|
|
8
|
+
|
|
9
|
+
Scenario: A class selector where the step reads a text
|
|
10
|
+
Fails with: ".news-item" looks like a CSS selector, but this step reads it as the exact text of an element or of a label. For a selector, use: ".news-item" should be visible
|
|
11
|
+
Given I am on "/element-selector-hint.html"
|
|
12
|
+
Then I should see a ".news-item" element
|
|
13
|
+
|
|
14
|
+
Scenario: A tag name where the step reads a text
|
|
15
|
+
Fails with: "header" looks like a CSS selector, but this step reads it as the exact text of an element or of a label. For a selector, use: "header" should be visible
|
|
16
|
+
Given I am on "/element-selector-hint.html"
|
|
17
|
+
Then I should see a "header" element
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@must-fail
|
|
2
|
+
Feature: Field state checks that must fail, and what they say
|
|
3
|
+
tests/check-must-fail.js runs these scenarios and checks that each one
|
|
4
|
+
fails at its last step with the message its description announces, the
|
|
5
|
+
address of the page and a hint.
|
|
6
|
+
|
|
7
|
+
Scenario: An editable field is not read-only
|
|
8
|
+
Fails with: The field "Username" is not read-only.
|
|
9
|
+
Given I am on "/field-states.html"
|
|
10
|
+
Then the field "Username" should have "read-only" state
|
|
11
|
+
|
|
12
|
+
Scenario: A disabled field is not editable
|
|
13
|
+
Fails with: The field "Account ID" is not editable.
|
|
14
|
+
Given I am on "/field-states.html"
|
|
15
|
+
Then the field "Account ID" should have "editable" state
|
|
16
|
+
|
|
17
|
+
Scenario: A state the step does not know
|
|
18
|
+
Fails with: "valid" is not a state this step can check.
|
|
19
|
+
Given I am on "/field-states.html"
|
|
20
|
+
Then the field "Username" should have "valid" state
|