webship-js 2.0.6 → 2.0.8
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/.drone.yml +0 -0
- package/.harness/webship-js-pipeline.yml +0 -0
- package/.semaphore/semaphore.yml +0 -0
- package/.teamcity/pom.xml +0 -0
- package/.teamcity/settings.kts +0 -0
- package/.travis.yml +0 -0
- package/CLAUDE.md +1 -1
- package/Jenkinsfile +0 -0
- package/azure-pipelines.yml +0 -0
- package/bamboo-specs/bamboo.yml +0 -0
- package/bin/generate-reports.js +0 -0
- package/bin/init-webship.js +8 -9
- package/bin/postinstall.js +0 -0
- package/buildspec.yml +0 -0
- package/cloudbuild.yaml +0 -0
- package/codefresh.yml +0 -0
- package/docs/00-quick-start.md +0 -0
- package/docs/01-getting-started.md +0 -0
- package/docs/03-selector-registry.md +0 -0
- package/docs/05-web-first-assertions.md +2 -0
- package/docs/06-network-and-dialogs.md +0 -0
- package/docs/07-auth-state.md +0 -0
- package/docs/08-clock-mocking.md +0 -0
- package/docs/09-api-testing.md +0 -0
- package/docs/11-debugging.md +0 -0
- package/docs/12-ai-agent-guide.md +0 -0
- package/docs/13-faq.md +0 -0
- package/docs/14-recipes-cookbook.md +0 -0
- package/docs/15-tag-conventions.md +0 -0
- package/docs/16-ci-cd.md +0 -0
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +0 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +0 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +0 -0
- package/docs/advanced-screenshots.md +0 -0
- package/docs/advanced-selectors.md +0 -0
- package/docs/api-step-definitions.md +0 -0
- package/docs/global-settings.md +5 -3
- package/docs/install-webship-js/ddev-webship-js.md +0 -0
- package/docs/step-definitions/given-i-am-anonymous-user.md +0 -0
- package/docs/step-definitions/given-i-am-homepage.md +0 -0
- package/docs/step-definitions/given-i-am-specific-page.md +4 -0
- package/docs/step-definitions/then-i-should-be.md +0 -0
- package/docs/step-definitions/then-i-should-see.md +6 -0
- package/docs/step-definitions/then-item-checkbox.md +0 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +0 -0
- package/docs/step-definitions/then-item-should-contain.md +0 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +0 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +0 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +0 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +0 -0
- package/docs/step-definitions/when-i-check-checkbox.md +0 -0
- package/docs/step-definitions/when-i-click-link.md +0 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +0 -0
- package/docs/step-definitions/when-i-fill.md +0 -0
- package/docs/step-definitions/when-i-go-homepage.md +0 -0
- package/docs/step-definitions/when-i-go-specific-page.md +4 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +0 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +0 -0
- package/docs/step-definitions/when-i-press-button.md +0 -0
- package/docs/step-definitions/when-i-reload-page.md +0 -0
- package/docs/step-definitions/when-i-scroll.md +0 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +0 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +0 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +0 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +0 -0
- package/docs/step-definitions/when-i-wait.md +0 -0
- package/docs/step-definitions.md +0 -0
- package/examples/account.html +0 -0
- package/examples/ajax-wait-examples.html +0 -0
- package/examples/cookies.html +0 -0
- package/examples/date.html +0 -0
- package/examples/dynamic-examples.html +0 -0
- package/examples/element-visibility.html +17 -0
- package/examples/element.html +0 -0
- package/examples/field.html +0 -0
- package/examples/keyboard.html +0 -0
- package/examples/links.html +0 -0
- package/examples/modal.html +0 -0
- package/examples/native-dialogs.html +22 -0
- package/examples/path.html +0 -0
- package/examples/table.html +0 -0
- package/examples/test--modal-dialogs.html +0 -0
- package/examples/test--when--i-additionally-select.html +0 -0
- package/examples/test--when--i-select-radio-button.html +0 -0
- package/examples/video-demo.html +0 -0
- package/examples/web-first-text.html +18 -0
- package/package.json +2 -2
- package/playwright.config.ts +0 -0
- package/tests/assets/test-document.pdf +0 -0
- package/tests/features/absolute-url.feature +51 -0
- package/tests/features/ajax-wait-examples.feature +0 -0
- package/tests/features/cookie.feature +0 -0
- package/tests/features/date.feature +0 -0
- package/tests/features/dynamic-content-examples.feature +0 -0
- package/tests/features/element.feature +0 -0
- package/tests/features/field.feature +0 -0
- package/tests/features/keyboard.feature +0 -0
- package/tests/features/link.feature +0 -0
- package/tests/features/modal-advanced-example.feature +0 -0
- package/tests/features/modal-basic-example.feature +0 -0
- package/tests/features/modal-error-handling-example.feature +0 -0
- package/tests/features/modal.feature +0 -0
- package/tests/features/path.feature +0 -0
- package/tests/features/pronoun-prefix-steps.feature +81 -0
- package/tests/features/response.feature +0 -0
- package/tests/features/responsive.feature +0 -0
- package/tests/features/table.feature +0 -0
- package/tests/features/test--given--i-am-an-anonymous-user.feature +0 -0
- package/tests/features/test--then--i-save-screenshot.feature +0 -0
- package/tests/features/test--then--i-see-locator.feature +0 -0
- package/tests/features/test--then--i-should-not-see-an-element.feature +11 -1
- package/tests/features/test--then--i-should-see-n-elements.feature +0 -0
- package/tests/features/test--then--print-current-url-and-response.feature +0 -0
- package/tests/features/test--when--i-additionally-select.feature +0 -0
- package/tests/features/test--when--i-follow.feature +0 -0
- package/tests/features/test--when--i-select-radio-button.feature +0 -0
- package/tests/features/video.feature +0 -0
- package/tests/features/wait.feature +0 -0
- package/tests/features/web-first-text.feature +21 -0
- package/tests/features/yaml.feature +0 -0
- package/tests/reports/README.md +0 -0
- package/tests/selectors/_canonical-keys.json +0 -0
- package/tests/selectors/back-end-selectors.json +0 -0
- package/tests/selectors/cms-contentful-admin.json +0 -0
- package/tests/selectors/cms-craft-admin.json +0 -0
- package/tests/selectors/cms-drupal-cms-gin.json +0 -0
- package/tests/selectors/cms-drupal-core-claro.json +0 -0
- package/tests/selectors/cms-generic-admin.json +0 -0
- package/tests/selectors/cms-ghost-admin.json +0 -0
- package/tests/selectors/cms-joomla-admin.json +0 -0
- package/tests/selectors/cms-magento2-admin.json +0 -0
- package/tests/selectors/cms-prestashop-admin.json +0 -0
- package/tests/selectors/cms-shopify-admin.json +0 -0
- package/tests/selectors/cms-strapi-admin.json +0 -0
- package/tests/selectors/cms-typo3-admin.json +0 -0
- package/tests/selectors/cms-woocommerce-front.json +0 -0
- package/tests/selectors/cms-wordpress-admin.json +0 -0
- package/tests/selectors/framework-ant-design.json +0 -0
- package/tests/selectors/framework-bootstrap.json +0 -0
- package/tests/selectors/framework-bulma.json +0 -0
- package/tests/selectors/framework-chakra.json +0 -0
- package/tests/selectors/framework-foundation.json +0 -0
- package/tests/selectors/framework-material-ui.json +0 -0
- package/tests/selectors/framework-shadcn.json +0 -0
- package/tests/selectors/framework-tailwind.json +0 -0
- package/tests/selectors/framework-vuetify.json +0 -0
- package/tests/selectors/front-end-selectors.json +0 -0
- package/tests/selectors/homepage-selectors.json +0 -0
- package/tests/step-definitions/a11y.steps.js +1 -1
- package/tests/step-definitions/action.steps.js +0 -0
- package/tests/step-definitions/api.steps.js +0 -0
- package/tests/step-definitions/assertion.steps.js +18 -3
- package/tests/step-definitions/auth.steps.js +1 -1
- package/tests/step-definitions/clock.steps.js +2 -2
- package/tests/step-definitions/cookie.steps.js +0 -0
- package/tests/step-definitions/debug.steps.js +0 -0
- package/tests/step-definitions/dialog.steps.js +4 -4
- package/tests/step-definitions/element.steps.js +0 -0
- package/tests/step-definitions/field.steps.js +0 -0
- package/tests/step-definitions/file-download.steps.js +2 -2
- package/tests/step-definitions/form.steps.js +0 -0
- package/tests/step-definitions/iframe.steps.js +1 -1
- package/tests/step-definitions/input.steps.js +0 -0
- package/tests/step-definitions/javascript.steps.js +0 -0
- package/tests/step-definitions/keyboard.steps.js +0 -0
- package/tests/step-definitions/link.steps.js +0 -0
- package/tests/step-definitions/metatag.steps.js +0 -0
- package/tests/step-definitions/modal.steps.js +0 -0
- package/tests/step-definitions/navigation.steps.js +8 -5
- package/tests/step-definitions/network.steps.js +1 -1
- package/tests/step-definitions/path.steps.js +0 -0
- package/tests/step-definitions/response.steps.js +0 -0
- package/tests/step-definitions/responsive.steps.js +0 -0
- package/tests/step-definitions/rest.steps.js +3 -2
- package/tests/step-definitions/screenshot.steps.js +0 -0
- package/tests/step-definitions/scroll.steps.js +0 -0
- package/tests/step-definitions/selectors.steps.js +0 -0
- package/tests/step-definitions/storage.steps.js +0 -0
- package/tests/step-definitions/table.steps.js +0 -0
- package/tests/step-definitions/video.steps.js +0 -0
- package/tests/step-definitions/wait.steps.js +3 -3
- package/tests/step-definitions/web-first.steps.js +14 -3
- package/tests/step-definitions/webship.js +16 -0
- package/tests/step-definitions/xml.steps.js +1 -1
- package/tests/step-definitions/yaml.steps.js +1 -1
- package/tsconfig.json +0 -0
- package/videos/README.md +0 -0
package/.drone.yml
CHANGED
|
File without changes
|
|
File without changes
|
package/.semaphore/semaphore.yml
CHANGED
|
File without changes
|
package/.teamcity/pom.xml
CHANGED
|
File without changes
|
package/.teamcity/settings.kts
CHANGED
|
File without changes
|
package/.travis.yml
CHANGED
|
File without changes
|
package/CLAUDE.md
CHANGED
|
@@ -299,7 +299,7 @@ tests/step-definitions/
|
|
|
299
299
|
├── xml.steps.js (20) # XPath equals / contains / count / attr
|
|
300
300
|
└── yaml.steps.js (38) # multi-doc, types, numerics, JSON Schema, diff
|
|
301
301
|
|
|
302
|
-
tests/features/ #
|
|
302
|
+
tests/features/ # 73 .feature files
|
|
303
303
|
tests/selectors/ # 26 JSON presets + _canonical-keys.json
|
|
304
304
|
tests/assets/ # upload fixtures (pdf, png)
|
|
305
305
|
examples/ # static HTML fixtures served by `npm start`
|
package/Jenkinsfile
CHANGED
|
File without changes
|
package/azure-pipelines.yml
CHANGED
|
File without changes
|
package/bamboo-specs/bamboo.yml
CHANGED
|
File without changes
|
package/bin/generate-reports.js
CHANGED
|
File without changes
|
package/bin/init-webship.js
CHANGED
|
@@ -11,12 +11,13 @@ const packagePath = path.join(__dirname, '..');
|
|
|
11
11
|
const CUCUMBER_JS = `module.exports = {
|
|
12
12
|
default: {
|
|
13
13
|
timeout: 30000, // Overridden by webship-js's setDefaultTimeout (45s); raise it with WEBSHIP_STEP_TIMEOUT.
|
|
14
|
-
requireModule: ['
|
|
14
|
+
requireModule: ['tsx/cjs'],
|
|
15
15
|
require: [
|
|
16
16
|
'node_modules/webship-js/tests/step-definitions/**/*.js', // Webship-js core step definitions (auto HTML report on exit; disable: WEBSHIP_REPORT_DISABLE=1).
|
|
17
17
|
'tests/step-definitions/**/*.js', // Your custom step definitions.
|
|
18
18
|
],
|
|
19
|
-
|
|
19
|
+
// FEATURES=tests/features/a.feature,tests/features/b.feature runs a subset.
|
|
20
|
+
paths: process.env.FEATURES ? process.env.FEATURES.split(',') : ['tests/features/**/*.feature'],
|
|
20
21
|
format: [
|
|
21
22
|
'@cucumber/pretty-formatter',
|
|
22
23
|
'json:tests/reports/cucumber_report.json',
|
|
@@ -59,7 +60,7 @@ const CUCUMBER_JS = `module.exports = {
|
|
|
59
60
|
},
|
|
60
61
|
},
|
|
61
62
|
screenshot: {
|
|
62
|
-
dir: './screenshots',
|
|
63
|
+
dir: './tests/screenshots',
|
|
63
64
|
purge: false,
|
|
64
65
|
onFailed: true,
|
|
65
66
|
onEveryStep: false,
|
|
@@ -100,8 +101,9 @@ interface PlaywrightConfig {
|
|
|
100
101
|
const config: PlaywrightConfig = {
|
|
101
102
|
browser,
|
|
102
103
|
launchOptions: {
|
|
103
|
-
headless:
|
|
104
|
-
|
|
104
|
+
headless: process.env.HEADLESS !== 'false',
|
|
105
|
+
// SLOW_MO env var: 0 in CI for speed, 800ms when watching headed runs.
|
|
106
|
+
slowMo: parseInt(process.env.SLOW_MO || (process.env.HEADLESS === 'false' ? '800' : '300'), 10),
|
|
105
107
|
args: browser === 'chromium' ? chromiumArgs : [],
|
|
106
108
|
},
|
|
107
109
|
contextOptions: {
|
|
@@ -121,9 +123,6 @@ const TSCONFIG_JSON = {
|
|
|
121
123
|
esModuleInterop: true,
|
|
122
124
|
types: ['node'],
|
|
123
125
|
},
|
|
124
|
-
'ts-node': {
|
|
125
|
-
ignore: ['node_modules/(?!webship-js/)'],
|
|
126
|
-
},
|
|
127
126
|
};
|
|
128
127
|
|
|
129
128
|
const FEATURE_SAMPLE = `Feature: Check the home page
|
|
@@ -304,7 +303,7 @@ function run(argv) {
|
|
|
304
303
|
ensureDir(path.join(projectPath, 'tests', 'reports'));
|
|
305
304
|
ensureDir(path.join(projectPath, 'tests', 'step-definitions'));
|
|
306
305
|
ensureDir(path.join(projectPath, 'tests', 'selectors'));
|
|
307
|
-
ensureDir(path.join(projectPath, 'screenshots'));
|
|
306
|
+
ensureDir(path.join(projectPath, 'tests', 'screenshots'));
|
|
308
307
|
|
|
309
308
|
const assetResults = writeTextAssets(projectPath, opts);
|
|
310
309
|
const tsconfigWritten = writeTsconfig(projectPath, opts);
|
package/bin/postinstall.js
CHANGED
|
File without changes
|
package/buildspec.yml
CHANGED
|
File without changes
|
package/cloudbuild.yaml
CHANGED
|
File without changes
|
package/codefresh.yml
CHANGED
|
File without changes
|
package/docs/00-quick-start.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -52,6 +52,8 @@ Then "<sel>" should contain text "$99"
|
|
|
52
52
|
Then "<sel>" should have value "alice@example.com"
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
`should have text` is the exact match: the element's text, trimmed. `should contain text` collapses every run of whitespace to one space, on the element's text and on the expected text, before it looks for the substring, so a line the markup wraps still matches.
|
|
56
|
+
|
|
55
57
|
## Attributes / classes
|
|
56
58
|
|
|
57
59
|
```gherkin
|
|
File without changes
|
package/docs/07-auth-state.md
CHANGED
|
File without changes
|
package/docs/08-clock-mocking.md
CHANGED
|
File without changes
|
package/docs/09-api-testing.md
CHANGED
|
File without changes
|
package/docs/11-debugging.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/13-faq.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/16-ci-cd.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/global-settings.md
CHANGED
|
@@ -15,9 +15,9 @@ This page documents every supported setting plus its env-var override.
|
|
|
15
15
|
| Key | Type | Default | Notes |
|
|
16
16
|
| --- | --- | --- | --- |
|
|
17
17
|
| `timeout` | int (ms) | `30000` | Per-step timeout enforced by `setDefaultTimeout`. |
|
|
18
|
-
| `requireModule` | array | `['
|
|
18
|
+
| `requireModule` | array | `['tsx/cjs']` | TypeScript runtime support. |
|
|
19
19
|
| `require` | array | step-definition globs | Files Cucumber-js loads at startup. |
|
|
20
|
-
| `paths` | array | `['tests/features/**/*.feature']` | Where to find feature files. |
|
|
20
|
+
| `paths` | array | `['tests/features/**/*.feature']` | Where to find feature files. The scaffolded `cucumber.js` also reads `FEATURES`, comma-separated: `FEATURES=tests/features/a.feature,tests/features/b.feature`. |
|
|
21
21
|
| `format` | array | pretty + JSON report | Output formatters. |
|
|
22
22
|
| `formatOptions` | object | colour theme | Pretty-formatter colours. |
|
|
23
23
|
| `worldParameters` | object | (sections below) | Everything passed to the Playwright World. |
|
|
@@ -42,7 +42,7 @@ on the command line).
|
|
|
42
42
|
| --- | --- | --- |
|
|
43
43
|
| string | `http://localhost:8080` | `LAUNCH_URL` |
|
|
44
44
|
|
|
45
|
-
Base URL prepended to every relative path in `Given I am on "/path"`.
|
|
45
|
+
Base URL prepended to every relative path in `Given I am on "/path"`. An absolute `http://` or `https://` URL is opened as written.
|
|
46
46
|
|
|
47
47
|
### `assetsFolder`
|
|
48
48
|
|
|
@@ -132,6 +132,8 @@ screenshot: {
|
|
|
132
132
|
| `filenamePatternFailed` | `{failed_prefix}...` | `WEBSHIP_SCREENSHOT_PATTERN_FAIL` |
|
|
133
133
|
| `infoTypes` | `''` | `WEBSHIP_SCREENSHOT_INFO_TYPES` (e.g. `"url,feature,step,datetime"`) |
|
|
134
134
|
|
|
135
|
+
`init-webship-js` writes `dir: './tests/screenshots'` in the scaffolded `cucumber.js`, beside `tests/reports/`.
|
|
136
|
+
|
|
135
137
|
Filename pattern tokens: `{datetime}`, `{date}`, `{time}`, `{feature_file}`,
|
|
136
138
|
`{feature}`, `{scenario}`, `{step_line}`, `{ext}`, `{failed_prefix}`,
|
|
137
139
|
`{url}`, `{host}`, `{path}`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,8 +25,12 @@ Given we are on the "/about-us" page
|
|
|
25
25
|
Given on "/about-us"
|
|
26
26
|
|
|
27
27
|
Given on the "/about-us" page
|
|
28
|
+
|
|
29
|
+
Given I am on "https://un.org"
|
|
28
30
|
```
|
|
29
31
|
|
|
32
|
+
A path is opened under the `launchUrl`; an absolute `http://` or `https://` URL is opened as written.
|
|
33
|
+
|
|
30
34
|
## Key Information
|
|
31
35
|
|
|
32
36
|
This step definition is part of the Webship JS 2.0.x documentation's Step Definitions section. It supports flexible phrasing patterns, allowing users to specify page locations using various grammatical structures. The pattern accepts optional articles ("the") and the word "page," accommodating different natural language preferences while directing the test to navigate to the specified URL or page identifier.
|
|
File without changes
|
|
@@ -22,6 +22,12 @@ The following step variations are available:
|
|
|
22
22
|
- Then I should see "value" in the "text" element by attr
|
|
23
23
|
- Then I should not see "value" in the "text" element by attr
|
|
24
24
|
|
|
25
|
+
## Seeing an element
|
|
26
|
+
|
|
27
|
+
`I should see (a/an) "text" element` and `I should not see (a/an) "text" element` name the element by its exact visible text, as it reads on the page. A `<label for="...">` stands for the control it labels. "Should not see" is the opposite of "should see": it passes when no element named that way is visible, so an element that is hidden does not fail it.
|
|
28
|
+
|
|
29
|
+
The text is not a CSS selector. For a selector use `"<selector>" should be visible` or `"<selector>" should not be visible`.
|
|
30
|
+
|
|
25
31
|
## Purpose
|
|
26
32
|
|
|
27
33
|
"This step is useful for verifying that certain elements or messages are displayed correctly on a webpage or application, ensuring that the expected content is visible to the user or the automated tests."
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -27,8 +27,12 @@ When navigating to "/products"
|
|
|
27
27
|
When we go to "/products"
|
|
28
28
|
|
|
29
29
|
When we navigate to "/terms"
|
|
30
|
+
|
|
31
|
+
When I go to "https://un.org"
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
A path is opened under the `launchUrl`; an absolute `http://` or `https://` URL is opened as written.
|
|
35
|
+
|
|
32
36
|
## Key Details
|
|
33
37
|
|
|
34
38
|
This step accepts flexible phrasing with multiple variations including "go," "navigate," and collective pronouns ("we"). The page identifier is captured as a parameter in quotation marks and can represent either a page name or a complete URL path.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/step-definitions.md
CHANGED
|
File without changes
|
package/examples/account.html
CHANGED
|
File without changes
|
|
File without changes
|
package/examples/cookies.html
CHANGED
|
File without changes
|
package/examples/date.html
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Element visibility</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Account</h1>
|
|
9
|
+
|
|
10
|
+
<p><label for="email">Email</label> <input id="email" type="text"></p>
|
|
11
|
+
<p><input id="save" type="button" value="Save"></p>
|
|
12
|
+
<p id="note" style="display: none">Hidden note</p>
|
|
13
|
+
<p><label for="ghost">Ghost label</label><input id="ghost" type="text" style="display: none"></p>
|
|
14
|
+
|
|
15
|
+
<script>var promo = 'Promo banner';</script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
package/examples/element.html
CHANGED
|
File without changes
|
package/examples/field.html
CHANGED
|
File without changes
|
package/examples/keyboard.html
CHANGED
|
File without changes
|
package/examples/links.html
CHANGED
|
File without changes
|
package/examples/modal.html
CHANGED
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Native dialogs</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Native dialogs</h1>
|
|
9
|
+
|
|
10
|
+
<p><button id="delete" type="button">Delete item</button></p>
|
|
11
|
+
<p id="result">Waiting</p>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
var clicks = 0;
|
|
15
|
+
document.getElementById('delete').addEventListener('click', function () {
|
|
16
|
+
clicks += 1;
|
|
17
|
+
var answer = window.confirm('Delete this item?') ? 'Item deleted' : 'Deletion cancelled';
|
|
18
|
+
document.getElementById('result').textContent = answer + ' #' + clicks;
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
package/examples/path.html
CHANGED
|
File without changes
|
package/examples/table.html
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/examples/video-demo.html
CHANGED
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Web-first text</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Home</h1>
|
|
9
|
+
|
|
10
|
+
<footer class="site-footer">
|
|
11
|
+
<p>Powered by
|
|
12
|
+
Example</p>
|
|
13
|
+
</footer>
|
|
14
|
+
|
|
15
|
+
<p class="price">Price: $99</p>
|
|
16
|
+
<p class="tagline"> Built with care </p>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Webship JS automated functional testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"homepage": "https://github.com/webship/webship-js",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@axe-core/playwright": "^4.11.3",
|
|
39
|
-
"@cucumber/cucumber": "
|
|
39
|
+
"@cucumber/cucumber": "^12",
|
|
40
40
|
"@cucumber/pretty-formatter": "~1",
|
|
41
41
|
"@types/node": "~20",
|
|
42
42
|
"ajv": "^8.20.0",
|
package/playwright.config.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Feature: Steps that take a URL accept a path or an absolute URL
|
|
2
|
+
As a tester,
|
|
3
|
+
I want a step given "/page" to open it under the launch URL,
|
|
4
|
+
and a step given "http://host/page" to open that URL as written,
|
|
5
|
+
so that a scenario can leave the site under test and come back.
|
|
6
|
+
|
|
7
|
+
Scenario: A path is joined to the launch URL
|
|
8
|
+
Given I am on "/about-us.html"
|
|
9
|
+
Then the path should be "/about-us.html"
|
|
10
|
+
And I should see "About Us"
|
|
11
|
+
|
|
12
|
+
Scenario: An absolute URL is opened as written
|
|
13
|
+
Given I am on "http://localhost:8080/contact-us.html"
|
|
14
|
+
Then the path should be "/contact-us.html"
|
|
15
|
+
And I should see "Contact Us"
|
|
16
|
+
|
|
17
|
+
Scenario: An absolute URL is opened as written, with the page phrasing
|
|
18
|
+
Given I am on the "http://localhost:8080/path.html?lang=en" page
|
|
19
|
+
Then the path should be "/path.html"
|
|
20
|
+
And current url should have the "lang" parameter with the "en" value
|
|
21
|
+
|
|
22
|
+
Scenario: Go to a path, then to an absolute URL
|
|
23
|
+
Given I am on the homepage
|
|
24
|
+
When I go to "/about-us.html"
|
|
25
|
+
Then the path should be "/about-us.html"
|
|
26
|
+
When I navigate to "http://localhost:8080/contact-us.html"
|
|
27
|
+
Then the path should be "/contact-us.html"
|
|
28
|
+
And I should see "Contact Us"
|
|
29
|
+
|
|
30
|
+
Scenario: Go to an absolute URL with the other phrasings
|
|
31
|
+
Given I am on the homepage
|
|
32
|
+
When we go to "http://localhost:8080/path.html"
|
|
33
|
+
Then the path should be "/path.html"
|
|
34
|
+
When navigating to "http://localhost:8080/element.html"
|
|
35
|
+
Then the path should be "/element.html"
|
|
36
|
+
|
|
37
|
+
Scenario: An absolute URL is case-insensitive in its scheme
|
|
38
|
+
Given I am on "HTTP://localhost:8080/path.html"
|
|
39
|
+
Then the path should be "/path.html"
|
|
40
|
+
|
|
41
|
+
Scenario: A REST request takes a path or an absolute URL
|
|
42
|
+
When I send a REST "GET" request to "/example-api.json"
|
|
43
|
+
Then the REST response status code should be 200
|
|
44
|
+
When I send a REST "GET" request to "http://localhost:8080/example-api.json"
|
|
45
|
+
Then the REST response status code should be 200
|
|
46
|
+
|
|
47
|
+
Scenario: A download takes a path or an absolute URL
|
|
48
|
+
When I download the file from the URL "/example-api.json"
|
|
49
|
+
Then the downloaded file name should be "example-api.json"
|
|
50
|
+
When I download the file from the URL "http://localhost:8080/example-api.json"
|
|
51
|
+
Then the downloaded file name should be "example-api.json"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Feature: Steps that open with the optional "I " or "we " run
|
|
2
|
+
As a tester,
|
|
3
|
+
I want every step that takes the optional pronoun to run,
|
|
4
|
+
because cucumber-js refuses a step whose function declares fewer parameters
|
|
5
|
+
than its pattern has groups: "function has 0 arguments, should have 1".
|
|
6
|
+
|
|
7
|
+
Scenario: Print the accessibility violations
|
|
8
|
+
Given I am on "/a11y.html"
|
|
9
|
+
Then I print accessibility violations
|
|
10
|
+
|
|
11
|
+
Scenario: Clear the auth state
|
|
12
|
+
Given I am on "/cookies.html"
|
|
13
|
+
Then a cookie with the name "session_id" should exist
|
|
14
|
+
When I clear the auth state
|
|
15
|
+
Then a cookie with the name "session_id" should not exist
|
|
16
|
+
|
|
17
|
+
Scenario: Pause and resume the clock
|
|
18
|
+
Given the system time is "2026-05-08T10:00:00Z"
|
|
19
|
+
And I am on the homepage
|
|
20
|
+
When I pause the clock
|
|
21
|
+
And I resume the clock
|
|
22
|
+
Then I should see "Step Definitions Examples:"
|
|
23
|
+
|
|
24
|
+
Scenario: Accept the next dialog
|
|
25
|
+
Given I am on "/native-dialogs.html"
|
|
26
|
+
And I will accept the next dialog
|
|
27
|
+
When I press "Delete item"
|
|
28
|
+
Then I should see "Item deleted #1"
|
|
29
|
+
And the last dialog message should be "Delete this item?"
|
|
30
|
+
|
|
31
|
+
Scenario: Dismiss the next dialog
|
|
32
|
+
Given I am on "/native-dialogs.html"
|
|
33
|
+
And I will dismiss the next dialog
|
|
34
|
+
When I press "Delete item"
|
|
35
|
+
Then I should see "Deletion cancelled #1"
|
|
36
|
+
And the last dialog type should be "confirm"
|
|
37
|
+
|
|
38
|
+
Scenario: Accept all confirmation dialogs
|
|
39
|
+
Given I am on "/native-dialogs.html"
|
|
40
|
+
And I accept all confirmation dialogs
|
|
41
|
+
When I press "Delete item"
|
|
42
|
+
And I press "Delete item"
|
|
43
|
+
Then I should see "Item deleted #2"
|
|
44
|
+
|
|
45
|
+
Scenario: Do not accept any confirmation dialogs
|
|
46
|
+
Given I am on "/native-dialogs.html"
|
|
47
|
+
And I do not accept any confirmation dialogs
|
|
48
|
+
When I press "Delete item"
|
|
49
|
+
And I press "Delete item"
|
|
50
|
+
Then I should see "Deletion cancelled #2"
|
|
51
|
+
|
|
52
|
+
Scenario: Switch to the root document
|
|
53
|
+
Given I am on the homepage
|
|
54
|
+
When I switch to the root document
|
|
55
|
+
Then I should see "Step Definitions Examples:"
|
|
56
|
+
|
|
57
|
+
Scenario: Start recording network requests
|
|
58
|
+
Given I am on the homepage
|
|
59
|
+
And I start recording network requests
|
|
60
|
+
When I go to "/about-us.html"
|
|
61
|
+
Then a request to "about-us.html" should have been made
|
|
62
|
+
And no request to "contact-us.html" should have been made
|
|
63
|
+
|
|
64
|
+
Scenario Outline: Wait until the page settles
|
|
65
|
+
Given I am on the homepage
|
|
66
|
+
When I wait until <condition>
|
|
67
|
+
Then I should see "Step Definitions Examples:"
|
|
68
|
+
|
|
69
|
+
Examples:
|
|
70
|
+
| condition |
|
|
71
|
+
| the network is idle |
|
|
72
|
+
| requests are complete |
|
|
73
|
+
| network goes quiet |
|
|
74
|
+
| the page is interactive |
|
|
75
|
+
| page is interactive |
|
|
76
|
+
| pending timers settle |
|
|
77
|
+
|
|
78
|
+
Scenario: Print the last XML and YAML responses
|
|
79
|
+
Given I am on the homepage
|
|
80
|
+
When I print last XML response
|
|
81
|
+
And I print last YAML response
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,4 +5,14 @@ Feature: An example to ensure that a specific element is not visible on the curr
|
|
|
5
5
|
Scenario: Ensure to test that a specific element is not visible by its label
|
|
6
6
|
Given I am on "/test--then--i-should--see-text-in-element.html"
|
|
7
7
|
Then I should not see an "Eamil" element
|
|
8
|
-
And I should not see a "Country" element
|
|
8
|
+
And I should not see a "Country" element
|
|
9
|
+
|
|
10
|
+
Scenario: An element that is hidden is not seen
|
|
11
|
+
Given I am on "/element-visibility.html"
|
|
12
|
+
Then I should not see a "Hidden note" element
|
|
13
|
+
And I should not see a "Promo banner" element
|
|
14
|
+
|
|
15
|
+
Scenario: A label stands for the control it labels
|
|
16
|
+
Given I am on "/element-visibility.html"
|
|
17
|
+
Then I should see an "Email" element
|
|
18
|
+
And I should not see a "Ghost label" element
|