doc-detective-common 3.0.4-dev.2 → 3.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/.github/workflows/npm-test.yml +55 -5
- package/package.json +2 -2
- package/src/schemas/dereferenceSchemas.js +39 -20
- package/src/schemas/output_schemas/checkLink_v3.schema.json +4 -0
- package/src/schemas/output_schemas/click_v3.schema.json +2 -2
- package/src/schemas/output_schemas/config_v3.schema.json +603 -241
- package/src/schemas/output_schemas/context_v3.schema.json +18 -9
- package/src/schemas/output_schemas/find_v3.schema.json +24 -8
- package/src/schemas/output_schemas/goTo_v3.schema.json +6 -2
- package/src/schemas/output_schemas/httpRequest_v3.schema.json +64 -22
- package/src/schemas/output_schemas/openApi_v3.schema.json +4 -2
- package/src/schemas/output_schemas/record_v3.schema.json +9 -3
- package/src/schemas/output_schemas/report_v3.schema.json +618 -248
- package/src/schemas/output_schemas/resolvedTests_v3.schema.json +1222 -490
- package/src/schemas/output_schemas/runCode_v3.schema.json +4 -2
- package/src/schemas/output_schemas/runShell_v3.schema.json +8 -2
- package/src/schemas/output_schemas/screenshot_v3.schema.json +28 -9
- package/src/schemas/output_schemas/spec_v3.schema.json +618 -248
- package/src/schemas/output_schemas/step_v3.schema.json +275 -107
- package/src/schemas/output_schemas/test_v3.schema.json +594 -236
- package/src/schemas/output_schemas/type_v3.schema.json +6 -0
- package/src/schemas/output_schemas/wait_v3.schema.json +6 -2
- package/src/schemas/schemas.json +4474 -1994
- package/src/schemas/src_schemas/checkLink_v3.schema.json +25 -7
- package/src/schemas/src_schemas/click_v3.schema.json +13 -5
- package/src/schemas/src_schemas/config_v3.schema.json +67 -23
- package/src/schemas/src_schemas/context_v3.schema.json +46 -13
- package/src/schemas/src_schemas/find_v3.schema.json +17 -6
- package/src/schemas/src_schemas/goTo_v3.schema.json +17 -7
- package/src/schemas/src_schemas/httpRequest_v3.schema.json +71 -20
- package/src/schemas/src_schemas/loadVariables_v3.schema.json +4 -2
- package/src/schemas/src_schemas/openApi_v3.schema.json +26 -8
- package/src/schemas/src_schemas/record_v3.schema.json +20 -7
- package/src/schemas/src_schemas/report_v3.schema.json +9 -3
- package/src/schemas/src_schemas/resolvedTests_v3.schema.json +78 -25
- package/src/schemas/src_schemas/runCode_v3.schema.json +29 -9
- package/src/schemas/src_schemas/runShell_v3.schema.json +40 -14
- package/src/schemas/src_schemas/screenshot_v3.schema.json +45 -14
- package/src/schemas/src_schemas/spec_v3.schema.json +26 -8
- package/src/schemas/src_schemas/step_v3.schema.json +99 -37
- package/src/schemas/src_schemas/stopRecord_v3.schema.json +13 -12
- package/src/schemas/src_schemas/test_v3.schema.json +43 -11
- package/src/schemas/src_schemas/type_v3.schema.json +2 -0
- package/src/schemas/src_schemas/wait_v3.schema.json +34 -26
- package/.github/workflows/npm-publish.yml +0 -62
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Test (& Publish)
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
7
|
pull_request:
|
|
8
|
-
types:
|
|
8
|
+
types:
|
|
9
|
+
- opened
|
|
10
|
+
- reopened
|
|
11
|
+
- synchronize
|
|
12
|
+
release:
|
|
13
|
+
types:
|
|
14
|
+
- published
|
|
9
15
|
workflow_dispatch:
|
|
10
16
|
|
|
11
17
|
jobs:
|
|
@@ -13,7 +19,7 @@ jobs:
|
|
|
13
19
|
runs-on: ${{ matrix.os }}
|
|
14
20
|
strategy:
|
|
15
21
|
matrix:
|
|
16
|
-
os:
|
|
22
|
+
os:
|
|
17
23
|
- ubuntu-latest
|
|
18
24
|
- windows-latest
|
|
19
25
|
- macos-latest
|
|
@@ -21,11 +27,55 @@ jobs:
|
|
|
21
27
|
- 18
|
|
22
28
|
- 20
|
|
23
29
|
- 22
|
|
24
|
-
|
|
30
|
+
- 24
|
|
31
|
+
|
|
25
32
|
steps:
|
|
26
33
|
- uses: actions/checkout@v4
|
|
27
34
|
- uses: actions/setup-node@v4
|
|
28
35
|
with:
|
|
36
|
+
cache: 'npm'
|
|
37
|
+
cache-dependency-path: package-lock.json
|
|
29
38
|
node-version: ${{ matrix.node }}
|
|
30
39
|
- run: npm ci
|
|
31
|
-
- run: npm
|
|
40
|
+
- run: npm run build # Automatically run tests because of the `postbuild` script in package.json
|
|
41
|
+
|
|
42
|
+
publish-npm:
|
|
43
|
+
# if: github.event_name == 'release' && github.event.action == 'published'
|
|
44
|
+
name: Publish to NPM
|
|
45
|
+
needs: test
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: actions/setup-node@v4
|
|
50
|
+
with:
|
|
51
|
+
cache: 'npm'
|
|
52
|
+
cache-dependency-path: package-lock.json
|
|
53
|
+
registry-url: https://registry.npmjs.org/
|
|
54
|
+
- run: echo "NODE_AUTH_TOKEN is set"
|
|
55
|
+
env:
|
|
56
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
|
57
|
+
- run: npm whoami
|
|
58
|
+
env:
|
|
59
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
|
60
|
+
- run: npm ci
|
|
61
|
+
- run: npm run build
|
|
62
|
+
- run: npm publish
|
|
63
|
+
env:
|
|
64
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
|
65
|
+
|
|
66
|
+
update-docs:
|
|
67
|
+
name: Update documentation
|
|
68
|
+
needs: publish-npm
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
|
|
73
|
+
- name: Get package version
|
|
74
|
+
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
|
|
75
|
+
|
|
76
|
+
- name: Trigger GitHub Action in doc-detective.github.io
|
|
77
|
+
run: |
|
|
78
|
+
curl -XPOST -H "Authorization: token ${{ secrets.DOCS_PERSONAL_ACCESS_TOKEN }}" \
|
|
79
|
+
-H "Accept: application/vnd.github.everest-preview+json" \
|
|
80
|
+
"https://api.github.com/repos/doc-detective/doc-detective.github.io/dispatches" \
|
|
81
|
+
-d '{"event_type": "update-common-package-event", "client_payload": {"version": "${{ env.VERSION }}"} }'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective-common",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Shared components for Doc Detective projects.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"homepage": "https://github.com/doc-detective/doc-detective-common#readme",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"chai": "^5.2.0",
|
|
24
|
-
"mocha": "^11.
|
|
24
|
+
"mocha": "^11.5.0",
|
|
25
25
|
"sinon": "^20.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
@@ -67,30 +67,49 @@ async function dereferenceSchemas() {
|
|
|
67
67
|
for (const file of files) {
|
|
68
68
|
// console.log(`File: ${file}`)
|
|
69
69
|
const filePath = path.resolve(`${inputDir}/${file}`);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
const buildFilePath = path.resolve(`${buildDir}/${file}`);
|
|
71
|
+
try {
|
|
72
|
+
// Check if file exists
|
|
73
|
+
if (!fs.existsSync(filePath)) {
|
|
74
|
+
throw new Error(`File not found: ${filePath}`);
|
|
75
|
+
}
|
|
76
|
+
// Load schema
|
|
77
|
+
let schema = fs.readFileSync(filePath).toString();
|
|
78
|
+
schema = JSON.parse(schema);
|
|
79
|
+
|
|
80
|
+
// Update references to current relative path
|
|
81
|
+
schema.$id = `${filePath}`;
|
|
82
|
+
schema = updateRefPaths(schema);
|
|
83
|
+
|
|
84
|
+
// Write to build directory
|
|
85
|
+
fs.writeFileSync(buildFilePath, JSON.stringify(schema, null, 2));
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error(`Error processing ${file}:`, err);
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
// Dereference schemas
|
|
82
91
|
for await (const file of files) {
|
|
83
92
|
const filePath = path.resolve(`${buildDir}/${file}`);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
const outputFilePath = path.resolve(`${outputDir}/${file}`);
|
|
94
|
+
try {
|
|
95
|
+
// Check if file exists
|
|
96
|
+
if (!fs.existsSync(filePath))
|
|
97
|
+
throw new Error(`File not found: ${filePath}`);
|
|
98
|
+
|
|
99
|
+
// Load schema
|
|
100
|
+
let schema = fs.readFileSync(filePath).toString();
|
|
101
|
+
schema = JSON.parse(schema);
|
|
102
|
+
|
|
103
|
+
// Dereference schema
|
|
104
|
+
schema = await parser.dereference(schema);
|
|
105
|
+
// Delete $id attributes
|
|
106
|
+
schema = deleteDollarIds(schema);
|
|
107
|
+
|
|
108
|
+
// Write to file
|
|
109
|
+
fs.writeFileSync(outputFilePath, JSON.stringify(schema, null, 2));
|
|
110
|
+
} catch (err) {
|
|
111
|
+
console.error(`Error processing ${file}:`, err);
|
|
112
|
+
}
|
|
94
113
|
}
|
|
95
114
|
// Build final schemas.json file
|
|
96
115
|
const schemas = {};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"title": "checkLink",
|
|
4
4
|
"anyOf": [
|
|
5
5
|
{
|
|
6
|
+
"title": "Check link (detailed)",
|
|
6
7
|
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
7
8
|
"type": "string",
|
|
8
9
|
"pattern": "(^(http://|https://|\\/).*|\\$[A-Za-z0-9_]+$)",
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
]
|
|
12
13
|
},
|
|
13
14
|
{
|
|
15
|
+
"title": "Check link (detailed)",
|
|
14
16
|
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
15
17
|
"type": "object",
|
|
16
18
|
"additionalProperties": false,
|
|
@@ -64,6 +66,7 @@
|
|
|
64
66
|
"components": {
|
|
65
67
|
"schemas": {
|
|
66
68
|
"string": {
|
|
69
|
+
"title": "Check link (detailed)",
|
|
67
70
|
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
68
71
|
"type": "string",
|
|
69
72
|
"pattern": "(^(http://|https://|\\/).*|\\$[A-Za-z0-9_]+$)",
|
|
@@ -72,6 +75,7 @@
|
|
|
72
75
|
]
|
|
73
76
|
},
|
|
74
77
|
"object": {
|
|
78
|
+
"title": "Check link (detailed)",
|
|
75
79
|
"description": "Check if an HTTP or HTTPS URL returns an acceptable status code from a GET request.",
|
|
76
80
|
"type": "object",
|
|
77
81
|
"additionalProperties": false,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Click or tap an element.",
|
|
5
5
|
"anyOf": [
|
|
6
6
|
{
|
|
7
|
-
"title": "
|
|
7
|
+
"title": "Click element (simple)",
|
|
8
8
|
"type": "string",
|
|
9
9
|
"description": "Display text or selector of the element to find."
|
|
10
10
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"components": {
|
|
51
51
|
"schemas": {
|
|
52
52
|
"string": {
|
|
53
|
-
"title": "
|
|
53
|
+
"title": "Click element (simple)",
|
|
54
54
|
"type": "string",
|
|
55
55
|
"description": "Display text or selector of the element to find."
|
|
56
56
|
},
|