@sit-onyx/playwright-utils 1.1.1 → 1.2.0-dev-20260301140520

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { expect as f } from "@playwright/test";
2
- import { jsxs as d, jsx as u } from "playwright/jsx-runtime";
2
+ import { jsxs as m, jsx as u } from "playwright/jsx-runtime";
3
3
  import { expect as v, test as k } from "@playwright/experimental-ct-vue";
4
4
  const S = /* @__PURE__ */ Symbol("EMIT_SPY_SYMBOL"), I = () => {
5
5
  const t = [], n = (...r) => {
@@ -11,30 +11,30 @@ const S = /* @__PURE__ */ Symbol("EMIT_SPY_SYMBOL"), I = () => {
11
11
  f(e).toHaveLength(n);
12
12
  const c = e[n - 1];
13
13
  return r && f(c).toMatchObject(r), c;
14
- }, m = (t) => t.replace(/\W/g, (n) => n.codePointAt(0)?.toString() || "-"), L = (t) => {
14
+ }, d = (t) => t.replace(/\W/g, (n) => n.codePointAt(0)?.toString() || "-"), L = (t) => {
15
15
  const n = () => {
16
16
  const r = [
17
- `"blank ${t.columns.map((e) => `column-${m(e)}`).join(" ")}"`
17
+ `"blank ${t.columns.map((e) => `column-${d(e)}`).join(" ")}"`
18
18
  ];
19
19
  return t.rows.forEach((e) => {
20
20
  r.push(
21
- `"row-${m(e)} ${t.columns.map((c) => `${m(e)}-${m(c)}`).join(" ")}"`
21
+ `"row-${d(e)} ${t.columns.map((c) => `${d(e)}-${d(c)}`).join(" ")}"`
22
22
  );
23
23
  }), r.join(`
24
24
  `);
25
25
  };
26
- return /* @__PURE__ */ d("div", { style: { width: "max-content", fontFamily: "Arial, sans-serif" }, children: [
27
- /* @__PURE__ */ d("div", { style: { marginBottom: "2rem" }, children: [
28
- /* @__PURE__ */ d("h1", { style: { fontSize: "1.25rem", lineHeight: "1.75rem", margin: "0" }, children: [
26
+ return /* @__PURE__ */ m("div", { style: { width: "max-content", fontFamily: "Arial, sans-serif" }, children: [
27
+ /* @__PURE__ */ m("div", { style: { marginBottom: "2rem" }, children: [
28
+ /* @__PURE__ */ m("h1", { style: { fontSize: "1.25rem", lineHeight: "1.75rem", margin: "0" }, children: [
29
29
  "Screenshot test: ",
30
30
  t.name
31
31
  ] }),
32
- /* @__PURE__ */ d("div", { children: [
32
+ /* @__PURE__ */ m("div", { children: [
33
33
  "Browser: ",
34
34
  t.browserName
35
35
  ] })
36
36
  ] }),
37
- /* @__PURE__ */ d(
37
+ /* @__PURE__ */ m(
38
38
  "div",
39
39
  {
40
40
  style: {
@@ -73,7 +73,11 @@ const S = /* @__PURE__ */ Symbol("EMIT_SPY_SYMBOL"), I = () => {
73
73
  l,
74
74
  e.context
75
75
  ), await e.hooks?.beforeEach?.(o, i, a, l, e.context);
76
- const x = await o.screenshot({ animations: "disabled" }), h = await o.boundingBox(), B = `${m(l)}-${m(a)}`;
76
+ const x = await o.screenshot({
77
+ animations: "disabled",
78
+ ...t.defaults?.screenshotOptions,
79
+ ...e.screenshotOptions
80
+ }), h = await o.boundingBox(), B = `${d(l)}-${d(a)}`;
77
81
  return await t.defaults?.hooks?.afterEach?.(
78
82
  o,
79
83
  i,
@@ -135,10 +139,10 @@ const S = /* @__PURE__ */ Symbol("EMIT_SPY_SYMBOL"), I = () => {
135
139
  }, g = (t) => /* @__PURE__ */ u(
136
140
  "div",
137
141
  {
138
- style: { textAlign: "center", gridArea: `${t.type}-${m(t.name)}` },
142
+ style: { textAlign: "center", gridArea: `${t.type}-${d(t.name)}` },
139
143
  children: t.name
140
144
  }
141
- ), z = async ({ component: t, page: n, state: r }) => {
145
+ ), O = async ({ component: t, page: n, state: r }) => {
142
146
  if (r === "hover" && await t.hover(), r === "focus-visible" && await n.keyboard.press("Tab"), r === "active") {
143
147
  const e = await t.boundingBox(), c = { x: e.x + e.width / 2, y: e.y + e.height / 2 };
144
148
  await n.mouse.move(c.x, c.y), await n.mouse.down();
@@ -149,6 +153,6 @@ export {
149
153
  N as adjustSizeToAbsolutePosition,
150
154
  I as createEmitSpy,
151
155
  Y as expectEmit,
152
- z as useFocusStateHooks,
156
+ O as useFocusStateHooks,
153
157
  G as useMatrixScreenshotTest
154
158
  };
@@ -1,11 +1,12 @@
1
1
  import type { MountResultJsx, test } from "@playwright/experimental-ct-vue";
2
+ import type { LocatorScreenshotOptions } from "playwright";
2
3
  import type { JSX } from "vue/jsx-runtime";
3
4
  export type UseMatrixScreenshotTestOptions<TContext extends HookContext = HookContext> = {
4
5
  /**
5
6
  * Global default options for the matrix screenshot tests.
6
7
  * Will be merged with the options passed to a single screenshot test.
7
8
  */
8
- defaults?: Partial<Pick<MatrixScreenshotTestOptions<string, string, TContext>, "removePadding" | "hooks">>;
9
+ defaults?: Partial<Pick<MatrixScreenshotTestOptions<string, string, TContext>, "removePadding" | "hooks" | "screenshotOptions">>;
9
10
  /**
10
11
  * Optional custom `test` function to use. Useful when using [fixtures](https://playwright.dev/docs/test-fixtures#creating-a-fixture).
11
12
  */
@@ -42,6 +43,11 @@ export type MatrixScreenshotTestOptions<TColumn extends string = string, TRow ex
42
43
  * Useful for passing options to (global) hooks per matrix screenshot, e.g. for disabling specific accessibility test rule.
43
44
  */
44
45
  context?: TContext;
46
+ /**
47
+ * LocatorScreenshotOptions that are passed to the playwright `.screenshot(...)` function.
48
+ * Per default `animations` are `disabled`.
49
+ */
50
+ screenshotOptions?: LocatorScreenshotOptions;
45
51
  };
46
52
  export type ScreenshotTestHooks<TColumn extends string, TRow extends string, TContext extends HookContext = HookContext> = Partial<{
47
53
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sit-onyx/playwright-utils",
3
3
  "description": "Utilities for Vue component testing with Playwright",
4
- "version": "1.1.1",
4
+ "version": "1.2.0-dev-20260301140520",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
7
7
  "license": "Apache-2.0",