@argos-ci/playwright 6.1.10 → 6.3.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.
@@ -0,0 +1,48 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
+
41
+ export {
42
+ __require,
43
+ __esm,
44
+ __commonJS,
45
+ __export,
46
+ __toESM,
47
+ __toCommonJS
48
+ };
Binary file
package/dist/index.d.ts CHANGED
@@ -1,7 +1,57 @@
1
- import { ElementHandle, Locator, Page, PageScreenshotOptions, LocatorScreenshotOptions, Frame } from '@playwright/test';
2
- import { ViewportOption, StabilizationPluginOptions } from '@argos-ci/browser';
1
+ import { Locator, Page, Frame, ElementHandle, PageScreenshotOptions, LocatorScreenshotOptions } from '@playwright/test';
2
+ import { StabilizationPluginOptions, ViewportOption } from '@argos-ci/browser';
3
3
  import { ScreenshotMetadata } from '@argos-ci/util';
4
4
 
5
+ type ArgosAttachment = {
6
+ name: string;
7
+ contentType: string;
8
+ path: string;
9
+ };
10
+
11
+ type LocatorOptions$1 = Parameters<Page["locator"]>[1];
12
+ type ArgosSnapshotOptions = {
13
+ /**
14
+ * `Locator` or string selector of the element to take a snapshot of.
15
+ */
16
+ element?: string | Locator;
17
+ /**
18
+ * Folder where the snapshots will be saved if not using the Argos reporter.
19
+ * @default "./screenshots"
20
+ */
21
+ root?: string;
22
+ /**
23
+ * Wait for the UI to stabilize before taking the snapshot.
24
+ * Set to `false` to disable stabilization.
25
+ * Pass an object to customize the stabilization.
26
+ * @default true
27
+ */
28
+ stabilize?: boolean | StabilizationPluginOptions;
29
+ /**
30
+ * Maximum time in milliseconds. Defaults to `0` - no timeout
31
+ */
32
+ timeout?: number;
33
+ } & LocatorOptions$1;
34
+ /**
35
+ * Stabilize the UI and takes a snapshot of the application under test.
36
+ *
37
+ * @example
38
+ * argosAriaSnapshot(page, "my-screenshot")
39
+ * @see https://playwright.dev/docs/aria-snapshots
40
+ */
41
+ declare function argosAriaSnapshot(
42
+ /**
43
+ * Playwright `page` or `frame` object.
44
+ */
45
+ handler: Page | Frame,
46
+ /**
47
+ * Name of the snapshot. Must be unique.
48
+ */
49
+ name: string,
50
+ /**
51
+ * Options for the snapshot.
52
+ */
53
+ options?: ArgosSnapshotOptions): Promise<ArgosAttachment[]>;
54
+
5
55
  type LocatorOptions = Parameters<Page["locator"]>[1];
6
56
  type ScreenshotOptions<TBase extends PageScreenshotOptions | LocatorScreenshotOptions> = Omit<TBase, "encoding" | "type" | "omitBackground" | "path">;
7
57
  type ArgosScreenshotOptions = {
@@ -14,6 +64,14 @@ type ArgosScreenshotOptions = {
14
64
  * Viewports to take screenshots of.
15
65
  */
16
66
  viewports?: ViewportOption[];
67
+ /**
68
+ * Capture an ARIA snapshot along with the screenshot.
69
+ * Each ARIA snapshot counts as an additional screenshot for billing.
70
+ * When using the viewports setting, one ARIA snapshot is taken per viewport.
71
+ * @see https://playwright.dev/docs/aria-snapshots#aria-snapshots
72
+ * @default false
73
+ */
74
+ ariaSnapshot?: boolean;
17
75
  /**
18
76
  * Custom CSS evaluated during the screenshot process.
19
77
  */
@@ -59,12 +117,6 @@ type ArgosScreenshotOptions = {
59
117
  */
60
118
  afterScreenshot?: () => Promise<void> | void;
61
119
  } & LocatorOptions & ScreenshotOptions<LocatorScreenshotOptions> & ScreenshotOptions<PageScreenshotOptions>;
62
- type Attachment = {
63
- name: string;
64
- contentType: string;
65
- path: string;
66
- };
67
- type Handler = Page | Frame;
68
120
  /**
69
121
  * Stabilize the UI and takes a screenshot of the application under test.
70
122
  *
@@ -76,7 +128,7 @@ declare function argosScreenshot(
76
128
  /**
77
129
  * Playwright `page` or `frame` object.
78
130
  */
79
- handler: Handler,
131
+ handler: Page | Frame,
80
132
  /**
81
133
  * Name of the screenshot. Must be unique.
82
134
  */
@@ -84,7 +136,7 @@ name: string,
84
136
  /**
85
137
  * Options for the screenshot.
86
138
  */
87
- options?: ArgosScreenshotOptions): Promise<Attachment[]>;
139
+ options?: ArgosScreenshotOptions): Promise<ArgosAttachment[]>;
88
140
 
89
141
  /**
90
142
  * Get the CSP script hash.
@@ -103,4 +155,4 @@ type MetadataConfig = {
103
155
  */
104
156
  declare function setMetadataConfig(metadata: MetadataConfig): void;
105
157
 
106
- export { type ArgosScreenshotOptions, type Attachment, setMetadataConfig as DO_NOT_USE_setMetadataConfig, type MetadataConfig, argosScreenshot, getCSPScriptHash };
158
+ export { type ArgosAttachment, type ArgosScreenshotOptions, type ArgosSnapshotOptions, setMetadataConfig as DO_NOT_USE_setMetadataConfig, type MetadataConfig, argosAriaSnapshot, argosScreenshot, getCSPScriptHash };