@cappa/core 0.1.0 → 0.1.2
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/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +44 -52
- package/dist/index.d.ts +44 -52
- package/dist/index.js +54 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/compare.test.ts +21 -9
- package/src/compare.ts +29 -9
- package/src/config.ts +1 -1
- package/src/index.ts +1 -7
- package/src/plugin.ts +1 -7
- package/src/screenshot.ts +61 -180
- package/src/types.ts +12 -14
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @cappa/core@0.
|
|
3
|
+
> @cappa/core@0.1.1 build /home/tim/cappa/packages/core
|
|
4
4
|
> tsdown
|
|
5
5
|
|
|
6
6
|
[34mℹ[39m tsdown [2mv0.14.1[22m powered by rolldown [2mv1.0.0-beta.40[22m
|
|
7
7
|
[34mℹ[39m Using tsdown config: [4m/home/tim/cappa/packages/core/tsdown.config.ts[24m
|
|
8
|
-
(node:
|
|
8
|
+
(node:256487) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/tim/cappa/packages/core/tsdown.config.ts is not specified and it doesn't parse as CommonJS.
|
|
9
9
|
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
|
|
10
10
|
To eliminate this warning, add "type": "module" to /home/tim/cappa/packages/core/package.json.
|
|
11
11
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
@@ -17,15 +17,15 @@ To eliminate this warning, add "type": "module" to /home/tim/cappa/packages/core
|
|
|
17
17
|
- For the "resolve.tsconfigFilename". It is deprecated. Please use the top-level `tsconfig` option instead. [0m
|
|
18
18
|
[33mWarning: Invalid input options (1 issue found)
|
|
19
19
|
- For the "resolve.tsconfigFilename". It is deprecated. Please use the top-level `tsconfig` option instead. [0m
|
|
20
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.js[22m [
|
|
21
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.js.map [
|
|
22
|
-
[34mℹ[39m [33m[CJS][39m 2 files, total:
|
|
20
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.js[22m [2m 9.57 kB[22m [2m│ gzip: 2.94 kB[22m
|
|
21
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.js.map [2m17.73 kB[22m [2m│ gzip: 5.11 kB[22m
|
|
22
|
+
[34mℹ[39m [33m[CJS][39m 2 files, total: 27.31 kB
|
|
23
23
|
[33mWarning: Invalid input options (1 issue found)
|
|
24
24
|
- For the "resolve.tsconfigFilename". It is deprecated. Please use the top-level `tsconfig` option instead. [0m
|
|
25
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.mjs[22m [2m
|
|
26
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.mjs.map [
|
|
27
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m
|
|
28
|
-
[34mℹ[39m [34m[ESM][39m 3 files, total:
|
|
29
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [
|
|
30
|
-
[34mℹ[39m [33m[CJS][39m 1 files, total:
|
|
31
|
-
[32m✔[39m Build complete in [
|
|
25
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.mjs[22m [2m 7.97 kB[22m [2m│ gzip: 2.44 kB[22m
|
|
26
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.mjs.map [2m17.66 kB[22m [2m│ gzip: 5.08 kB[22m
|
|
27
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 5.99 kB[22m [2m│ gzip: 2.09 kB[22m
|
|
28
|
+
[34mℹ[39m [34m[ESM][39m 3 files, total: 31.61 kB
|
|
29
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m5.99 kB[22m [2m│ gzip: 2.09 kB[22m
|
|
30
|
+
[34mℹ[39m [33m[CJS][39m 1 files, total: 5.99 kB
|
|
31
|
+
[32m✔[39m Build complete in [32m1205ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @cappa/core
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a772b76: Add better logging + cleanup
|
|
8
|
+
- Updated dependencies [a772b76]
|
|
9
|
+
- @cappa/logger@0.0.2
|
|
10
|
+
|
|
11
|
+
## 0.1.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- d640855: Fix server public folder publish
|
|
16
|
+
|
|
3
17
|
## 0.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Logger } from "@cappa/logger";
|
|
1
2
|
import { Browser, BrowserContext, Locator, Page } from "playwright-core";
|
|
2
|
-
import { ConsolaInstance } from "consola";
|
|
3
3
|
import { BlazeDiffOptions } from "@blazediff/types";
|
|
4
4
|
|
|
5
5
|
//#region src/compare.d.ts
|
|
@@ -17,13 +17,12 @@ interface CompareResult {
|
|
|
17
17
|
* @param image2 - Second image (file path or Buffer)
|
|
18
18
|
* @param withDiff - Whether to create a diff image
|
|
19
19
|
* @param options - Comparison options
|
|
20
|
-
* @param maxDifferencePercent - Maximum allowed difference percentage (0-100)
|
|
21
20
|
* @returns Comparison result
|
|
22
21
|
*/
|
|
23
22
|
//#endregion
|
|
24
23
|
//#region src/screenshot.d.ts
|
|
25
24
|
declare class ScreenshotTool {
|
|
26
|
-
browserType:
|
|
25
|
+
browserType: "chromium" | "firefox" | "webkit";
|
|
27
26
|
headless: boolean;
|
|
28
27
|
viewport: {
|
|
29
28
|
width: number;
|
|
@@ -33,39 +32,54 @@ declare class ScreenshotTool {
|
|
|
33
32
|
actualDir: string;
|
|
34
33
|
diffDir: string;
|
|
35
34
|
expectedDir: string;
|
|
36
|
-
fullPage: boolean;
|
|
37
35
|
browser: Browser | null;
|
|
38
36
|
context: BrowserContext | null;
|
|
39
37
|
page: Page | null;
|
|
40
38
|
diff: DiffConfig;
|
|
39
|
+
logger: Logger;
|
|
41
40
|
constructor(options: {
|
|
42
|
-
browserType?:
|
|
41
|
+
browserType?: "chromium" | "firefox" | "webkit";
|
|
43
42
|
headless?: boolean;
|
|
44
43
|
viewport?: {
|
|
45
44
|
width: number;
|
|
46
45
|
height: number;
|
|
47
46
|
};
|
|
48
47
|
outputDir?: string;
|
|
49
|
-
fullPage?: boolean;
|
|
50
48
|
diff?: DiffConfig;
|
|
51
49
|
});
|
|
50
|
+
/**
|
|
51
|
+
* Initialize playwright and page
|
|
52
|
+
*/
|
|
52
53
|
init(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Closes browser
|
|
56
|
+
* If not closed, the process will not exit
|
|
57
|
+
*/
|
|
53
58
|
close(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Navigates to a URL with "domcontentloaded" waitUntil
|
|
61
|
+
*/
|
|
54
62
|
goTo(page: Page, url: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Creates directories for screenshots and other files
|
|
65
|
+
*/
|
|
55
66
|
private createDirectories;
|
|
67
|
+
/**
|
|
68
|
+
* Gets the path to the actual screenshot file
|
|
69
|
+
*/
|
|
56
70
|
getActualFilePath(filename: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the path to the diff screenshot file
|
|
73
|
+
*/
|
|
57
74
|
getDiffFilePath(filename: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the path to the expected screenshot file
|
|
77
|
+
*/
|
|
58
78
|
getExpectedFilePath(filename: string): string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
omitBackground?: boolean;
|
|
64
|
-
}): Promise<string>;
|
|
65
|
-
takeElementScreenshot(page: Page, selector: string, options?: {
|
|
66
|
-
filename?: string;
|
|
67
|
-
fullPage?: boolean;
|
|
68
|
-
}): Promise<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Takes a screenshot of the page
|
|
81
|
+
*/
|
|
82
|
+
takeScreenshot(page: Page, filename: string, options: ScreenshotOptions): Promise<string | undefined>;
|
|
69
83
|
takeScreenshotWithComparison(page: Page, filename: string, referenceImage: Buffer, options?: {
|
|
70
84
|
fullPage?: boolean;
|
|
71
85
|
mask?: Locator[];
|
|
@@ -79,24 +93,6 @@ declare class ScreenshotTool {
|
|
|
79
93
|
comparisonResult: CompareResult;
|
|
80
94
|
diffImagePath?: string;
|
|
81
95
|
}>;
|
|
82
|
-
batchScreenshots(urls: string[], options?: {}): Promise<{
|
|
83
|
-
url: string;
|
|
84
|
-
success: boolean;
|
|
85
|
-
filepath: string;
|
|
86
|
-
error?: string;
|
|
87
|
-
}[]>;
|
|
88
|
-
takeResponsiveScreenshots(url: string, viewports?: {
|
|
89
|
-
width: number;
|
|
90
|
-
height: number;
|
|
91
|
-
name: string;
|
|
92
|
-
}[], options?: {
|
|
93
|
-
fullPage?: boolean;
|
|
94
|
-
}): Promise<{
|
|
95
|
-
viewport: string;
|
|
96
|
-
success: boolean;
|
|
97
|
-
filepath: string;
|
|
98
|
-
error?: string;
|
|
99
|
-
}[]>;
|
|
100
96
|
hasExpectedImage(filename: string): boolean;
|
|
101
97
|
getExpectedImageBuffer(filename: string): Buffer;
|
|
102
98
|
}
|
|
@@ -105,16 +101,14 @@ declare class ScreenshotTool {
|
|
|
105
101
|
/**
|
|
106
102
|
* Plugin function type definition
|
|
107
103
|
*/
|
|
108
|
-
type PluginFunction = (screenshotTool: ScreenshotTool
|
|
104
|
+
type PluginFunction = (screenshotTool: ScreenshotTool) => Promise<any[]>;
|
|
109
105
|
/**
|
|
110
106
|
* Plugin definition interface
|
|
111
107
|
*/
|
|
112
108
|
type PluginDef = {
|
|
113
109
|
name: string;
|
|
114
110
|
description: string;
|
|
115
|
-
version: string;
|
|
116
111
|
execute: PluginFunction;
|
|
117
|
-
validateOptions?: (options: any) => boolean;
|
|
118
112
|
};
|
|
119
113
|
/**
|
|
120
114
|
* Plugin function type definition
|
|
@@ -123,12 +117,15 @@ type Plugin<Config = any> = (config?: Config) => PluginDef;
|
|
|
123
117
|
//#endregion
|
|
124
118
|
//#region src/types.d.ts
|
|
125
119
|
type PossiblePromise<T> = Promise<T> | T;
|
|
120
|
+
/**
|
|
121
|
+
* Configuration for the comparison of images
|
|
122
|
+
*/
|
|
126
123
|
interface DiffConfig {
|
|
127
124
|
/**
|
|
128
125
|
* Matching threshold (0-1). Lower = more sensitive
|
|
129
126
|
* Default = 0.1
|
|
130
127
|
*
|
|
131
|
-
* This affects how similar a pixel needs to be
|
|
128
|
+
* This affects how similar a pixel needs to be in the reference image to be considered the same.
|
|
132
129
|
*/
|
|
133
130
|
threshold?: number;
|
|
134
131
|
/**
|
|
@@ -175,31 +172,26 @@ interface DiffConfig {
|
|
|
175
172
|
*/
|
|
176
173
|
type UserConfig = {
|
|
177
174
|
/**
|
|
178
|
-
* The
|
|
179
|
-
* @default process.cwd()
|
|
175
|
+
* The directory to save screenshots and other files in
|
|
180
176
|
*/
|
|
181
|
-
root?: string;
|
|
182
177
|
outputDir?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Configuration for the comparison of images
|
|
180
|
+
*/
|
|
183
181
|
diff?: DiffConfig;
|
|
184
182
|
/**
|
|
185
|
-
* An array of Cappa plugins used for generation.
|
|
183
|
+
* An array of Cappa plugins used for generation.
|
|
184
|
+
* Each plugin may have additional configurable options (defined within the plugin itself).
|
|
186
185
|
*/
|
|
187
186
|
plugins?: Array<Plugin | PluginDef>;
|
|
188
187
|
};
|
|
189
188
|
type ScreenshotOptions = {
|
|
190
189
|
fullPage?: boolean;
|
|
191
|
-
waitForSelector?: string;
|
|
192
|
-
waitForTimeout?: number;
|
|
193
190
|
delay?: number;
|
|
194
191
|
skip?: boolean;
|
|
195
|
-
mask?:
|
|
192
|
+
mask?: Locator[];
|
|
196
193
|
omitBackground?: boolean;
|
|
197
194
|
};
|
|
198
|
-
interface Exposed {
|
|
199
|
-
emitCapture(opt: ScreenshotOptions): void;
|
|
200
|
-
getBaseScreenshotOptions(): ScreenshotOptions;
|
|
201
|
-
waitBrowserMetricsStable(): Promise<void>;
|
|
202
|
-
}
|
|
203
195
|
interface Screenshot {
|
|
204
196
|
id: string;
|
|
205
197
|
name: string;
|
|
@@ -212,9 +204,9 @@ interface Screenshot {
|
|
|
212
204
|
//#endregion
|
|
213
205
|
//#region src/config.d.ts
|
|
214
206
|
/**
|
|
215
|
-
* Type helper to make it easier to use
|
|
207
|
+
* Type helper to make it easier to use cappa.config.ts, or a function that returns it. The function receives a ConfigEnv object.
|
|
216
208
|
*/
|
|
217
209
|
declare function defineConfig(options: PossiblePromise<UserConfig | Array<UserConfig>> | (() => PossiblePromise<UserConfig | Array<UserConfig>>)): typeof options;
|
|
218
210
|
//#endregion
|
|
219
|
-
export { type
|
|
211
|
+
export { type Plugin, type PluginDef, type PluginFunction, type Screenshot, type ScreenshotOptions, ScreenshotTool, type UserConfig, defineConfig };
|
|
220
212
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConsolaInstance } from "consola";
|
|
2
1
|
import { Browser, BrowserContext, Locator, Page } from "playwright-core";
|
|
2
|
+
import { Logger } from "@cappa/logger";
|
|
3
3
|
import { BlazeDiffOptions } from "@blazediff/types";
|
|
4
4
|
|
|
5
5
|
//#region src/compare.d.ts
|
|
@@ -17,13 +17,12 @@ interface CompareResult {
|
|
|
17
17
|
* @param image2 - Second image (file path or Buffer)
|
|
18
18
|
* @param withDiff - Whether to create a diff image
|
|
19
19
|
* @param options - Comparison options
|
|
20
|
-
* @param maxDifferencePercent - Maximum allowed difference percentage (0-100)
|
|
21
20
|
* @returns Comparison result
|
|
22
21
|
*/
|
|
23
22
|
//#endregion
|
|
24
23
|
//#region src/screenshot.d.ts
|
|
25
24
|
declare class ScreenshotTool {
|
|
26
|
-
browserType:
|
|
25
|
+
browserType: "chromium" | "firefox" | "webkit";
|
|
27
26
|
headless: boolean;
|
|
28
27
|
viewport: {
|
|
29
28
|
width: number;
|
|
@@ -33,39 +32,54 @@ declare class ScreenshotTool {
|
|
|
33
32
|
actualDir: string;
|
|
34
33
|
diffDir: string;
|
|
35
34
|
expectedDir: string;
|
|
36
|
-
fullPage: boolean;
|
|
37
35
|
browser: Browser | null;
|
|
38
36
|
context: BrowserContext | null;
|
|
39
37
|
page: Page | null;
|
|
40
38
|
diff: DiffConfig;
|
|
39
|
+
logger: Logger;
|
|
41
40
|
constructor(options: {
|
|
42
|
-
browserType?:
|
|
41
|
+
browserType?: "chromium" | "firefox" | "webkit";
|
|
43
42
|
headless?: boolean;
|
|
44
43
|
viewport?: {
|
|
45
44
|
width: number;
|
|
46
45
|
height: number;
|
|
47
46
|
};
|
|
48
47
|
outputDir?: string;
|
|
49
|
-
fullPage?: boolean;
|
|
50
48
|
diff?: DiffConfig;
|
|
51
49
|
});
|
|
50
|
+
/**
|
|
51
|
+
* Initialize playwright and page
|
|
52
|
+
*/
|
|
52
53
|
init(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Closes browser
|
|
56
|
+
* If not closed, the process will not exit
|
|
57
|
+
*/
|
|
53
58
|
close(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Navigates to a URL with "domcontentloaded" waitUntil
|
|
61
|
+
*/
|
|
54
62
|
goTo(page: Page, url: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Creates directories for screenshots and other files
|
|
65
|
+
*/
|
|
55
66
|
private createDirectories;
|
|
67
|
+
/**
|
|
68
|
+
* Gets the path to the actual screenshot file
|
|
69
|
+
*/
|
|
56
70
|
getActualFilePath(filename: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the path to the diff screenshot file
|
|
73
|
+
*/
|
|
57
74
|
getDiffFilePath(filename: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the path to the expected screenshot file
|
|
77
|
+
*/
|
|
58
78
|
getExpectedFilePath(filename: string): string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
omitBackground?: boolean;
|
|
64
|
-
}): Promise<string>;
|
|
65
|
-
takeElementScreenshot(page: Page, selector: string, options?: {
|
|
66
|
-
filename?: string;
|
|
67
|
-
fullPage?: boolean;
|
|
68
|
-
}): Promise<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Takes a screenshot of the page
|
|
81
|
+
*/
|
|
82
|
+
takeScreenshot(page: Page, filename: string, options: ScreenshotOptions): Promise<string | undefined>;
|
|
69
83
|
takeScreenshotWithComparison(page: Page, filename: string, referenceImage: Buffer, options?: {
|
|
70
84
|
fullPage?: boolean;
|
|
71
85
|
mask?: Locator[];
|
|
@@ -79,24 +93,6 @@ declare class ScreenshotTool {
|
|
|
79
93
|
comparisonResult: CompareResult;
|
|
80
94
|
diffImagePath?: string;
|
|
81
95
|
}>;
|
|
82
|
-
batchScreenshots(urls: string[], options?: {}): Promise<{
|
|
83
|
-
url: string;
|
|
84
|
-
success: boolean;
|
|
85
|
-
filepath: string;
|
|
86
|
-
error?: string;
|
|
87
|
-
}[]>;
|
|
88
|
-
takeResponsiveScreenshots(url: string, viewports?: {
|
|
89
|
-
width: number;
|
|
90
|
-
height: number;
|
|
91
|
-
name: string;
|
|
92
|
-
}[], options?: {
|
|
93
|
-
fullPage?: boolean;
|
|
94
|
-
}): Promise<{
|
|
95
|
-
viewport: string;
|
|
96
|
-
success: boolean;
|
|
97
|
-
filepath: string;
|
|
98
|
-
error?: string;
|
|
99
|
-
}[]>;
|
|
100
96
|
hasExpectedImage(filename: string): boolean;
|
|
101
97
|
getExpectedImageBuffer(filename: string): Buffer;
|
|
102
98
|
}
|
|
@@ -105,16 +101,14 @@ declare class ScreenshotTool {
|
|
|
105
101
|
/**
|
|
106
102
|
* Plugin function type definition
|
|
107
103
|
*/
|
|
108
|
-
type PluginFunction = (screenshotTool: ScreenshotTool
|
|
104
|
+
type PluginFunction = (screenshotTool: ScreenshotTool) => Promise<any[]>;
|
|
109
105
|
/**
|
|
110
106
|
* Plugin definition interface
|
|
111
107
|
*/
|
|
112
108
|
type PluginDef = {
|
|
113
109
|
name: string;
|
|
114
110
|
description: string;
|
|
115
|
-
version: string;
|
|
116
111
|
execute: PluginFunction;
|
|
117
|
-
validateOptions?: (options: any) => boolean;
|
|
118
112
|
};
|
|
119
113
|
/**
|
|
120
114
|
* Plugin function type definition
|
|
@@ -123,12 +117,15 @@ type Plugin<Config = any> = (config?: Config) => PluginDef;
|
|
|
123
117
|
//#endregion
|
|
124
118
|
//#region src/types.d.ts
|
|
125
119
|
type PossiblePromise<T> = Promise<T> | T;
|
|
120
|
+
/**
|
|
121
|
+
* Configuration for the comparison of images
|
|
122
|
+
*/
|
|
126
123
|
interface DiffConfig {
|
|
127
124
|
/**
|
|
128
125
|
* Matching threshold (0-1). Lower = more sensitive
|
|
129
126
|
* Default = 0.1
|
|
130
127
|
*
|
|
131
|
-
* This affects how similar a pixel needs to be
|
|
128
|
+
* This affects how similar a pixel needs to be in the reference image to be considered the same.
|
|
132
129
|
*/
|
|
133
130
|
threshold?: number;
|
|
134
131
|
/**
|
|
@@ -175,31 +172,26 @@ interface DiffConfig {
|
|
|
175
172
|
*/
|
|
176
173
|
type UserConfig = {
|
|
177
174
|
/**
|
|
178
|
-
* The
|
|
179
|
-
* @default process.cwd()
|
|
175
|
+
* The directory to save screenshots and other files in
|
|
180
176
|
*/
|
|
181
|
-
root?: string;
|
|
182
177
|
outputDir?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Configuration for the comparison of images
|
|
180
|
+
*/
|
|
183
181
|
diff?: DiffConfig;
|
|
184
182
|
/**
|
|
185
|
-
* An array of Cappa plugins used for generation.
|
|
183
|
+
* An array of Cappa plugins used for generation.
|
|
184
|
+
* Each plugin may have additional configurable options (defined within the plugin itself).
|
|
186
185
|
*/
|
|
187
186
|
plugins?: Array<Plugin | PluginDef>;
|
|
188
187
|
};
|
|
189
188
|
type ScreenshotOptions = {
|
|
190
189
|
fullPage?: boolean;
|
|
191
|
-
waitForSelector?: string;
|
|
192
|
-
waitForTimeout?: number;
|
|
193
190
|
delay?: number;
|
|
194
191
|
skip?: boolean;
|
|
195
|
-
mask?:
|
|
192
|
+
mask?: Locator[];
|
|
196
193
|
omitBackground?: boolean;
|
|
197
194
|
};
|
|
198
|
-
interface Exposed {
|
|
199
|
-
emitCapture(opt: ScreenshotOptions): void;
|
|
200
|
-
getBaseScreenshotOptions(): ScreenshotOptions;
|
|
201
|
-
waitBrowserMetricsStable(): Promise<void>;
|
|
202
|
-
}
|
|
203
195
|
interface Screenshot {
|
|
204
196
|
id: string;
|
|
205
197
|
name: string;
|
|
@@ -212,9 +204,9 @@ interface Screenshot {
|
|
|
212
204
|
//#endregion
|
|
213
205
|
//#region src/config.d.ts
|
|
214
206
|
/**
|
|
215
|
-
* Type helper to make it easier to use
|
|
207
|
+
* Type helper to make it easier to use cappa.config.ts, or a function that returns it. The function receives a ConfigEnv object.
|
|
216
208
|
*/
|
|
217
209
|
declare function defineConfig(options: PossiblePromise<UserConfig | Array<UserConfig>> | (() => PossiblePromise<UserConfig | Array<UserConfig>>)): typeof options;
|
|
218
210
|
//#endregion
|
|
219
|
-
export { type
|
|
211
|
+
export { type Plugin, type PluginDef, type PluginFunction, type Screenshot, type ScreenshotOptions, ScreenshotTool, type UserConfig, defineConfig };
|
|
220
212
|
//# sourceMappingURL=index.d.ts.map
|