webship-js 2.0.3 → 2.0.4
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 +7 -31
- package/.drone.yml +68 -0
- package/.harness/webship-js-pipeline.yml +101 -0
- package/.semaphore/semaphore.yml +58 -0
- package/.teamcity/pom.xml +52 -0
- package/.teamcity/settings.kts +92 -0
- package/.travis.yml +24 -3
- package/AGENTS.md +2 -2
- package/CLAUDE.md +2 -2
- package/Jenkinsfile +54 -0
- package/azure-pipelines.yml +82 -0
- package/bamboo-specs/bamboo.yml +131 -0
- package/buildspec.yml +56 -0
- package/cloudbuild.yaml +49 -0
- package/codefresh.yml +77 -0
- package/cucumber.js +40 -3
- package/docs/04-step-reference.md +74 -3
- package/docs/16-ci-cd.md +879 -0
- package/docs/README.md +113 -0
- package/docs/global-settings.md +51 -0
- package/examples/video-demo.html +43 -0
- package/package.json +1 -1
- package/tests/features/video.feature +18 -0
- package/tests/step-definitions/a11y.steps.js +3 -1
- package/tests/step-definitions/action.steps.js +2 -2
- package/tests/step-definitions/api.steps.js +17 -16
- package/tests/step-definitions/assertion.steps.js +2 -2
- package/tests/step-definitions/auth.steps.js +3 -1
- package/tests/step-definitions/clock.steps.js +38 -38
- package/tests/step-definitions/debug.steps.js +13 -5
- package/tests/step-definitions/element.steps.js +47 -5
- package/tests/step-definitions/file-download.steps.js +38 -20
- package/tests/step-definitions/form.steps.js +6 -6
- package/tests/step-definitions/iframe.steps.js +65 -15
- package/tests/step-definitions/input.steps.js +47 -8
- package/tests/step-definitions/javascript.steps.js +195 -34
- package/tests/step-definitions/keyboard.steps.js +38 -4
- package/tests/step-definitions/modal.steps.js +39 -14
- package/tests/step-definitions/network.steps.js +61 -19
- package/tests/step-definitions/responsive.steps.js +3 -1
- package/tests/step-definitions/selectors.steps.js +19 -17
- package/tests/step-definitions/video.steps.js +178 -0
- package/tests/step-definitions/web-first.steps.js +3 -1
- package/tests/step-definitions/webship.js +234 -15
- package/tests/step-definitions/xml.steps.js +4 -2
- package/tests/step-definitions/yaml.steps.js +13 -11
- package/videos/README.md +32 -0
- package/.travis-ci.yml +0 -16
- package/docs/index.md +0 -104
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Atlassian Bamboo YAML Specs for webship-js.
|
|
2
|
+
#
|
|
3
|
+
# Runs the full BDD suite on a Bamboo Data Center self-hosted instance.
|
|
4
|
+
# (Bamboo Cloud was retired by Atlassian on 2024-02-15; the YAML below
|
|
5
|
+
# targets Bamboo Data Center 9.x — which is the only flavour still
|
|
6
|
+
# supported.)
|
|
7
|
+
#
|
|
8
|
+
# Setup (full walkthrough in docs/16-ci-cd.md → "Bamboo Data Center"):
|
|
9
|
+
# 1. Bamboo admin → Linked repositories → add the GitHub repo.
|
|
10
|
+
# 2. Bamboo admin → Specs → Repositories → enable specs scanning on
|
|
11
|
+
# that repo so this file is read on every push.
|
|
12
|
+
#
|
|
13
|
+
# References:
|
|
14
|
+
# - https://confluence.atlassian.com/bamboo/bamboo-yaml-specs-1054778761.html
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
version: 2
|
|
18
|
+
|
|
19
|
+
plan:
|
|
20
|
+
project-key: WEB # 3+ uppercase chars (project key)
|
|
21
|
+
key: JS # plan key — final id WEB-JS
|
|
22
|
+
name: webship-js
|
|
23
|
+
description: Webship-js BDD test suite (Playwright + Cucumber-js)
|
|
24
|
+
|
|
25
|
+
stages:
|
|
26
|
+
- Test:
|
|
27
|
+
jobs:
|
|
28
|
+
- Cucumber
|
|
29
|
+
|
|
30
|
+
Cucumber:
|
|
31
|
+
key: CUC
|
|
32
|
+
docker:
|
|
33
|
+
image: mcr.microsoft.com/playwright:v1.58.2-jammy
|
|
34
|
+
docker-run-arguments:
|
|
35
|
+
- --user=root:root
|
|
36
|
+
- --network=host
|
|
37
|
+
tasks:
|
|
38
|
+
- checkout:
|
|
39
|
+
force-clean-build: true
|
|
40
|
+
- script:
|
|
41
|
+
description: Show toolchain versions
|
|
42
|
+
scripts:
|
|
43
|
+
- node --version
|
|
44
|
+
- npm --version
|
|
45
|
+
- script:
|
|
46
|
+
description: Install npm dependencies
|
|
47
|
+
scripts:
|
|
48
|
+
- npm install
|
|
49
|
+
- script:
|
|
50
|
+
description: Install Playwright browsers
|
|
51
|
+
scripts:
|
|
52
|
+
- npx playwright install --with-deps chromium
|
|
53
|
+
- script:
|
|
54
|
+
description: Start fixture server
|
|
55
|
+
scripts:
|
|
56
|
+
- nohup npm start > /tmp/srv.log 2>&1 &
|
|
57
|
+
- sleep 3
|
|
58
|
+
- curl -sf http://localhost:8080/ > /dev/null
|
|
59
|
+
- script:
|
|
60
|
+
description: Run cucumber suite
|
|
61
|
+
scripts:
|
|
62
|
+
- npm test
|
|
63
|
+
artifacts:
|
|
64
|
+
- name: cucumber-report-html
|
|
65
|
+
pattern: tests/reports/cucumber_report.html
|
|
66
|
+
shared: true
|
|
67
|
+
required: false
|
|
68
|
+
- name: cucumber-report-pdf
|
|
69
|
+
pattern: tests/reports/cucumber_report.pdf
|
|
70
|
+
shared: true
|
|
71
|
+
required: false
|
|
72
|
+
- name: cucumber-report-json
|
|
73
|
+
pattern: tests/reports/cucumber_report.json
|
|
74
|
+
shared: true
|
|
75
|
+
required: false
|
|
76
|
+
- name: screenshots
|
|
77
|
+
pattern: screenshots/**
|
|
78
|
+
shared: true
|
|
79
|
+
required: false
|
|
80
|
+
requirements:
|
|
81
|
+
- os: Linux
|
|
82
|
+
|
|
83
|
+
triggers:
|
|
84
|
+
- polling:
|
|
85
|
+
period: 60 # poll every 60s
|
|
86
|
+
condition:
|
|
87
|
+
any-branch: '^2\.0\.x$'
|
|
88
|
+
|
|
89
|
+
branches:
|
|
90
|
+
create: manually
|
|
91
|
+
delete: never
|
|
92
|
+
|
|
93
|
+
variables:
|
|
94
|
+
FORCE_COLOR: "1"
|
|
95
|
+
LAUNCH_URL: "http://localhost:8080"
|
|
96
|
+
|
|
97
|
+
repositories:
|
|
98
|
+
- webship-js:
|
|
99
|
+
scope: global # already linked at admin level
|
|
100
|
+
|
|
101
|
+
notifications: []
|
|
102
|
+
|
|
103
|
+
labels:
|
|
104
|
+
- webship-js
|
|
105
|
+
- bdd
|
|
106
|
+
- playwright
|
|
107
|
+
- cucumber-js
|
|
108
|
+
|
|
109
|
+
other:
|
|
110
|
+
concurrent-build-plugin: system-default
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
version: 2
|
|
114
|
+
plan-permissions:
|
|
115
|
+
project-key: WEB
|
|
116
|
+
plan-key: JS
|
|
117
|
+
permissions:
|
|
118
|
+
- users:
|
|
119
|
+
- admin
|
|
120
|
+
permissions:
|
|
121
|
+
- view
|
|
122
|
+
- edit
|
|
123
|
+
- build
|
|
124
|
+
- admin
|
|
125
|
+
- groups:
|
|
126
|
+
- bamboo-admin
|
|
127
|
+
permissions:
|
|
128
|
+
- admin
|
|
129
|
+
- view
|
|
130
|
+
- build
|
|
131
|
+
- edit
|
package/buildspec.yml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# AWS CodeBuild spec for webship-js.
|
|
2
|
+
#
|
|
3
|
+
# Runs the full BDD suite on AWS-managed compute. Pair with CodePipeline
|
|
4
|
+
# (for source/build/test orchestration) or invoke CodeBuild directly from a
|
|
5
|
+
# GitHub webhook. Free tier covers 100 build-minutes / month on
|
|
6
|
+
# `general1.small` indefinitely.
|
|
7
|
+
#
|
|
8
|
+
# Suggested CodeBuild project settings:
|
|
9
|
+
# Environment image: aws/codebuild/standard:7.0
|
|
10
|
+
# Compute: general1.small (3 GB RAM, 2 vCPU) — fits the suite
|
|
11
|
+
# Service role: needs S3 PutObject for the artifacts bucket
|
|
12
|
+
#
|
|
13
|
+
# See docs/16-ci-cd.md → "AWS CodeBuild" for the account + project walkthrough.
|
|
14
|
+
|
|
15
|
+
version: 0.2
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
variables:
|
|
19
|
+
FORCE_COLOR: "1"
|
|
20
|
+
LAUNCH_URL: "http://localhost:8080"
|
|
21
|
+
NPM_CONFIG_CACHE: "/codebuild/output/npm-cache"
|
|
22
|
+
|
|
23
|
+
phases:
|
|
24
|
+
install:
|
|
25
|
+
runtime-versions:
|
|
26
|
+
nodejs: 20
|
|
27
|
+
commands:
|
|
28
|
+
- node --version
|
|
29
|
+
- npm --version
|
|
30
|
+
- npm install
|
|
31
|
+
- npx playwright install --with-deps chromium
|
|
32
|
+
|
|
33
|
+
pre_build:
|
|
34
|
+
commands:
|
|
35
|
+
- nohup npm start > /tmp/srv.log 2>&1 &
|
|
36
|
+
- sleep 3
|
|
37
|
+
- curl -sf http://localhost:8080/ > /dev/null
|
|
38
|
+
|
|
39
|
+
build:
|
|
40
|
+
commands:
|
|
41
|
+
- npm test
|
|
42
|
+
|
|
43
|
+
cache:
|
|
44
|
+
paths:
|
|
45
|
+
- 'node_modules/**/*'
|
|
46
|
+
- '/root/.cache/ms-playwright/**/*'
|
|
47
|
+
- '/codebuild/output/npm-cache/**/*'
|
|
48
|
+
|
|
49
|
+
artifacts:
|
|
50
|
+
name: webship-js-report-$(date +%Y%m%d-%H%M%S)
|
|
51
|
+
files:
|
|
52
|
+
- tests/reports/cucumber_report.html
|
|
53
|
+
- tests/reports/cucumber_report.pdf
|
|
54
|
+
- tests/reports/cucumber_report.json
|
|
55
|
+
- screenshots/**/*
|
|
56
|
+
discard-paths: no
|
package/cloudbuild.yaml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Google Cloud Build config for webship-js.
|
|
2
|
+
#
|
|
3
|
+
# Runs the full BDD suite inside a Playwright-prepped container on Google's
|
|
4
|
+
# managed builder pool. Free tier (post-$300 credit): 120 build-minutes per
|
|
5
|
+
# day on the default `e2-standard-2` machine — the 9-minute suite fits ~13
|
|
6
|
+
# runs / day.
|
|
7
|
+
#
|
|
8
|
+
# Setup (full walkthrough in docs/16-ci-cd.md → "Google Cloud Build"):
|
|
9
|
+
# 1. console.cloud.google.com → create project → enable Cloud Build API.
|
|
10
|
+
# 2. Cloud Build → Triggers → Connect repository → GitHub OAuth.
|
|
11
|
+
# 3. Add trigger pointing at this file on branch ^2\.0\.x$.
|
|
12
|
+
|
|
13
|
+
substitutions:
|
|
14
|
+
_BRANCH_NAME: '2.0.x'
|
|
15
|
+
_ARTIFACT_BUCKET: 'webship-js-reports'
|
|
16
|
+
|
|
17
|
+
options:
|
|
18
|
+
logging: CLOUD_LOGGING_ONLY
|
|
19
|
+
machineType: 'E2_STANDARD_2'
|
|
20
|
+
|
|
21
|
+
timeout: '1800s'
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- id: install-and-test
|
|
25
|
+
name: 'mcr.microsoft.com/playwright:v1.58.2-jammy'
|
|
26
|
+
entrypoint: 'bash'
|
|
27
|
+
env:
|
|
28
|
+
- 'FORCE_COLOR=1'
|
|
29
|
+
- 'LAUNCH_URL=http://localhost:8080'
|
|
30
|
+
args:
|
|
31
|
+
- '-c'
|
|
32
|
+
- |
|
|
33
|
+
set -euo pipefail
|
|
34
|
+
node --version
|
|
35
|
+
npm --version
|
|
36
|
+
npm install
|
|
37
|
+
npx playwright install --with-deps chromium
|
|
38
|
+
nohup npm start > /tmp/srv.log 2>&1 &
|
|
39
|
+
sleep 3
|
|
40
|
+
curl -sf http://localhost:8080/ > /dev/null
|
|
41
|
+
npm test
|
|
42
|
+
|
|
43
|
+
artifacts:
|
|
44
|
+
objects:
|
|
45
|
+
location: 'gs://${_ARTIFACT_BUCKET}/$BUILD_ID/'
|
|
46
|
+
paths:
|
|
47
|
+
- 'tests/reports/cucumber_report.html'
|
|
48
|
+
- 'tests/reports/cucumber_report.pdf'
|
|
49
|
+
- 'tests/reports/cucumber_report.json'
|
package/codefresh.yml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Codefresh Classic pipeline for webship-js.
|
|
2
|
+
#
|
|
3
|
+
# Codefresh is a Kubernetes-native CI/CD platform. The Classic pipeline format
|
|
4
|
+
# (used here) reads `codefresh.yml` from the repository. Free tier covers 100
|
|
5
|
+
# build-minutes per month on shared infrastructure; OSS public repositories
|
|
6
|
+
# can apply for the Community plan with more capacity.
|
|
7
|
+
#
|
|
8
|
+
# Setup (full walkthrough in docs/16-ci-cd.md → "Codefresh"):
|
|
9
|
+
# 1. codefresh.io → sign up with GitHub → create pipeline → "Inline YAML
|
|
10
|
+
# from repository".
|
|
11
|
+
# 2. Point at this file on branch 2.0.x.
|
|
12
|
+
#
|
|
13
|
+
# References:
|
|
14
|
+
# - https://codefresh.io/docs/docs/pipelines/pipeline-spec/
|
|
15
|
+
# - https://codefresh.io/docs/docs/pipelines/steps/
|
|
16
|
+
|
|
17
|
+
version: "1.0"
|
|
18
|
+
kind: pipeline
|
|
19
|
+
|
|
20
|
+
stages:
|
|
21
|
+
- prepare
|
|
22
|
+
- test
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
main_clone:
|
|
26
|
+
title: "Clone repository"
|
|
27
|
+
type: git-clone
|
|
28
|
+
arguments:
|
|
29
|
+
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
|
|
30
|
+
revision: "${{CF_REVISION}}"
|
|
31
|
+
git: github
|
|
32
|
+
stage: prepare
|
|
33
|
+
|
|
34
|
+
install_dependencies:
|
|
35
|
+
title: "Install npm dependencies + Playwright browsers"
|
|
36
|
+
type: freestyle
|
|
37
|
+
image: mcr.microsoft.com/playwright:v1.58.2-jammy
|
|
38
|
+
working_directory: ${{main_clone}}
|
|
39
|
+
environment:
|
|
40
|
+
- FORCE_COLOR=1
|
|
41
|
+
commands:
|
|
42
|
+
- node --version
|
|
43
|
+
- npm --version
|
|
44
|
+
- npm install
|
|
45
|
+
- npx playwright install --with-deps chromium
|
|
46
|
+
stage: prepare
|
|
47
|
+
|
|
48
|
+
test_suite:
|
|
49
|
+
title: "Run cucumber-js"
|
|
50
|
+
type: freestyle
|
|
51
|
+
image: mcr.microsoft.com/playwright:v1.58.2-jammy
|
|
52
|
+
working_directory: ${{main_clone}}
|
|
53
|
+
environment:
|
|
54
|
+
- FORCE_COLOR=1
|
|
55
|
+
- LAUNCH_URL=http://localhost:8080
|
|
56
|
+
commands:
|
|
57
|
+
- nohup npm start > /tmp/srv.log 2>&1 &
|
|
58
|
+
- sleep 3
|
|
59
|
+
- curl -sf http://localhost:8080/ > /dev/null
|
|
60
|
+
- npm test
|
|
61
|
+
stage: test
|
|
62
|
+
|
|
63
|
+
upload_reports:
|
|
64
|
+
title: "Upload HTML / PDF / JSON cucumber report"
|
|
65
|
+
type: freestyle
|
|
66
|
+
image: alpine:3
|
|
67
|
+
working_directory: ${{main_clone}}
|
|
68
|
+
when:
|
|
69
|
+
condition:
|
|
70
|
+
any:
|
|
71
|
+
successOnly: "'${{TEST_SUITE_OUTCOME}}' == 'success'"
|
|
72
|
+
failureToo: "true"
|
|
73
|
+
commands:
|
|
74
|
+
- mkdir -p /codefresh/volume/cucumber-report
|
|
75
|
+
- cp -a tests/reports/cucumber_report.html tests/reports/cucumber_report.pdf tests/reports/cucumber_report.json /codefresh/volume/cucumber-report/ || true
|
|
76
|
+
- cp -a screenshots /codefresh/volume/cucumber-report/screenshots 2>/dev/null || true
|
|
77
|
+
stage: test
|
package/cucumber.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
default: {
|
|
3
|
-
timeout
|
|
3
|
+
// Cucumber step timeout must exceed Playwright's default 30s so the
|
|
4
|
+
// try/catch wrappers in step files always see the Playwright error
|
|
5
|
+
// first (and emit a friendly message) rather than cucumber's raw
|
|
6
|
+
// "function timed out" stack.
|
|
7
|
+
timeout: 45000,
|
|
4
8
|
// tsx/cjs registers a require() hook so cucumber-js can load both
|
|
5
9
|
// `.js` and `.ts` step files with zero build step. If you ship only
|
|
6
10
|
// JavaScript, drop `requireModule` and the `.ts` half of the glob.
|
|
7
11
|
requireModule: ['tsx/cjs'],
|
|
8
12
|
require: [
|
|
9
13
|
'tests/step-definitions/**/*.js',
|
|
10
|
-
'tests/step-definitions/**/*.ts',
|
|
11
14
|
'tests/step-definitions-diffy/**/*.js',
|
|
12
|
-
'tests/step-definitions-diffy/**/*.ts',
|
|
13
15
|
],
|
|
14
16
|
paths: ['tests/features/**/*.feature'],
|
|
15
17
|
format: [
|
|
@@ -84,6 +86,41 @@ module.exports = {
|
|
|
84
86
|
filenamePatternFailed: '{failed_prefix}{datetime}.{feature_file}.feature_{step_line}.{ext}', // WEBSHIP_SCREENSHOT_PATTERN_FAIL
|
|
85
87
|
infoTypes: '', // WEBSHIP_SCREENSHOT_INFO_TYPES e.g. "url,feature,step,datetime"
|
|
86
88
|
},
|
|
89
|
+
video: {
|
|
90
|
+
// Record the browser as a webm video.
|
|
91
|
+
// 'off' (default) — no recording.
|
|
92
|
+
// 'on' — record every scenario.
|
|
93
|
+
// 'on-failure' — record every scenario, keep only failures.
|
|
94
|
+
// 'tag' — record only scenarios tagged @video.
|
|
95
|
+
// Override per scenario with tags:
|
|
96
|
+
// @video — force recording on (independent of mode).
|
|
97
|
+
// @no-video — suppress recording for this scenario.
|
|
98
|
+
// Override per run with env: WEBSHIP_VIDEO.
|
|
99
|
+
mode: 'off', // WEBSHIP_VIDEO
|
|
100
|
+
dir: './videos', // WEBSHIP_VIDEO_DIR
|
|
101
|
+
size: { width: 1280, height: 720 }, // viewport size of the recording
|
|
102
|
+
// Filename template tokens: {datetime} {feature_file} {feature} {scenario}
|
|
103
|
+
// {status} {ext}. Sanitised to filesystem-safe characters.
|
|
104
|
+
filenamePattern: '{datetime}.{feature_file}.{scenario}.{status}.{ext}',
|
|
105
|
+
},
|
|
106
|
+
javascript: {
|
|
107
|
+
// How to report collected JavaScript errors at scenario end.
|
|
108
|
+
// 'warn' (default) — log a yellow warning, scenario still passes.
|
|
109
|
+
// 'fail' — fail the scenario.
|
|
110
|
+
// 'off' — silent.
|
|
111
|
+
// Override per scenario with tags: @js-fail, @js-warn, @js-off.
|
|
112
|
+
// Override per run with env: WEBSHIP_JS_ERROR_MODE.
|
|
113
|
+
mode: 'warn', // WEBSHIP_JS_ERROR_MODE
|
|
114
|
+
// Console levels to capture in addition to `pageerror`.
|
|
115
|
+
// Common: ['error'], ['error','warning'], ['error','warning','info'].
|
|
116
|
+
levels: ['error'], // WEBSHIP_JS_ERROR_LEVELS (csv)
|
|
117
|
+
// Regex string. Errors whose message matches are ignored.
|
|
118
|
+
ignore: '', // WEBSHIP_JS_ERROR_IGNORE
|
|
119
|
+
// Snapshot any pre-existing errors at scenario start.
|
|
120
|
+
beforeScenario: false, // WEBSHIP_JS_ERROR_BEFORE
|
|
121
|
+
// Report collected errors at scenario end (default true).
|
|
122
|
+
afterScenario: true, // WEBSHIP_JS_ERROR_AFTER
|
|
123
|
+
},
|
|
87
124
|
diffy: {
|
|
88
125
|
apiKey: 'mock-key', // DIFFY_API_KEY
|
|
89
126
|
projectId: 1, // DIFFY_PROJECT_ID
|
|
@@ -197,9 +197,72 @@ Then the focused element should be labeled "..."
|
|
|
197
197
|
|
|
198
198
|
```
|
|
199
199
|
Then there should be no JavaScript errors
|
|
200
|
+
Then there should be no JavaScript warnings
|
|
201
|
+
Then JavaScript errors should not match "TypeError"
|
|
202
|
+
Then print JavaScript errors
|
|
200
203
|
```
|
|
201
204
|
|
|
202
|
-
|
|
205
|
+
Errors are always tracked (page errors + matched console levels). At scenario end the collector reports per the active **mode**:
|
|
206
|
+
|
|
207
|
+
| Mode | Behaviour |
|
|
208
|
+
| --- | --- |
|
|
209
|
+
| `warn` (default) | Logs a yellow warning to stderr — scenario still passes |
|
|
210
|
+
| `fail` | Fails the scenario with the error list |
|
|
211
|
+
| `off` | Silent |
|
|
212
|
+
|
|
213
|
+
Mode resolution (first match wins):
|
|
214
|
+
|
|
215
|
+
1. **Scenario tag** — `@js-fail`, `@js-warn`, `@js-off`, plus back-compat `@javascript` (= fail) and `@js-errors` (= off).
|
|
216
|
+
2. **Env var** — `WEBSHIP_JS_ERROR_MODE=warn|fail|off`.
|
|
217
|
+
3. **`worldParameters.javascript.mode`** in `cucumber.js`.
|
|
218
|
+
4. **Default** — `warn`.
|
|
219
|
+
|
|
220
|
+
Settings (`worldParameters.javascript`):
|
|
221
|
+
|
|
222
|
+
| Key | Env override | Default | Effect |
|
|
223
|
+
| --- | --- | --- | --- |
|
|
224
|
+
| `mode` | `WEBSHIP_JS_ERROR_MODE` | `warn` | `warn` / `fail` / `off` |
|
|
225
|
+
| `levels` | `WEBSHIP_JS_ERROR_LEVELS` | `['error']` | Console levels to capture (csv when via env: `error,warning`) |
|
|
226
|
+
| `ignore` | `WEBSHIP_JS_ERROR_IGNORE` | _none_ | Regex; matching messages dropped before report |
|
|
227
|
+
| `beforeScenario` | `WEBSHIP_JS_ERROR_BEFORE` | `false` | Snapshot pre-existing errors at scenario start |
|
|
228
|
+
| `afterScenario` | `WEBSHIP_JS_ERROR_AFTER` | `true` | Report at scenario end |
|
|
229
|
+
|
|
230
|
+
The explicit step `Then there should be no JavaScript errors` always asserts (independent of `mode`) and suppresses the auto-report so a single error is not announced twice.
|
|
231
|
+
|
|
232
|
+
## Video recording
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
When I start video recording
|
|
236
|
+
When I stop video recording
|
|
237
|
+
When I save the current video as "checkout-flow.webm"
|
|
238
|
+
Then print video path
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Recording is **off by default**. Resolution priority:
|
|
242
|
+
|
|
243
|
+
1. **Scenario tag** — `@video` (force on) / `@no-video` (force off).
|
|
244
|
+
2. **Env var** — `WEBSHIP_VIDEO=on|off|on-failure|tag`.
|
|
245
|
+
3. **`worldParameters.video.mode`** — `'off'` (default) / `'on'` / `'on-failure'` / `'tag'`.
|
|
246
|
+
|
|
247
|
+
Mode semantics:
|
|
248
|
+
|
|
249
|
+
| Mode | Behaviour |
|
|
250
|
+
| --- | --- |
|
|
251
|
+
| `off` (default) | No recording. |
|
|
252
|
+
| `on` | Every scenario produces a `webm`. |
|
|
253
|
+
| `on-failure` | Every scenario records; only failures are kept on disk. |
|
|
254
|
+
| `tag` | Only scenarios tagged `@video` record. |
|
|
255
|
+
|
|
256
|
+
Settings (`worldParameters.video`):
|
|
257
|
+
|
|
258
|
+
| Key | Env override | Default | Effect |
|
|
259
|
+
| --- | --- | --- | --- |
|
|
260
|
+
| `mode` | `WEBSHIP_VIDEO` | `off` | Activation mode. |
|
|
261
|
+
| `dir` | `WEBSHIP_VIDEO_DIR` | `./videos` | Output directory (created automatically). |
|
|
262
|
+
| `size` | _none_ | `{ width: 1280, height: 720 }` | Recording resolution. |
|
|
263
|
+
| `filenamePattern` | _none_ | `{datetime}.{feature_file}.{scenario}.{status}.{ext}` | Per-scenario filename. Tokens: `{datetime} {feature_file} {feature} {scenario} {status} {ext}`. |
|
|
264
|
+
|
|
265
|
+
The `start` / `stop` mid-scenario steps close + reopen the browser context (Playwright records at context creation only). Page state is lost across the boundary — call `start` BEFORE any navigation. `videos/` is gitignored.
|
|
203
266
|
|
|
204
267
|
## Date tokens
|
|
205
268
|
|
|
@@ -451,6 +514,9 @@ This index lists every public step grouped by source file, with one Gherkin exam
|
|
|
451
514
|
### javascript.steps.js
|
|
452
515
|
|
|
453
516
|
- *^there should be no JavaScript errors$* · Example: `Then there should be no JavaScript errors`
|
|
517
|
+
- *^there should be no JavaScript warnings$* · Example: `Then there should be no JavaScript warnings`
|
|
518
|
+
- *^JavaScript errors should not match "([^"]*)"$* · Example: `Then JavaScript errors should not match "TypeError"`
|
|
519
|
+
- *^print JavaScript errors$* · Example: `Then print JavaScript errors`
|
|
454
520
|
|
|
455
521
|
### keyboard.steps.js
|
|
456
522
|
|
|
@@ -581,8 +647,6 @@ This index lists every public step grouped by source file, with one Gherkin exam
|
|
|
581
647
|
- *^(I |we )*add selectors from "([^"]*)" file$* · Example: `When I add selectors from "selectors.json" file`
|
|
582
648
|
- *^(I |we )*print css selectors$* · Example: `Then I print css selectors`
|
|
583
649
|
- *^(I |we )*print xpath selectors$* · Example: `Then I print xpath selectors`
|
|
584
|
-
- *^(I |we )*define css selectors:$* · Example: `Given I define css selectors:`
|
|
585
|
-
- *^(I |we )*define xpath selectors:$* · Example: `Given I define xpath selectors:`
|
|
586
650
|
- *^(I am |we are )?viewing the site on a (?:"([^"]+)"|([a-zA-Z0-9 _,]+)) (?:screen|device)$* · Example: `Given I am viewing the site on a xl screen`
|
|
587
651
|
- *^(I |we )*see ([a-zA-Z0-9 ,\-]+) above ([a-zA-Z0-9 ,\-]+)$* · Example: `Then I see header above footer`
|
|
588
652
|
- *^(I |we )*see ([a-zA-Z0-9 ,\-]+) below ([a-zA-Z0-9 ,\-]+)$* · Example: `Then I see footer below header`
|
|
@@ -624,6 +688,13 @@ This index lists every public step grouped by source file, with one Gherkin exam
|
|
|
624
688
|
- *the table {string} should contain the following rows:* · Example: `Then the table "#users" should contain the following rows:`
|
|
625
689
|
- *the {string} row should contain the following:* · Example: `Then the "Alice" row should contain the following:`
|
|
626
690
|
|
|
691
|
+
### video.steps.js
|
|
692
|
+
|
|
693
|
+
- *^(I |we )*start video recording$* · Example: `When I start video recording`
|
|
694
|
+
- *^(I |we )*stop video recording$* · Example: `When I stop video recording`
|
|
695
|
+
- *^(I |we )*save the current video as "([^"]*)"$* · Example: `When I save the current video as "checkout-flow.webm"`
|
|
696
|
+
- *^print video path$* · Example: `Then print video path`
|
|
697
|
+
|
|
627
698
|
### wait.steps.js
|
|
628
699
|
|
|
629
700
|
- *^(I |we )*wait for (\d+) seconds?$* · Example: `When I wait for 1 second`
|