@alwaysmeticulous/cli 2.4.0 → 2.5.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.
Files changed (34) hide show
  1. package/dist/api/client.js +2 -2
  2. package/dist/api/download.js +1 -1
  3. package/dist/api/replay.api.d.ts +1 -1
  4. package/dist/api/upload.js +1 -1
  5. package/dist/archive/archive.js +2 -2
  6. package/dist/command-utils/common-options.d.ts +2 -2
  7. package/dist/command-utils/common-options.js +3 -3
  8. package/dist/commands/create-test/create-test.command.js +14 -13
  9. package/dist/commands/record/record.command.d.ts +9 -9
  10. package/dist/commands/record/record.command.js +2 -3
  11. package/dist/commands/replay/replay.command.d.ts +13 -10
  12. package/dist/commands/replay/replay.command.js +24 -13
  13. package/dist/commands/run-all-tests/run-all-tests.command.js +12 -12
  14. package/dist/commands/screenshot-diff/screenshot-diff.command.js +1 -1
  15. package/dist/commands/upload-build/upload-build.command.js +2 -2
  16. package/dist/config/config.js +2 -2
  17. package/dist/deflake-tests/deflake-tests.handler.d.ts +1 -1
  18. package/dist/deflake-tests/deflake-tests.handler.js +2 -1
  19. package/dist/local-data/replay-assets.js +2 -2
  20. package/dist/local-data/replays.js +8 -9
  21. package/dist/local-data/screenshot-diffs.js +1 -1
  22. package/dist/local-data/serve-assets-from-simulation.js +5 -4
  23. package/dist/local-data/sessions.js +2 -2
  24. package/dist/parallel-tests/parallel-tests.handler.d.ts +3 -3
  25. package/dist/parallel-tests/parallel-tests.handler.js +2 -2
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/utils/api-token.utils.d.ts +1 -1
  28. package/dist/utils/api-token.utils.js +3 -3
  29. package/dist/utils/commit-sha.utils.js +1 -1
  30. package/dist/utils/config.utils.d.ts +1 -1
  31. package/dist/utils/github-summary.utils.js +2 -2
  32. package/package.json +3 -3
  33. package/dist/command-utils/command-utils.d.ts +0 -9
  34. package/dist/command-utils/command-utils.js +0 -18
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createClient = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const api_token_utils_1 = require("../utils/api-token.utils");
9
7
  const common_1 = require("@alwaysmeticulous/common");
8
+ const axios_1 = __importDefault(require("axios"));
10
9
  const loglevel_1 = __importDefault(require("loglevel"));
10
+ const api_token_utils_1 = require("../utils/api-token.utils");
11
11
  const BASE_API_URL = "https://app.meticulous.ai/api/";
12
12
  const createClient = ({ apiToken: apiToken_, }) => {
13
13
  const apiToken = (0, api_token_utils_1.getApiToken)(apiToken_);
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.downloadFile = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
7
  const fs_1 = require("fs");
9
8
  const stream_1 = require("stream");
10
9
  const util_1 = require("util");
10
+ const axios_1 = __importDefault(require("axios"));
11
11
  const promisifiedFinished = (0, util_1.promisify)(stream_1.finished);
12
12
  const downloadFile = async (fileUrl, path) => {
13
13
  const writer = (0, fs_1.createWriteStream)(path);
@@ -1,5 +1,5 @@
1
- import { AxiosInstance } from "axios";
2
1
  import { Replay } from "@alwaysmeticulous/common";
2
+ import { AxiosInstance } from "axios";
3
3
  export declare const getReplay: (client: AxiosInstance, replayId: string) => Promise<any>;
4
4
  export declare const createReplay: (options: {
5
5
  client: AxiosInstance;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.uploadArchive = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
7
  const promises_1 = require("fs/promises");
8
+ const axios_1 = __importDefault(require("axios"));
9
9
  const uploadArchive = async (uploadUrl, archivePath) => {
10
10
  await axios_1.default.put(uploadUrl, await (0, promises_1.readFile)(archivePath), {
11
11
  headers: {
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.deleteArchive = exports.createReplayArchive = exports.createArchive = exports.checkDistFolder = void 0;
7
- const path_1 = require("path");
7
+ const fs_1 = require("fs");
8
8
  const promises_1 = require("fs/promises");
9
9
  const os_1 = require("os");
10
+ const path_1 = require("path");
10
11
  const archiver_1 = __importDefault(require("archiver"));
11
- const fs_1 = require("fs");
12
12
  const checkDistFolder = async (dist_) => {
13
13
  const dist = (0, path_1.resolve)(process.cwd(), dist_);
14
14
  const files = await (0, promises_1.readdir)(dist, { encoding: "utf-8", withFileTypes: true });
@@ -35,7 +35,7 @@ export declare const OPTIONS: {
35
35
  description: string;
36
36
  default: boolean;
37
37
  };
38
- accelerate: {
38
+ skipPauses: {
39
39
  boolean: boolean;
40
40
  description: string;
41
41
  default: boolean;
@@ -102,7 +102,7 @@ export declare const COMMON_REPLAY_OPTIONS: {
102
102
  description: string;
103
103
  default: boolean;
104
104
  };
105
- accelerate: {
105
+ skipPauses: {
106
106
  boolean: boolean;
107
107
  description: string;
108
108
  default: boolean;
@@ -35,7 +35,7 @@ exports.OPTIONS = {
35
35
  },
36
36
  padTime: {
37
37
  boolean: true,
38
- description: "Pad replay time according to recording duration. Please note this option will be ignored if running with the '--accelerate' option.",
38
+ description: "Pad replay time according to recording duration. Please note this option will be ignored if running with the '--skipPauses' option.",
39
39
  default: true,
40
40
  },
41
41
  shiftTime: {
@@ -48,7 +48,7 @@ exports.OPTIONS = {
48
48
  description: "Stub network requests during replay",
49
49
  default: true,
50
50
  },
51
- accelerate: {
51
+ skipPauses: {
52
52
  boolean: true,
53
53
  description: "Fast forward through any pauses to replay as fast as possible. Warning: this option is experimental and may be deprecated",
54
54
  default: false,
@@ -83,5 +83,5 @@ exports.COMMON_REPLAY_OPTIONS = {
83
83
  padTime: exports.OPTIONS.padTime,
84
84
  shiftTime: exports.OPTIONS.shiftTime,
85
85
  networkStubbing: exports.OPTIONS.networkStubbing,
86
- accelerate: exports.OPTIONS.accelerate,
86
+ skipPauses: exports.OPTIONS.skipPauses,
87
87
  };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createTest = void 0;
7
7
  const common_1 = require("@alwaysmeticulous/common");
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
- const inquirer_1 = __importDefault(require("inquirer"));
9
+ const inquirer_1 = require("inquirer");
10
10
  const loglevel_1 = __importDefault(require("loglevel"));
11
11
  const common_options_1 = require("../../command-utils/common-options");
12
12
  const config_utils_1 = require("../../utils/config.utils");
@@ -15,7 +15,7 @@ const record_command_1 = require("../record/record.command");
15
15
  const replay_command_1 = require("../replay/replay.command");
16
16
  const handleTestCreation = async (replay, sessionId) => {
17
17
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
18
- const validationResponse = await inquirer_1.default.prompt([
18
+ const validationResponse = await (0, inquirer_1.prompt)([
19
19
  {
20
20
  type: "confirm",
21
21
  name: "value",
@@ -26,7 +26,7 @@ const handleTestCreation = async (replay, sessionId) => {
26
26
  if (!validationResponse.value) {
27
27
  return;
28
28
  }
29
- const createTestResponse = await inquirer_1.default.prompt([
29
+ const createTestResponse = await (0, inquirer_1.prompt)([
30
30
  {
31
31
  type: "confirm",
32
32
  name: "value",
@@ -37,7 +37,7 @@ const handleTestCreation = async (replay, sessionId) => {
37
37
  if (!createTestResponse.value) {
38
38
  return;
39
39
  }
40
- const testNameResponse = await inquirer_1.default.prompt([
40
+ const testNameResponse = await (0, inquirer_1.prompt)([
41
41
  {
42
42
  type: "input",
43
43
  name: "name",
@@ -60,7 +60,7 @@ apiToken, commitSha, devTools, bypassCSP,
60
60
  // Record options
61
61
  width, height, uploadIntervalMs, incognito, trace,
62
62
  // Replay options
63
- headless, screenshotSelector, padTime, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, accelerate, }) => {
63
+ headless, screenshotSelector, padTime, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, skipPauses, }) => {
64
64
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
65
65
  logger.info("Creating a new Meticulous test");
66
66
  logger.info("Step 1: record a new test");
@@ -102,18 +102,19 @@ headless, screenshotSelector, padTime, shiftTime, networkStubbing, moveBeforeCli
102
102
  networkStubbing,
103
103
  moveBeforeClick,
104
104
  cookiesFile,
105
- accelerate,
105
+ skipPauses,
106
106
  save: false,
107
107
  // We replay against the original recorded URL
108
- appUrl: undefined,
109
- simulationIdForAssets: undefined,
108
+ appUrl: null,
109
+ simulationIdForAssets: null,
110
110
  // We don't try comparing to the original screenshot, so just set these to their defaults
111
- baseSimulationId: undefined,
111
+ baseSimulationId: null,
112
112
  diffThreshold: common_options_1.OPTIONS.diffThreshold.default,
113
113
  diffPixelThreshold: common_options_1.OPTIONS.diffPixelThreshold.default,
114
114
  // We don't expose these options
115
- maxDurationMs: undefined,
116
- maxEventCount: undefined,
115
+ maxDurationMs: null,
116
+ maxEventCount: null,
117
+ storyboard: false,
117
118
  };
118
119
  const replay = await (0, replay_command_1.rawReplayCommandHandler)(replayOptions);
119
120
  await handleTestCreation(replay, lastSessionId);
@@ -163,8 +164,8 @@ exports.createTest = {
163
164
  ...common_options_1.COMMON_REPLAY_OPTIONS.headless,
164
165
  default: true,
165
166
  },
166
- accelerate: {
167
- ...common_options_1.COMMON_REPLAY_OPTIONS.accelerate,
167
+ skipPauses: {
168
+ ...common_options_1.COMMON_REPLAY_OPTIONS.skipPauses,
168
169
  description: "Fast forward through any pauses to replay as fast as possible when replaying for the first time to create the test. Warning: this option is experimental and may be deprecated",
169
170
  },
170
171
  },
@@ -1,14 +1,14 @@
1
1
  import { CommandModule } from "yargs";
2
2
  export interface RecordCommandHandlerOptions {
3
- apiToken: string | undefined;
4
- commitSha: string | undefined;
5
- devTools: boolean | undefined;
6
- bypassCSP: boolean | undefined;
7
- width: number | undefined;
8
- height: number | undefined;
9
- uploadIntervalMs: number | undefined;
10
- incognito: boolean | undefined;
11
- trace: boolean | undefined;
3
+ apiToken: string | null | undefined;
4
+ commitSha: string | null | undefined;
5
+ devTools: boolean | null | undefined;
6
+ bypassCSP: boolean | null | undefined;
7
+ width: number | null | undefined;
8
+ height: number | null | undefined;
9
+ uploadIntervalMs: number | null | undefined;
10
+ incognito: boolean | null | undefined;
11
+ trace: boolean | null | undefined;
12
12
  onDetectedSession?: (sessionId: string) => void;
13
13
  }
14
14
  export declare const recordCommandHandler: (options: RecordCommandHandlerOptions) => Promise<void>;
@@ -4,13 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.record = exports.recordCommandHandler = void 0;
7
+ const path_1 = require("path");
7
8
  const common_1 = require("@alwaysmeticulous/common");
8
9
  const loglevel_1 = __importDefault(require("loglevel"));
9
- const path_1 = require("path");
10
10
  const client_1 = require("../../api/client");
11
11
  const project_api_1 = require("../../api/project.api");
12
12
  const session_api_1 = require("../../api/session.api");
13
- const command_utils_1 = require("../../command-utils/command-utils");
14
13
  const replay_assets_1 = require("../../local-data/replay-assets");
15
14
  const commit_sha_utils_1 = require("../../utils/commit-sha.utils");
16
15
  const sentry_utils_1 = require("../../utils/sentry.utils");
@@ -139,5 +138,5 @@ exports.record = {
139
138
  description: "Enable verbose logging",
140
139
  },
141
140
  },
142
- handler: (0, sentry_utils_1.wrapHandler)((0, command_utils_1.handleNulls)(exports.recordCommandHandler)),
141
+ handler: (0, sentry_utils_1.wrapHandler)(exports.recordCommandHandler),
143
142
  };
@@ -9,20 +9,23 @@ export interface ReplayOptions extends AdditionalReplayOptions {
9
9
  exitOnMismatch: boolean;
10
10
  }
11
11
  export declare const replayCommandHandler: ({ replayTarget, executionOptions, screenshottingOptions, apiToken, sessionId, commitSha: commitSha_, save, exitOnMismatch, baseSimulationId: baseReplayId_, cookiesFile, }: ReplayOptions) => Promise<Replay>;
12
- export interface RawReplayCommandHandlerOptions extends ScreenshotDiffOptions, ReplayExecutionOptions, AdditionalReplayOptions {
12
+ export interface RawReplayCommandHandlerOptions extends ScreenshotDiffOptions, Omit<ReplayExecutionOptions, "maxDurationMs" | "maxEventCount">, AdditionalReplayOptions {
13
13
  screenshot: boolean;
14
- appUrl: string | undefined;
15
- simulationIdForAssets: string | undefined;
16
- screenshotSelector: string | undefined;
14
+ appUrl: string | null | undefined;
15
+ simulationIdForAssets: string | null | undefined;
16
+ screenshotSelector: string | null | undefined;
17
+ maxDurationMs: number | null | undefined;
18
+ maxEventCount: number | null | undefined;
19
+ storyboard: boolean;
17
20
  }
18
21
  interface AdditionalReplayOptions {
19
- apiToken: string | undefined;
20
- commitSha: string | undefined;
22
+ apiToken: string | null | undefined;
23
+ commitSha: string | null | undefined;
21
24
  sessionId: string;
22
- save: boolean | undefined;
23
- baseSimulationId: string | undefined;
24
- cookiesFile: string | undefined;
25
+ save: boolean | null | undefined;
26
+ baseSimulationId: string | null | undefined;
27
+ cookiesFile: string | null | undefined;
25
28
  }
26
- export declare const rawReplayCommandHandler: ({ apiToken, commitSha, sessionId, appUrl, simulationIdForAssets, headless, devTools, bypassCSP, screenshot, screenshotSelector, baseSimulationId, diffThreshold, diffPixelThreshold, save, padTime, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, accelerate, maxDurationMs, maxEventCount, }: RawReplayCommandHandlerOptions) => Promise<Replay>;
29
+ export declare const rawReplayCommandHandler: ({ apiToken, commitSha, sessionId, appUrl, simulationIdForAssets, headless, devTools, bypassCSP, screenshot, screenshotSelector, baseSimulationId, diffThreshold, diffPixelThreshold, save, padTime, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, skipPauses, maxDurationMs, maxEventCount, storyboard, }: RawReplayCommandHandlerOptions) => Promise<Replay>;
27
30
  export declare const replay: CommandModule<unknown, RawReplayCommandHandlerOptions>;
28
31
  export {};
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.replay = exports.rawReplayCommandHandler = exports.replayCommandHandler = void 0;
7
- const common_1 = require("@alwaysmeticulous/common");
8
7
  const promises_1 = require("fs/promises");
8
+ const path_1 = require("path");
9
+ const common_1 = require("@alwaysmeticulous/common");
9
10
  const loglevel_1 = __importDefault(require("loglevel"));
10
11
  const luxon_1 = require("luxon");
11
- const path_1 = require("path");
12
12
  const client_1 = require("../../api/client");
13
13
  const replay_api_1 = require("../../api/replay.api");
14
14
  const upload_1 = require("../../api/upload");
@@ -24,7 +24,6 @@ const config_utils_1 = require("../../utils/config.utils");
24
24
  const sentry_utils_1 = require("../../utils/sentry.utils");
25
25
  const version_utils_1 = require("../../utils/version.utils");
26
26
  const screenshot_diff_command_1 = require("../screenshot-diff/screenshot-diff.command");
27
- const command_utils_1 = require("../../command-utils/command-utils");
28
27
  const replayCommandHandler = async ({ replayTarget, executionOptions, screenshottingOptions, apiToken, sessionId, commitSha: commitSha_, save, exitOnMismatch, baseSimulationId: baseReplayId_, cookiesFile, }) => {
29
28
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
30
29
  const client = (0, client_1.createClient)({ apiToken });
@@ -65,7 +64,7 @@ const replayCommandHandler = async ({ replayTarget, executionOptions, screenshot
65
64
  const tempDir = await (0, promises_1.mkdtemp)((0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "replays", tempDirName));
66
65
  // 6. Create and save replay parameters
67
66
  const replayEventsParams = {
68
- appUrl,
67
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
69
68
  replayExecutionOptions: executionOptions,
70
69
  browser: null,
71
70
  outputDir: tempDir,
@@ -100,7 +99,7 @@ const replayCommandHandler = async ({ replayTarget, executionOptions, screenshot
100
99
  },
101
100
  },
102
101
  screenshottingOptions,
103
- cookiesFile: cookiesFile,
102
+ cookiesFile: cookiesFile !== null && cookiesFile !== void 0 ? cookiesFile : null,
104
103
  };
105
104
  await (0, promises_1.writeFile)((0, path_1.join)(tempDir, "replayEventsParams.json"), JSON.stringify(replayEventsParams));
106
105
  // 7. Perform replay
@@ -196,7 +195,7 @@ const serveOrGetAppUrl = async (client, replayTarget) => {
196
195
  const unknownReplayTargetType = (replayTarget) => {
197
196
  throw new Error(`Unknown type of replay target: ${JSON.stringify(replayTarget)}`);
198
197
  };
199
- const rawReplayCommandHandler = ({ apiToken, commitSha, sessionId, appUrl, simulationIdForAssets, headless, devTools, bypassCSP, screenshot, screenshotSelector, baseSimulationId, diffThreshold, diffPixelThreshold, save, padTime, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, accelerate, maxDurationMs, maxEventCount, }) => {
198
+ const rawReplayCommandHandler = ({ apiToken, commitSha, sessionId, appUrl, simulationIdForAssets, headless, devTools, bypassCSP, screenshot, screenshotSelector, baseSimulationId, diffThreshold, diffPixelThreshold, save, padTime, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, skipPauses, maxDurationMs, maxEventCount, storyboard, }) => {
200
199
  const executionOptions = {
201
200
  headless,
202
201
  devTools,
@@ -204,20 +203,27 @@ const rawReplayCommandHandler = ({ apiToken, commitSha, sessionId, appUrl, simul
204
203
  padTime,
205
204
  shiftTime,
206
205
  networkStubbing,
207
- accelerate,
206
+ skipPauses,
208
207
  moveBeforeClick,
209
- maxDurationMs: maxDurationMs !== null && maxDurationMs !== void 0 ? maxDurationMs : undefined,
210
- maxEventCount: maxEventCount !== null && maxEventCount !== void 0 ? maxEventCount : undefined,
208
+ maxDurationMs: maxDurationMs !== null && maxDurationMs !== void 0 ? maxDurationMs : null,
209
+ maxEventCount: maxEventCount !== null && maxEventCount !== void 0 ? maxEventCount : null,
211
210
  };
211
+ const storyboardOptions = storyboard
212
+ ? { enabled: true }
213
+ : { enabled: false };
212
214
  const screenshottingOptions = screenshot
213
215
  ? {
214
216
  enabled: true,
215
- screenshotSelector: screenshotSelector !== null && screenshotSelector !== void 0 ? screenshotSelector : undefined,
217
+ screenshotSelector: screenshotSelector !== null && screenshotSelector !== void 0 ? screenshotSelector : null,
216
218
  diffOptions: { diffPixelThreshold, diffThreshold },
219
+ storyboardOptions,
217
220
  }
218
221
  : { enabled: false };
219
222
  return (0, exports.replayCommandHandler)({
220
- replayTarget: getReplayTarget({ appUrl, simulationIdForAssets }),
223
+ replayTarget: getReplayTarget({
224
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
225
+ simulationIdForAssets: simulationIdForAssets !== null && simulationIdForAssets !== void 0 ? simulationIdForAssets : null,
226
+ }),
221
227
  executionOptions,
222
228
  screenshottingOptions,
223
229
  apiToken,
@@ -296,8 +302,13 @@ exports.replay = {
296
302
  number: true,
297
303
  description: "Maximum number of events the simulation will run",
298
304
  },
305
+ storyboard: {
306
+ boolean: true,
307
+ description: "Take a storyboard of screenshots during simulation",
308
+ default: false,
309
+ },
299
310
  },
300
- handler: (0, sentry_utils_1.wrapHandler)((0, command_utils_1.handleNulls)(async (options) => {
311
+ handler: (0, sentry_utils_1.wrapHandler)(async (options) => {
301
312
  await (0, exports.rawReplayCommandHandler)(options);
302
- })),
313
+ }),
303
314
  };
@@ -18,8 +18,7 @@ const github_summary_utils_1 = require("../../utils/github-summary.utils");
18
18
  const run_all_tests_utils_1 = require("../../utils/run-all-tests.utils");
19
19
  const sentry_utils_1 = require("../../utils/sentry.utils");
20
20
  const version_utils_1 = require("../../utils/version.utils");
21
- const command_utils_1 = require("../../command-utils/command-utils");
22
- const handler = async ({ apiToken, commitSha: commitSha_, appUrl, useAssetsSnapshottedInBaseSimulation, headless, devTools, bypassCSP, diffThreshold, diffPixelThreshold, padTime, shiftTime, networkStubbing, githubSummary, parallelize, parallelTasks, deflake, useCache, testsFile, accelerate, }) => {
21
+ const handler = async ({ apiToken, commitSha: commitSha_, appUrl, useAssetsSnapshottedInBaseSimulation, headless, devTools, bypassCSP, diffThreshold, diffPixelThreshold, padTime, shiftTime, networkStubbing, githubSummary, parallelize, parallelTasks, deflake, useCache, testsFile, skipPauses, }) => {
23
22
  const executionOptions = {
24
23
  headless,
25
24
  devTools,
@@ -27,15 +26,16 @@ const handler = async ({ apiToken, commitSha: commitSha_, appUrl, useAssetsSnaps
27
26
  padTime,
28
27
  shiftTime,
29
28
  networkStubbing,
30
- accelerate,
29
+ skipPauses,
31
30
  moveBeforeClick: false,
32
- maxDurationMs: undefined,
33
- maxEventCount: undefined, // we don't expose this option
31
+ maxDurationMs: null,
32
+ maxEventCount: null, // we don't expose this option
34
33
  };
35
34
  const screenshottingOptions = {
36
35
  enabled: true,
37
- screenshotSelector: undefined,
36
+ screenshotSelector: null,
38
37
  diffOptions: { diffPixelThreshold, diffThreshold },
38
+ storyboardOptions: { enabled: false }, // we don't expose this option
39
39
  };
40
40
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
41
41
  const client = (0, client_1.createClient)({ apiToken });
@@ -68,11 +68,11 @@ const handler = async ({ apiToken, commitSha: commitSha_, appUrl, useAssetsSnaps
68
68
  testRun,
69
69
  executionOptions,
70
70
  screenshottingOptions,
71
- apiToken,
71
+ apiToken: apiToken !== null && apiToken !== void 0 ? apiToken : null,
72
72
  commitSha,
73
- appUrl,
73
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
74
74
  useAssetsSnapshottedInBaseSimulation,
75
- parallelTasks: parallelTasks !== null && parallelTasks !== void 0 ? parallelTasks : undefined,
75
+ parallelTasks: parallelTasks !== null && parallelTasks !== void 0 ? parallelTasks : null,
76
76
  deflake,
77
77
  cachedTestRunResults,
78
78
  });
@@ -84,13 +84,13 @@ const handler = async ({ apiToken, commitSha: commitSha_, appUrl, useAssetsSnaps
84
84
  const result = await (0, deflake_tests_handler_1.deflakeReplayCommandHandler)({
85
85
  replayTarget: (0, config_utils_1.getReplayTargetForTestCase)({
86
86
  useAssetsSnapshottedInBaseSimulation,
87
- appUrl,
87
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
88
88
  testCase,
89
89
  }),
90
90
  executionOptions,
91
91
  screenshottingOptions,
92
92
  testCase,
93
- apiToken,
93
+ apiToken: apiToken !== null && apiToken !== void 0 ? apiToken : null,
94
94
  commitSha,
95
95
  deflake: deflake !== null && deflake !== void 0 ? deflake : false,
96
96
  });
@@ -181,5 +181,5 @@ exports.runAllTests = {
181
181
  ...common_options_1.COMMON_REPLAY_OPTIONS,
182
182
  ...common_options_1.SCREENSHOT_DIFF_OPTIONS,
183
183
  },
184
- handler: (0, sentry_utils_1.wrapHandler)((0, command_utils_1.handleNulls)(handler)),
184
+ handler: (0, sentry_utils_1.wrapHandler)(handler),
185
185
  };
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.screenshotDiff = exports.diffScreenshots = exports.DiffError = void 0;
7
+ const path_1 = require("path");
7
8
  const common_1 = require("@alwaysmeticulous/common");
8
9
  const loglevel_1 = __importDefault(require("loglevel"));
9
- const path_1 = require("path");
10
10
  const client_1 = require("../../api/client");
11
11
  const replay_api_1 = require("../../api/replay.api");
12
12
  const common_options_1 = require("../../command-utils/common-options");
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.uploadBuild = void 0;
7
+ const common_1 = require("@alwaysmeticulous/common");
8
+ const loglevel_1 = __importDefault(require("loglevel"));
7
9
  const client_1 = require("../../api/client");
8
10
  const project_build_api_1 = require("../../api/project-build.api");
9
11
  const project_api_1 = require("../../api/project.api");
10
12
  const upload_1 = require("../../api/upload");
11
13
  const archive_1 = require("../../archive/archive");
12
- const loglevel_1 = __importDefault(require("loglevel"));
13
14
  const commit_sha_utils_1 = require("../../utils/commit-sha.utils");
14
15
  const sentry_utils_1 = require("../../utils/sentry.utils");
15
- const common_1 = require("@alwaysmeticulous/common");
16
16
  const handler = async ({ apiToken, commitSha: commitSha_, dist, }) => {
17
17
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
18
18
  // 1. Print project name
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.saveConfig = exports.readConfig = void 0;
4
- const cosmiconfig_1 = require("cosmiconfig");
5
4
  const promises_1 = require("fs/promises");
6
5
  const path_1 = require("path");
7
6
  const process_1 = require("process");
7
+ const cosmiconfig_1 = require("cosmiconfig");
8
8
  const METICULOUS_CONFIG_FILE = "meticulous.json";
9
9
  const findConfig = async () => {
10
10
  const explorer = (0, cosmiconfig_1.cosmiconfig)("meticulous", {
@@ -53,7 +53,7 @@ const readConfig = async (configFilePath) => {
53
53
  const filePath = configFilePath !== null && configFilePath !== void 0 ? configFilePath : (await getConfigFilePath());
54
54
  const configStr = await (0, promises_1.readFile)(filePath, "utf-8").catch((error) => {
55
55
  // Use an empty config object if there is no config file
56
- if (configFilePath === undefined &&
56
+ if (configFilePath == null &&
57
57
  error instanceof Error &&
58
58
  error.code === "ENOENT") {
59
59
  return "{}";
@@ -9,7 +9,7 @@ interface HandleReplayOptions {
9
9
  executionOptions: ReplayExecutionOptions;
10
10
  screenshottingOptions: ScreenshotAssertionsEnabledOptions;
11
11
  testCase: TestCase;
12
- apiToken: string | undefined;
12
+ apiToken: string | null;
13
13
  commitSha: string;
14
14
  }
15
15
  export declare const deflakeReplayCommandHandler: (options: DeflakeReplayCommandHandlerOptions) => Promise<TestCaseResult>;
@@ -21,7 +21,7 @@ const handleReplay = async ({ testCase, replayTarget, executionOptions, screensh
21
21
  baseSimulationId: testCase.baseReplayId,
22
22
  save: false,
23
23
  exitOnMismatch: false,
24
- cookiesFile: undefined,
24
+ cookiesFile: null,
25
25
  });
26
26
  const result = await replayPromise
27
27
  .then((replay) => ({
@@ -78,5 +78,6 @@ const applyTestCaseScreenshottingOptionsOverrides = (screenshottingOptionsFromCl
78
78
  enabled: true,
79
79
  screenshotSelector: (_c = overridesFromTestCase.screenshotSelector) !== null && _c !== void 0 ? _c : screenshottingOptionsFromCliFlags.screenshotSelector,
80
80
  diffOptions,
81
+ storyboardOptions: { enabled: false }, // we don't expose this option
81
82
  };
82
83
  };
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchAsset = exports.saveAssetMetadata = exports.loadAssetMetadata = exports.getOrCreateAssetsDir = void 0;
7
+ const promises_1 = require("fs/promises");
8
+ const path_1 = require("path");
7
9
  const common_1 = require("@alwaysmeticulous/common");
8
10
  const axios_1 = __importDefault(require("axios"));
9
- const promises_1 = require("fs/promises");
10
11
  const loglevel_1 = __importDefault(require("loglevel"));
11
- const path_1 = require("path");
12
12
  const snippets_1 = require("../config/snippets");
13
13
  const ASSETS_FOLDER_NAME = "assets";
14
14
  const ASSET_METADATA_FILE_NAME = "assets.json";
@@ -4,20 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getReplayDir = exports.getScreenshotsDir = exports.getSnapshottedAssetsDir = exports.getScreenshotFiles = exports.getOrFetchReplayArchive = exports.getOrFetchReplay = void 0;
7
+ const promises_1 = require("fs/promises");
8
+ const path_1 = require("path");
7
9
  const common_1 = require("@alwaysmeticulous/common");
8
10
  const adm_zip_1 = __importDefault(require("adm-zip"));
9
- const promises_1 = require("fs/promises");
10
- const promises_2 = require("fs/promises");
11
11
  const loglevel_1 = __importDefault(require("loglevel"));
12
- const path_1 = require("path");
13
12
  const download_1 = require("../api/download");
14
13
  const replay_api_1 = require("../api/replay.api");
15
14
  const getOrFetchReplay = async (client, replayId) => {
16
15
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
17
16
  const replayDir = (0, exports.getReplayDir)(replayId);
18
- await (0, promises_2.mkdir)(replayDir, { recursive: true });
17
+ await (0, promises_1.mkdir)(replayDir, { recursive: true });
19
18
  const replayFile = (0, path_1.join)(replayDir, `${replayId}.json`);
20
- const existingReplay = await (0, promises_2.readFile)(replayFile)
19
+ const existingReplay = await (0, promises_1.readFile)(replayFile)
21
20
  .then((data) => JSON.parse(data.toString("utf-8")))
22
21
  .catch(() => null);
23
22
  if (existingReplay) {
@@ -29,7 +28,7 @@ const getOrFetchReplay = async (client, replayId) => {
29
28
  logger.error(`Error: Could not retrieve replay with id "${replayId}". Is the API token correct?`);
30
29
  process.exit(1);
31
30
  }
32
- await (0, promises_2.writeFile)(replayFile, JSON.stringify(replay, null, 2));
31
+ await (0, promises_1.writeFile)(replayFile, JSON.stringify(replay, null, 2));
33
32
  logger.debug(`Wrote replay to ${replayFile}`);
34
33
  return replay;
35
34
  };
@@ -37,12 +36,12 @@ exports.getOrFetchReplay = getOrFetchReplay;
37
36
  const getOrFetchReplayArchive = async (client, replayId) => {
38
37
  const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
39
38
  const replayDir = (0, exports.getReplayDir)(replayId);
40
- await (0, promises_2.mkdir)(replayDir, { recursive: true });
39
+ await (0, promises_1.mkdir)(replayDir, { recursive: true });
41
40
  const replayArchiveFile = (0, path_1.join)(replayDir, `${replayId}.zip`);
42
41
  const paramsFile = (0, path_1.join)(replayDir, "replayEventsParams.json");
43
42
  // Check if "replayEventsParams.json" exists. If yes, we assume the replay
44
43
  // zip archive has been downloaded and extracted.
45
- const paramsFileExists = await (0, promises_2.access)(paramsFile)
44
+ const paramsFileExists = await (0, promises_1.access)(paramsFile)
46
45
  .then(() => true)
47
46
  .catch(() => false);
48
47
  if (paramsFileExists) {
@@ -57,7 +56,7 @@ const getOrFetchReplayArchive = async (client, replayId) => {
57
56
  await (0, download_1.downloadFile)(downloadUrlData.dowloadUrl, replayArchiveFile);
58
57
  const zipFile = new adm_zip_1.default(replayArchiveFile);
59
58
  zipFile.extractAllTo(replayDir, /*overwrite=*/ true);
60
- await (0, promises_2.rm)(replayArchiveFile);
59
+ await (0, promises_1.rm)(replayArchiveFile);
61
60
  logger.debug(`Exrtracted replay archive in ${replayDir}`);
62
61
  };
63
62
  exports.getOrFetchReplayArchive = getOrFetchReplayArchive;
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.writeScreenshotDiff = void 0;
7
- const common_1 = require("@alwaysmeticulous/common");
8
7
  const promises_1 = require("fs/promises");
9
8
  const path_1 = require("path");
9
+ const common_1 = require("@alwaysmeticulous/common");
10
10
  const loglevel_1 = __importDefault(require("loglevel"));
11
11
  const io_utils_1 = require("../image/io.utils");
12
12
  const writeScreenshotDiff = async ({ baseReplayId, headReplayId, screenshotFileName, diff, }) => {
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.serveAssetsFromSimulation = void 0;
7
- const replays_1 = require("./replays");
8
- const express_1 = __importDefault(require("express"));
9
- const common_1 = require("@alwaysmeticulous/common");
10
7
  const fs_1 = require("fs");
11
- const loglevel_1 = __importDefault(require("loglevel"));
8
+ const common_1 = require("@alwaysmeticulous/common");
9
+ const express_1 = __importDefault(require("express"));
12
10
  const find_free_port_1 = __importDefault(require("find-free-port"));
11
+ const loglevel_1 = __importDefault(require("loglevel"));
12
+ const replays_1 = require("./replays");
13
13
  // We must avoid ports blocked by Chrome: https://superuser.com/questions/188058/which-ports-are-considered-unsafe-by-chrome
14
14
  const STARTING_PORT = 9100;
15
15
  const ENDING_PORT = 10000;
@@ -25,6 +25,7 @@ async function serveAssetsFromSimulation(client, simulationId) {
25
25
  process.exit(1);
26
26
  }
27
27
  const app = (0, express_1.default)();
28
+ // eslint-disable-next-line import/no-named-as-default-member
28
29
  app.use(express_1.default.static(snapshottedAssetsDir));
29
30
  const serverStartupPromise = (0, common_1.defer)();
30
31
  const { server, port } = await retryUntilFreePortFound((portToTry) => app.listen(portToTry, () => serverStartupPromise.resolve()));
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getOrFetchRecordedSessionData = exports.getOrFetchRecordedSession = void 0;
7
- const common_1 = require("@alwaysmeticulous/common");
8
7
  const promises_1 = require("fs/promises");
9
- const loglevel_1 = __importDefault(require("loglevel"));
10
8
  const path_1 = require("path");
9
+ const common_1 = require("@alwaysmeticulous/common");
10
+ const loglevel_1 = __importDefault(require("loglevel"));
11
11
  const session_api_1 = require("../api/session.api");
12
12
  const local_data_utils_1 = require("./local-data.utils");
13
13
  const getOrFetchRecordedSession = async (client, sessionId) => {