@alwaysmeticulous/cli 2.40.0 → 2.40.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.
- package/dist/api/test-run.api.d.ts +3 -31
- package/dist/api/test-run.api.js +3 -96
- package/dist/commands/download-replay/download-replay.command.js +4 -4
- package/dist/commands/download-session/download-session.command.js +4 -4
- package/dist/commands/record/record.command.js +8 -11
- package/dist/commands/replay/replay.command.d.ts +3 -14
- package/dist/commands/replay/replay.command.js +3 -233
- package/dist/commands/run-all-tests/run-all-tests.command.js +5 -5
- package/dist/commands/show-project/show-project.command.js +2 -3
- package/dist/index.d.ts +0 -7
- package/dist/index.js +1 -13
- package/dist/main.js +5 -11
- package/dist/utils/sentry.utils.d.ts +0 -4
- package/dist/utils/sentry.utils.js +3 -23
- package/package.json +14 -32
- package/dist/api/client.d.ts +0 -5
- package/dist/api/client.js +0 -32
- package/dist/api/download.d.ts +0 -1
- package/dist/api/download.js +0 -21
- package/dist/api/project.api.d.ts +0 -3
- package/dist/api/project.api.js +0 -22
- package/dist/api/replay-diff.api.d.ts +0 -13
- package/dist/api/replay-diff.api.js +0 -32
- package/dist/api/replay.api.d.ts +0 -36
- package/dist/api/replay.api.js +0 -89
- package/dist/api/session.api.d.ts +0 -6
- package/dist/api/session.api.js +0 -45
- package/dist/api/types.d.ts +0 -39
- package/dist/api/types.js +0 -2
- package/dist/api/upload.d.ts +0 -1
- package/dist/api/upload.js +0 -18
- package/dist/archive/archive.d.ts +0 -4
- package/dist/archive/archive.js +0 -64
- package/dist/command-utils/common-types.d.ts +0 -20
- package/dist/command-utils/common-types.js +0 -2
- package/dist/commands/bootstrap/bootstrap.command.d.ts +0 -2
- package/dist/commands/bootstrap/bootstrap.command.js +0 -33
- package/dist/commands/create-test/create-test.command.d.ts +0 -90
- package/dist/commands/create-test/create-test.command.js +0 -165
- package/dist/commands/replay/utils/compute-diff.d.ts +0 -13
- package/dist/commands/replay/utils/compute-diff.js +0 -95
- package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.d.ts +0 -1
- package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.js +0 -27
- package/dist/commands/screenshot-diff/screenshot-diff.command.d.ts +0 -53
- package/dist/commands/screenshot-diff/screenshot-diff.command.js +0 -182
- package/dist/commands/screenshot-diff/utils/__tests__/get-screenshot-identifier.spec.d.ts +0 -1
- package/dist/commands/screenshot-diff/utils/__tests__/get-screenshot-identifier.spec.js +0 -25
- package/dist/commands/screenshot-diff/utils/get-screenshot-filename.d.ts +0 -2
- package/dist/commands/screenshot-diff/utils/get-screenshot-filename.js +0 -22
- package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.d.ts +0 -2
- package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.js +0 -39
- package/dist/commands/screenshot-diff/utils/has-notable-differences.d.ts +0 -2
- package/dist/commands/screenshot-diff/utils/has-notable-differences.js +0 -10
- package/dist/commands/serve/serve.command.d.ts +0 -10
- package/dist/commands/serve/serve.command.js +0 -31
- package/dist/commands/update-tests/update-tests.command.d.ts +0 -21
- package/dist/commands/update-tests/update-tests.command.js +0 -96
- package/dist/config/config.d.ts +0 -3
- package/dist/config/config.js +0 -69
- package/dist/config/config.types.d.ts +0 -16
- package/dist/config/config.types.js +0 -2
- package/dist/config/snippets.d.ts +0 -1
- package/dist/config/snippets.js +0 -18
- package/dist/errors/config.d.ts +0 -3
- package/dist/errors/config.js +0 -10
- package/dist/image/diff.utils.d.ts +0 -19
- package/dist/image/diff.utils.js +0 -25
- package/dist/image/io.utils.d.ts +0 -3
- package/dist/image/io.utils.js +0 -25
- package/dist/local-data/local-data.utils.d.ts +0 -20
- package/dist/local-data/local-data.utils.js +0 -92
- package/dist/local-data/replay-assets.d.ts +0 -3
- package/dist/local-data/replay-assets.js +0 -94
- package/dist/local-data/replays.d.ts +0 -18
- package/dist/local-data/replays.js +0 -87
- package/dist/local-data/screenshot-diffs.d.ts +0 -7
- package/dist/local-data/screenshot-diffs.js +0 -20
- package/dist/local-data/serve-assets-from-simulation.d.ts +0 -5
- package/dist/local-data/serve-assets-from-simulation.js +0 -52
- package/dist/local-data/sessions.d.ts +0 -10
- package/dist/local-data/sessions.js +0 -41
- package/dist/parallel-tests/__tests__/merge-test-results.spec.d.ts +0 -1
- package/dist/parallel-tests/__tests__/merge-test-results.spec.js +0 -104
- package/dist/parallel-tests/__tests__/mock-test-results.d.ts +0 -17
- package/dist/parallel-tests/__tests__/mock-test-results.js +0 -106
- package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.d.ts +0 -1
- package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.js +0 -205
- package/dist/parallel-tests/execute-test-in-child-process.d.ts +0 -3
- package/dist/parallel-tests/execute-test-in-child-process.js +0 -44
- package/dist/parallel-tests/merge-test-results.d.ts +0 -12
- package/dist/parallel-tests/merge-test-results.js +0 -106
- package/dist/parallel-tests/messages.types.d.ts +0 -17
- package/dist/parallel-tests/messages.types.js +0 -2
- package/dist/parallel-tests/parallel-replay.handler.d.ts +0 -3
- package/dist/parallel-tests/parallel-replay.handler.js +0 -56
- package/dist/parallel-tests/parallel-replay.types.d.ts +0 -16
- package/dist/parallel-tests/parallel-replay.types.js +0 -2
- package/dist/parallel-tests/parallel-tests.handler.d.ts +0 -14
- package/dist/parallel-tests/parallel-tests.handler.js +0 -194
- package/dist/parallel-tests/run-all-tests.d.ts +0 -73
- package/dist/parallel-tests/run-all-tests.js +0 -237
- package/dist/parallel-tests/run-all-tests.types.d.ts +0 -6
- package/dist/parallel-tests/run-all-tests.types.js +0 -2
- package/dist/parallel-tests/screenshot-diff-results.utils.d.ts +0 -7
- package/dist/parallel-tests/screenshot-diff-results.utils.js +0 -20
- package/dist/parallel-tests/task.handler.d.ts +0 -1
- package/dist/parallel-tests/task.handler.js +0 -86
- package/dist/utils/api-token.utils.d.ts +0 -1
- package/dist/utils/api-token.utils.js +0 -31
- package/dist/utils/commit-sha.utils.d.ts +0 -1
- package/dist/utils/commit-sha.utils.js +0 -42
- package/dist/utils/config.utils.d.ts +0 -7
- package/dist/utils/config.utils.js +0 -33
- package/dist/utils/github-summary.utils.d.ts +0 -5
- package/dist/utils/github-summary.utils.js +0 -38
- package/dist/utils/run-all-tests.utils.d.ts +0 -16
- package/dist/utils/run-all-tests.utils.js +0 -32
- package/dist/utils/test-run-environment.utils.d.ts +0 -2
- package/dist/utils/test-run-environment.utils.js +0 -25
- package/dist/utils/version.utils.d.ts +0 -1
- package/dist/utils/version.utils.js +0 -17
package/dist/main.js
CHANGED
|
@@ -4,19 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.main = void 0;
|
|
7
|
+
const path_1 = require("path");
|
|
7
8
|
const common_1 = require("@alwaysmeticulous/common");
|
|
9
|
+
const sentry_1 = require("@alwaysmeticulous/sentry");
|
|
8
10
|
const yargs_1 = __importDefault(require("yargs"));
|
|
9
|
-
const bootstrap_command_1 = require("./commands/bootstrap/bootstrap.command");
|
|
10
|
-
const create_test_command_1 = require("./commands/create-test/create-test.command");
|
|
11
11
|
const download_replay_command_1 = require("./commands/download-replay/download-replay.command");
|
|
12
12
|
const download_session_command_1 = require("./commands/download-session/download-session.command");
|
|
13
13
|
const record_command_1 = require("./commands/record/record.command");
|
|
14
14
|
const replay_command_1 = require("./commands/replay/replay.command");
|
|
15
15
|
const run_all_tests_command_1 = require("./commands/run-all-tests/run-all-tests.command");
|
|
16
|
-
const screenshot_diff_command_1 = require("./commands/screenshot-diff/screenshot-diff.command");
|
|
17
|
-
const serve_command_1 = require("./commands/serve/serve.command");
|
|
18
16
|
const show_project_command_1 = require("./commands/show-project/show-project.command");
|
|
19
|
-
const update_tests_command_1 = require("./commands/update-tests/update-tests.command");
|
|
20
17
|
const logger_utils_1 = require("./utils/logger.utils");
|
|
21
18
|
const sentry_utils_1 = require("./utils/sentry.utils");
|
|
22
19
|
const handleDataDir = (dataDir) => {
|
|
@@ -24,23 +21,20 @@ const handleDataDir = (dataDir) => {
|
|
|
24
21
|
};
|
|
25
22
|
const main = async () => {
|
|
26
23
|
(0, logger_utils_1.initLogger)();
|
|
27
|
-
|
|
24
|
+
const packageJsonPath = (0, path_1.normalize)((0, path_1.join)(__dirname, "../package.json"));
|
|
25
|
+
const meticulousVersion = await (0, common_1.getMeticulousVersion)(packageJsonPath);
|
|
26
|
+
await (0, sentry_1.initSentry)(meticulousVersion);
|
|
28
27
|
yargs_1.default
|
|
29
28
|
.scriptName("meticulous")
|
|
30
29
|
.usage(`$0 <command>
|
|
31
30
|
|
|
32
31
|
Meticulous CLI`)
|
|
33
|
-
.command(bootstrap_command_1.bootstrapCommand)
|
|
34
|
-
.command(create_test_command_1.createTestCommand)
|
|
35
32
|
.command(download_replay_command_1.downloadReplayCommand)
|
|
36
33
|
.command(download_session_command_1.downloadSessionCommand)
|
|
37
34
|
.command(record_command_1.recordCommand)
|
|
38
35
|
.command(replay_command_1.replayCommand)
|
|
39
36
|
.command(run_all_tests_command_1.runAllTestsCommand)
|
|
40
|
-
.command(screenshot_diff_command_1.screenshotDiffCommand)
|
|
41
37
|
.command(show_project_command_1.showProjectCommand)
|
|
42
|
-
.command(update_tests_command_1.updateTestsCommand)
|
|
43
|
-
.command("serve", false, serve_command_1.serveCommand) // This is a debugging command, so we hide it to not pollute the main menu
|
|
44
38
|
.help()
|
|
45
39
|
.strict()
|
|
46
40
|
.demandCommand()
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
import { Duration } from "luxon";
|
|
3
|
-
export declare const SENTRY_FLUSH_TIMEOUT: Duration;
|
|
4
|
-
export declare const initSentry: (tracesSampleRateOverride?: number) => Promise<Sentry.Hub>;
|
|
5
1
|
export declare const setOptions: (options: any) => void;
|
|
6
2
|
export declare const wrapHandler: <T>(handler: (args: T) => Promise<void>) => (args: T) => Promise<void>;
|
|
@@ -26,31 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.wrapHandler = exports.setOptions =
|
|
29
|
+
exports.wrapHandler = exports.setOptions = void 0;
|
|
30
30
|
const common_1 = require("@alwaysmeticulous/common");
|
|
31
|
+
const sentry_1 = require("@alwaysmeticulous/sentry");
|
|
31
32
|
const Sentry = __importStar(require("@sentry/node"));
|
|
32
|
-
const tracing_1 = require("@sentry/tracing");
|
|
33
33
|
const loglevel_1 = __importDefault(require("loglevel"));
|
|
34
|
-
const luxon_1 = require("luxon");
|
|
35
|
-
const version_utils_1 = require("./version.utils");
|
|
36
|
-
const SENTRY_DSN = "https://10c6a6c9f5434786b37fb81b01323798@o914390.ingest.sentry.io/6435232";
|
|
37
|
-
exports.SENTRY_FLUSH_TIMEOUT = luxon_1.Duration.fromObject({ seconds: 1 });
|
|
38
|
-
const getTracesSampleRate = () => {
|
|
39
|
-
var _a;
|
|
40
|
-
return parseFloat((_a = process.env["METICULOUS_TELEMETRY_SAMPLE_RATE"]) !== null && _a !== void 0 ? _a : "1.0");
|
|
41
|
-
};
|
|
42
|
-
const initSentry = async (tracesSampleRateOverride) => {
|
|
43
|
-
const meticulousVersion = await (0, version_utils_1.getMeticulousVersion)();
|
|
44
|
-
Sentry.init({
|
|
45
|
-
dsn: SENTRY_DSN,
|
|
46
|
-
release: meticulousVersion,
|
|
47
|
-
tracesSampleRate: tracesSampleRateOverride !== null && tracesSampleRateOverride !== void 0 ? tracesSampleRateOverride : getTracesSampleRate(),
|
|
48
|
-
environment: __filename.endsWith(".ts") ? "development" : "production",
|
|
49
|
-
});
|
|
50
|
-
(0, tracing_1.addExtensionMethods)();
|
|
51
|
-
return Sentry.getCurrentHub();
|
|
52
|
-
};
|
|
53
|
-
exports.initSentry = initSentry;
|
|
54
34
|
const setOptions = (options) => {
|
|
55
35
|
Sentry.setContext("invoke-options", options);
|
|
56
36
|
};
|
|
@@ -87,5 +67,5 @@ const reportHandlerError = async (error) => {
|
|
|
87
67
|
logger.info("");
|
|
88
68
|
logger.info("Tip: run `meticulous <command> --help` for help on a particular command, or `meticulous --help` for a list of the available commands.");
|
|
89
69
|
Sentry.captureException(error);
|
|
90
|
-
await Sentry.flush(
|
|
70
|
+
await Sentry.flush(sentry_1.SENTRY_FLUSH_TIMEOUT.toMillis());
|
|
91
71
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwaysmeticulous/cli",
|
|
3
|
-
"version": "2.40.
|
|
3
|
+
"version": "2.40.4",
|
|
4
4
|
"description": "The Meticulous CLI",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,43 +23,25 @@
|
|
|
23
23
|
"cli": "node dist/main.js",
|
|
24
24
|
"cli:dev": "ts-node src/main.ts",
|
|
25
25
|
"cli:dev-localhost": "METICULOUS_API_URL=http://localhost:3001/api/ ts-node src/main.ts",
|
|
26
|
-
"test": "jest"
|
|
26
|
+
"test": "jest --passWithNoTests",
|
|
27
|
+
"depcheck": "depcheck --ignore-patterns=dist"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@alwaysmeticulous/
|
|
30
|
+
"@alwaysmeticulous/api": "^2.40.4",
|
|
31
|
+
"@alwaysmeticulous/client": "^2.40.4",
|
|
32
|
+
"@alwaysmeticulous/common": "^2.40.4",
|
|
33
|
+
"@alwaysmeticulous/downloading-helpers": "^2.40.4",
|
|
34
|
+
"@alwaysmeticulous/record": "^2.40.4",
|
|
35
|
+
"@alwaysmeticulous/replay-orchestrator": "^2.40.4",
|
|
36
|
+
"@alwaysmeticulous/sdk-bundles-api": "^2.40.4",
|
|
37
|
+
"@alwaysmeticulous/sentry": "^2.40.0",
|
|
30
38
|
"@sentry/node": "^7.36.0",
|
|
31
|
-
"@sentry/tracing": "^7.36.0",
|
|
32
|
-
"adm-zip": "^0.5.9",
|
|
33
|
-
"archiver": "^5.3.1",
|
|
34
39
|
"axios": "^1.2.6",
|
|
35
|
-
"
|
|
36
|
-
"cosmiconfig": "^8.0.0",
|
|
37
|
-
"express": "^4.18.1",
|
|
38
|
-
"fast-json-stable-stringify": "^2.1.0",
|
|
39
|
-
"find-free-port": "^2.0.0",
|
|
40
|
-
"inquirer": "^8.2.4",
|
|
41
|
-
"luxon": "^3.2.1",
|
|
42
|
-
"pixelmatch": "^5.3.0",
|
|
43
|
-
"pngjs": "^7.0.0",
|
|
44
|
-
"proper-lockfile": "^4.1.2",
|
|
40
|
+
"loglevel": "^1.8.0",
|
|
45
41
|
"yargs": "^17.5.1"
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@types/express": "^4.17.14",
|
|
50
|
-
"@types/proper-lockfile": "^4.1.2"
|
|
51
|
-
},
|
|
52
|
-
"peerDependencies": {
|
|
53
|
-
"@alwaysmeticulous/record": "^2.3.3",
|
|
54
|
-
"@alwaysmeticulous/replayer": "^2.5.1"
|
|
55
|
-
},
|
|
56
|
-
"peerDependenciesMeta": {
|
|
57
|
-
"@alwaysmeticulous/record": {
|
|
58
|
-
"optional": true
|
|
59
|
-
},
|
|
60
|
-
"@alwaysmeticulous/replayer": {
|
|
61
|
-
"optional": true
|
|
62
|
-
}
|
|
44
|
+
"@types/yargs": "^17.0.10"
|
|
63
45
|
},
|
|
64
46
|
"author": {
|
|
65
47
|
"name": "The Meticulous Team",
|
|
@@ -95,5 +77,5 @@
|
|
|
95
77
|
"coverageDirectory": "../coverage",
|
|
96
78
|
"testEnvironment": "node"
|
|
97
79
|
},
|
|
98
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "11acce96c03e23cbb556779a121710a8136d24db"
|
|
99
81
|
}
|
package/dist/api/client.d.ts
DELETED
package/dist/api/client.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createClient = void 0;
|
|
7
|
-
const common_1 = require("@alwaysmeticulous/common");
|
|
8
|
-
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
const loglevel_1 = __importDefault(require("loglevel"));
|
|
10
|
-
const api_token_utils_1 = require("../utils/api-token.utils");
|
|
11
|
-
const BASE_API_URL = "https://app.meticulous.ai/api/";
|
|
12
|
-
const createClient = ({ apiToken: apiToken_, }) => {
|
|
13
|
-
const apiToken = (0, api_token_utils_1.getApiToken)(apiToken_);
|
|
14
|
-
if (!apiToken) {
|
|
15
|
-
const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
|
|
16
|
-
logger.error("You must provide an API token by using the --apiToken parameter");
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
return axios_1.default.create({
|
|
20
|
-
baseURL: getApiUrl(),
|
|
21
|
-
headers: {
|
|
22
|
-
authorization: apiToken,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
exports.createClient = createClient;
|
|
27
|
-
const getApiUrl = () => {
|
|
28
|
-
if (process.env["METICULOUS_API_URL"]) {
|
|
29
|
-
return process.env["METICULOUS_API_URL"];
|
|
30
|
-
}
|
|
31
|
-
return BASE_API_URL;
|
|
32
|
-
};
|
package/dist/api/download.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const downloadFile: (fileUrl: string, path: string) => Promise<void>;
|
package/dist/api/download.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.downloadFile = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const stream_1 = require("stream");
|
|
9
|
-
const util_1 = require("util");
|
|
10
|
-
const axios_1 = __importDefault(require("axios"));
|
|
11
|
-
const promisifiedFinished = (0, util_1.promisify)(stream_1.finished);
|
|
12
|
-
const downloadFile = async (fileUrl, path) => {
|
|
13
|
-
const writer = (0, fs_1.createWriteStream)(path);
|
|
14
|
-
return axios_1.default
|
|
15
|
-
.request({ method: "GET", url: fileUrl, responseType: "stream" })
|
|
16
|
-
.then(async (response) => {
|
|
17
|
-
response.data.pipe(writer);
|
|
18
|
-
return promisifiedFinished(writer);
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.downloadFile = downloadFile;
|
package/dist/api/project.api.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getProject = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const getProject = async (client) => {
|
|
9
|
-
const { data } = await client
|
|
10
|
-
.get("projects/token-info")
|
|
11
|
-
.catch((error) => {
|
|
12
|
-
var _a;
|
|
13
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
14
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
15
|
-
return { data: null };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
throw error;
|
|
19
|
-
});
|
|
20
|
-
return data;
|
|
21
|
-
};
|
|
22
|
-
exports.getProject = getProject;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReplayDiff, ReplayDiffData } from "@alwaysmeticulous/api";
|
|
2
|
-
import { AxiosInstance } from "axios";
|
|
3
|
-
export declare const getReplayDiff: ({ client, replayDiffId, }: {
|
|
4
|
-
client: AxiosInstance;
|
|
5
|
-
replayDiffId: string;
|
|
6
|
-
}) => Promise<ReplayDiff | null>;
|
|
7
|
-
export declare const createReplayDiff: ({ client, headReplayId, baseReplayId, testRunId, data: replayDiffData, }: {
|
|
8
|
-
client: AxiosInstance;
|
|
9
|
-
headReplayId: string;
|
|
10
|
-
baseReplayId: string;
|
|
11
|
-
testRunId: string | null;
|
|
12
|
-
data: ReplayDiffData;
|
|
13
|
-
}) => Promise<ReplayDiff>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createReplayDiff = exports.getReplayDiff = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const getReplayDiff = async ({ client, replayDiffId, }) => {
|
|
9
|
-
const { data } = await client
|
|
10
|
-
.get(`replay-diffs/${replayDiffId}`)
|
|
11
|
-
.catch((error) => {
|
|
12
|
-
var _a;
|
|
13
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
14
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
15
|
-
return { data: null };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
throw error;
|
|
19
|
-
});
|
|
20
|
-
return data;
|
|
21
|
-
};
|
|
22
|
-
exports.getReplayDiff = getReplayDiff;
|
|
23
|
-
const createReplayDiff = async ({ client, headReplayId, baseReplayId, testRunId, data: replayDiffData, }) => {
|
|
24
|
-
const { data } = await client.post("replay-diffs", {
|
|
25
|
-
headReplayId,
|
|
26
|
-
baseReplayId,
|
|
27
|
-
...(testRunId ? { testRunId } : {}),
|
|
28
|
-
data: replayDiffData,
|
|
29
|
-
});
|
|
30
|
-
return data;
|
|
31
|
-
};
|
|
32
|
-
exports.createReplayDiff = createReplayDiff;
|
package/dist/api/replay.api.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Replay } from "@alwaysmeticulous/common";
|
|
2
|
-
import { AxiosInstance } from "axios";
|
|
3
|
-
export declare const getReplay: (client: AxiosInstance, replayId: string) => Promise<Replay>;
|
|
4
|
-
export declare const createReplay: (options: {
|
|
5
|
-
client: AxiosInstance;
|
|
6
|
-
commitSha: string;
|
|
7
|
-
sessionId: string;
|
|
8
|
-
meticulousSha: string;
|
|
9
|
-
version: "v1" | "v2";
|
|
10
|
-
metadata: {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
13
|
-
}) => Promise<Replay>;
|
|
14
|
-
export interface ReplayPushUrlOutput {
|
|
15
|
-
replayId: string;
|
|
16
|
-
pushUrl: string;
|
|
17
|
-
}
|
|
18
|
-
export declare const getReplayPushUrl: (client: AxiosInstance, replayId: string) => Promise<ReplayPushUrlOutput | null>;
|
|
19
|
-
export interface ReplayDownloadUrlOutput {
|
|
20
|
-
replayId: string;
|
|
21
|
-
dowloadUrl: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const getReplayDownloadUrl: (client: AxiosInstance, replayId: string) => Promise<ReplayDownloadUrlOutput | null>;
|
|
24
|
-
export declare const putReplayPushedStatus: (client: AxiosInstance, projectBuildId: string, status: "success" | "failure", replayCommandId: string) => Promise<any>;
|
|
25
|
-
export declare const getReplayCommandId: (client: AxiosInstance, sessionId: string) => Promise<string>;
|
|
26
|
-
export interface ScreenshotDiffStats {
|
|
27
|
-
baseReplayId: string;
|
|
28
|
-
headReplayId: string;
|
|
29
|
-
stats: {
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
mismatchPixels: number;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export declare const postScreenshotDiffStats: (client: AxiosInstance, options: ScreenshotDiffStats) => Promise<void>;
|
|
36
|
-
export declare const getReplayUrl: (replay: any) => string;
|
package/dist/api/replay.api.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getReplayUrl = exports.postScreenshotDiffStats = exports.getReplayCommandId = exports.putReplayPushedStatus = exports.getReplayDownloadUrl = exports.getReplayPushUrl = exports.createReplay = exports.getReplay = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const getReplay = async (client, replayId) => {
|
|
9
|
-
const { data } = await client.get(`replays/${replayId}`).catch((error) => {
|
|
10
|
-
var _a;
|
|
11
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
12
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
13
|
-
return { data: null };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
throw error;
|
|
17
|
-
});
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
exports.getReplay = getReplay;
|
|
21
|
-
const createReplay = async ({ client, commitSha, sessionId, meticulousSha, version, metadata, }) => {
|
|
22
|
-
const { data } = await client.post("replays", {
|
|
23
|
-
commitSha,
|
|
24
|
-
sessionId,
|
|
25
|
-
meticulousSha,
|
|
26
|
-
version,
|
|
27
|
-
metadata,
|
|
28
|
-
});
|
|
29
|
-
return data;
|
|
30
|
-
};
|
|
31
|
-
exports.createReplay = createReplay;
|
|
32
|
-
const getReplayPushUrl = async (client, replayId) => {
|
|
33
|
-
const { data } = await client
|
|
34
|
-
.get(`replays/${replayId}/push-url`)
|
|
35
|
-
.catch((error) => {
|
|
36
|
-
var _a;
|
|
37
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
38
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
39
|
-
return { data: null };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw error;
|
|
43
|
-
});
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
exports.getReplayPushUrl = getReplayPushUrl;
|
|
47
|
-
const getReplayDownloadUrl = async (client, replayId) => {
|
|
48
|
-
const { data } = await client
|
|
49
|
-
.get(`replays/${replayId}/archive-url`)
|
|
50
|
-
.catch((error) => {
|
|
51
|
-
var _a;
|
|
52
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
53
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
54
|
-
return { data: null };
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
throw error;
|
|
58
|
-
});
|
|
59
|
-
return data;
|
|
60
|
-
};
|
|
61
|
-
exports.getReplayDownloadUrl = getReplayDownloadUrl;
|
|
62
|
-
const putReplayPushedStatus = async (client, projectBuildId, status, replayCommandId) => {
|
|
63
|
-
const { data } = await client.put(`replays/${projectBuildId}/pushed`, {
|
|
64
|
-
status,
|
|
65
|
-
replayCommandId,
|
|
66
|
-
});
|
|
67
|
-
return data;
|
|
68
|
-
};
|
|
69
|
-
exports.putReplayPushedStatus = putReplayPushedStatus;
|
|
70
|
-
const getReplayCommandId = async (client, sessionId) => {
|
|
71
|
-
const { data } = await client.post("replays/start", { sessionId });
|
|
72
|
-
const { replayCommandId } = data;
|
|
73
|
-
return replayCommandId;
|
|
74
|
-
};
|
|
75
|
-
exports.getReplayCommandId = getReplayCommandId;
|
|
76
|
-
const postScreenshotDiffStats = async (client, { baseReplayId, headReplayId, stats }) => {
|
|
77
|
-
await client.post(`replays/${headReplayId}/screenshot-diff`, {
|
|
78
|
-
baseReplayId,
|
|
79
|
-
stats,
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
exports.postScreenshotDiffStats = postScreenshotDiffStats;
|
|
83
|
-
const getReplayUrl = (replay) => {
|
|
84
|
-
const organizationName = encodeURIComponent(replay.project.organization.name);
|
|
85
|
-
const projectName = encodeURIComponent(replay.project.name);
|
|
86
|
-
const replayUrl = `https://app.meticulous.ai/projects/${organizationName}/${projectName}/simulations/${replay.id}`;
|
|
87
|
-
return replayUrl;
|
|
88
|
-
};
|
|
89
|
-
exports.getReplayUrl = getReplayUrl;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SessionData } from "@alwaysmeticulous/api";
|
|
2
|
-
import { AxiosInstance } from "axios";
|
|
3
|
-
export declare const getRecordedSession: (client: AxiosInstance, sessionId: string) => Promise<any>;
|
|
4
|
-
export declare const getRecordedSessionData: (client: AxiosInstance, sessionId: string) => Promise<SessionData>;
|
|
5
|
-
export declare const getRecordingCommandId: (client: AxiosInstance) => Promise<string>;
|
|
6
|
-
export declare const postSessionIdNotification: (client: AxiosInstance, sessionId: string, recordingCommandId: string) => Promise<void>;
|
package/dist/api/session.api.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.postSessionIdNotification = exports.getRecordingCommandId = exports.getRecordedSessionData = exports.getRecordedSession = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const getRecordedSession = async (client, sessionId) => {
|
|
9
|
-
const { data } = await client.get(`sessions/${sessionId}`).catch((error) => {
|
|
10
|
-
var _a;
|
|
11
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
12
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
13
|
-
return { data: null };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
throw error;
|
|
17
|
-
});
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
exports.getRecordedSession = getRecordedSession;
|
|
21
|
-
const getRecordedSessionData = async (client, sessionId) => {
|
|
22
|
-
const { data } = await client
|
|
23
|
-
.get(`sessions/${sessionId}/data`)
|
|
24
|
-
.catch((error) => {
|
|
25
|
-
var _a;
|
|
26
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
27
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
28
|
-
return { data: null };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
throw error;
|
|
32
|
-
});
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
exports.getRecordedSessionData = getRecordedSessionData;
|
|
36
|
-
const getRecordingCommandId = async (client) => {
|
|
37
|
-
const { data } = await client.post("sessions/start");
|
|
38
|
-
const { recordingCommandId } = data;
|
|
39
|
-
return recordingCommandId;
|
|
40
|
-
};
|
|
41
|
-
exports.getRecordingCommandId = getRecordingCommandId;
|
|
42
|
-
const postSessionIdNotification = async (client, sessionId, recordingCommandId) => {
|
|
43
|
-
await client.post(`sessions/${sessionId}/notify`, { recordingCommandId });
|
|
44
|
-
};
|
|
45
|
-
exports.postSessionIdNotification = postSessionIdNotification;
|
package/dist/api/types.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ScreenshotIdentifier } from "@alwaysmeticulous/api";
|
|
2
|
-
import { TestCaseResult } from "../config/config.types";
|
|
3
|
-
interface Organization {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
createdAt: string;
|
|
7
|
-
updatedAt: string;
|
|
8
|
-
}
|
|
9
|
-
interface Project {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
recordingToken: string;
|
|
13
|
-
apiToken: string;
|
|
14
|
-
isGitHubIntegrationActive: boolean;
|
|
15
|
-
url: string;
|
|
16
|
-
organization: Organization;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
updatedAt: string;
|
|
19
|
-
}
|
|
20
|
-
export type TestRunStatus = "Running" | "Success" | "Failure";
|
|
21
|
-
export interface TestRun {
|
|
22
|
-
id: string;
|
|
23
|
-
status: TestRunStatus;
|
|
24
|
-
project: Project;
|
|
25
|
-
resultData?: {
|
|
26
|
-
results: TestCaseResult[];
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
};
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* All the information required to locate & download a screenshot of a replay.
|
|
33
|
-
*/
|
|
34
|
-
export interface ScreenshotLocator {
|
|
35
|
-
replayId: string;
|
|
36
|
-
screenshotIdentifier: ScreenshotIdentifier;
|
|
37
|
-
screenshotUrl: string;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
package/dist/api/types.js
DELETED
package/dist/api/upload.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const uploadArchive: (uploadUrl: string, archivePath: string) => Promise<void>;
|
package/dist/api/upload.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.uploadArchive = void 0;
|
|
7
|
-
const promises_1 = require("fs/promises");
|
|
8
|
-
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
const uploadArchive = async (uploadUrl, archivePath) => {
|
|
10
|
-
await axios_1.default.put(uploadUrl, await (0, promises_1.readFile)(archivePath), {
|
|
11
|
-
headers: {
|
|
12
|
-
"Content-Type": "application/zip",
|
|
13
|
-
},
|
|
14
|
-
maxBodyLength: Infinity,
|
|
15
|
-
maxContentLength: Infinity,
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
exports.uploadArchive = uploadArchive;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const checkDistFolder: (dist: string) => Promise<void>;
|
|
2
|
-
export declare const createArchive: (dist: string) => Promise<string>;
|
|
3
|
-
export declare const createReplayArchive: (dir: string) => Promise<string>;
|
|
4
|
-
export declare const deleteArchive: (archivePath: string) => Promise<void>;
|
package/dist/archive/archive.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.deleteArchive = exports.createReplayArchive = exports.createArchive = exports.checkDistFolder = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const promises_1 = require("fs/promises");
|
|
9
|
-
const os_1 = require("os");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const archiver_1 = __importDefault(require("archiver"));
|
|
12
|
-
const checkDistFolder = async (dist_) => {
|
|
13
|
-
const dist = (0, path_1.resolve)(process.cwd(), dist_);
|
|
14
|
-
const files = await (0, promises_1.readdir)(dist, { encoding: "utf-8", withFileTypes: true });
|
|
15
|
-
const indexHtml = files.find((entry) => entry.name.toLocaleLowerCase() === "index.html" && entry.isFile());
|
|
16
|
-
if (!indexHtml) {
|
|
17
|
-
throw new Error(`Cannot find "index.html" in ${dist}`);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.checkDistFolder = checkDistFolder;
|
|
21
|
-
const createArchive = async (dist_) => {
|
|
22
|
-
const tempDir = await (0, promises_1.mkdtemp)((0, path_1.join)((0, os_1.tmpdir)(), "meticulous-"));
|
|
23
|
-
const archivePath = (0, path_1.join)(tempDir, "build.zip");
|
|
24
|
-
const dist = (0, path_1.resolve)(process.cwd(), dist_);
|
|
25
|
-
const fileStream = (0, fs_1.createWriteStream)(archivePath);
|
|
26
|
-
const archive = (0, archiver_1.default)("zip");
|
|
27
|
-
await new Promise((resolve, reject) => {
|
|
28
|
-
archive.on("error", (err) => reject(err));
|
|
29
|
-
fileStream.on("close", () => {
|
|
30
|
-
resolve(null);
|
|
31
|
-
});
|
|
32
|
-
archive.pipe(fileStream);
|
|
33
|
-
archive.directory(dist, false);
|
|
34
|
-
archive.finalize().catch((error) => {
|
|
35
|
-
throw error;
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
return archivePath;
|
|
39
|
-
};
|
|
40
|
-
exports.createArchive = createArchive;
|
|
41
|
-
const createReplayArchive = async (dir) => {
|
|
42
|
-
const tempDir = await (0, promises_1.mkdtemp)((0, path_1.join)((0, os_1.tmpdir)(), "meticulous-"));
|
|
43
|
-
const archivePath = (0, path_1.join)(tempDir, "replay.zip");
|
|
44
|
-
const fileStream = (0, fs_1.createWriteStream)(archivePath);
|
|
45
|
-
const archive = (0, archiver_1.default)("zip");
|
|
46
|
-
await new Promise((resolve, reject) => {
|
|
47
|
-
archive.on("error", (err) => reject(err));
|
|
48
|
-
fileStream.on("close", () => {
|
|
49
|
-
resolve(null);
|
|
50
|
-
});
|
|
51
|
-
archive.pipe(fileStream);
|
|
52
|
-
archive.directory(dir, false);
|
|
53
|
-
archive.finalize().catch((error) => {
|
|
54
|
-
throw error;
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
return archivePath;
|
|
58
|
-
};
|
|
59
|
-
exports.createReplayArchive = createReplayArchive;
|
|
60
|
-
const deleteArchive = async (archivePath) => {
|
|
61
|
-
const dir = (0, path_1.dirname)(archivePath);
|
|
62
|
-
await (0, promises_1.rm)(dir, { force: true, recursive: true });
|
|
63
|
-
};
|
|
64
|
-
exports.deleteArchive = deleteArchive;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ScreenshottingEnabledOptions } from "@alwaysmeticulous/common";
|
|
2
|
-
/**
|
|
3
|
-
* Options for taking a screenshot and comparing it against a previous screenshot
|
|
4
|
-
*/
|
|
5
|
-
export type ScreenshotAssertionsOptions = {
|
|
6
|
-
enabled: false;
|
|
7
|
-
} | ScreenshotAssertionsEnabledOptions;
|
|
8
|
-
export interface ScreenshotAssertionsEnabledOptions extends ScreenshottingEnabledOptions {
|
|
9
|
-
diffOptions: ScreenshotDiffOptions;
|
|
10
|
-
}
|
|
11
|
-
export interface ScreenshotDiffOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Acceptable maximum proportion of changed pixels, between 0 and 1.
|
|
14
|
-
*/
|
|
15
|
-
diffThreshold: number;
|
|
16
|
-
/**
|
|
17
|
-
* A number between 0 and 1. Color/brightness differences in individual pixels will be ignored if the difference is less than this threshold. A value of 1.0 would accept any difference in color, while a value of 0.0 would accept no difference in color.
|
|
18
|
-
*/
|
|
19
|
-
diffPixelThreshold: number;
|
|
20
|
-
}
|