@alwaysmeticulous/sdk-bundles-api 2.40.4 → 2.42.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.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { RecordConfig, RecordSettings, RecordState } from "./record";
2
2
  export { MeticulousWindowConfig, NetworkResponseSanitizer, } from "./record/record-settings";
3
3
  export { ReplayUserInteractionsResult, ReplayUserInteractionsResultFull, ReplayUserInteractionsResultShort, BeforeUserEventOptions, } from "./replay/bundle-to-sdk/index";
4
4
  export { BootstrapReplayUserInteractionsFn, BootstrapReplayUserInteractionsOptions, OnReplayTimelineEventFn, ReplayUserInteractionsFn, ReplayUserInteractionsOptions, VirtualTimeOptions, InstallVirtualEventLoopOpts, SetupReplayNetworkStubbingFn, NetworkStubbingOptions, BrowserContextSeedingOptions, SetupBrowserContextSeedingFn, ScreenshottingOptions, } from "./replay/sdk-to-bundle";
5
- export { ReplayAndStoreResultsOptions, AdditionalReplayOptions, ReplayTarget, SnapshottedAssetsReplayTarget, URLReplayTarget, OriginalRecordedURLReplayTarget, ReplayExecutionOptions, ReplayOrchestratorScreenshottingOptions, ScreenshottingEnabledOptions, StoryboardOptions, GeneratedBy, GeneratedByNotebookRun, GeneratedByTestRun, GeneratedByReplayCommand, } from "./replay-orchestrator/sdk-to-bundle/execute-replay";
5
+ export { ReplayAndStoreResultsOptions, ReplayTarget, SnapshottedAssetsReplayTarget, URLReplayTarget, OriginalRecordedURLReplayTarget, ReplayExecutionOptions, ReplayOrchestratorScreenshottingOptions, ScreenshottingEnabledOptions, StoryboardOptions, GeneratedBy, GeneratedByNotebookRun, GeneratedByTestRun, GeneratedByReplayCommand, ScreenshotComparisonOptions, ScreenshotComparisonEnabledOptions, CompareScreenshotsTo, CompareScreenshotsToSpecificReplay, CompareScreenshotsToTestRun, DoNotCompareScreenshots, } from "./replay-orchestrator/sdk-to-bundle/execute-replay";
6
6
  export { ExecuteTestRunOptions } from "./replay-orchestrator/sdk-to-bundle/execute-test-run";
7
7
  export { ExecuteTestRunResult, TestRunExecution, RunningTestRunExecution, FinishedTestRunExecution, TestRunProgress, DetailedTestCaseResult, } from "./replay-orchestrator/bundle-to-sdk/execute-test-run";
8
- export { ReplayAndStoreResultsResult } from "./replay-orchestrator/bundle-to-sdk/execute-replay";
8
+ export { ReplayAndStoreResultsResult, ReplayExecution, BeforeUserEventResult, } from "./replay-orchestrator/bundle-to-sdk/execute-replay";
@@ -1,4 +1,19 @@
1
- import { Replay, ScreenshotDiffResult } from "@alwaysmeticulous/api";
1
+ import { Replay, ReplayableEvent, ScreenshotDiffResult } from "@alwaysmeticulous/api";
2
+ export interface ReplayExecution {
3
+ /**
4
+ * Promise resolves when the replay is complete.
5
+ */
6
+ finalResult: Promise<ReplayAndStoreResultsResult>;
7
+ eventsBeingReplayed: ReplayableEvent[];
8
+ /**
9
+ * When called will log the target of the given event to the browser console.
10
+ */
11
+ logEventTarget: (event: ReplayableEvent) => Promise<void>;
12
+ /**
13
+ * Closes the browser window and stops the replay short.
14
+ */
15
+ closePage: () => Promise<void>;
16
+ }
2
17
  export interface ReplayAndStoreResultsResult {
3
18
  replay: Replay;
4
19
  /**
@@ -6,3 +21,12 @@ export interface ReplayAndStoreResultsResult {
6
21
  */
7
22
  screenshotDiffResultsByBaseReplayId: Record<string, ScreenshotDiffResult[]>;
8
23
  }
24
+ export interface BeforeUserEventResult {
25
+ /**
26
+ * If provided then execution will continue, without calling onBeforeUserEvent, until
27
+ * the next event with this index is reached.
28
+ *
29
+ * If omitted then onBeforeUserEvent will be called again on the immediate next event.
30
+ */
31
+ nextEventIndexToPauseBefore?: number;
32
+ }
@@ -1,19 +1,59 @@
1
- import { ScreenshotAssertionsOptions } from "@alwaysmeticulous/api";
2
- export interface ReplayAndStoreResultsOptions extends AdditionalReplayOptions {
1
+ import { ScreenshotDiffOptions } from "@alwaysmeticulous/api";
2
+ import { BeforeUserEventOptions } from "../../replay/bundle-to-sdk";
3
+ import { BeforeUserEventResult } from "../bundle-to-sdk/execute-replay";
4
+ export interface ReplayAndStoreResultsOptions {
3
5
  replayTarget: ReplayTarget;
4
6
  executionOptions: ReplayExecutionOptions;
5
- screenshottingOptions: ScreenshotAssertionsOptions;
7
+ screenshottingOptions: ScreenshotComparisonOptions;
6
8
  generatedBy: GeneratedBy;
7
9
  testRunId: string | null;
8
10
  suppressScreenshotDiffLogging: boolean;
9
- }
10
- export interface AdditionalReplayOptions {
11
11
  apiToken: string | null | undefined;
12
12
  commitSha: string | null | undefined;
13
13
  sessionId: string;
14
- baseTestRunId: string | null | undefined;
15
14
  cookiesFile: string | null | undefined;
16
- debugger: boolean;
15
+ /**
16
+ * Called when the user or runner closes the page or browser window
17
+ */
18
+ onClosePage?: () => void;
19
+ /**
20
+ * The replay runner will block on the promise returned before replaying the
21
+ * next event. This allows the caller to pause the replay, or control the playback.
22
+ */
23
+ onBeforeUserEvent?: (opts: BeforeUserEventOptions) => Promise<BeforeUserEventResult>;
24
+ }
25
+ /**
26
+ * Similar to ScreenshotAssertionsOptions, but also specifies the test run or base replay id
27
+ * to compare to.
28
+ */
29
+ export type ScreenshotComparisonOptions = {
30
+ enabled: false;
31
+ } | ScreenshotComparisonEnabledOptions;
32
+ export interface ScreenshotComparisonEnabledOptions extends ScreenshottingEnabledOptions {
33
+ compareTo: CompareScreenshotsTo;
34
+ }
35
+ export type CompareScreenshotsTo = CompareScreenshotsToSpecificReplay | CompareScreenshotsToTestRun | DoNotCompareScreenshots;
36
+ export interface CompareScreenshotsToSpecificReplay {
37
+ type: "specific-replay";
38
+ replayId: string;
39
+ diffOptions: ScreenshotDiffOptions;
40
+ }
41
+ /**
42
+ * Compare to the appropiate 'base-screenshots' of the specified test run.
43
+ *
44
+ * The 'base-screenshots' of a test run are the screenshots that should be
45
+ * used when comparing to the test run as a base. By default the screenshots
46
+ * taken in the replays in that test run are used as the base-screenshots, but if
47
+ * there is a flake then we "don't update the base screenshot", and so re-use
48
+ * the base screenshot from the previous test run.
49
+ */
50
+ export interface CompareScreenshotsToTestRun {
51
+ type: "base-screenshots-of-test-run";
52
+ testRunId: string;
53
+ diffOptions: ScreenshotDiffOptions;
54
+ }
55
+ export interface DoNotCompareScreenshots {
56
+ type: "do-not-compare";
17
57
  }
18
58
  export type ReplayTarget = SnapshottedAssetsReplayTarget | URLReplayTarget | OriginalRecordedURLReplayTarget;
19
59
  export interface SnapshottedAssetsReplayTarget {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/sdk-bundles-api",
3
- "version": "2.40.4",
3
+ "version": "2.42.0",
4
4
  "description": "Meticulous common types",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "depcheck": "depcheck --ignore-patterns=dist"
20
20
  },
21
21
  "devDependencies": {
22
- "@alwaysmeticulous/api": "^2.40.4"
22
+ "@alwaysmeticulous/api": "^2.42.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "loglevel": "^1.8.0",
@@ -50,5 +50,5 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
52
52
  },
53
- "gitHead": "11acce96c03e23cbb556779a121710a8136d24db"
53
+ "gitHead": "65e2410a784642674ea6c8203d5b9f8a303c33ea"
54
54
  }