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.
Files changed (49) 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 +2 -2
  9. package/CLAUDE.md +2 -2
  10. package/Jenkinsfile +54 -0
  11. package/azure-pipelines.yml +82 -0
  12. package/bamboo-specs/bamboo.yml +131 -0
  13. package/buildspec.yml +56 -0
  14. package/cloudbuild.yaml +49 -0
  15. package/codefresh.yml +77 -0
  16. package/cucumber.js +40 -3
  17. package/docs/04-step-reference.md +74 -3
  18. package/docs/16-ci-cd.md +879 -0
  19. package/docs/README.md +113 -0
  20. package/docs/global-settings.md +51 -0
  21. package/examples/video-demo.html +43 -0
  22. package/package.json +1 -1
  23. package/tests/features/video.feature +18 -0
  24. package/tests/step-definitions/a11y.steps.js +3 -1
  25. package/tests/step-definitions/action.steps.js +2 -2
  26. package/tests/step-definitions/api.steps.js +17 -16
  27. package/tests/step-definitions/assertion.steps.js +2 -2
  28. package/tests/step-definitions/auth.steps.js +3 -1
  29. package/tests/step-definitions/clock.steps.js +38 -38
  30. package/tests/step-definitions/debug.steps.js +13 -5
  31. package/tests/step-definitions/element.steps.js +47 -5
  32. package/tests/step-definitions/file-download.steps.js +38 -20
  33. package/tests/step-definitions/form.steps.js +6 -6
  34. package/tests/step-definitions/iframe.steps.js +65 -15
  35. package/tests/step-definitions/input.steps.js +47 -8
  36. package/tests/step-definitions/javascript.steps.js +195 -34
  37. package/tests/step-definitions/keyboard.steps.js +38 -4
  38. package/tests/step-definitions/modal.steps.js +39 -14
  39. package/tests/step-definitions/network.steps.js +61 -19
  40. package/tests/step-definitions/responsive.steps.js +3 -1
  41. package/tests/step-definitions/selectors.steps.js +19 -17
  42. package/tests/step-definitions/video.steps.js +178 -0
  43. package/tests/step-definitions/web-first.steps.js +3 -1
  44. package/tests/step-definitions/webship.js +234 -15
  45. package/tests/step-definitions/xml.steps.js +4 -2
  46. package/tests/step-definitions/yaml.steps.js +13 -11
  47. package/videos/README.md +32 -0
  48. package/.travis-ci.yml +0 -16
  49. package/docs/index.md +0 -104
@@ -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 CHANGED
@@ -74,7 +74,7 @@ Before reporting a task complete:
74
74
  * [ ] Ran the affected feature(s) via `LAUNCH_URL=http://localhost:8080 npx cucumber-js <path>`.
75
75
  * [ ] Updated `docs/04-step-reference.md` and the topic doc if a step or
76
76
  selector preset changed.
77
- * [ ] Updated `docs/index.md` source layout if a new step file was added.
77
+ * [ ] Updated `docs/README.md` source layout if a new step file was added.
78
78
  * [ ] Verified examples match patterns (no audit mismatches).
79
79
  * [ ] Bumped version + produced backup zip if user requested it.
80
80
 
@@ -103,7 +103,7 @@ shared helpers (`smartSettle`, `getModalLocator`, `buildSelector`,
103
103
  `waitForModalState`, `findVisibleModal`, `isAnyModalVisible`,
104
104
  `getModalSelector`).
105
105
 
106
- Docs: `docs/` — see `docs/index.md` for the reading order.
106
+ Docs: `docs/` — see `docs/README.md` for the reading order.
107
107
 
108
108
  Selector presets: `tests/selectors/*.json`. Canonical key list:
109
109
  `tests/selectors/_canonical-keys.json`.
package/CLAUDE.md CHANGED
@@ -27,7 +27,7 @@ them. Treat webship-js as the source of truth.
27
27
  restructure a step / selector / configuration option, update the matching
28
28
  page under `docs/` in the same turn. Specifically:
29
29
  * New / removed step → update `docs/04-step-reference.md`.
30
- * New step file → add it to the source layout block in `docs/index.md`.
30
+ * New step file → add it to the source layout block in `docs/README.md`.
31
31
  * Topic-level addition (auth, network, clock, …) → add or refresh the
32
32
  dedicated page (`docs/07-auth-state.md`, `docs/06-network-and-dialogs.md`,
33
33
  etc.).
@@ -137,7 +137,7 @@ tests/step-definitions/
137
137
 
138
138
  When you add a new step, place it in the file whose topic matches. Do NOT
139
139
  spawn a new file unless the topic is genuinely orthogonal to every
140
- existing file. New file → mention it in `docs/index.md` AND update the
140
+ existing file. New file → mention it in `docs/README.md` AND update the
141
141
  table above.
142
142
 
143
143
  ## 4. Behavior-Based Robotics (BBR) wait policy
package/Jenkinsfile ADDED
@@ -0,0 +1,54 @@
1
+ // Jenkins declarative pipeline for webship-js.
2
+ //
3
+ // Runs the full BDD suite against an http-server fixture on port 8080.
4
+ // Uses the official Playwright image so chromium + all apt deps are baked in.
5
+ //
6
+ // Requirements on the Jenkins controller:
7
+ // - Docker Pipeline plugin (built into the "suggested plugins" install)
8
+ // - One executor with the docker daemon reachable
9
+ //
10
+ // Drop the file at repo root and configure a Pipeline job that points
11
+ // "Pipeline script from SCM" at this branch.
12
+
13
+ pipeline {
14
+ agent {
15
+ docker {
16
+ image 'mcr.microsoft.com/playwright:v1.58.2-jammy'
17
+ args '-u root:root'
18
+ }
19
+ }
20
+ options {
21
+ timestamps()
22
+ ansiColor('xterm')
23
+ timeout(time: 30, unit: 'MINUTES')
24
+ buildDiscarder(logRotator(numToKeepStr: '20'))
25
+ }
26
+ environment {
27
+ FORCE_COLOR = '1'
28
+ LAUNCH_URL = 'http://localhost:8080'
29
+ }
30
+ stages {
31
+ stage('Install') {
32
+ steps { sh 'npm install' }
33
+ }
34
+ stage('Browsers') {
35
+ steps { sh 'npx playwright install --with-deps chromium' }
36
+ }
37
+ stage('Serve fixtures') {
38
+ steps {
39
+ sh 'nohup npm start > /tmp/srv.log 2>&1 &'
40
+ sh 'sleep 3'
41
+ sh 'curl -sf http://localhost:8080/ > /dev/null'
42
+ }
43
+ }
44
+ stage('Test') {
45
+ steps { sh 'npm test' }
46
+ }
47
+ }
48
+ post {
49
+ always {
50
+ archiveArtifacts artifacts: 'tests/reports/cucumber_report.html,tests/reports/cucumber_report.pdf,tests/reports/cucumber_report.json,screenshots/**/*',
51
+ allowEmptyArchive: true
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,82 @@
1
+ # Azure DevOps Pipelines for webship-js.
2
+ #
3
+ # Runs the full BDD suite on a Microsoft-hosted Ubuntu agent. Free tier for
4
+ # public projects: 10 parallel jobs, unlimited minutes. Free tier for private
5
+ # projects: 1 job, 1,800 minutes / month.
6
+ #
7
+ # Setup:
8
+ # 1. dev.azure.com → sign in → create Organization → create Project.
9
+ # 2. Pipelines → New pipeline → GitHub → authorise OAuth.
10
+ # 3. "Existing Azure Pipelines YAML file" → /azure-pipelines.yml.
11
+ #
12
+ # Badge after first run (paste in README.md):
13
+ # ![Azure Pipelines](https://dev.azure.com/<org>/<project>/_apis/build/status/webship-js?branchName=2.0.x)
14
+
15
+ trigger:
16
+ branches:
17
+ include:
18
+ - 2.0.x
19
+ tags:
20
+ include:
21
+ - '2.0.*'
22
+
23
+ pr:
24
+ branches:
25
+ include:
26
+ - 2.0.x
27
+
28
+ pool:
29
+ vmImage: 'ubuntu-latest'
30
+
31
+ variables:
32
+ FORCE_COLOR: '1'
33
+ LAUNCH_URL: 'http://localhost:8080'
34
+
35
+ steps:
36
+ - task: NodeTool@0
37
+ inputs:
38
+ versionSpec: '20.x'
39
+ displayName: 'Install Node 20'
40
+
41
+ - task: Cache@2
42
+ inputs:
43
+ key: '"npm" | "$(Agent.OS)" | package.json'
44
+ restoreKeys: '"npm" | "$(Agent.OS)"'
45
+ path: $(Pipeline.Workspace)/.npm
46
+ displayName: 'Cache npm'
47
+
48
+ - task: Cache@2
49
+ inputs:
50
+ key: '"playwright" | "$(Agent.OS)"'
51
+ restoreKeys: '"playwright" | "$(Agent.OS)"'
52
+ path: $(HOME)/.cache/ms-playwright
53
+ displayName: 'Cache Playwright browsers'
54
+
55
+ - script: npm install
56
+ displayName: 'Install npm dependencies'
57
+
58
+ - script: npx playwright install --with-deps chromium
59
+ displayName: 'Install Playwright browsers'
60
+
61
+ - script: |
62
+ nohup npm start > /tmp/srv.log 2>&1 &
63
+ sleep 3
64
+ curl -sf http://localhost:8080/ > /dev/null
65
+ displayName: 'Start virtual server'
66
+
67
+ - script: npm test
68
+ displayName: 'Run tests'
69
+
70
+ - task: PublishBuildArtifacts@1
71
+ condition: always()
72
+ inputs:
73
+ pathToPublish: 'tests/reports'
74
+ artifactName: 'cucumber-report'
75
+ displayName: 'Publish HTML / PDF / JSON report'
76
+
77
+ - task: PublishBuildArtifacts@1
78
+ condition: failed()
79
+ inputs:
80
+ pathToPublish: 'screenshots'
81
+ artifactName: 'failure-screenshots'
82
+ displayName: 'Publish failure screenshots'