doc-detective 2.16.0-dev.0 → 2.16.0

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.
@@ -1,3 +1,3 @@
1
- USER="John Doe"
2
- JOB="Software Engineer"
1
+ USER="John Doe"
2
+ JOB="Software Engineer"
3
3
  SECRET="YOUR_SECRET_KEY"
@@ -1,55 +1,55 @@
1
- {
2
- "id": "http tests",
3
- "description": "This is a test collection",
4
- "tests": [
5
- {
6
- "id": "env variables test",
7
- "description": "These tests will show off how using env files to set variables works in Doc Detective.",
8
- "steps": [
9
- {
10
- "action": "setVariables",
11
- "path": "test/artifacts/env"
12
- },
13
- {
14
- "action": "httpRequest",
15
- "url": "https://reqres.in/api/users",
16
- "method": "post",
17
- "requestData": {
18
- "auth": "$SECRET",
19
- "name": "$USER",
20
- "job": "$JOB"
21
- },
22
- "responseData": {
23
- "name": "John Doe",
24
- "job": "Software Engineer"
25
- },
26
- "statusCodes": [200, 201]
27
- },
28
- {
29
- "action": "httpRequest",
30
- "url": "https://reqres.in/api/users",
31
- "method": "get",
32
- "envsFromResponseData": [
33
- {
34
- "name": "ID",
35
- "jqFilter": ".data[0].id"
36
- }
37
- ],
38
- "statusCodes": [200, 201]
39
- },
40
- {
41
- "action": "httpRequest",
42
- "url": "https://reqres.in/api/users/$ID",
43
- "method": "get",
44
- "responseData": {
45
- "data": {
46
- "first_name": "George",
47
- "last_name": "Bluth"
48
- }
49
- },
50
- "statusCodes": [200, 201]
51
- }
52
- ]
53
- }
54
- ]
55
- }
1
+ {
2
+ "id": "http tests",
3
+ "description": "This is a test collection",
4
+ "tests": [
5
+ {
6
+ "id": "env variables test",
7
+ "description": "These tests will show off how using env files to set variables works in Doc Detective.",
8
+ "steps": [
9
+ {
10
+ "action": "setVariables",
11
+ "path": "env"
12
+ },
13
+ {
14
+ "action": "httpRequest",
15
+ "url": "https://reqres.in/api/users",
16
+ "method": "post",
17
+ "requestData": {
18
+ "auth": "$SECRET",
19
+ "name": "$USER",
20
+ "job": "$JOB"
21
+ },
22
+ "responseData": {
23
+ "name": "John Doe",
24
+ "job": "Software Engineer"
25
+ },
26
+ "statusCodes": [200, 201]
27
+ },
28
+ {
29
+ "action": "httpRequest",
30
+ "url": "https://reqres.in/api/users",
31
+ "method": "get",
32
+ "envsFromResponseData": [
33
+ {
34
+ "name": "ID",
35
+ "jqFilter": ".data[0].id"
36
+ }
37
+ ],
38
+ "statusCodes": [200, 201]
39
+ },
40
+ {
41
+ "action": "httpRequest",
42
+ "url": "https://reqres.in/api/users/$ID",
43
+ "method": "get",
44
+ "responseData": {
45
+ "data": {
46
+ "first_name": "George",
47
+ "last_name": "Bluth"
48
+ }
49
+ },
50
+ "statusCodes": [200, 201]
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ }
@@ -1,29 +1,29 @@
1
- {
2
- "id": "setup",
3
- "tests": [
4
- {
5
- "steps": [
6
- {
7
- "action": "runShell",
8
- "command": "echo",
9
- "args": ["setup"],
10
- "exitCodes": [0],
11
- "output": "/.*?/",
12
- "setVariables": [
13
- {
14
- "name": "TEST",
15
- "regex": ".*"
16
- }
17
- ]
18
- },
19
- {
20
- "action": "runShell",
21
- "command": "echo",
22
- "args": ["$TEST"],
23
- "exitCodes": [0],
24
- "output": "setup"
25
- }
26
- ]
27
- }
28
- ]
29
- }
1
+ {
2
+ "id": "setup",
3
+ "tests": [
4
+ {
5
+ "steps": [
6
+ {
7
+ "action": "runShell",
8
+ "command": "echo",
9
+ "args": ["setup"],
10
+ "exitCodes": [0],
11
+ "output": "/.*?/",
12
+ "setVariables": [
13
+ {
14
+ "name": "TEST",
15
+ "regex": ".*"
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "action": "runShell",
21
+ "command": "echo",
22
+ "args": ["$TEST"],
23
+ "exitCodes": [0],
24
+ "output": "setup"
25
+ }
26
+ ]
27
+ }
28
+ ]
29
+ }
@@ -1,18 +1,18 @@
1
- {
2
- "id": "setup",
3
- "tests": [
4
- {
5
- "steps": [
6
- {
7
- "action": "setVariables",
8
- "path": ".env"
9
- },
10
- {
11
- "action": "runShell",
12
- "command": "echo",
13
- "args": ["setup"]
14
- }
15
- ]
16
- }
17
- ]
18
- }
1
+ {
2
+ "id": "setup",
3
+ "tests": [
4
+ {
5
+ "steps": [
6
+ {
7
+ "action": "setVariables",
8
+ "path": ".env"
9
+ },
10
+ {
11
+ "action": "runShell",
12
+ "command": "echo",
13
+ "args": ["setup"]
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
@@ -1,60 +1,60 @@
1
- {
2
- "id": "Do all the things! - Spec",
3
- "tests": [
4
- {
5
- "id": "Do all the things! - Test",
6
- "description": "This test includes nearly every property across all actions.",
7
- "setup": "setup.spec.json",
8
- "cleanup": "cleanup.spec.json",
9
- "steps": [
10
- {
11
- "action": "setVariables",
12
- "path": ".env"
13
- },
14
- {
15
- "action": "runShell",
16
- "command": "echo",
17
- "args": ["$USER"]
18
- },
19
- {
20
- "action": "checkLink",
21
- "url": "https://www.duckduckgo.com"
22
- },
23
- {
24
- "action": "httpRequest",
25
- "url": "https://reqres.in/api/users",
26
- "method": "post",
27
- "requestData": {
28
- "name": "morpheus",
29
- "job": "leader"
30
- },
31
- "responseData": {
32
- "name": "morpheus",
33
- "job": "leader"
34
- },
35
- "statusCodes": [200, 201]
36
- },
37
- {
38
- "action": "goTo",
39
- "url": "https://www.google.com"
40
- },
41
- {
42
- "action": "startRecording"
43
- },
44
- {
45
- "action": "find",
46
- "selector": "[title=Search]",
47
- "timeout": 10000,
48
- "moveTo": true,
49
- "click": true,
50
- "typeKeys": {
51
- "keys": ["shorthair cat", "$ENTER$"]
52
- }
53
- },
54
- {
55
- "action": "stopRecording"
56
- }
57
- ]
58
- }
59
- ]
60
- }
1
+ {
2
+ "id": "Do all the things! - Spec",
3
+ "tests": [
4
+ {
5
+ "id": "Do all the things! - Test",
6
+ "description": "This test includes nearly every property across all actions.",
7
+ "setup": "setup.spec.json",
8
+ "cleanup": "cleanup.spec.json",
9
+ "steps": [
10
+ {
11
+ "action": "setVariables",
12
+ "path": ".env"
13
+ },
14
+ {
15
+ "action": "runShell",
16
+ "command": "echo",
17
+ "args": ["$USER"]
18
+ },
19
+ {
20
+ "action": "checkLink",
21
+ "url": "https://www.duckduckgo.com"
22
+ },
23
+ {
24
+ "action": "httpRequest",
25
+ "url": "https://reqres.in/api/users",
26
+ "method": "post",
27
+ "requestData": {
28
+ "name": "morpheus",
29
+ "job": "leader"
30
+ },
31
+ "responseData": {
32
+ "name": "morpheus",
33
+ "job": "leader"
34
+ },
35
+ "statusCodes": [200, 201]
36
+ },
37
+ {
38
+ "action": "goTo",
39
+ "url": "https://www.google.com"
40
+ },
41
+ {
42
+ "action": "startRecording"
43
+ },
44
+ {
45
+ "action": "find",
46
+ "selector": "[title=Search]",
47
+ "timeout": 10000,
48
+ "moveTo": true,
49
+ "click": true,
50
+ "typeKeys": {
51
+ "keys": ["shorthair cat", "$ENTER$"]
52
+ }
53
+ },
54
+ {
55
+ "action": "stopRecording"
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+ }
@@ -1,24 +1,20 @@
1
- const path = require("path");
2
- const { spawnCommand } = require(path.resolve(__dirname,"../src/utils"));
3
- const assert = require("assert").strict;
4
- const fs = require("fs");
5
- const artifactPath = path.resolve(__dirname,"./artifacts");
6
-
7
- describe("Perform coverage analysis successfully", function () {
8
- // Set indefinite timeout
9
- this.timeout(0);
10
- it("Should have 6 covered and 0 uncovered", async () => {
11
- const coverateResults = await spawnCommand(`node ./src/index.js runCoverage -c ${artifactPath}/config.json -i ${artifactPath}/doc-content.md -o ${artifactPath}`);
12
- // Find output file
13
- // console.log(coverateResults.stdout)
14
- const outputFiles = coverateResults.stdout.split("See results at ");
15
- const outputFile = outputFiles[outputFiles.length - 1].trim();
16
- // If output file is not found, throw an error
17
- if (!outputFile) {
18
- throw new Error(`Output file not found.\nOutput file: ${outputFile}\nCWD: ${process.cwd()}\nstdout: ${coverateResults.stdout}`);
19
- }
20
- const result = require(outputFile);
21
- assert.equal(result.summary.covered, 6);
22
- assert.equal(result.summary.uncovered, 0);
23
- });
24
- });
1
+ const path = require("path");
2
+ const { spawnCommand } = require(path.resolve(__dirname, "../src/utils"));
3
+ const assert = require("assert").strict;
4
+ const fs = require("fs");
5
+ const artifactPath = path.resolve(__dirname, "./artifacts");
6
+ const outputFile = path.resolve(`${artifactPath}/coverageResults.json`);
7
+
8
+ describe("Perform coverage analysis successfully", function () {
9
+ // Set indefinite timeout
10
+ this.timeout(0);
11
+ it("Should have 6 covered and 0 uncovered", async () => {
12
+ await spawnCommand(
13
+ `node ./src/index.js runCoverage -c ${artifactPath}/config.json -i ${artifactPath}/doc-content.md -o ${outputFile}`
14
+ );
15
+ const result = require(outputFile);
16
+ fs.unlinkSync(outputFile);
17
+ assert.equal(result.summary.covered, 6);
18
+ assert.equal(result.summary.uncovered, 0);
19
+ });
20
+ });
@@ -1,29 +1,19 @@
1
- const path = require("path");
2
- const { spawnCommand } = require(path.resolve(__dirname,"../src/utils"));
3
- const assert = require("assert").strict;
4
- const fs = require("fs");
5
- const artifactPath = path.resolve(__dirname,"./artifacts");
6
-
7
- describe("Run tests sucessfully", function () {
8
- // Set indefinite timeout
9
- this.timeout(0);
10
- it("All specs pass", async () => {
11
- const runTests = await spawnCommand(
12
- `node ./src/index.js runTests -c ${artifactPath}/config.json -i ${artifactPath} -o ${artifactPath}`
13
- );
14
- // Find output file
15
- console.log(runTests.stdout)
16
- const outputFiles = runTests.stdout.split("See results at ");
17
- const outputFile = outputFiles[outputFiles.length - 1].trim();
18
- console.log(outputFile);
19
- console.log(fs.existsSync(outputFile));
20
- // If output file is not found, throw an error
21
- if (!outputFile) {
22
- throw new Error(`Output file not found.\nOutput file: ${outputFile}\nCWD: ${process.cwd()}\nstdout: ${runTests.stdout}`);
23
- }
24
- const result = JSON.parse(
25
- fs.readFileSync(outputFile, { encoding: "utf8" })
26
- );
27
- assert.equal(result.summary.specs.fail, 0);
28
- });
29
- });
1
+ const path = require("path");
2
+ const { spawnCommand } = require(path.resolve(__dirname, "../src/utils"));
3
+ const assert = require("assert").strict;
4
+ const fs = require("fs");
5
+ const artifactPath = path.resolve(__dirname, "./artifacts");
6
+ const outputFile = path.resolve(`${artifactPath}/testResults.json`);
7
+
8
+ describe("Run tests sucessfully", function () {
9
+ // Set indefinite timeout
10
+ this.timeout(0);
11
+ it("All specs pass", async () => {
12
+ await spawnCommand(
13
+ `node ./src/index.js runTests -c ${artifactPath}/config.json -i ${artifactPath} -o ${outputFile}`
14
+ );
15
+ const result = require(outputFile);
16
+ fs.unlinkSync(outputFile);
17
+ assert.equal(result.summary.specs.fail, 0);
18
+ });
19
+ });
@@ -1,13 +1,13 @@
1
- {
2
- "input": ".",
3
- "output": ".",
4
- "logLevel": "silent",
5
- "recursive": true,
6
- "runTests": {
7
- "setup": ".",
8
- "cleanup": "."
9
- },
10
- "telemetry": {
11
- "send": false
12
- }
1
+ {
2
+ "input": ".",
3
+ "output": ".",
4
+ "logLevel": "silent",
5
+ "recursive": true,
6
+ "runTests": {
7
+ "setup": ".",
8
+ "cleanup": "."
9
+ },
10
+ "telemetry": {
11
+ "send": false
12
+ }
13
13
  }