webship-js 2.0.3 → 2.0.5
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 +53 -17
- package/CLAUDE.md +327 -105
- package/Jenkinsfile +54 -0
- package/azure-pipelines.yml +82 -0
- package/bamboo-specs/bamboo.yml +131 -0
- package/bin/init-webship.js +0 -13
- package/bin/postinstall.js +0 -0
- package/buildspec.yml +56 -0
- package/cloudbuild.yaml +49 -0
- package/codefresh.yml +77 -0
- package/cucumber.js +39 -14
- package/docs/00-quick-start.md +0 -0
- package/docs/01-getting-started.md +0 -0
- package/docs/02-bbr-smart-waits.md +0 -0
- package/docs/03-selector-registry.md +0 -0
- package/docs/04-step-reference.md +74 -3
- package/docs/05-web-first-assertions.md +0 -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/10-accessibility.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 +879 -0
- package/docs/README.md +116 -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 +45 -22
- package/docs/install-webship-js/ddev-webship-js.md +0 -0
- package/docs/install-webship-js.md +0 -1
- package/docs/overview.md +0 -1
- 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 +0 -0
- package/docs/step-definitions/then-i-should-be.md +0 -0
- package/docs/step-definitions/then-i-should-see.md +0 -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 +0 -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/a11y.html +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.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/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 +43 -0
- package/package.json +1 -1
- package/playwright.config.ts +0 -0
- package/tests/assets/test-document.pdf +0 -0
- package/tests/features/a11y.feature +0 -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/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-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 +18 -0
- package/tests/features/wait.feature +0 -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 +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/cookie.steps.js +0 -0
- package/tests/step-definitions/debug.steps.js +13 -5
- package/tests/step-definitions/dialog.steps.js +0 -0
- package/tests/step-definitions/element.steps.js +47 -5
- package/tests/step-definitions/field.steps.js +0 -0
- 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/link.steps.js +0 -0
- package/tests/step-definitions/metatag.steps.js +0 -0
- package/tests/step-definitions/modal.steps.js +39 -14
- package/tests/step-definitions/navigation.steps.js +0 -0
- package/tests/step-definitions/network.steps.js +61 -19
- 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 +3 -1
- package/tests/step-definitions/rest.steps.js +0 -0
- 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 +19 -17
- 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 +178 -0
- package/tests/step-definitions/wait.steps.js +0 -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/tsconfig.json +0 -0
- package/videos/README.md +32 -0
- package/.travis-ci.yml +0 -16
- package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +0 -30
- package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +0 -21
- package/docs/diffy-step-definitions/then-create-diffy-comparison.md +0 -25
- package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +0 -35
- package/docs/diffy-step-definitions/then-i-take-screenshot.md +0 -21
- package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +0 -27
- package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +0 -27
- package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +0 -28
- package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +0 -21
- package/docs/diffy-step-definitions/when-i-resize-window-number.md +0 -29
- package/docs/diffy-step-definitions.md +0 -21
- package/docs/index.md +0 -104
- package/examples/diffy/baseline.html +0 -54
- package/examples/diffy/changed.html +0 -63
- package/examples/diffy/index.html +0 -52
- package/tests/features/diffy/test--diffy-01-example-demo.feature +0 -22
- package/tests/features/diffy/test--diffy-02-all-steps.feature +0 -52
- package/tests/features/diffy/test--diffy-03-real-api.feature +0 -21
- package/tests/step-definitions-diffy/README.md +0 -329
- package/tests/step-definitions-diffy/mock-diffy-api/server.js +0 -84
- package/tests/step-definitions-diffy/webship-diffy-mock.js +0 -31
- package/tests/step-definitions-diffy/webship-diffy.js +0 -459
package/.circleci/config.yml
CHANGED
|
@@ -1,46 +1,22 @@
|
|
|
1
1
|
version: 2.1
|
|
2
|
+
|
|
2
3
|
defaults: &defaults
|
|
3
4
|
docker:
|
|
4
|
-
- image: cimg/
|
|
5
|
-
auth:
|
|
6
|
-
username: mydockerhub-user
|
|
7
|
-
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
|
|
5
|
+
- image: cimg/node:20.20
|
|
8
6
|
environment:
|
|
9
7
|
FORCE_COLOR: "1"
|
|
10
|
-
commands:
|
|
11
|
-
webship-js-build:
|
|
12
|
-
steps:
|
|
13
|
-
- checkout
|
|
14
|
-
## Useful must have utils.
|
|
15
|
-
- run:
|
|
16
|
-
name: Useful must have utils
|
|
17
|
-
command: |
|
|
18
|
-
sudo apt -qq update
|
|
19
|
-
sudo apt -qqy upgrade
|
|
20
|
-
sudo apt -yqq install vim links lynx git diffutils htop curl wget p7zip-full unzip zip sed gcc g++ make libfreetype6-dev libaio1 libaio-dev libonig-dev libpng-dev
|
|
21
|
-
|
|
22
|
-
## Install node js, npm
|
|
23
|
-
- run:
|
|
24
|
-
name: Install node js
|
|
25
|
-
command: |
|
|
26
|
-
curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
|
|
27
|
-
sudo apt install -y nodejs
|
|
28
8
|
|
|
29
9
|
jobs:
|
|
30
10
|
webship-js-testing:
|
|
31
11
|
<<: *defaults
|
|
32
12
|
steps:
|
|
33
|
-
-
|
|
34
|
-
## Install npm dependencies
|
|
13
|
+
- checkout
|
|
35
14
|
- run:
|
|
36
15
|
name: Install npm dependencies
|
|
37
|
-
command:
|
|
38
|
-
npm install
|
|
39
|
-
## Install Playwright browsers
|
|
16
|
+
command: npm install
|
|
40
17
|
- run:
|
|
41
18
|
name: Install Playwright browsers
|
|
42
|
-
command:
|
|
43
|
-
npx playwright install --with-deps chromium
|
|
19
|
+
command: npx playwright install --with-deps chromium
|
|
44
20
|
- run:
|
|
45
21
|
name: Start virtual server
|
|
46
22
|
command: npm start
|
|
@@ -50,8 +26,8 @@ jobs:
|
|
|
50
26
|
command: sleep 3
|
|
51
27
|
- run:
|
|
52
28
|
name: Test
|
|
53
|
-
command:
|
|
54
|
-
|
|
29
|
+
command: npm test
|
|
30
|
+
|
|
55
31
|
workflows:
|
|
56
32
|
version: 2
|
|
57
33
|
webship-js-workflow:
|
package/.drone.yml
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Drone CI for webship-js.
|
|
2
|
+
#
|
|
3
|
+
# Runs the full BDD suite inside the official Playwright container, so
|
|
4
|
+
# chromium + every apt dependency are pre-installed. Anyone running a Drone
|
|
5
|
+
# server can drop the repo in: enable in the UI and push.
|
|
6
|
+
#
|
|
7
|
+
# Setup (full walkthrough in docs/16-ci-cd.md → "Drone CI"):
|
|
8
|
+
# 1. Self-host Drone:
|
|
9
|
+
# docker run -d \
|
|
10
|
+
# -e DRONE_GITHUB_CLIENT_ID=... \
|
|
11
|
+
# -e DRONE_GITHUB_CLIENT_SECRET=... \
|
|
12
|
+
# -e DRONE_RPC_SECRET=$(openssl rand -hex 16) \
|
|
13
|
+
# -e DRONE_SERVER_HOST=ci.example.com \
|
|
14
|
+
# -e DRONE_SERVER_PROTO=https \
|
|
15
|
+
# -p 80:80 -p 443:443 \
|
|
16
|
+
# --restart=always --name=drone drone/drone:2
|
|
17
|
+
# Plus at least one runner (docker runner is the common choice).
|
|
18
|
+
# 2. Sign in at https://ci.example.com → activate webship-js.
|
|
19
|
+
#
|
|
20
|
+
# Drone Cloud (drone.io) is paid as of 2023 — self-host is the OSS path.
|
|
21
|
+
|
|
22
|
+
kind: pipeline
|
|
23
|
+
type: docker
|
|
24
|
+
name: default
|
|
25
|
+
|
|
26
|
+
trigger:
|
|
27
|
+
branch:
|
|
28
|
+
- 2.0.x
|
|
29
|
+
ref:
|
|
30
|
+
include:
|
|
31
|
+
- refs/heads/2.0.x
|
|
32
|
+
- refs/tags/2.0.*
|
|
33
|
+
exclude:
|
|
34
|
+
- refs/pull/**
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- name: test
|
|
38
|
+
image: mcr.microsoft.com/playwright:v1.58.2-jammy
|
|
39
|
+
environment:
|
|
40
|
+
FORCE_COLOR: "1"
|
|
41
|
+
LAUNCH_URL: "http://localhost:8080"
|
|
42
|
+
commands:
|
|
43
|
+
- node --version
|
|
44
|
+
- npm --version
|
|
45
|
+
- npm install
|
|
46
|
+
- npx playwright install --with-deps chromium
|
|
47
|
+
- nohup npm start > /tmp/srv.log 2>&1 &
|
|
48
|
+
- sleep 3
|
|
49
|
+
- curl -sf http://localhost:8080/ > /dev/null
|
|
50
|
+
- npm test
|
|
51
|
+
|
|
52
|
+
- name: archive-reports
|
|
53
|
+
image: alpine:3
|
|
54
|
+
when:
|
|
55
|
+
status:
|
|
56
|
+
- success
|
|
57
|
+
- failure
|
|
58
|
+
commands:
|
|
59
|
+
- apk add --no-cache tar
|
|
60
|
+
- tar czf /artifacts/cucumber-report-${DRONE_BUILD_NUMBER}.tar.gz tests/reports screenshots || true
|
|
61
|
+
volumes:
|
|
62
|
+
- name: artifacts
|
|
63
|
+
path: /artifacts
|
|
64
|
+
|
|
65
|
+
volumes:
|
|
66
|
+
- name: artifacts
|
|
67
|
+
host:
|
|
68
|
+
path: /var/lib/drone/artifacts
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Harness CI pipeline for webship-js (Pipeline-as-Code).
|
|
2
|
+
#
|
|
3
|
+
# Harness CI is part of the Harness Software Delivery Platform. The free
|
|
4
|
+
# Developer plan includes 90 build credits/day on hosted Linux x86 builds —
|
|
5
|
+
# enough for ~9 runs of the 9-minute suite per day. After signup, point a
|
|
6
|
+
# Git Sync connector at this repo and pick `.harness/webship-js-pipeline.yml`
|
|
7
|
+
# as the pipeline definition.
|
|
8
|
+
#
|
|
9
|
+
# Full walkthrough: docs/16-ci-cd.md → "Harness CI".
|
|
10
|
+
|
|
11
|
+
pipeline:
|
|
12
|
+
name: webship-js
|
|
13
|
+
identifier: webship_js
|
|
14
|
+
projectIdentifier: <PROJECT_ID> # set after project creation
|
|
15
|
+
orgIdentifier: <ORG_ID> # set after org creation
|
|
16
|
+
tags: {}
|
|
17
|
+
properties:
|
|
18
|
+
ci:
|
|
19
|
+
codebase:
|
|
20
|
+
connectorRef: <GITHUB_CONNECTOR_ID> # GitHub OAuth connector created in Harness
|
|
21
|
+
repoName: webship/webship-js
|
|
22
|
+
build: <+input>
|
|
23
|
+
stages:
|
|
24
|
+
- stage:
|
|
25
|
+
name: Test
|
|
26
|
+
identifier: Test
|
|
27
|
+
type: CI
|
|
28
|
+
spec:
|
|
29
|
+
cloneCodebase: true
|
|
30
|
+
platform:
|
|
31
|
+
os: Linux
|
|
32
|
+
arch: Amd64
|
|
33
|
+
runtime:
|
|
34
|
+
type: Cloud
|
|
35
|
+
spec: {}
|
|
36
|
+
execution:
|
|
37
|
+
steps:
|
|
38
|
+
- step:
|
|
39
|
+
type: Run
|
|
40
|
+
name: Install + browsers
|
|
41
|
+
identifier: install
|
|
42
|
+
spec:
|
|
43
|
+
shell: Bash
|
|
44
|
+
command: |
|
|
45
|
+
node --version
|
|
46
|
+
npm --version
|
|
47
|
+
npm install
|
|
48
|
+
npx playwright install --with-deps chromium
|
|
49
|
+
envVariables:
|
|
50
|
+
FORCE_COLOR: "1"
|
|
51
|
+
- step:
|
|
52
|
+
type: Background
|
|
53
|
+
name: Fixture server
|
|
54
|
+
identifier: fixture_server
|
|
55
|
+
spec:
|
|
56
|
+
shell: Bash
|
|
57
|
+
command: npm start
|
|
58
|
+
envVariables:
|
|
59
|
+
FORCE_COLOR: "1"
|
|
60
|
+
- step:
|
|
61
|
+
type: Run
|
|
62
|
+
name: Wait for server
|
|
63
|
+
identifier: wait
|
|
64
|
+
spec:
|
|
65
|
+
shell: Bash
|
|
66
|
+
command: |
|
|
67
|
+
sleep 3
|
|
68
|
+
curl -sf http://localhost:8080/ > /dev/null
|
|
69
|
+
- step:
|
|
70
|
+
type: Run
|
|
71
|
+
name: Cucumber
|
|
72
|
+
identifier: cucumber
|
|
73
|
+
spec:
|
|
74
|
+
shell: Bash
|
|
75
|
+
command: npm test
|
|
76
|
+
envVariables:
|
|
77
|
+
FORCE_COLOR: "1"
|
|
78
|
+
LAUNCH_URL: http://localhost:8080
|
|
79
|
+
reports:
|
|
80
|
+
type: JUnit
|
|
81
|
+
spec:
|
|
82
|
+
paths:
|
|
83
|
+
- tests/reports/junit.xml # populated only if you add a junit formatter
|
|
84
|
+
- step:
|
|
85
|
+
type: Plugin
|
|
86
|
+
name: Upload report artefacts
|
|
87
|
+
identifier: upload_artefacts
|
|
88
|
+
when:
|
|
89
|
+
stageStatus: All
|
|
90
|
+
spec:
|
|
91
|
+
connectorRef: <DOCKER_CONNECTOR_ID>
|
|
92
|
+
image: plugins/s3
|
|
93
|
+
settings:
|
|
94
|
+
bucket: webship-js-reports
|
|
95
|
+
source: tests/reports/cucumber_report.{html,pdf,json}
|
|
96
|
+
target: harness/$DRONE_BUILD_NUMBER/
|
|
97
|
+
access_key: <+secrets.getValue("aws_access_key")>
|
|
98
|
+
secret_key: <+secrets.getValue("aws_secret_key")>
|
|
99
|
+
when:
|
|
100
|
+
pipelineStatus: All
|
|
101
|
+
variables: []
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Semaphore CI for webship-js.
|
|
2
|
+
#
|
|
3
|
+
# Free tier: 1,300 build-minutes per month on `e1-standard-2` (2 vCPU, 4 GB).
|
|
4
|
+
# Open-source projects qualify for additional minutes via the Startup plan.
|
|
5
|
+
#
|
|
6
|
+
# Setup (full walkthrough in docs/16-ci-cd.md → "Semaphore"):
|
|
7
|
+
# 1. semaphoreci.com → sign up with GitHub.
|
|
8
|
+
# 2. "Create new project" → pick webship/webship-js → branch 2.0.x.
|
|
9
|
+
# 3. Choose "Customize" → "I have a pipeline file in my repo".
|
|
10
|
+
|
|
11
|
+
version: v1.0
|
|
12
|
+
name: webship-js
|
|
13
|
+
|
|
14
|
+
agent:
|
|
15
|
+
machine:
|
|
16
|
+
type: e1-standard-2
|
|
17
|
+
os_image: ubuntu2204
|
|
18
|
+
|
|
19
|
+
global_job_config:
|
|
20
|
+
env_vars:
|
|
21
|
+
- { name: FORCE_COLOR, value: "1" }
|
|
22
|
+
- { name: LAUNCH_URL, value: "http://localhost:8080" }
|
|
23
|
+
prologue:
|
|
24
|
+
commands:
|
|
25
|
+
- sem-version node 20
|
|
26
|
+
- checkout
|
|
27
|
+
- cache restore node-modules-$(checksum package.json)
|
|
28
|
+
- cache restore ms-playwright
|
|
29
|
+
|
|
30
|
+
blocks:
|
|
31
|
+
- name: Install
|
|
32
|
+
task:
|
|
33
|
+
jobs:
|
|
34
|
+
- name: npm install
|
|
35
|
+
commands:
|
|
36
|
+
- npm install
|
|
37
|
+
- npx playwright install --with-deps chromium
|
|
38
|
+
- cache store node-modules-$(checksum package.json) node_modules
|
|
39
|
+
- cache store ms-playwright ~/.cache/ms-playwright
|
|
40
|
+
|
|
41
|
+
- name: Test
|
|
42
|
+
task:
|
|
43
|
+
jobs:
|
|
44
|
+
- name: cucumber
|
|
45
|
+
commands:
|
|
46
|
+
- nohup npm start > /tmp/srv.log 2>&1 &
|
|
47
|
+
- sleep 3
|
|
48
|
+
- curl -sf http://localhost:8080/ > /dev/null
|
|
49
|
+
- npm test
|
|
50
|
+
epilogue:
|
|
51
|
+
always:
|
|
52
|
+
commands:
|
|
53
|
+
- artifact push job tests/reports/cucumber_report.html --expire-in 30d || true
|
|
54
|
+
- artifact push job tests/reports/cucumber_report.pdf --expire-in 30d || true
|
|
55
|
+
- artifact push job tests/reports/cucumber_report.json --expire-in 30d || true
|
|
56
|
+
on_failure:
|
|
57
|
+
commands:
|
|
58
|
+
- artifact push job screenshots --expire-in 30d || true
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
TeamCity Kotlin DSL Maven descriptor.
|
|
4
|
+
|
|
5
|
+
Lets IntelliJ resolve the kotlin-dsl artefacts so settings.kts has
|
|
6
|
+
full IDE completion. TeamCity Cloud and Server ignore this file at
|
|
7
|
+
build time — only the IDE uses it.
|
|
8
|
+
-->
|
|
9
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
10
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
11
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
12
|
+
<modelVersion>4.0.0</modelVersion>
|
|
13
|
+
<groupId>webship.js</groupId>
|
|
14
|
+
<artifactId>webship-js-teamcity-config</artifactId>
|
|
15
|
+
<version>1.0-SNAPSHOT</version>
|
|
16
|
+
<packaging>pom</packaging>
|
|
17
|
+
|
|
18
|
+
<properties>
|
|
19
|
+
<kotlin.version>1.9.0</kotlin.version>
|
|
20
|
+
<teamcity.dsl.version>2024.03</teamcity.dsl.version>
|
|
21
|
+
</properties>
|
|
22
|
+
|
|
23
|
+
<repositories>
|
|
24
|
+
<repository>
|
|
25
|
+
<id>jetbrains-all</id>
|
|
26
|
+
<url>https://download.jetbrains.com/teamcity-repository</url>
|
|
27
|
+
</repository>
|
|
28
|
+
</repositories>
|
|
29
|
+
|
|
30
|
+
<pluginRepositories>
|
|
31
|
+
<pluginRepository>
|
|
32
|
+
<id>jetbrains-all</id>
|
|
33
|
+
<url>https://download.jetbrains.com/teamcity-repository</url>
|
|
34
|
+
</pluginRepository>
|
|
35
|
+
</pluginRepositories>
|
|
36
|
+
|
|
37
|
+
<dependencies>
|
|
38
|
+
<dependency>
|
|
39
|
+
<groupId>org.jetbrains.teamcity</groupId>
|
|
40
|
+
<artifactId>configs-dsl-kotlin</artifactId>
|
|
41
|
+
<version>${teamcity.dsl.version}</version>
|
|
42
|
+
<scope>compile</scope>
|
|
43
|
+
</dependency>
|
|
44
|
+
<dependency>
|
|
45
|
+
<groupId>org.jetbrains.teamcity</groupId>
|
|
46
|
+
<artifactId>configs-dsl-kotlin-plugins</artifactId>
|
|
47
|
+
<version>${teamcity.dsl.version}</version>
|
|
48
|
+
<type>pom</type>
|
|
49
|
+
<scope>compile</scope>
|
|
50
|
+
</dependency>
|
|
51
|
+
</dependencies>
|
|
52
|
+
</project>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// TeamCity Kotlin DSL for webship-js.
|
|
2
|
+
//
|
|
3
|
+
// Versioned settings file. TeamCity reads it on every commit to the
|
|
4
|
+
// configured branch and re-syncs the build configuration with what is in
|
|
5
|
+
// version control.
|
|
6
|
+
//
|
|
7
|
+
// Setup:
|
|
8
|
+
// 1. jetbrains.com/teamcity/cloud → sign in → start free trial.
|
|
9
|
+
// 2. Create project → connect VCS root (GitHub OAuth).
|
|
10
|
+
// 3. Project Settings → Versioned Settings → enable Kotlin DSL.
|
|
11
|
+
// TeamCity will offer to generate this file the first time; we ship
|
|
12
|
+
// a hand-crafted version below.
|
|
13
|
+
//
|
|
14
|
+
// Free tier: 600 build-minutes / month + 1 build agent + 100 build configs.
|
|
15
|
+
// The 9-minute suite fits ~66 runs / month.
|
|
16
|
+
|
|
17
|
+
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
|
18
|
+
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
|
|
19
|
+
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
|
20
|
+
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.commitStatusPublisher
|
|
21
|
+
|
|
22
|
+
version = "2024.03"
|
|
23
|
+
|
|
24
|
+
project {
|
|
25
|
+
description = "Webship-js — BDD on Playwright + Cucumber-js"
|
|
26
|
+
|
|
27
|
+
buildType(WebshipJsTest)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
object WebshipJsTest : BuildType({
|
|
31
|
+
id("WebshipJsTest")
|
|
32
|
+
name = "Test"
|
|
33
|
+
|
|
34
|
+
params {
|
|
35
|
+
param("env.FORCE_COLOR", "1")
|
|
36
|
+
param("env.LAUNCH_URL", "http://localhost:8080")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
vcs {
|
|
40
|
+
root(DslContext.settingsRoot)
|
|
41
|
+
cleanCheckout = true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
steps {
|
|
45
|
+
script {
|
|
46
|
+
name = "Install + test"
|
|
47
|
+
scriptContent = """
|
|
48
|
+
set -euo pipefail
|
|
49
|
+
node --version
|
|
50
|
+
npm --version
|
|
51
|
+
npm install
|
|
52
|
+
npx playwright install --with-deps chromium
|
|
53
|
+
nohup npm start > /tmp/srv.log 2>&1 &
|
|
54
|
+
sleep 3
|
|
55
|
+
curl -sf http://localhost:8080/ > /dev/null
|
|
56
|
+
npm test
|
|
57
|
+
""".trimIndent()
|
|
58
|
+
dockerImage = "mcr.microsoft.com/playwright:v1.58.2-jammy"
|
|
59
|
+
dockerPull = true
|
|
60
|
+
dockerRunParameters = "--user root:root --network host"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
triggers {
|
|
65
|
+
vcs {
|
|
66
|
+
branchFilter = """
|
|
67
|
+
+:2.0.x
|
|
68
|
+
+:refs/tags/2.0.*
|
|
69
|
+
""".trimIndent()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
features {
|
|
74
|
+
commitStatusPublisher {
|
|
75
|
+
publisher = github {
|
|
76
|
+
githubUrl = "https://api.github.com"
|
|
77
|
+
authType = personalToken { token = "credentialsJSON:webship-js-github-token" }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
artifactRules = """
|
|
83
|
+
tests/reports/cucumber_report.html
|
|
84
|
+
tests/reports/cucumber_report.pdf
|
|
85
|
+
tests/reports/cucumber_report.json
|
|
86
|
+
screenshots/** => screenshots
|
|
87
|
+
""".trimIndent()
|
|
88
|
+
|
|
89
|
+
requirements {
|
|
90
|
+
contains("os.name", "Linux")
|
|
91
|
+
}
|
|
92
|
+
})
|
package/.travis.yml
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
language: node_js
|
|
2
|
+
os: linux
|
|
3
|
+
dist: jammy
|
|
2
4
|
|
|
3
5
|
node_js:
|
|
4
|
-
-
|
|
6
|
+
- "20"
|
|
5
7
|
|
|
6
8
|
env:
|
|
7
|
-
|
|
9
|
+
global:
|
|
10
|
+
- FORCE_COLOR=1
|
|
11
|
+
- LAUNCH_URL=http://localhost:8080
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
cache:
|
|
14
|
+
npm: true
|
|
15
|
+
directories:
|
|
16
|
+
- $HOME/.cache/ms-playwright
|
|
17
|
+
|
|
18
|
+
branches:
|
|
19
|
+
only:
|
|
20
|
+
- 2.0.x
|
|
21
|
+
- /^2\.0\..*$/
|
|
22
|
+
|
|
23
|
+
install:
|
|
24
|
+
- npm install
|
|
10
25
|
- npx playwright install --with-deps chromium
|
|
11
26
|
|
|
12
27
|
before_script:
|
|
13
28
|
- npm start &
|
|
14
29
|
- sleep 3
|
|
30
|
+
- curl -sf http://localhost:8080/ > /dev/null
|
|
15
31
|
|
|
16
32
|
script:
|
|
17
33
|
- npm test
|
|
34
|
+
|
|
35
|
+
notifications:
|
|
36
|
+
email:
|
|
37
|
+
on_success: never
|
|
38
|
+
on_failure: change
|
package/AGENTS.md
CHANGED
|
@@ -5,8 +5,11 @@ machine-readable rules for any AI agent (Claude, Codex, Cursor, Copilot,
|
|
|
5
5
|
etc.) working on the repository.
|
|
6
6
|
|
|
7
7
|
For full project context, read `CLAUDE.md` in the same directory — it is
|
|
8
|
-
the canonical, longer policy
|
|
9
|
-
|
|
8
|
+
the canonical, longer policy (commands §1, architecture §2, file
|
|
9
|
+
organisation §5, BBR waits §6, local agents and skills §11). This file
|
|
10
|
+
extracts the critical rules that every agent must respect. When the two
|
|
11
|
+
disagree, `CLAUDE.md` wins — and the disagreement is a bug to fix in the
|
|
12
|
+
same change.
|
|
10
13
|
|
|
11
14
|
## Identity
|
|
12
15
|
|
|
@@ -20,11 +23,15 @@ Drupal, or PHP in code, file names, comments, or step phrasings.
|
|
|
20
23
|
`git commit`, `git push`, `npm publish`, or anything that mutates a
|
|
21
24
|
shared repository / registry without explicit per-action consent.
|
|
22
25
|
2. **Update docs in the same change.** Step / selector / config changes
|
|
23
|
-
must update the matching page in `docs/`.
|
|
26
|
+
must update the matching page in `docs/`. A `worldParameters` change
|
|
27
|
+
must also update the scaffold template in `bin/init-webship.js`.
|
|
24
28
|
3. **Stay green.** Every change must keep `npx cucumber-js --dry-run`
|
|
25
|
-
ambiguity-free and `npx cucumber-js` passing.
|
|
29
|
+
ambiguity-free and `npx cucumber-js` passing. `node_modules/` is not
|
|
30
|
+
committed — run `npm install` first, and `npm start` (the `examples/`
|
|
31
|
+
fixture server on :8080) before the suite. If you could not run it,
|
|
32
|
+
say so; never imply green.
|
|
26
33
|
4. **Backups.** When asked, bump `package.json` `version` and emit
|
|
27
|
-
|
|
34
|
+
`~/workspace/products/webship-js-<version>.zip` excluding
|
|
28
35
|
`node_modules/`, `tests/reports/`, `screenshots/`, `.git/`.
|
|
29
36
|
|
|
30
37
|
## Step definition rules
|
|
@@ -38,6 +45,9 @@ Drupal, or PHP in code, file names, comments, or step phrasings.
|
|
|
38
45
|
Gherkin keyword is stripped.
|
|
39
46
|
* No static `sleep` calls. Wait steps go through `smartSettle()` in
|
|
40
47
|
`webship.js`.
|
|
48
|
+
* Never let a raw Playwright error reach the tester. Wrap risky locator
|
|
49
|
+
work and re-throw through `friendly()` / `humanize()` — see
|
|
50
|
+
`actOrExplain()` in `action.steps.js` for the reference shape.
|
|
41
51
|
* Place new steps in the file whose topic matches. Don't create a new
|
|
42
52
|
file unless the topic is genuinely orthogonal to every existing one.
|
|
43
53
|
|
|
@@ -71,10 +81,13 @@ sleeps with edge waits.
|
|
|
71
81
|
|
|
72
82
|
Before reporting a task complete:
|
|
73
83
|
|
|
84
|
+
* [ ] Ran `npx cucumber-js --dry-run` — no ambiguity, no undefined steps.
|
|
74
85
|
* [ ] Ran the affected feature(s) via `LAUNCH_URL=http://localhost:8080 npx cucumber-js <path>`.
|
|
75
86
|
* [ ] Updated `docs/04-step-reference.md` and the topic doc if a step or
|
|
76
87
|
selector preset changed.
|
|
77
|
-
* [ ] Updated `docs/
|
|
88
|
+
* [ ] Updated `docs/README.md` source layout + step counts if a step file
|
|
89
|
+
was added or steps were added / removed.
|
|
90
|
+
* [ ] Updated `bin/init-webship.js` if `worldParameters` changed.
|
|
78
91
|
* [ ] Verified examples match patterns (no audit mismatches).
|
|
79
92
|
* [ ] Bumped version + produced backup zip if user requested it.
|
|
80
93
|
|
|
@@ -96,14 +109,37 @@ step definitions. Critical takeaways:
|
|
|
96
109
|
|
|
97
110
|
## Source map
|
|
98
111
|
|
|
99
|
-
Step definitions: `tests/step-definitions
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
`
|
|
104
|
-
`getModalSelector`
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
Step definitions: `tests/step-definitions/` — 413 steps across 36
|
|
113
|
+
`*.steps.js` files, all auto-loaded. The `webship.js` file there is the
|
|
114
|
+
single canonical entry point — World, hooks, init script, and shared
|
|
115
|
+
helpers (`smartSettle`, `waitForPageLoad`, `buildSelector`, `gotoUrl`,
|
|
116
|
+
`fillField`, `getLocatorText`, `pad`, the modal probes
|
|
117
|
+
`getModalSelector` / `getModalLocator` / `waitForModalState` /
|
|
118
|
+
`findVisibleModal` / `isAnyModalVisible`, the date helpers
|
|
119
|
+
`resolveRelativeDate` / `parseRelativeOffset` / `formatRelativeDate`, and
|
|
120
|
+
the error builders `friendly` / `humanize`). It also owns two
|
|
121
|
+
process-level side effects: the stdout hook-line filter and the auto HTML
|
|
122
|
+
report on exit.
|
|
123
|
+
|
|
124
|
+
Docs: `docs/` — see `docs/README.md` for the reading order.
|
|
125
|
+
|
|
126
|
+
Selector presets: `tests/selectors/*.json` — 26 presets. Canonical key
|
|
127
|
+
list: `tests/selectors/_canonical-keys.json`.
|
|
128
|
+
|
|
129
|
+
Config: `cucumber.js` (`worldParameters`, annotated) and
|
|
130
|
+
`playwright.config.ts` (browser launch + context), plus the scaffold
|
|
131
|
+
template in `bin/init-webship.js` that must mirror them.
|
|
132
|
+
|
|
133
|
+
Visual regression: extracted to the [`diffy-steps`](https://github.com/webship/diffy-steps)
|
|
134
|
+
plugin — not in this repository.
|
|
135
|
+
|
|
136
|
+
## This repo is the package
|
|
137
|
+
|
|
138
|
+
webship-js ships `tests/` to consumers on npm, so `tests/` is both the
|
|
139
|
+
step library and its own test suite. The local agents and skills that
|
|
140
|
+
drive this project (`agent-webship-js`, `webship-ai-agent`, and the
|
|
141
|
+
`/webship-js-*` skills) all read `node_modules/webship-js/...` as their
|
|
142
|
+
source of truth. That path does not exist here — translate it to
|
|
143
|
+
`tests/step-definitions/`, `docs/`, `bin/`. Running one of them
|
|
144
|
+
unmodified inside this repository reads the published copy from GitHub,
|
|
145
|
+
not the working tree. See `CLAUDE.md` §11.
|