webship-js 2.0.2 → 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.
Files changed (181) hide show
  1. package/.circleci/config.yml +7 -31
  2. package/.drone.yml +68 -0
  3. package/.harness/webship-js-pipeline.yml +101 -0
  4. package/.semaphore/semaphore.yml +58 -0
  5. package/.teamcity/pom.xml +52 -0
  6. package/.teamcity/settings.kts +92 -0
  7. package/.travis.yml +24 -3
  8. package/AGENTS.md +109 -0
  9. package/CLAUDE.md +317 -0
  10. package/Jenkinsfile +54 -0
  11. package/azure-pipelines.yml +82 -0
  12. package/bamboo-specs/bamboo.yml +131 -0
  13. package/bin/generate-reports.js +181 -9
  14. package/buildspec.yml +56 -0
  15. package/cloudbuild.yaml +49 -0
  16. package/codefresh.yml +77 -0
  17. package/cucumber.js +48 -5
  18. package/docs/00-quick-start.md +102 -0
  19. package/docs/01-getting-started.md +102 -0
  20. package/docs/02-bbr-smart-waits.md +77 -0
  21. package/docs/03-selector-registry.md +95 -0
  22. package/docs/04-step-reference.md +799 -0
  23. package/docs/05-web-first-assertions.md +91 -0
  24. package/docs/06-network-and-dialogs.md +83 -0
  25. package/docs/07-auth-state.md +75 -0
  26. package/docs/08-clock-mocking.md +59 -0
  27. package/docs/09-api-testing.md +114 -0
  28. package/docs/10-accessibility.md +167 -0
  29. package/docs/11-debugging.md +129 -0
  30. package/docs/12-ai-agent-guide.md +338 -0
  31. package/docs/13-faq.md +236 -0
  32. package/docs/14-recipes-cookbook.md +255 -0
  33. package/docs/15-tag-conventions.md +76 -0
  34. package/docs/16-ci-cd.md +879 -0
  35. package/docs/README.md +113 -0
  36. package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
  37. package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
  38. package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
  39. package/docs/advanced-screenshots.md +52 -0
  40. package/docs/advanced-selectors.md +18 -0
  41. package/docs/api-step-definitions.md +45 -0
  42. package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +30 -0
  43. package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +21 -0
  44. package/docs/diffy-step-definitions/then-create-diffy-comparison.md +25 -0
  45. package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +35 -0
  46. package/docs/diffy-step-definitions/then-i-take-screenshot.md +21 -0
  47. package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +27 -0
  48. package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +27 -0
  49. package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +28 -0
  50. package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +21 -0
  51. package/docs/diffy-step-definitions/when-i-resize-window-number.md +29 -0
  52. package/docs/diffy-step-definitions.md +21 -0
  53. package/docs/global-settings.md +295 -0
  54. package/docs/install-webship-js/ddev-webship-js.md +52 -0
  55. package/docs/install-webship-js.md +35 -0
  56. package/docs/overview.md +41 -0
  57. package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
  58. package/docs/step-definitions/given-i-am-homepage.md +68 -0
  59. package/docs/step-definitions/given-i-am-specific-page.md +72 -0
  60. package/docs/step-definitions/then-i-should-be.md +56 -0
  61. package/docs/step-definitions/then-i-should-see.md +62 -0
  62. package/docs/step-definitions/then-item-checkbox.md +54 -0
  63. package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
  64. package/docs/step-definitions/then-item-should-contain.md +67 -0
  65. package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
  66. package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
  67. package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
  68. package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
  69. package/docs/step-definitions/when-i-check-checkbox.md +60 -0
  70. package/docs/step-definitions/when-i-click-link.md +51 -0
  71. package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
  72. package/docs/step-definitions/when-i-fill.md +59 -0
  73. package/docs/step-definitions/when-i-go-homepage.md +60 -0
  74. package/docs/step-definitions/when-i-go-specific-page.md +67 -0
  75. package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
  76. package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
  77. package/docs/step-definitions/when-i-press-button.md +58 -0
  78. package/docs/step-definitions/when-i-reload-page.md +51 -0
  79. package/docs/step-definitions/when-i-scroll.md +73 -0
  80. package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
  81. package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
  82. package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
  83. package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
  84. package/docs/step-definitions/when-i-wait.md +62 -0
  85. package/docs/step-definitions.md +50 -0
  86. package/examples/a11y.html +31 -0
  87. package/examples/cookies.html +10 -0
  88. package/examples/date.html +12 -0
  89. package/examples/element.html +11 -0
  90. package/examples/field.html +24 -0
  91. package/examples/keyboard.html +11 -0
  92. package/examples/links.html +9 -0
  93. package/examples/modal.html +14 -0
  94. package/examples/path.html +3 -0
  95. package/examples/table.html +13 -0
  96. package/examples/video-demo.html +43 -0
  97. package/package.json +10 -3
  98. package/playwright.config.ts +3 -2
  99. package/tests/features/a11y.feature +39 -0
  100. package/tests/features/cookie.feature +13 -0
  101. package/tests/features/date.feature +11 -0
  102. package/tests/features/element.feature +16 -0
  103. package/tests/features/field.feature +25 -0
  104. package/tests/features/keyboard.feature +10 -0
  105. package/tests/features/link.feature +11 -0
  106. package/tests/features/modal-advanced-example.feature +1 -1
  107. package/tests/features/modal.feature +11 -0
  108. package/tests/features/path.feature +16 -0
  109. package/tests/features/response.feature +8 -0
  110. package/tests/features/responsive.feature +10 -0
  111. package/tests/features/table.feature +18 -0
  112. package/tests/features/video.feature +18 -0
  113. package/tests/features/wait.feature +7 -0
  114. package/tests/features/yaml.feature +102 -0
  115. package/tests/reports/README.md +55 -0
  116. package/tests/selectors/_canonical-keys.json +113 -0
  117. package/tests/selectors/back-end-selectors.json +7 -1
  118. package/tests/selectors/cms-contentful-admin.json +35 -0
  119. package/tests/selectors/cms-craft-admin.json +39 -0
  120. package/tests/selectors/cms-drupal-cms-gin.json +56 -0
  121. package/tests/selectors/cms-drupal-core-claro.json +50 -0
  122. package/tests/selectors/cms-generic-admin.json +34 -0
  123. package/tests/selectors/cms-ghost-admin.json +34 -0
  124. package/tests/selectors/cms-joomla-admin.json +41 -0
  125. package/tests/selectors/cms-magento2-admin.json +32 -0
  126. package/tests/selectors/cms-prestashop-admin.json +38 -0
  127. package/tests/selectors/cms-shopify-admin.json +25 -0
  128. package/tests/selectors/cms-strapi-admin.json +42 -0
  129. package/tests/selectors/cms-typo3-admin.json +41 -0
  130. package/tests/selectors/cms-woocommerce-front.json +50 -0
  131. package/tests/selectors/cms-wordpress-admin.json +31 -0
  132. package/tests/selectors/framework-ant-design.json +80 -0
  133. package/tests/selectors/framework-bootstrap.json +86 -0
  134. package/tests/selectors/framework-bulma.json +74 -0
  135. package/tests/selectors/framework-chakra.json +58 -0
  136. package/tests/selectors/framework-foundation.json +51 -0
  137. package/tests/selectors/framework-material-ui.json +72 -0
  138. package/tests/selectors/framework-shadcn.json +51 -0
  139. package/tests/selectors/framework-tailwind.json +40 -0
  140. package/tests/selectors/framework-vuetify.json +61 -0
  141. package/tests/step-definitions/a11y.steps.js +800 -0
  142. package/tests/step-definitions/action.steps.js +167 -0
  143. package/tests/step-definitions/{webship-api.js → api.steps.js} +41 -23
  144. package/tests/step-definitions/assertion.steps.js +352 -0
  145. package/tests/step-definitions/auth.steps.js +126 -0
  146. package/tests/step-definitions/clock.steps.js +128 -0
  147. package/tests/step-definitions/cookie.steps.js +216 -0
  148. package/tests/step-definitions/debug.steps.js +39 -0
  149. package/tests/step-definitions/dialog.steps.js +193 -0
  150. package/tests/step-definitions/element.steps.js +356 -0
  151. package/tests/step-definitions/field.steps.js +653 -0
  152. package/tests/step-definitions/file-download.steps.js +211 -0
  153. package/tests/step-definitions/form.steps.js +333 -0
  154. package/tests/step-definitions/iframe.steps.js +228 -0
  155. package/tests/step-definitions/input.steps.js +202 -0
  156. package/tests/step-definitions/javascript.steps.js +232 -0
  157. package/tests/step-definitions/keyboard.steps.js +112 -0
  158. package/tests/step-definitions/link.steps.js +142 -0
  159. package/tests/step-definitions/metatag.steps.js +91 -0
  160. package/tests/step-definitions/modal.steps.js +244 -0
  161. package/tests/step-definitions/navigation.steps.js +218 -0
  162. package/tests/step-definitions/network.steps.js +280 -0
  163. package/tests/step-definitions/path.steps.js +141 -0
  164. package/tests/step-definitions/response.steps.js +98 -0
  165. package/tests/step-definitions/responsive.steps.js +125 -0
  166. package/tests/step-definitions/rest.steps.js +111 -0
  167. package/tests/step-definitions/{webship-screenshot.js → screenshot.steps.js} +1 -5
  168. package/tests/step-definitions/scroll.steps.js +189 -0
  169. package/tests/step-definitions/{webship-selectors.js → selectors.steps.js} +64 -27
  170. package/tests/step-definitions/storage.steps.js +194 -0
  171. package/tests/step-definitions/table.steps.js +181 -0
  172. package/tests/step-definitions/video.steps.js +178 -0
  173. package/tests/step-definitions/wait.steps.js +400 -0
  174. package/tests/step-definitions/web-first.steps.js +298 -0
  175. package/tests/step-definitions/webship.js +741 -1477
  176. package/tests/step-definitions/xml.steps.js +411 -0
  177. package/tests/step-definitions/yaml.steps.js +913 -0
  178. package/tests/step-definitions-diffy/webship-diffy.js +0 -13
  179. package/tsconfig.json +19 -3
  180. package/videos/README.md +32 -0
  181. package/.travis-ci.yml +0 -16
@@ -1,46 +1,22 @@
1
1
  version: 2.1
2
+
2
3
  defaults: &defaults
3
4
  docker:
4
- - image: cimg/base:stable-20.04
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
- - webship-js-build
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
- npm test
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
- - '20'
6
+ - "20"
5
7
 
6
8
  env:
7
- - FORCE_COLOR=1
9
+ global:
10
+ - FORCE_COLOR=1
11
+ - LAUNCH_URL=http://localhost:8080
8
12
 
9
- before_install:
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 ADDED
@@ -0,0 +1,109 @@
1
+ # AGENTS.md — webship-js
2
+
3
+ This file follows the [agents.md](https://agents.md) convention: short,
4
+ machine-readable rules for any AI agent (Claude, Codex, Cursor, Copilot,
5
+ etc.) working on the repository.
6
+
7
+ For full project context, read `CLAUDE.md` in the same directory — it is
8
+ the canonical, longer policy. This file extracts the critical rules that
9
+ every agent must respect.
10
+
11
+ ## Identity
12
+
13
+ webship-js is a BDD browser-automation harness built on Playwright +
14
+ Cucumber-js. It is its own product. Never reference Behat, DrevOps,
15
+ Drupal, or PHP in code, file names, comments, or step phrasings.
16
+
17
+ ## Hard rules
18
+
19
+ 1. **No git commits.** The user commits manually. Never invoke
20
+ `git commit`, `git push`, `npm publish`, or anything that mutates a
21
+ shared repository / registry without explicit per-action consent.
22
+ 2. **Update docs in the same change.** Step / selector / config changes
23
+ must update the matching page in `docs/`.
24
+ 3. **Stay green.** Every change must keep `npx cucumber-js --dry-run`
25
+ ambiguity-free and `npx cucumber-js` passing.
26
+ 4. **Backups.** When asked, bump `package.json` `version` and emit
27
+ `/var/www/html/products/webship-js-<version>.zip` excluding
28
+ `node_modules/`, `tests/reports/`, `screenshots/`, `.git/`.
29
+
30
+ ## Step definition rules
31
+
32
+ * Use a regex with `(I |we )*` — never `'I ...'` Cucumber Expressions
33
+ unless the step genuinely cannot start with a pronoun.
34
+ * Write step text in plain English. Avoid camelCase identifiers
35
+ (`local storage`, not `localStorage`).
36
+ * Every step needs a JSDoc block with at least 5 `Example #N:` Gherkin
37
+ lines. Each example header line must match the step pattern when the
38
+ Gherkin keyword is stripped.
39
+ * No static `sleep` calls. Wait steps go through `smartSettle()` in
40
+ `webship.js`.
41
+ * Place new steps in the file whose topic matches. Don't create a new
42
+ file unless the topic is genuinely orthogonal to every existing one.
43
+
44
+ ## Do-not-merge boundaries
45
+
46
+ | Pair | Reason |
47
+ | --- | --- |
48
+ | `modal.steps.js` vs `dialog.steps.js` | HTML modal overlay vs native browser alert/confirm/prompt. |
49
+ | `field.steps.js` vs `form.steps.js` | CSS-selector field control vs label/placeholder/name form fills. |
50
+ | `xml.steps.js` vs `yaml.steps.js` | Different parsers and different path conventions. |
51
+ | `api.steps.js` vs `rest.steps.js` | Long-form (header + body table) vs short-form REST steps. |
52
+ | `web-first.steps.js` vs `assertion.steps.js` | Auto-retrying matchers vs single-snapshot assertions. |
53
+ | `element.steps.js` vs `input.steps.js` | Element-scoped (`the element "X"`) vs short pointer (`"X"`). |
54
+
55
+ ## Quick prompt templates
56
+
57
+ **New feature file:** REASONS canvas → comments → Background → Scenarios →
58
+ tags → run.
59
+
60
+ **New step:** search first — if a match exists, point at it instead of
61
+ duplicating. Place by topic. Regex with `(I |we )*`. Plain English. JSDoc
62
+ with ≥5 examples. Friendly try/catch for locator actions.
63
+
64
+ **Maintenance:** run suite → group failures → fix selectors in JSON
65
+ preset (not feature files) → re-run → iterate.
66
+
67
+ **Flaky debug:** `HEADLESS=false SLOW_MO=800` → screenshots/ → replace
68
+ sleeps with edge waits.
69
+
70
+ ## Workflow checklist
71
+
72
+ Before reporting a task complete:
73
+
74
+ * [ ] Ran the affected feature(s) via `LAUNCH_URL=http://localhost:8080 npx cucumber-js <path>`.
75
+ * [ ] Updated `docs/04-step-reference.md` and the topic doc if a step or
76
+ selector preset changed.
77
+ * [ ] Updated `docs/README.md` source layout if a new step file was added.
78
+ * [ ] Verified examples match patterns (no audit mismatches).
79
+ * [ ] Bumped version + produced backup zip if user requested it.
80
+
81
+ ## Wisdom from the Recipes book
82
+
83
+ `docs/12-ai-agent-guide.md` is the AI-specific guide distilled from
84
+ *Webship-js-Recipes v1.0.30*. Read it before authoring features or
85
+ step definitions. Critical takeaways:
86
+
87
+ * **AI generates. Humans validate. Tests verify.**
88
+ * **Test-Drive-Develop:** human writes Gherkin → AI implements → tests
89
+ decide pass / fail.
90
+ * **SPDD REASONS canvas** (Requirements, Entities, Approach, Structure,
91
+ Operations, Norms, Safeguards) — apply it before writing any
92
+ `Scenario:` lines on high-value features.
93
+ * **Fix the prompt first** when reality diverges.
94
+ * **One scenario, one behaviour. Wait for events, not time. Test
95
+ behaviour, not implementation.**
96
+
97
+ ## Source map
98
+
99
+ Step definitions: `tests/step-definitions/`. The `webship.js` file there
100
+ is the single canonical entry point — World, hooks, init script, and
101
+ shared helpers (`smartSettle`, `getModalLocator`, `buildSelector`,
102
+ `gotoUrl`, `fillField`, `getLocatorText`, `pad`, `waitForPageLoad`,
103
+ `waitForModalState`, `findVisibleModal`, `isAnyModalVisible`,
104
+ `getModalSelector`).
105
+
106
+ Docs: `docs/` — see `docs/README.md` for the reading order.
107
+
108
+ Selector presets: `tests/selectors/*.json`. Canonical key list:
109
+ `tests/selectors/_canonical-keys.json`.