wdio-test-ledger-service 9.2.4 → 9.2.6
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/.github/workflows/release.yml +15 -1
- package/.release-it.json +8 -0
- package/README.md +26 -13
- package/package.json +2 -3
- package/src/index.js +9 -14
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
name: Publish to NPM
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
4
7
|
workflow_dispatch:
|
|
5
8
|
inputs:
|
|
6
9
|
release_type:
|
|
@@ -25,6 +28,7 @@ jobs:
|
|
|
25
28
|
with:
|
|
26
29
|
ref: 'master'
|
|
27
30
|
fetch-depth: 0
|
|
31
|
+
|
|
28
32
|
- uses: actions/setup-node@v4
|
|
29
33
|
with:
|
|
30
34
|
node-version: '20'
|
|
@@ -43,6 +47,16 @@ jobs:
|
|
|
43
47
|
- name: Install Dependencies
|
|
44
48
|
run: npm ci
|
|
45
49
|
|
|
46
|
-
-
|
|
50
|
+
- name: Release (manual)
|
|
51
|
+
if: github.event_name == 'workflow_dispatch'
|
|
52
|
+
run: npm run release -- ${{ github.event.inputs.release_type }}
|
|
53
|
+
env:
|
|
54
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
55
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
56
|
+
|
|
57
|
+
- name: Release (auto patch on push)
|
|
58
|
+
if: github.event_name == 'push'
|
|
59
|
+
run: npm run release -- patch
|
|
47
60
|
env:
|
|
48
61
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
62
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.release-it.json
CHANGED
package/README.md
CHANGED
|
@@ -14,22 +14,35 @@ npm install wdio-test-ledger-service
|
|
|
14
14
|
|
|
15
15
|
## Add the service to the services array in wdio.conf.js
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```javascript
|
|
18
18
|
services: [['test-ledger', {
|
|
19
|
-
reporterOutputDir :
|
|
20
|
-
apiUrl :
|
|
21
|
-
|
|
22
|
-
apiToken : `12345`, // Found in the app.testledger.dev under your proifle section
|
|
19
|
+
reporterOutputDir : './testledger', // This must match the outputDir from the wdio-test-reporter
|
|
20
|
+
apiUrl : 'app-api.testledger.dev', // Defaults to app-api.testledger.dev if none is set
|
|
21
|
+
apiToken : 'tl_abc123_yoursecret', // API token from app.testledger.dev
|
|
23
22
|
projectId : 123, // Only needed if using more than one project
|
|
24
|
-
appVersion :
|
|
23
|
+
appVersion : '2.8.10', // The code version can also be set here
|
|
25
24
|
enableFlaky : 1, // Will mark tests as flaky if it detects them based on previous runs
|
|
26
25
|
uploadArtifacts : true, // Enable screenshot/video artifact uploads
|
|
27
|
-
screenshotDir :
|
|
28
|
-
videoDir :
|
|
26
|
+
screenshotDir : './screenshots', // Directory containing screenshots
|
|
27
|
+
videoDir : './_results_/videos', // Directory containing videos (e.g. from wdio-video-reporter)
|
|
29
28
|
}]],
|
|
30
29
|
```
|
|
31
30
|
|
|
32
|
-
You
|
|
31
|
+
You can create an API token in the UI under Settings -> Profile -> API Keys.
|
|
32
|
+
|
|
33
|
+
**Tip:** Use the `TESTLEDGER_API_TOKEN` environment variable instead of hardcoding the token:
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
services: [['test-ledger', {
|
|
37
|
+
reporterOutputDir : './testledger',
|
|
38
|
+
projectId : 123,
|
|
39
|
+
}]],
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export TESTLEDGER_API_TOKEN="tl_abc123_yoursecret"
|
|
44
|
+
npx wdio run wdio.conf.js
|
|
45
|
+
```
|
|
33
46
|
|
|
34
47
|
## Add the wdio-test-ledger-reporter to the reporters array in wdio.conf.js
|
|
35
48
|
|
|
@@ -70,8 +83,7 @@ reporters: [
|
|
|
70
83
|
],
|
|
71
84
|
services: [['test-ledger', {
|
|
72
85
|
reporterOutputDir : './testledger',
|
|
73
|
-
|
|
74
|
-
apiToken : 'your-api-token',
|
|
86
|
+
apiToken : 'tl_abc123_yoursecret', // Or use TESTLEDGER_API_TOKEN env var
|
|
75
87
|
uploadArtifacts : true,
|
|
76
88
|
screenshotDir : './screenshots',
|
|
77
89
|
videoDir : './_results_/videos'
|
|
@@ -82,8 +94,9 @@ Artifacts are matched to test suites based on filename. The service looks for th
|
|
|
82
94
|
|
|
83
95
|
## Environment variables
|
|
84
96
|
|
|
85
|
-
Environment variables can be set when running tests
|
|
97
|
+
Environment variables can be set when running tests:
|
|
86
98
|
|
|
99
|
+
* `TESTLEDGER_API_TOKEN` - API token for authentication (recommended for CI)
|
|
87
100
|
* `RUN_TITLE` - Title of the test run. This might be something like a Jira issue key. Defaults to a timestamp if not specified
|
|
88
|
-
* `RUN_UUID` - UUID which can be used to directly link to the test run results. e.g. https://app.testledger.dev/runs
|
|
101
|
+
* `RUN_UUID` - UUID which can be used to directly link to the test run results. e.g. https://app.testledger.dev/runs/<uuid>
|
|
89
102
|
* `APP_VERSION` - Set the version of app this test run ran against
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wdio-test-ledger-service",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.6",
|
|
4
4
|
"description": "WebdriverIO server to send reporter data to testledger.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"node": "20.x"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"release": "release-it
|
|
11
|
+
"release": "release-it"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/WillBrock/wdio-test-ledger-service#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"btoa": "^1.2.1",
|
|
35
34
|
"fs-extra": "^11.2.0",
|
|
36
35
|
"node-fetch": "^3.3.2"
|
|
37
36
|
},
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import btoa from 'btoa';
|
|
4
3
|
import { SevereServiceError } from 'webdriverio';
|
|
5
4
|
|
|
6
5
|
const api_url = `https://app-api.testledger.dev`;
|
|
@@ -25,12 +24,11 @@ class TestLedgerLauncher {
|
|
|
25
24
|
throw new SevereServiceError(`No reporterOutputDir specified`)
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
27
|
+
// Support env var with fallback to option
|
|
28
|
+
this.apiToken = process.env.TESTLEDGER_API_TOKEN || this.options.apiToken;
|
|
31
29
|
|
|
32
|
-
if(!this.
|
|
33
|
-
throw new SevereServiceError(`No apiToken specified
|
|
30
|
+
if(!this.apiToken) {
|
|
31
|
+
throw new SevereServiceError(`No apiToken specified. Set TESTLEDGER_API_TOKEN env var or pass apiToken option.`)
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
// Artifact upload options
|
|
@@ -201,7 +199,7 @@ class TestLedgerLauncher {
|
|
|
201
199
|
method : `POST`,
|
|
202
200
|
headers : {
|
|
203
201
|
'Content-Type' : `application/json`,
|
|
204
|
-
'Authorization' :
|
|
202
|
+
'Authorization' : this.getAuthHeader(),
|
|
205
203
|
},
|
|
206
204
|
body : JSON.stringify(data),
|
|
207
205
|
});
|
|
@@ -218,11 +216,8 @@ class TestLedgerLauncher {
|
|
|
218
216
|
].join(``);
|
|
219
217
|
}
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
return
|
|
223
|
-
this.options.username,
|
|
224
|
-
this.options.apiToken,
|
|
225
|
-
].join(`:`));
|
|
219
|
+
getAuthHeader() {
|
|
220
|
+
return `Bearer ${this.apiToken}`;
|
|
226
221
|
}
|
|
227
222
|
|
|
228
223
|
/**
|
|
@@ -414,7 +409,7 @@ class TestLedgerLauncher {
|
|
|
414
409
|
method : 'POST',
|
|
415
410
|
headers : {
|
|
416
411
|
'Content-Type' : 'application/json',
|
|
417
|
-
'Authorization' :
|
|
412
|
+
'Authorization' : this.getAuthHeader()
|
|
418
413
|
},
|
|
419
414
|
body : JSON.stringify(payload)
|
|
420
415
|
});
|
|
@@ -477,7 +472,7 @@ class TestLedgerLauncher {
|
|
|
477
472
|
method : 'POST',
|
|
478
473
|
headers : {
|
|
479
474
|
'Content-Type' : 'application/json',
|
|
480
|
-
'Authorization' :
|
|
475
|
+
'Authorization' : this.getAuthHeader()
|
|
481
476
|
},
|
|
482
477
|
body : JSON.stringify({ artifact_ids: artifact_ids })
|
|
483
478
|
});
|