@chromatic-com/playwright 0.14.6 → 0.14.8

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/browser.mjs CHANGED
@@ -5275,7 +5275,6 @@ postcss$1.Root;
5275
5275
  postcss$1.Node;
5276
5276
 
5277
5277
  // src/browser.ts
5278
- window.__chromatic_takeSnapshot = takeSnapshot;
5279
5278
  async function takeSnapshot() {
5280
5279
  const mirror = createMirror();
5281
5280
  const domSnapshot = snapshot(document, {
@@ -5325,3 +5324,4 @@ async function toDataURL(url) {
5325
5324
  });
5326
5325
  }
5327
5326
  __name(toDataURL, "toDataURL");
5327
+ window.__chromatic_takeSnapshot = takeSnapshot;
package/dist/index.js CHANGED
@@ -4100,8 +4100,8 @@ __name(trackComplete, "trackComplete");
4100
4100
 
4101
4101
  // ../shared/src/constants.ts
4102
4102
  var DEFAULT_GLOBAL_RESOURCE_ARCHIVE_TIMEOUT_MS = 1e4;
4103
-
4104
- // src/takeSnapshot.ts
4103
+ var browserEntry = __require.resolve("@chromatic-com/playwright/browser");
4104
+ var browserScript = fs.readFileSync(browserEntry, "utf-8");
4105
4105
  var chromaticSnapshots = /* @__PURE__ */ new Map();
4106
4106
  async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
4107
4107
  let name;
@@ -4155,14 +4155,15 @@ async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
4155
4155
  }
4156
4156
  __name(takeSnapshot, "takeSnapshot");
4157
4157
  async function executeSnapshotScript(context) {
4158
- await context.addScriptTag({
4159
- type: "module",
4160
- path: __require.resolve("@chromatic-com/playwright/browser")
4161
- });
4162
- await context.waitForFunction(() => typeof window.__chromatic_takeSnapshot === "function");
4163
- const snapshot = await context.evaluate(async () => {
4164
- return JSON.stringify(await window.__chromatic_takeSnapshot());
4165
- });
4158
+ const snapshot = await context.evaluate(
4159
+ // Wrapper is needed to scope all inlined definitions of browser script, as
4160
+ // it contains bundled rrweb-snapshot that inlines variables like "const node = ...".
4161
+ `async function wrapper() {
4162
+ ${browserScript}
4163
+
4164
+ return JSON.stringify(await takeSnapshot());
4165
+ }()`
4166
+ );
4166
4167
  return JSON.parse(snapshot);
4167
4168
  }
4168
4169
  __name(executeSnapshotScript, "executeSnapshotScript");
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { createRequire } from 'module';
2
2
  import { test as test$1 } from '@playwright/test';
3
3
  export { expect } from '@playwright/test';
4
4
  import path2, { join } from 'path';
5
- import { existsSync, mkdirSync } from 'fs';
5
+ import { readFileSync, existsSync, mkdirSync } from 'fs';
6
6
  import { writeFile } from 'fs/promises';
7
7
  import { createHash } from 'crypto';
8
8
  import { toId, storyNameFromExport } from 'storybook/internal/csf';
@@ -4094,8 +4094,8 @@ __name(trackComplete, "trackComplete");
4094
4094
 
4095
4095
  // ../shared/src/constants.ts
4096
4096
  var DEFAULT_GLOBAL_RESOURCE_ARCHIVE_TIMEOUT_MS = 1e4;
4097
-
4098
- // src/takeSnapshot.ts
4097
+ var browserEntry = __require.resolve("@chromatic-com/playwright/browser");
4098
+ var browserScript = readFileSync(browserEntry, "utf-8");
4099
4099
  var chromaticSnapshots = /* @__PURE__ */ new Map();
4100
4100
  async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
4101
4101
  let name;
@@ -4149,14 +4149,15 @@ async function takeSnapshot(page, nameOrTestInfo, maybeTestInfo) {
4149
4149
  }
4150
4150
  __name(takeSnapshot, "takeSnapshot");
4151
4151
  async function executeSnapshotScript(context) {
4152
- await context.addScriptTag({
4153
- type: "module",
4154
- path: __require.resolve("@chromatic-com/playwright/browser")
4155
- });
4156
- await context.waitForFunction(() => typeof window.__chromatic_takeSnapshot === "function");
4157
- const snapshot = await context.evaluate(async () => {
4158
- return JSON.stringify(await window.__chromatic_takeSnapshot());
4159
- });
4152
+ const snapshot = await context.evaluate(
4153
+ // Wrapper is needed to scope all inlined definitions of browser script, as
4154
+ // it contains bundled rrweb-snapshot that inlines variables like "const node = ...".
4155
+ `async function wrapper() {
4156
+ ${browserScript}
4157
+
4158
+ return JSON.stringify(await takeSnapshot());
4159
+ }()`
4160
+ );
4160
4161
  return JSON.parse(snapshot);
4161
4162
  }
4162
4163
  __name(executeSnapshotScript, "executeSnapshotScript");
@@ -12,6 +12,9 @@ declare const _default: {
12
12
  renderer: string;
13
13
  };
14
14
  staticDirs: string[];
15
+ features: {
16
+ sidebarOnboardingChecklist: boolean;
17
+ };
15
18
  };
16
19
 
17
20
  export { _default as default };
@@ -47,7 +47,10 @@ var main_default = {
47
47
  },
48
48
  staticDirs: [
49
49
  path2.resolve(archivesDir(DEFAULT_OUTPUT_DIR), "archive")
50
- ]
50
+ ],
51
+ features: {
52
+ sidebarOnboardingChecklist: false
53
+ }
51
54
  };
52
55
 
53
56
  export { main_default as default };
@@ -3,7 +3,13 @@ import { addons } from 'storybook/manager-api';
3
3
  // ../shared/storybook-config/manager.ts
4
4
  addons.setConfig({
5
5
  sidebar: {
6
- // this ensures we use folders at the root-level instead of categories
6
+ // Ensures we use folders at the root-level instead of categories
7
7
  showRoots: false
8
+ },
9
+ layoutCustomisations: {
10
+ // Hide toolbar options that don't make sense in e2e setup
11
+ showToolbar: () => false,
12
+ // Hide bottom panel that's empty in e2e setup
13
+ showPanel: () => false
8
14
  }
9
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromatic-com/playwright",
3
- "version": "0.14.6",
3
+ "version": "0.14.8",
4
4
  "description": "Chromatic Visual Regression Testing for Playwright",
5
5
  "repository": {
6
6
  "type": "git",