doc-detective 2.11.4-dev.1 → 2.11.4-dev.2

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 (38) hide show
  1. package/.doc-detective.json +63 -63
  2. package/.github/FUNDING.yml +14 -14
  3. package/.github/dependabot.yml +11 -11
  4. package/.github/workflows/docker-image.yml +19 -19
  5. package/.github/workflows/electron-publish.yml +17 -17
  6. package/.github/workflows/npm-publish.yml +67 -67
  7. package/.github/workflows/npm-test.yaml +49 -49
  8. package/CONTRIBUTIONS.md +27 -27
  9. package/LICENSE +20 -20
  10. package/README.md +126 -126
  11. package/dev/dev.spec.json +62 -62
  12. package/dev/index.js +5 -5
  13. package/doc-detective.svg +26 -0
  14. package/package.json +44 -43
  15. package/samples/.doc-detective.json +82 -90
  16. package/samples/{doc-content.md → doc-content-detect.md} +10 -8
  17. package/samples/doc-content-inline-tests.md +28 -28
  18. package/samples/docker-hello.spec.json +14 -0
  19. package/samples/http.spec.json +26 -0
  20. package/samples/kitten-search-inline.md +15 -0
  21. package/samples/kitten-search.spec.json +28 -0
  22. package/samples/tests.spec.json +70 -70
  23. package/samples/variables.env +4 -4
  24. package/src/index.js +85 -85
  25. package/src/utils.js +190 -188
  26. package/test/artifacts/cleanup.spec.json +18 -18
  27. package/test/artifacts/config.json +46 -46
  28. package/test/artifacts/doc-content.md +17 -17
  29. package/test/artifacts/env +2 -2
  30. package/test/artifacts/httpRequest.spec.json +55 -55
  31. package/test/artifacts/runShell.spec.json +29 -29
  32. package/test/artifacts/setup.spec.json +18 -18
  33. package/test/artifacts/test.spec.json +60 -60
  34. package/test/runCoverage.test.js +18 -18
  35. package/test/runTests.test.js +22 -22
  36. package/test/test-config.json +12 -12
  37. package/test/test-results.json +124 -124
  38. package/test/utils.test.js +206 -204
@@ -1,90 +1,82 @@
1
- {
2
- "envVariables": "./variables.env",
3
- "input": ".",
4
- "output": ".",
5
- "recursive": true,
6
- "logLevel": "info",
7
- "runTests": {
8
- "detectSteps": true,
9
- "input": "./doc-content.md",
10
- "output": ".",
11
- "setup": "",
12
- "cleanup": "",
13
- "recursive": true,
14
- "mediaDirectory": ".",
15
- "downloadDirectory": ".",
16
- "contexts": [
17
- {
18
- "app": {
19
- "name": "firefox",
20
- "options": {
21
- "width": 1200,
22
- "height": 800,
23
- "headless": false
24
- }
25
- },
26
- "platforms": ["linux", "mac", "windows"]
27
- }
28
- ]
29
- },
30
- "runCoverage": {
31
- "recursive": true,
32
- "input": ".",
33
- "output": ".",
34
- "markup": []
35
- },
36
- "suggestTests": {
37
- "recursive": true,
38
- "input": ".",
39
- "output": ".",
40
- "markup": []
41
- },
42
- "fileTypes": [
43
- {
44
- "name": "Markdown",
45
- "extensions": [".md"],
46
- "testStartStatementOpen": "[comment]: # (test start",
47
- "testStartStatementClose": ")",
48
- "testIgnoreStatement": "[comment]: # (test ignore)",
49
- "testEndStatement": "[comment]: # (test end)",
50
- "stepStatementOpen": "[comment]: # (step",
51
- "stepStatementClose": ")",
52
- "markup": [
53
- {
54
- "name": "Hyperlink",
55
- "regex": ["(?<=(?<!!)\\[[\\w\\s]+\\]\\().*?(?=\\))"],
56
- "actions": ["checkLink"]
57
- },
58
- {
59
- "name": "Navigation link",
60
- "regex": ["(?<=([Oo]pen|[Cc]lick) (?<!!)\\[[\\w\\s]+\\]\\().*?(?=\\))"],
61
- "actions": ["goTo"]
62
- },
63
- {
64
- "name": "Onscreen text",
65
- "regex": ["(?<=\\*\\*)[\\w\\s]+?(?=\\*\\*)"],
66
- "actions": ["find"]
67
- },
68
- {
69
- "name": "Image",
70
- "regex": ["(?<=\\!\\[.*?\\]\\().*?(?=\\))"],
71
- "actions": [
72
- {
73
- "name": "saveScreenshot",
74
- "params": {
75
- "directory": ".",
76
- "maxVariation": 5,
77
- "overwrite": "byVariation"
78
- }
79
- }
80
- ]
81
- }
82
- ]
83
- }
84
- ],
85
- "integrations": {},
86
- "telemetry": {
87
- "send": true,
88
- "userId": "Doc Detective Samples"
89
- }
90
- }
1
+ {
2
+ "envVariables": "./variables.env",
3
+ "defaultCommand": "runTests",
4
+ "input": ".",
5
+ "output": ".",
6
+ "recursive": true,
7
+ "logLevel": "info",
8
+ "runTests": {
9
+ "detectSteps": true,
10
+ "input": "./doc-content-inline-tests.md",
11
+ "output": ".",
12
+ "setup": "",
13
+ "cleanup": "",
14
+ "recursive": true,
15
+ "mediaDirectory": ".",
16
+ "downloadDirectory": ".",
17
+ "contexts": [
18
+ {
19
+ "app": {
20
+ "name": "chrome",
21
+ "options": {
22
+ "headless": false
23
+ }
24
+ },
25
+ "platforms": ["windows", "mac", "linux"]
26
+ }
27
+ ]
28
+ },
29
+ "runCoverage": {
30
+ "recursive": true,
31
+ "input": ".",
32
+ "output": ".",
33
+ "markup": []
34
+ },
35
+ "fileTypes": [
36
+ {
37
+ "name": "Markdown",
38
+ "extensions": [".md"],
39
+ "testStartStatementOpen": "[comment]: # (test start",
40
+ "testStartStatementClose": ")",
41
+ "testIgnoreStatement": "[comment]: # (test ignore)",
42
+ "testEndStatement": "[comment]: # (test end)",
43
+ "stepStatementOpen": "[comment]: # (step",
44
+ "stepStatementClose": ")",
45
+ "markup": [
46
+ {
47
+ "name": "Hyperlink",
48
+ "regex": ["(?<!!)\\[.+?\\]\\((.+?)\\)"],
49
+ "actions": ["checkLink"]
50
+ },
51
+ {
52
+ "name": "Navigation link",
53
+ "regex": [
54
+ "(?:[Cc]hose|[Oo]pen|[Cc]lick|[Nn]avigate to|[Gg]o to)\\s+(?<!!)\\[.+?\\]\\((.+?)\\)"
55
+ ],
56
+ "actions": ["goTo"]
57
+ },
58
+ {
59
+ "name": "Onscreen text",
60
+ "regex": ["\\*\\*(.+?)\\*\\*"],
61
+ "actions": ["find"]
62
+ },
63
+ {
64
+ "name": "Image",
65
+ "regex": ["!\\[.+?\\]\\((.+?)\\)"],
66
+ "actions": [
67
+ {
68
+ "action": "saveScreenshot",
69
+ "maxVariation": 5,
70
+ "overwrite": "byVariation"
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+ }
76
+ ],
77
+ "integrations": {},
78
+ "telemetry": {
79
+ "send": true,
80
+ "userId": "Doc Detective Samples"
81
+ }
82
+ }
@@ -1,9 +1,11 @@
1
- # Doc Detective documentation overview
2
-
3
- [Doc Detective documentation](https://doc-detective.com) is split into a few key sections:
4
-
5
- - The landing page discusses what Doc Detective is, what it does, and who might find it useful.
6
- - [Get started](https://doc-detective.com/get-started.html) covers how to quickly get up and running with Doc Detective.
7
- - The [references](https://doc-detective.com/reference/) detail the various JSON objects that Doc Detective expects for [configs](https://doc-detective.com/reference/schemas/config.html), [test specifications](https://doc-detective.com/reference/schemas/specification.html), [tests](https://doc-detective.com/reference/schemas/test), actions, and more. Open [typeKeys](https://doc-detective.com/reference/schemas/typeKeys.html)--or any other schema--and you'll find three sections: **Description**, **Fields**, and **Examples**.
8
-
1
+ # Doc Detective documentation overview
2
+
3
+ [Doc Detective documentation](https://doc-detective.com) is split into a few key sections:
4
+
5
+ - The landing page discusses what Doc Detective is, what it does, and who might find it useful.
6
+
7
+ - [Get started](https://doc-detective.com/get-started.html) covers how to quickly get up and running with Doc Detective.
8
+
9
+ - The [references](https://doc-detective.com/reference/) detail the various JSON objects that Doc Detective expects for [configs](https://doc-detective.com/reference/schemas/config.html), [test specifications](https://doc-detective.com/reference/schemas/specification.html), [tests](https://doc-detective.com/reference/schemas/test), actions, and more. Open [typeKeys](https://doc-detective.com/reference/schemas/typeKeys.html)--or any other schema--and you'll find three sections: **Description**, **Fields**, and **Examples**.
10
+
9
11
  ![Search results.](reference.png)
@@ -1,29 +1,29 @@
1
- # Doc Detective documentation overview
2
-
3
- [comment]: # (test start {"id":"search-kittens", "detectSteps":false})
4
-
5
- [Doc Detective documentation](http://doc-detective.com) is split into a few key sections:
6
-
7
- [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com"})
8
-
9
- The landing page discusses what Doc Detective is, what it does, and who might find it useful.
10
-
11
- - [Get started](https://doc-detective.com/get-started.html) covers how to quickly get up and running with Doc Detective.
12
-
13
- [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/get-started.html"})
14
-
15
- - The [references](https://doc-detective.com/reference/) detail the various JSON objects that Doc Detective expects for [configs](https://doc-detective.com/reference/schemas/config.html), [test specifications](https://doc-detective.com/reference/schemas/specification.html), [tests](https://doc-detective.com/reference/schemas/test), actions, and more. Open [typeKeys](https://doc-detective.com/reference/schemas/typeKeys.html)--or any other schema--and you'll find three sections: **Description**, **Fields**, and **Examples**.
16
-
17
- [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/"})
18
- [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/schemas/config.html"})
19
- [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/schemas/specification.html"})
20
- [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/schemas/test.html"})
21
- [comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/reference/schemas/typeKeys.html"})
22
- [comment]: # (step {"action":"find", "selector":"h2#description", "matchText":"Description"})
23
- [comment]: # (step {"action":"find", "selector":"h2#fields", "matchText":"Fields"})
24
- [comment]: # (step {"action":"find", "selector":"h2#examples", "matchText":"Examples"})
25
-
26
- ![Search results.](reference.png)
27
-
28
- [comment]: # (step {"action":"saveScreenshot", "path":"reference.png", "directory":"samples", "maxVariation":5, "overwrite":"byVariation"})
1
+ # Doc Detective documentation overview
2
+
3
+ [comment]: # (test start {"id":"doc-detective-docs", "detectSteps": false})
4
+
5
+ [Doc Detective documentation](http://doc-detective.com) is split into a few key sections:
6
+
7
+ [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com"})
8
+
9
+ - The landing page discusses what Doc Detective is, what it does, and who might find it useful.
10
+
11
+ - [Get started](https://doc-detective.com/get-started.html) covers how to quickly get up and running with Doc Detective.
12
+
13
+ [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/get-started.html"})
14
+
15
+ - The [references](https://doc-detective.com/reference/) detail the various JSON objects that Doc Detective expects for [configs](https://doc-detective.com/reference/schemas/config.html), [test specifications](https://doc-detective.com/reference/schemas/specification.html), [tests](https://doc-detective.com/reference/schemas/test), actions, and more. Open [typeKeys](https://doc-detective.com/reference/schemas/typeKeys.html)--or any other schema--and you'll find three sections: **Description**, **Fields**, and **Examples**.
16
+
17
+ [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/"})
18
+ [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/schemas/config.html"})
19
+ [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/schemas/specification.html"})
20
+ [comment]: # (step {"action":"checkLink", "url":"https://doc-detective.com/reference/schemas/test.html"})
21
+ [comment]: # (step {"action":"goTo", "url":"https://doc-detective.com/reference/schemas/typeKeys.html"})
22
+ [comment]: # (step {"action":"find", "selector":"h2#description", "matchText":"Description"})
23
+ [comment]: # (step {"action":"find", "selector":"h2#fields", "matchText":"Fields"})
24
+ [comment]: # (step {"action":"find", "selector":"h2#examples", "matchText":"Examples"})
25
+
26
+ ![Search results.](reference.png)
27
+
28
+ [comment]: # (step {"action":"saveScreenshot", "path":"reference.png", "maxVariation":5, "overwrite":"byVariation"})
29
29
  [comment]: # (test end)
@@ -0,0 +1,14 @@
1
+ {
2
+ "tests": [
3
+ {
4
+ "steps": [
5
+ {
6
+ "action": "runShell",
7
+ "description": "Run a Docker container and check the output.",
8
+ "command": "docker run hello-world",
9
+ "output": "Hello from Docker!"
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "tests": [
3
+ {
4
+ "steps": [
5
+ {
6
+ "action": "checkLink",
7
+ "url": "https://www.duckduckgo.com"
8
+ },
9
+ {
10
+ "action": "httpRequest",
11
+ "url": "https://reqres.in/api/users",
12
+ "method": "post",
13
+ "requestData": {
14
+ "name": "morpheus",
15
+ "job": "leader"
16
+ },
17
+ "responseData": {
18
+ "name": "morpheus",
19
+ "job": "leader"
20
+ },
21
+ "statusCodes": [200, 201]
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,15 @@
1
+ To search for American Shorthair kittens,
2
+
3
+ 1. Go to [DuckDuckGo](https://www.duckduckgo.com).
4
+
5
+ [comment]: # (step { "action": "goTo", "url": "https://www.duckduckgo.com"})
6
+ [comment]: # (step { "action": "startRecording", "path": "search-results.gif"})
7
+
8
+ 2. In the search bar, enter "American Shorthair kittens", then press Enter.
9
+
10
+ [comment]: # (step { "action": "find", "selector": "#searchbox_input", "click": true })
11
+ [comment]: # (step { "action": "typeKeys", "keys": ["American Shorthair kittens", "$ENTER$"] })
12
+ [comment]: # (step { "action": "find", "selector": "[data-testid='web-vertical']" })
13
+ [comment]: # (step { "action": "stopRecording" })
14
+
15
+ ![](search-results.gif)
@@ -0,0 +1,28 @@
1
+ {
2
+ "tests": [
3
+ {
4
+ "steps": [
5
+ {
6
+ "action": "goTo",
7
+ "url": "https://www.duckduckgo.com"
8
+ },
9
+ {
10
+ "action": "find",
11
+ "selector": "#searchbox_input",
12
+ "click": true,
13
+ "typeKeys": {
14
+ "keys": ["American Shorthair kittens", "$ENTER$"]
15
+ }
16
+ },
17
+ {
18
+ "action": "find",
19
+ "selector": "[data-testid='web-vertical']"
20
+ },
21
+ {
22
+ "action": "saveScreenshot",
23
+ "path": "search-results.png"
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -1,70 +1,70 @@
1
- {
2
- "id": "Do all the things! - Spec",
3
- "contexts": [
4
- {
5
- "app": {
6
- "name": "firefox"
7
- },
8
- "platforms": ["windows", "mac", "linux"]
9
- }
10
- ],
11
- "tests": [
12
- {
13
- "id": "Do all the things! - Test",
14
- "description": "This test includes nearly every property across all actions.",
15
- "steps": [
16
- {
17
- "action": "setVariables",
18
- "path": ".env"
19
- },
20
- {
21
- "action": "runShell",
22
- "command": "echo",
23
- "args": ["$USER"]
24
- },
25
- {
26
- "action": "checkLink",
27
- "url": "https://www.duckduckgo.com"
28
- },
29
- {
30
- "action": "httpRequest",
31
- "url": "https://reqres.in/api/users",
32
- "method": "post",
33
- "requestData": {
34
- "name": "morpheus",
35
- "job": "leader"
36
- },
37
- "responseData": {
38
- "name": "morpheus",
39
- "job": "leader"
40
- },
41
- "statusCodes": [200, 201]
42
- },
43
- {
44
- "action": "goTo",
45
- "url": "https://www.google.com"
46
- },
47
- {
48
- "action": "find",
49
- "selector": "[title=Search]",
50
- "timeout": 10000,
51
- "moveTo": true,
52
- "click": true,
53
- "typeKeys": {
54
- "keys": ["shorthair cat", "$ENTER$"]
55
- }
56
- },
57
- {
58
- "action": "wait"
59
- },
60
- {
61
- "action": "saveScreenshot",
62
- "path": "screenshot.png",
63
- "directory": "samples",
64
- "maxVariation": 5,
65
- "overwrite": "byVariation"
66
- }
67
- ]
68
- }
69
- ]
70
- }
1
+ {
2
+ "id": "Do all the things! - Spec",
3
+ "contexts": [
4
+ {
5
+ "app": {
6
+ "name": "firefox"
7
+ },
8
+ "platforms": ["windows", "mac", "linux"]
9
+ }
10
+ ],
11
+ "tests": [
12
+ {
13
+ "id": "Do all the things! - Test",
14
+ "description": "This test includes nearly every property across all actions.",
15
+ "steps": [
16
+ {
17
+ "action": "setVariables",
18
+ "path": ".env"
19
+ },
20
+ {
21
+ "action": "runShell",
22
+ "command": "echo",
23
+ "args": ["$USER"]
24
+ },
25
+ {
26
+ "action": "checkLink",
27
+ "url": "https://www.duckduckgo.com"
28
+ },
29
+ {
30
+ "action": "httpRequest",
31
+ "url": "https://reqres.in/api/users",
32
+ "method": "post",
33
+ "requestData": {
34
+ "name": "morpheus",
35
+ "job": "leader"
36
+ },
37
+ "responseData": {
38
+ "name": "morpheus",
39
+ "job": "leader"
40
+ },
41
+ "statusCodes": [200, 201]
42
+ },
43
+ {
44
+ "action": "goTo",
45
+ "url": "https://www.google.com"
46
+ },
47
+ {
48
+ "action": "find",
49
+ "selector": "[title=Search]",
50
+ "timeout": 10000,
51
+ "moveTo": true,
52
+ "click": true,
53
+ "typeKeys": {
54
+ "keys": ["shorthair cat", "$ENTER$"]
55
+ }
56
+ },
57
+ {
58
+ "action": "wait"
59
+ },
60
+ {
61
+ "action": "saveScreenshot",
62
+ "path": "screenshot.png",
63
+ "directory": "samples",
64
+ "maxVariation": 5,
65
+ "overwrite": "byVariation"
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ }
@@ -1,5 +1,5 @@
1
- USERNAME=foo
2
- PASSWORD=bar
3
- SHORTHAIR_CAT_SEARCH=american shorthair cats
4
- URL=www.google.com
1
+ USERNAME=foo
2
+ PASSWORD=bar
3
+ SHORTHAIR_CAT_SEARCH=american shorthair cats
4
+ URL=www.google.com
5
5
  TEXT=I'm Feeling Lucky