@alwaysmeticulous/cli 2.42.0 → 2.43.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.
@@ -59,7 +59,9 @@ export declare const replayCommand: import("yargs").CommandModule<unknown, impor
59
59
  readonly default: false;
60
60
  };
61
61
  shiftTime: {
62
- readonly boolean: true;
62
+ readonly boolean: true; /**
63
+ * Empty if screenshottingOptions.enabled was false.
64
+ */
63
65
  readonly description: "Shift time during simulation to be set as the recording time";
64
66
  readonly default: true;
65
67
  };
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.replayCommand = exports.getReplayTarget = exports.rawReplayCommandHandler = void 0;
4
4
  const common_1 = require("@alwaysmeticulous/common");
5
- const replay_orchestrator_1 = require("@alwaysmeticulous/replay-orchestrator");
5
+ const replay_orchestrator_launcher_1 = require("@alwaysmeticulous/replay-orchestrator-launcher");
6
6
  const command_builder_1 = require("../../command-utils/command-builder");
7
7
  const common_options_1 = require("../../command-utils/common-options");
8
+ const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
8
9
  const replay_debugger_ui_1 = require("./utils/replay-debugger.ui");
9
10
  const rawReplayCommandHandler = async ({ apiToken, commitSha, sessionId, appUrl, simulationIdForAssets, headless, devTools, bypassCSP, screenshot, baseReplayId, diffThreshold, diffPixelThreshold, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, disableRemoteFonts, noSandbox, skipPauses, maxDurationMs, maxEventCount, storyboard, essentialFeaturesOnly, debugger: enableStepThroughDebugger, }) => {
10
11
  if (!screenshot && storyboard) {
@@ -48,38 +49,49 @@ const rawReplayCommandHandler = async ({ apiToken, commitSha, sessionId, appUrl,
48
49
  : { enabled: false };
49
50
  const getOnBeforeUserEventCallback = (0, common_1.defer)();
50
51
  const getOnClosePageCallback = (0, common_1.defer)();
51
- const replayExecution = await (0, replay_orchestrator_1.replayAndStoreResults)({
52
- replayTarget: (0, exports.getReplayTarget)({
53
- appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
54
- simulationIdForAssets: simulationIdForAssets !== null && simulationIdForAssets !== void 0 ? simulationIdForAssets : null,
55
- }),
56
- executionOptions,
57
- screenshottingOptions,
58
- apiToken,
59
- commitSha,
60
- cookiesFile,
61
- sessionId,
62
- generatedBy: generatedByOption,
63
- testRunId: null,
64
- suppressScreenshotDiffLogging: false,
65
- ...(enableStepThroughDebugger
66
- ? {
67
- onBeforeUserEvent: async (options) => (await getOnBeforeUserEventCallback.promise)(options),
68
- onClosePage: async () => (await getOnClosePageCallback.promise)(),
69
- }
70
- : {}),
71
- });
72
- if (enableStepThroughDebugger) {
73
- const stepThroughDebuggerUI = await (0, replay_debugger_ui_1.openStepThroughDebuggerUI)({
74
- onLogEventTarget: replayExecution.logEventTarget,
75
- onCloseReplayedPage: replayExecution.closePage,
76
- replayableEvents: replayExecution.eventsBeingReplayed,
52
+ try {
53
+ const replayExecution = await (0, replay_orchestrator_launcher_1.replayAndStoreResults)({
54
+ replayTarget: (0, exports.getReplayTarget)({
55
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
56
+ simulationIdForAssets: simulationIdForAssets !== null && simulationIdForAssets !== void 0 ? simulationIdForAssets : null,
57
+ }),
58
+ executionOptions,
59
+ screenshottingOptions,
60
+ apiToken,
61
+ commitSha,
62
+ cookiesFile,
63
+ sessionId,
64
+ generatedBy: generatedByOption,
65
+ testRunId: null,
66
+ suppressScreenshotDiffLogging: false,
67
+ ...(enableStepThroughDebugger
68
+ ? {
69
+ onBeforeUserEvent: async (options) => (await getOnBeforeUserEventCallback.promise)(options),
70
+ onClosePage: async () => (await getOnClosePageCallback.promise)(),
71
+ }
72
+ : {}),
73
+ maxSemanticVersionSupported: 1,
77
74
  });
78
- getOnBeforeUserEventCallback.resolve(stepThroughDebuggerUI.onBeforeUserEvent);
79
- getOnClosePageCallback.resolve(stepThroughDebuggerUI.close);
75
+ if (enableStepThroughDebugger) {
76
+ const stepThroughDebuggerUI = await (0, replay_debugger_ui_1.openStepThroughDebuggerUI)({
77
+ onLogEventTarget: replayExecution.logEventTarget,
78
+ onCloseReplayedPage: replayExecution.closePage,
79
+ replayableEvents: replayExecution.eventsBeingReplayed,
80
+ });
81
+ getOnBeforeUserEventCallback.resolve(stepThroughDebuggerUI.onBeforeUserEvent);
82
+ getOnClosePageCallback.resolve(stepThroughDebuggerUI.close);
83
+ }
84
+ const { replay } = await replayExecution.finalResult;
85
+ return replay;
86
+ }
87
+ catch (error) {
88
+ if ((0, out_of_date_client_error_1.isOutOfDateClientError)(error)) {
89
+ throw new out_of_date_client_error_1.OutOfDateCLIError();
90
+ }
91
+ else {
92
+ throw error;
93
+ }
80
94
  }
81
- const { replay } = await replayExecution.finalResult;
82
- return replay;
83
95
  };
84
96
  exports.rawReplayCommandHandler = rawReplayCommandHandler;
85
97
  const getReplayTarget = ({ appUrl, simulationIdForAssets, }) => {
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runAllTestsCommand = void 0;
4
4
  const client_1 = require("@alwaysmeticulous/client");
5
5
  const common_1 = require("@alwaysmeticulous/common");
6
- const replay_orchestrator_1 = require("@alwaysmeticulous/replay-orchestrator");
6
+ const replay_orchestrator_launcher_1 = require("@alwaysmeticulous/replay-orchestrator-launcher");
7
7
  const test_run_api_1 = require("../../api/test-run.api");
8
8
  const command_builder_1 = require("../../command-utils/command-builder");
9
9
  const common_options_1 = require("../../command-utils/common-options");
10
+ const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
10
11
  const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl, headless, devTools, bypassCSP, diffThreshold, diffPixelThreshold, shiftTime, networkStubbing, githubSummary, parallelize, parallelTasks: parrelelTasks_, maxRetriesOnFailure, rerunTestsNTimes, useCache, testsFile, disableRemoteFonts, noSandbox, skipPauses, moveBeforeClick, maxDurationMs, maxEventCount, storyboard, essentialFeaturesOnly, baseTestRunId, }) => {
11
12
  const executionOptions = {
12
13
  headless,
@@ -36,23 +37,34 @@ const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl,
36
37
  const cachedTestRunResults = useCache
37
38
  ? await (0, test_run_api_1.getCachedTestRunResults)({ client, commitSha })
38
39
  : [];
39
- const { testRun } = await (0, replay_orchestrator_1.executeTestRun)({
40
- testsFile: testsFile !== null && testsFile !== void 0 ? testsFile : null,
41
- executionOptions,
42
- screenshottingOptions,
43
- apiToken: apiToken !== null && apiToken !== void 0 ? apiToken : null,
44
- commitSha,
45
- baseCommitSha: baseCommitSha !== null && baseCommitSha !== void 0 ? baseCommitSha : null,
46
- baseTestRunId: baseTestRunId !== null && baseTestRunId !== void 0 ? baseTestRunId : null,
47
- appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
48
- parallelTasks: parrelelTasks !== null && parrelelTasks !== void 0 ? parrelelTasks : null,
49
- maxRetriesOnFailure,
50
- rerunTestsNTimes,
51
- cachedTestRunResults,
52
- githubSummary,
53
- });
54
- if (testRun.status === "Failure") {
55
- process.exit(1);
40
+ try {
41
+ const { testRun } = await (0, replay_orchestrator_launcher_1.executeTestRun)({
42
+ testsFile: testsFile !== null && testsFile !== void 0 ? testsFile : null,
43
+ executionOptions,
44
+ screenshottingOptions,
45
+ apiToken: apiToken !== null && apiToken !== void 0 ? apiToken : null,
46
+ commitSha,
47
+ baseCommitSha: baseCommitSha !== null && baseCommitSha !== void 0 ? baseCommitSha : null,
48
+ baseTestRunId: baseTestRunId !== null && baseTestRunId !== void 0 ? baseTestRunId : null,
49
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
50
+ parallelTasks: parrelelTasks !== null && parrelelTasks !== void 0 ? parrelelTasks : null,
51
+ maxRetriesOnFailure,
52
+ rerunTestsNTimes,
53
+ cachedTestRunResults,
54
+ githubSummary,
55
+ maxSemanticVersionSupported: 1,
56
+ });
57
+ if (testRun.status === "Failure") {
58
+ process.exit(1);
59
+ }
60
+ }
61
+ catch (error) {
62
+ if ((0, out_of_date_client_error_1.isOutOfDateClientError)(error)) {
63
+ throw new out_of_date_client_error_1.OutOfDateCLIError();
64
+ }
65
+ else {
66
+ throw error;
67
+ }
56
68
  }
57
69
  };
58
70
  exports.runAllTestsCommand = (0, command_builder_1.buildCommand)("run-all-tests")
@@ -0,0 +1,5 @@
1
+ import { OutOfDateClientError } from "@alwaysmeticulous/sdk-bundles-api";
2
+ export declare const isOutOfDateClientError: (error: unknown) => error is OutOfDateClientError;
3
+ export declare class OutOfDateCLIError extends Error {
4
+ constructor();
5
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutOfDateCLIError = exports.isOutOfDateClientError = void 0;
4
+ const isOutOfDateClientError = (error) => {
5
+ return error.name === "OutOfDateClient";
6
+ };
7
+ exports.isOutOfDateClientError = isOutOfDateClientError;
8
+ class OutOfDateCLIError extends Error {
9
+ constructor() {
10
+ super("The version of @alwaysmeticulous/cli you are using is out of date. Please update to the latest version, using npm or yarn, and try again.");
11
+ this.name = "OutOfDateCLI";
12
+ }
13
+ }
14
+ exports.OutOfDateCLIError = OutOfDateCLIError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/cli",
3
- "version": "2.42.0",
3
+ "version": "2.43.0",
4
4
  "description": "The Meticulous CLI",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "@alwaysmeticulous/api": "^2.42.0",
31
31
  "@alwaysmeticulous/client": "^2.42.0",
32
32
  "@alwaysmeticulous/common": "^2.42.0",
33
- "@alwaysmeticulous/downloading-helpers": "^2.42.0",
33
+ "@alwaysmeticulous/downloading-helpers": "^2.43.0",
34
34
  "@alwaysmeticulous/record": "^2.42.0",
35
35
  "@alwaysmeticulous/replay-debugger-ui": "^2.42.0",
36
- "@alwaysmeticulous/replay-orchestrator": "^2.42.0",
37
- "@alwaysmeticulous/sdk-bundles-api": "^2.42.0",
36
+ "@alwaysmeticulous/replay-orchestrator-launcher": "^2.43.0",
37
+ "@alwaysmeticulous/sdk-bundles-api": "^2.43.0",
38
38
  "@alwaysmeticulous/sentry": "^2.40.0",
39
39
  "@sentry/node": "^7.36.0",
40
40
  "axios": "^1.2.6",
@@ -79,5 +79,5 @@
79
79
  "coverageDirectory": "../coverage",
80
80
  "testEnvironment": "node"
81
81
  },
82
- "gitHead": "65e2410a784642674ea6c8203d5b9f8a303c33ea"
82
+ "gitHead": "7664f4dfeed3b08e5523c0acb4d98d11eee4c9ff"
83
83
  }