@applitools/core 4.67.1 → 4.68.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/CHANGELOG.md +71 -0
- package/dist/autonomous/create-render-results.js +6 -1
- package/dist/autonomous/start-renders.js +16 -7
- package/dist/figma/client/figma-req.js +46 -0
- package/dist/figma/client/figma-rest.js +189 -0
- package/dist/figma/client/index.js +21 -0
- package/dist/figma/figma-images.js +62 -0
- package/dist/figma/figma.js +168 -0
- package/dist/figma/index.js +27 -0
- package/dist/figma/run-figma-check.js +82 -0
- package/dist/figma/seam.js +91 -0
- package/dist/figma/target-config.js +52 -0
- package/dist/figma/types.js +2 -0
- package/dist/figma/utils.js +128 -0
- package/dist/offline/run-offline-snapshots.js +18 -3
- package/dist/open-eyes.js +2 -0
- package/dist/ufg/build-accessibility-report-options.js +40 -0
- package/dist/ufg/check-and-close.js +14 -5
- package/dist/ufg/check.js +10 -1
- package/package.json +16 -15
- package/types/automation/types.d.ts +9 -0
- package/types/autonomous/types.d.ts +1 -0
- package/types/figma/client/figma-req.d.ts +9 -0
- package/types/figma/client/figma-rest.d.ts +24 -0
- package/types/figma/client/index.d.ts +2 -0
- package/types/figma/figma-images.d.ts +6 -0
- package/types/figma/figma.d.ts +21 -0
- package/types/figma/index.d.ts +8 -0
- package/types/figma/run-figma-check.d.ts +13 -0
- package/types/figma/seam.d.ts +12 -0
- package/types/figma/target-config.d.ts +7 -0
- package/types/figma/types.d.ts +69 -0
- package/types/figma/utils.d.ts +26 -0
- package/types/types.d.ts +1 -0
- package/types/ufg/build-accessibility-report-options.d.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.68.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -61,18 +61,19 @@
|
|
|
61
61
|
"setup:standalone": "sh -c 'yarn chromedriver --port=4444 --verbose &'"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@applitools/core-base": "1.
|
|
64
|
+
"@applitools/core-base": "1.38.0",
|
|
65
65
|
"@applitools/dom-capture": "11.8.4",
|
|
66
|
-
"@applitools/dom-snapshot": "4.17.
|
|
67
|
-
"@applitools/driver": "1.26.
|
|
68
|
-
"@applitools/ec-client": "1.12.
|
|
66
|
+
"@applitools/dom-snapshot": "4.17.8",
|
|
67
|
+
"@applitools/driver": "1.26.7",
|
|
68
|
+
"@applitools/ec-client": "1.12.41",
|
|
69
|
+
"@applitools/image": "1.3.0",
|
|
69
70
|
"@applitools/logger": "2.3.0",
|
|
70
|
-
"@applitools/nml-client": "1.11.
|
|
71
|
+
"@applitools/nml-client": "1.11.39",
|
|
71
72
|
"@applitools/req": "1.11.2",
|
|
72
|
-
"@applitools/screenshoter": "3.12.
|
|
73
|
-
"@applitools/snippets": "2.9.
|
|
73
|
+
"@applitools/screenshoter": "3.12.27",
|
|
74
|
+
"@applitools/snippets": "2.9.5",
|
|
74
75
|
"@applitools/socket": "1.3.15",
|
|
75
|
-
"@applitools/ufg-client": "1.
|
|
76
|
+
"@applitools/ufg-client": "1.23.0",
|
|
76
77
|
"@applitools/utils": "1.15.1",
|
|
77
78
|
"abort-controller": "3.0.0",
|
|
78
79
|
"chalk": "4.1.2",
|
|
@@ -83,10 +84,10 @@
|
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
86
|
"@applitools/bongo": "^5.10.0",
|
|
86
|
-
"@applitools/spec-driver-playwright": "^1.9.
|
|
87
|
-
"@applitools/spec-driver-puppeteer": "^1.8.
|
|
88
|
-
"@applitools/spec-driver-selenium": "^1.8.
|
|
89
|
-
"@applitools/spec-driver-webdriver": "^1.6.
|
|
87
|
+
"@applitools/spec-driver-playwright": "^1.9.7",
|
|
88
|
+
"@applitools/spec-driver-puppeteer": "^1.8.7",
|
|
89
|
+
"@applitools/spec-driver-selenium": "^1.8.7",
|
|
90
|
+
"@applitools/spec-driver-webdriver": "^1.6.7",
|
|
90
91
|
"@applitools/test-server": "^1.4.6",
|
|
91
92
|
"@applitools/test-utils": "^1.5.17",
|
|
92
93
|
"@applitools/tunnel-client": "^1.12.2",
|
|
@@ -120,10 +121,10 @@
|
|
|
120
121
|
"puppeteer": true,
|
|
121
122
|
"ws>bufferutil": false,
|
|
122
123
|
"ws>utf-8-validate": false,
|
|
123
|
-
"@applitools/core-base>@applitools/image>sharp": false,
|
|
124
124
|
"@swc-node/register>@swc/core": false,
|
|
125
125
|
"selenium-webdriver>ws>bufferutil": false,
|
|
126
|
-
"selenium-webdriver>ws>utf-8-validate": false
|
|
126
|
+
"selenium-webdriver>ws>utf-8-validate": false,
|
|
127
|
+
"@applitools/image>sharp": false
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
@@ -3,6 +3,7 @@ import type * as BaseCore from '@applitools/core-base/types';
|
|
|
3
3
|
import { type SpecType, type Driver, type ElementReference, type ContextReference } from '@applitools/driver';
|
|
4
4
|
import { type NMLClient, type NMLClientSettings } from '@applitools/nml-client';
|
|
5
5
|
import { type Logger } from '@applitools/logger';
|
|
6
|
+
import type { FigmaOptions } from '../figma/types';
|
|
6
7
|
export type * from '@applitools/core-base/types';
|
|
7
8
|
export type DriverTarget<TSpec extends SpecType> = TSpec['driver'] | Driver<TSpec>;
|
|
8
9
|
export type Target<TSpec extends SpecType> = DriverTarget<TSpec> | BaseCore.Target;
|
|
@@ -180,4 +181,12 @@ export type OpenSettings = BaseCore.OpenSettings & {
|
|
|
180
181
|
disableBrokerUrlCache?: boolean;
|
|
181
182
|
environments?: Environment[];
|
|
182
183
|
bypassCSP?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* @internal Resolved in core's open-eyes (the Figma seam) before session creation and stripped
|
|
186
|
+
* from the wire config — it is not part of the cross-language wire contract, but is available to
|
|
187
|
+
* every SDK that routes its opens through core.
|
|
188
|
+
*/
|
|
189
|
+
figmaBaselines?: string | Record<string, string | string[]>;
|
|
190
|
+
/** @internal Read and stripped by the Figma seam during open, like `figmaBaselines` — never reaches the wire. */
|
|
191
|
+
figmaOptions?: FigmaOptions;
|
|
183
192
|
};
|
|
@@ -71,6 +71,7 @@ export type StartedRender = {
|
|
|
71
71
|
settings: UFGCore.SafeCheckSettings;
|
|
72
72
|
environment: UFGCore.ExactEnvironment;
|
|
73
73
|
account: UFGCore.Account;
|
|
74
|
+
accessibilityReportLocation?: string;
|
|
74
75
|
};
|
|
75
76
|
export type RenderResult = {
|
|
76
77
|
status: 'rendering' | 'rendered' | 'error';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Req, type Proxy } from '@applitools/req';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
export declare const FIGMA_API = "https://api.figma.com/v1";
|
|
4
|
+
export type FigmaReqOptions = {
|
|
5
|
+
proxy?: Proxy;
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
maxRateLimitWaitSeconds?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function makeFigmaReq({ proxy, logger, maxRateLimitWaitSeconds }?: FigmaReqOptions): Req;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Logger } from '@applitools/logger';
|
|
2
|
+
import type { Proxy, Req } from '@applitools/req';
|
|
3
|
+
import type { FigmaImageResult, FigmaNodeMetadata } from '../types';
|
|
4
|
+
export type FigmaRestOptions = {
|
|
5
|
+
tempPath?: string;
|
|
6
|
+
nodesCacheTtlSeconds?: number;
|
|
7
|
+
maxRateLimitWaitSeconds?: number;
|
|
8
|
+
/** Serve from the on-disk caches only; throw on any miss. */
|
|
9
|
+
skipApi?: boolean;
|
|
10
|
+
proxy?: Proxy;
|
|
11
|
+
/** Defaults to `makeFigmaReq(…)`; tests inject a stub. */
|
|
12
|
+
req?: Req;
|
|
13
|
+
logger?: Logger;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Cache names are hashed because Figma node ids are not filename-safe — an instance node id looks like
|
|
17
|
+
* `I1:2;3:4`, and `:` / `;` are illegal on Windows.
|
|
18
|
+
*
|
|
19
|
+
* `test/fixtures/figma-cache/seed.mjs` mirrors both functions — keep them in sync.
|
|
20
|
+
*/
|
|
21
|
+
export declare function figmaNodesCacheFileName(fileId: string, uniqueNodeIds: string[]): string;
|
|
22
|
+
export declare function figmaImageCacheFileName(fileId: string, nodeId: string, lastModifiedUnix: number): string;
|
|
23
|
+
export declare function fetchFigmaMetadata(urls: string[], accessToken: string, opts?: FigmaRestOptions): Promise<FigmaNodeMetadata[]>;
|
|
24
|
+
export declare function fetchFigmaImages(urls: string[], accessToken: string, opts?: FigmaRestOptions): Promise<FigmaImageResult[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function createPlaceholderPng(width: number, height: number, tempPath: string): Promise<string>;
|
|
2
|
+
export declare function createPaddedDesignImage(imagePath: string, width: number, height: number, minSize: number, tempPath: string): Promise<{
|
|
3
|
+
imagePath: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Logger } from '@applitools/logger';
|
|
2
|
+
import type { Proxy, Req } from '@applitools/req';
|
|
3
|
+
import type { OpenSettings } from '../automation/types';
|
|
4
|
+
import { type FigmaMode } from './utils';
|
|
5
|
+
import type { FigmaViewportOptions, FigmaBaselineDeps } from './types';
|
|
6
|
+
export declare function setFigmaBaselineFlow(figmaUrls: string[], originalConfig: Partial<OpenSettings>, deps: FigmaBaselineDeps, mode?: Exclude<FigmaMode, 'disabled'>, viewportOpts?: FigmaViewportOptions, logger?: Logger): Promise<Partial<OpenSettings>>;
|
|
7
|
+
export declare function setFigmaBaseline(configuration: Partial<OpenSettings>, figmaBaselines: string | Record<string, string | string[]>, opts?: {
|
|
8
|
+
accessToken?: string;
|
|
9
|
+
maxRateLimitWaitSeconds?: number;
|
|
10
|
+
nodesCacheTtlSeconds?: number;
|
|
11
|
+
tempPath?: string;
|
|
12
|
+
mode?: FigmaMode;
|
|
13
|
+
maxViewportHeight?: number;
|
|
14
|
+
minViewportSize?: number | null;
|
|
15
|
+
/** Serve from the disk caches only; throw on any miss. */
|
|
16
|
+
skipApi?: boolean;
|
|
17
|
+
proxy?: Proxy;
|
|
18
|
+
/** Defaults to the client's own req; tests inject a stub. */
|
|
19
|
+
req?: Req;
|
|
20
|
+
logger?: Logger;
|
|
21
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './utils';
|
|
3
|
+
export * from './target-config';
|
|
4
|
+
export * from './client';
|
|
5
|
+
export * from './figma-images';
|
|
6
|
+
export * from './figma';
|
|
7
|
+
export { runFigmaCheck } from './run-figma-check';
|
|
8
|
+
export { applyFigmaBaselines } from './seam';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FigmaReferenceConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Establishes/updates the Figma-reference baseline via a throwaway headless classic image test (checks
|
|
4
|
+
* each PNG, closes, deletes the result — the saved baseline persists). Uses core's own API, not the
|
|
5
|
+
* eyes layer (core cannot depend on `@applitools/eyes`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function runFigmaCheck(config: FigmaReferenceConfig, checks: Array<{
|
|
8
|
+
imagePath: string;
|
|
9
|
+
tag: string;
|
|
10
|
+
}>): Promise<{
|
|
11
|
+
isNew: boolean;
|
|
12
|
+
diffs: boolean;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OpenSettings } from '../automation/types';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
import { setFigmaBaseline } from './figma';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Resolves the `figmaBaselines` / `figmaOptions` open config once per open, then always strips both — they
|
|
7
|
+
* are off-the-wire and must never be logged or sent. The resolver mutates `settings` in place.
|
|
8
|
+
*
|
|
9
|
+
* The only place the Figma feature reads the environment; everything below it takes parameters. Each
|
|
10
|
+
* `figmaOptions` field wins over its env fallback.
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyFigmaBaselines(settings: Partial<OpenSettings>, logger: Logger, resolve?: typeof setFigmaBaseline): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OpenSettings, Environment } from '../automation/types';
|
|
2
|
+
import { type FigmaMode } from './utils';
|
|
3
|
+
import type { FigmaNodeMetadata, FigmaViewport, FigmaBaselineLink } from './types';
|
|
4
|
+
export declare const DEFAULT_MAX_VIEWPORT_HEIGHT = 800;
|
|
5
|
+
export declare const PLACEHOLDER_TAG = "(no design)";
|
|
6
|
+
export declare function deduplicateBrowsers(environments: Environment[], targetWidth: number, targetHeight: number): Environment[];
|
|
7
|
+
export declare function buildTargetTestConfig(originalConfig: Partial<OpenSettings>, metadata: FigmaNodeMetadata, figmaViewport: FigmaViewport, baselineLink: FigmaBaselineLink | null, mode: FigmaMode): Partial<OpenSettings>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { OpenSettings } from '../automation/types';
|
|
2
|
+
import type { FigmaMode } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* The user-facing `figmaOptions` open config. Precedence is per field, not per object: a field set here
|
|
5
|
+
* wins, one left unset falls back to that field's environment variable where it has one; `README.md`
|
|
6
|
+
* holds the per-field mapping.
|
|
7
|
+
*
|
|
8
|
+
* `APPLITOOLS_FIGMA_SKIP_API` has no field by design — it is a CI/debug switch, not a user option.
|
|
9
|
+
*/
|
|
10
|
+
export type FigmaOptions = FigmaViewportOptions & {
|
|
11
|
+
mode?: FigmaMode;
|
|
12
|
+
accessToken?: string;
|
|
13
|
+
maxRateLimitWaitSeconds?: number;
|
|
14
|
+
nodesCacheTtlSeconds?: number;
|
|
15
|
+
tempPath?: string;
|
|
16
|
+
};
|
|
17
|
+
export type FigmaNodeRef = {
|
|
18
|
+
fileId: string;
|
|
19
|
+
nodeId: string;
|
|
20
|
+
};
|
|
21
|
+
export type FigmaNodeMetadata = {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
revision: string;
|
|
27
|
+
lastModifiedAt: string;
|
|
28
|
+
};
|
|
29
|
+
export type FigmaImageResult = {
|
|
30
|
+
imagePath: string;
|
|
31
|
+
metadata: FigmaNodeMetadata;
|
|
32
|
+
};
|
|
33
|
+
export type FigmaViewport = {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
export type FigmaViewportOptions = {
|
|
38
|
+
maxViewportHeight?: number;
|
|
39
|
+
/**
|
|
40
|
+
* One dimension, not a width/height pair: the same floor applies to both axes independently, so 320
|
|
41
|
+
* means "at least 320 wide AND at least 320 tall". `null` disables the floor.
|
|
42
|
+
*/
|
|
43
|
+
minViewportSize?: number | null;
|
|
44
|
+
};
|
|
45
|
+
export type FigmaBaselineLink = {
|
|
46
|
+
figmaEnvName: string;
|
|
47
|
+
useLatestEnvBaseline: boolean;
|
|
48
|
+
};
|
|
49
|
+
/** The throwaway Figma-reference test's config: a subset of core `OpenSettings` plus `saveNewTests` (maps to close's `updateBaselineIfNew`). */
|
|
50
|
+
export type FigmaReferenceConfig = Partial<OpenSettings> & {
|
|
51
|
+
saveNewTests?: boolean;
|
|
52
|
+
};
|
|
53
|
+
export type FigmaBaselineDeps = {
|
|
54
|
+
fetchFigmaImages: (figmaUrls: string[]) => Promise<FigmaImageResult[]>;
|
|
55
|
+
fetchFigmaMetadata: (figmaUrls: string[]) => Promise<FigmaNodeMetadata[]>;
|
|
56
|
+
createPlaceholderImage: (width: number, height: number) => Promise<string>;
|
|
57
|
+
padDesignImage: (imagePath: string, width: number, height: number, minViewportSize: number) => Promise<{
|
|
58
|
+
imagePath: string;
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
}>;
|
|
62
|
+
runFigmaCheck: (config: FigmaReferenceConfig, checks: Array<{
|
|
63
|
+
imagePath: string;
|
|
64
|
+
tag: string;
|
|
65
|
+
}>) => Promise<{
|
|
66
|
+
isNew: boolean;
|
|
67
|
+
diffs: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FigmaNodeRef, FigmaNodeMetadata, FigmaViewport } from './types';
|
|
2
|
+
export declare function isFigmaUrl(url: string): boolean;
|
|
3
|
+
export declare function parseFigmaNodeUrl(url: string): FigmaNodeRef;
|
|
4
|
+
/**
|
|
5
|
+
* The tag becomes the Eyes baseline step name, and Eyes matches steps by name, so it must derive only from
|
|
6
|
+
* stable identity. Figma's "Copy link to selection" appends a `t=` param that differs on every copy —
|
|
7
|
+
* keeping it means re-copying the link renames the step and orphans its accepted baseline.
|
|
8
|
+
*
|
|
9
|
+
* Drop only `t`: `node-id` is what distinguishes two frames of the same file, so stripping the whole query
|
|
10
|
+
* would give every frame in a file the same step name.
|
|
11
|
+
*/
|
|
12
|
+
export declare function figmaStepTag(figmaUrl: string): string;
|
|
13
|
+
export declare function resolveFigmaUrls(figmaBaselines: string | Record<string, string | string[]>, testName: string | undefined): string[] | null;
|
|
14
|
+
export declare const FIGMA_MODES: readonly ["figma-baseline", "test-baseline", "auto-baseline", "disabled"];
|
|
15
|
+
export type FigmaMode = (typeof FIGMA_MODES)[number];
|
|
16
|
+
export declare function resolveFigmaMode(value: string | undefined): FigmaMode;
|
|
17
|
+
export declare function figmaMetadataToProperties(metadata: FigmaNodeMetadata, mode: FigmaMode): Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function boundingViewport(viewports: FigmaViewport[]): FigmaViewport;
|
|
22
|
+
export declare function computeFigmaViewport(stepViewports: FigmaViewport[], maxViewportHeight: number): FigmaViewport;
|
|
23
|
+
export declare function paddedDesignSize(width: number, height: number, minSize: number): {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
package/types/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { type Logger } from '@applitools/logger';
|
|
|
8
8
|
import { type ECClient, type ECClientSettings } from '@applitools/ec-client';
|
|
9
9
|
export { ECClient };
|
|
10
10
|
export * from './automation/types';
|
|
11
|
+
export type { FigmaOptions } from './figma/types';
|
|
11
12
|
export { DEFAULT_CONCURRENCY } from '@applitools/core-base';
|
|
12
13
|
export type TypedCore<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = TType extends 'ufg' ? UFGCore.Core<TSpec> : ClassicCore.Core<TSpec>;
|
|
13
14
|
export type TypedEyes<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = TType extends 'ufg' ? UFGCore.Eyes<TSpec> : ClassicCore.Eyes<TSpec>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Account } from '@applitools/core-base';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the `accessibilityReportOptions` render option: forwards `runOptions` verbatim and fills the
|
|
4
|
+
* `uploadUrl` template's `__report_id__` with a fresh random id. Returns `undefined` when the account
|
|
5
|
+
* has no accessibility options.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildAccessibilityReportOptions({ accessibilityOptions, reportId, }: {
|
|
8
|
+
accessibilityOptions?: Account['accessibilityOptions'];
|
|
9
|
+
reportId?: string;
|
|
10
|
+
}): {
|
|
11
|
+
axeCoreOptions: unknown;
|
|
12
|
+
uploadUrl: string;
|
|
13
|
+
} | undefined;
|