@applitools/core 4.18.2 → 4.20.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 +69 -0
- package/dist/autonomous/core.js +1 -1
- package/dist/autonomous/create-render-target.js +2 -15
- package/dist/autonomous/take-snapshots.js +6 -2
- package/dist/classic/core.js +2 -2
- package/dist/classic/utils/take-dom-capture.js +1 -0
- package/dist/cli/cli.js +20 -0
- package/dist/core.js +6 -3
- package/dist/make-manager.js +4 -3
- package/dist/open-eyes.js +61 -1
- package/dist/run-offline-snapshots.js +346 -0
- package/dist/ufg/check.js +40 -96
- package/dist/ufg/core.js +4 -3
- package/dist/ufg/create-render-target-from-snapshot.js +21 -0
- package/dist/ufg/get-ufg-client.js +2 -2
- package/dist/ufg/take-snapshots.js +4 -6
- package/dist/ufg/utils/generate-safe-selectors.js +18 -18
- package/dist/ufg/utils/take-dom-snapshots.js +13 -14
- package/dist/{log-event.js → utils/ensure-offline-folder.js} +15 -11
- package/package.json +13 -12
- package/types/autonomous/create-render-target.d.ts +2 -2
- package/types/autonomous/start-renders.d.ts +2 -2
- package/types/autonomous/take-snapshots.d.ts +3 -2
- package/types/autonomous/types.d.ts +5 -5
- package/types/classic/core.d.ts +2 -1
- package/types/classic/utils/take-dom-capture.d.ts +8 -0
- package/types/make-manager.d.ts +2 -1
- package/types/run-offline-snapshots.d.ts +5 -0
- package/types/ufg/core.d.ts +2 -1
- package/types/ufg/create-render-target-from-snapshot.d.ts +8 -0
- package/types/ufg/get-ufg-client.d.ts +2 -1
- package/types/ufg/take-snapshots.d.ts +4 -6
- package/types/ufg/types.d.ts +3 -3
- package/types/ufg/utils/generate-safe-selectors.d.ts +18 -12
- package/types/utils/ensure-offline-folder.d.ts +1 -0
- package/types/log-event.d.ts +0 -12
|
@@ -27,37 +27,37 @@ exports.generateSafeSelectors = void 0;
|
|
|
27
27
|
const utils = __importStar(require("@applitools/utils"));
|
|
28
28
|
const { addElementIds, cleanupElementIds } = require('@applitools/snippets');
|
|
29
29
|
async function generateSafeSelectors({ context, elementReferences, }) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
if (!(elementReferences === null || elementReferences === void 0 ? void 0 : elementReferences.length))
|
|
31
|
+
return;
|
|
32
|
+
const mapping = await Promise.all(elementReferences.map(async (ref) => {
|
|
33
|
+
const elements = await context.elements(ref);
|
|
34
|
+
return {
|
|
35
|
+
ref,
|
|
36
|
+
elements,
|
|
37
|
+
id: utils.general.guid(), // same id for all elements that match the same ref
|
|
38
|
+
};
|
|
39
|
+
}));
|
|
40
|
+
// we can't structure elementsWithIds as object because it's not supported in safari webdriver (https://stackoverflow.com/questions/78953951/ios-safari-webdriver-executescript-fails-to-serialize-objects-with-elements)
|
|
41
|
+
const elementsWithIds = mapping.map(({ elements, id }) => [elements, id]);
|
|
42
|
+
const generatedSelectors = (await context.execute(addElementIds, elementsWithIds)).flat();
|
|
43
43
|
let offset = 0;
|
|
44
|
-
const selectors = mapping.
|
|
44
|
+
const selectors = mapping.map(({ elements, ref }) => {
|
|
45
45
|
if (elements.length === 0)
|
|
46
|
-
return { safeSelector: null, originalSelector: null, elementReference:
|
|
46
|
+
return { safeSelector: null, originalSelector: null, elementReference: ref };
|
|
47
47
|
const safeSelector = generatedSelectors[offset].reduceRight((selector, value) => {
|
|
48
48
|
return selector ? { type: 'css', selector: value, shadow: selector } : { type: 'css', selector: value };
|
|
49
49
|
}, undefined);
|
|
50
50
|
offset += elements.length;
|
|
51
|
-
return { safeSelector, originalSelector: elements[0].commonSelector, elementReference:
|
|
51
|
+
return { safeSelector, originalSelector: elements[0].commonSelector, elementReference: ref };
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
54
|
selectors,
|
|
55
55
|
cleanupGeneratedSelectors,
|
|
56
56
|
};
|
|
57
57
|
async function cleanupGeneratedSelectors() {
|
|
58
|
-
if (!mapping.
|
|
58
|
+
if (!mapping.length)
|
|
59
59
|
return;
|
|
60
|
-
await context.execute(cleanupElementIds, [mapping.elements.flat()]);
|
|
60
|
+
await context.execute(cleanupElementIds, [mapping.map(({ elements }) => elements).flat()]);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.generateSafeSelectors = generateSafeSelectors;
|
|
@@ -51,13 +51,10 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
51
51
|
logger.log(`taking single dom snapshot`);
|
|
52
52
|
await beforeEachSnapshot();
|
|
53
53
|
// it's important that we calculate safe selectors as close as possible to taking the dom snapshot
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
elementReferences: settings.elementReferences,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
54
|
+
const safeSelectorResult = await (0, generate_safe_selectors_1.generateSafeSelectors)({
|
|
55
|
+
context: currentContext,
|
|
56
|
+
elementReferences: settings.elementReferences,
|
|
57
|
+
});
|
|
61
58
|
const snapshot = await (0, take_dom_snapshot_1.takeDomSnapshot)({ context: currentContext, settings, logger });
|
|
62
59
|
await ((_b = safeSelectorResult === null || safeSelectorResult === void 0 ? void 0 : safeSelectorResult.cleanupGeneratedSelectors) === null || _b === void 0 ? void 0 : _b.call(safeSelectorResult));
|
|
63
60
|
return Array(settings.environments.length).fill({ ...snapshot, generatedSelectors: safeSelectorResult === null || safeSelectorResult === void 0 ? void 0 : safeSelectorResult.selectors });
|
|
@@ -94,7 +91,11 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
94
91
|
}
|
|
95
92
|
requiredWidths.forEach((browsers, requiredWidth) => entries.push({ viewportSize: { width: requiredWidth, height: initialViewportSize.height }, browsers }));
|
|
96
93
|
logger.log(`All entries to take dom snapshots for`, entries);
|
|
97
|
-
|
|
94
|
+
// making safe selectors before any resize in order to make sure fallback selectors are created
|
|
95
|
+
let safeSelectorResult = await (0, generate_safe_selectors_1.generateSafeSelectors)({
|
|
96
|
+
context: currentContext,
|
|
97
|
+
elementReferences: settings.elementReferences,
|
|
98
|
+
});
|
|
98
99
|
const snapshots = Array(settings.environments.length);
|
|
99
100
|
for (const [index, { viewportSize, browsers }] of entries.entries()) {
|
|
100
101
|
logger.log(`Taking dom snapshot for viewport size ${viewportSize}`);
|
|
@@ -132,12 +133,10 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
132
133
|
}
|
|
133
134
|
await beforeEachSnapshot();
|
|
134
135
|
// it's important that we calculate safe selectors as close as possible to taking the dom snapshot
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
}
|
|
136
|
+
safeSelectorResult = await (0, generate_safe_selectors_1.generateSafeSelectors)({
|
|
137
|
+
context: currentContext,
|
|
138
|
+
elementReferences: settings.elementReferences,
|
|
139
|
+
});
|
|
141
140
|
const snapshot = await (0, take_dom_snapshot_1.takeDomSnapshot)({ context: currentContext, settings, logger });
|
|
142
141
|
browsers.forEach(({ index }) => (snapshots[index] = { ...snapshot, generatedSelectors: safeSelectorResult === null || safeSelectorResult === void 0 ? void 0 : safeSelectorResult.selectors }));
|
|
143
142
|
}
|
|
@@ -22,17 +22,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
const
|
|
29
|
+
exports.ensureOfflineFolder = void 0;
|
|
30
|
+
const fs_1 = __importDefault(require("fs"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
28
32
|
const utils = __importStar(require("@applitools/utils"));
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
function ensureOfflineFolder() {
|
|
34
|
+
const offlineLocationPath = utils.general.getEnvValue('OFFLINE_LOCATION_PATH')
|
|
35
|
+
? path_1.default.resolve(utils.general.getEnvValue('OFFLINE_LOCATION_PATH'), `execution-${Date.now()}`)
|
|
36
|
+
: undefined;
|
|
37
|
+
if (offlineLocationPath) {
|
|
38
|
+
fs_1.default.mkdirSync(offlineLocationPath, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
return offlineLocationPath;
|
|
37
41
|
}
|
|
38
|
-
exports.
|
|
42
|
+
exports.ensureOfflineFolder = ensureOfflineFolder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.20.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -74,25 +74,26 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@applitools/core-base": "1.
|
|
78
|
-
"@applitools/dom-capture": "11.
|
|
77
|
+
"@applitools/core-base": "1.17.0",
|
|
78
|
+
"@applitools/dom-capture": "11.5.0",
|
|
79
79
|
"@applitools/dom-snapshot": "4.11.3",
|
|
80
|
-
"@applitools/driver": "1.19.
|
|
81
|
-
"@applitools/ec-client": "1.9.
|
|
80
|
+
"@applitools/driver": "1.19.1",
|
|
81
|
+
"@applitools/ec-client": "1.9.6",
|
|
82
82
|
"@applitools/logger": "2.0.18",
|
|
83
|
-
"@applitools/nml-client": "1.8.
|
|
83
|
+
"@applitools/nml-client": "1.8.11",
|
|
84
84
|
"@applitools/req": "1.7.2",
|
|
85
|
-
"@applitools/screenshoter": "3.8.
|
|
86
|
-
"@applitools/snippets": "2.
|
|
85
|
+
"@applitools/screenshoter": "3.8.37",
|
|
86
|
+
"@applitools/snippets": "2.5.0",
|
|
87
87
|
"@applitools/socket": "1.1.18",
|
|
88
|
-
"@applitools/spec-driver-webdriver": "1.1.
|
|
89
|
-
"@applitools/ufg-client": "1.
|
|
88
|
+
"@applitools/spec-driver-webdriver": "1.1.13",
|
|
89
|
+
"@applitools/ufg-client": "1.13.0",
|
|
90
90
|
"@applitools/utils": "1.7.4",
|
|
91
91
|
"@types/ws": "8.5.5",
|
|
92
92
|
"abort-controller": "3.0.0",
|
|
93
93
|
"chalk": "4.1.2",
|
|
94
94
|
"node-fetch": "2.6.7",
|
|
95
95
|
"semver": "7.6.2",
|
|
96
|
+
"tar": "7.4.3",
|
|
96
97
|
"webdriver": "7.31.1",
|
|
97
98
|
"ws": "8.17.1",
|
|
98
99
|
"yargs": "17.7.2"
|
|
@@ -100,8 +101,8 @@
|
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@applitools/bongo": "^5.10.0",
|
|
102
103
|
"@applitools/sea": "^1.0.0",
|
|
103
|
-
"@applitools/spec-driver-puppeteer": "^1.4.
|
|
104
|
-
"@applitools/spec-driver-selenium": "^1.5.
|
|
104
|
+
"@applitools/spec-driver-puppeteer": "^1.4.13",
|
|
105
|
+
"@applitools/spec-driver-selenium": "^1.5.84",
|
|
105
106
|
"@applitools/test-server": "^1.2.2",
|
|
106
107
|
"@applitools/test-utils": "^1.5.17",
|
|
107
108
|
"@applitools/tunnel-client": "^1.5.8",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Core as UFGCore } from '../ufg/types';
|
|
2
|
-
import type { Snapshot,
|
|
2
|
+
import type { Snapshot, RenderTargetWithSettings } from './types';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
4
|
type Options = {
|
|
5
5
|
core: UFGCore<any>;
|
|
@@ -8,5 +8,5 @@ type Options = {
|
|
|
8
8
|
export declare function makeCreateRenderTarget({ core, logger: defaultLogger }: Options): ({ snapshot, logger, }: {
|
|
9
9
|
snapshot: Snapshot;
|
|
10
10
|
logger: Logger;
|
|
11
|
-
}) => Promise<
|
|
11
|
+
}) => Promise<RenderTargetWithSettings>;
|
|
12
12
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Core as UFGCore } from '../ufg/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RenderTargetWithSettings, StartedRender } from './types';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
4
|
type Options = {
|
|
5
5
|
core: UFGCore<any>;
|
|
6
6
|
logger: Logger;
|
|
7
7
|
};
|
|
8
8
|
export declare function makeStartRenders({ core, logger: defaultLogger }: Options): ({ targets, logger, }: {
|
|
9
|
-
targets:
|
|
9
|
+
targets: RenderTargetWithSettings[];
|
|
10
10
|
logger: Logger;
|
|
11
11
|
}) => Promise<StartedRender[]>;
|
|
12
12
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Core as UFGCore } from '../ufg/types';
|
|
2
2
|
import type { DriverTarget, SnapshotSettings, Snapshot } from './types';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
|
-
import { type SpecType } from '@applitools/driver';
|
|
4
|
+
import { type SpecDriver, type SpecType } from '@applitools/driver';
|
|
5
5
|
type Options<TSpec extends SpecType> = {
|
|
6
6
|
core: UFGCore<TSpec>;
|
|
7
|
+
spec: SpecDriver<TSpec>;
|
|
7
8
|
logger: Logger;
|
|
8
9
|
};
|
|
9
|
-
export declare function makeTakeSnapshots<TSpec extends SpecType>({ core, logger: defaultLogger }: Options<TSpec>): ({ target, settings, logger, }: {
|
|
10
|
+
export declare function makeTakeSnapshots<TSpec extends SpecType>({ core, spec, logger: defaultLogger }: Options<TSpec>): ({ target, settings, logger, }: {
|
|
10
11
|
target: DriverTarget<TSpec>;
|
|
11
12
|
settings: SnapshotSettings<TSpec>;
|
|
12
13
|
logger?: Logger | undefined;
|
|
@@ -2,7 +2,7 @@ import type { Eyes as BaseEyes, ImageTarget as BaseImageTarget, OpenSettings as
|
|
|
2
2
|
import type * as UFGCore from '../ufg/types';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
4
|
import { type SpecType } from '@applitools/driver';
|
|
5
|
-
import { type RenderTarget
|
|
5
|
+
import { type RenderTarget, type StartedRender as UFGStartedRender } from '@applitools/ufg-client';
|
|
6
6
|
export * from '../ufg/types';
|
|
7
7
|
export interface AutonomousCore<TSpec extends SpecType> {
|
|
8
8
|
readonly type: 'autonomous';
|
|
@@ -14,9 +14,9 @@ export interface AutonomousCore<TSpec extends SpecType> {
|
|
|
14
14
|
createRenderTarget(options: {
|
|
15
15
|
snapshot: UFGCore.Snapshot;
|
|
16
16
|
logger?: Logger;
|
|
17
|
-
}): Promise<
|
|
17
|
+
}): Promise<RenderTargetWithSettings>;
|
|
18
18
|
startRenders(options: {
|
|
19
|
-
targets:
|
|
19
|
+
targets: RenderTargetWithSettings[];
|
|
20
20
|
logger?: Logger;
|
|
21
21
|
}): Promise<StartedRender[]>;
|
|
22
22
|
getRenderResults(options: {
|
|
@@ -34,8 +34,8 @@ export interface AutonomousCore<TSpec extends SpecType> {
|
|
|
34
34
|
}): Promise<BaseEyes>;
|
|
35
35
|
}
|
|
36
36
|
export type SnapshotSettings<TSpec extends SpecType> = UFGCore.SnapshotSettings<TSpec> & UFGCore.EyesServerSettings;
|
|
37
|
-
export type
|
|
38
|
-
target:
|
|
37
|
+
export type RenderTargetWithSettings = {
|
|
38
|
+
target: RenderTarget;
|
|
39
39
|
settings: UFGCore.SafeCheckSettings;
|
|
40
40
|
environment: UFGCore.RenderEnvironment;
|
|
41
41
|
account: UFGCore.Account;
|
package/types/classic/core.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ type Options<TSpec extends SpecType> = {
|
|
|
13
13
|
agentId?: string;
|
|
14
14
|
cwd?: string;
|
|
15
15
|
logger?: Logger;
|
|
16
|
+
offlineLocationPath?: string;
|
|
16
17
|
};
|
|
17
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, agentId, cwd, logger: defaultLogger, }: Options<TSpec>): Core<TSpec>;
|
|
18
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, agentId, cwd, logger: defaultLogger, offlineLocationPath, }: Options<TSpec>): Core<TSpec>;
|
|
18
19
|
export {};
|
|
@@ -8,6 +8,14 @@ export type DomCaptureSettings = {
|
|
|
8
8
|
chunkByteLength?: number;
|
|
9
9
|
proxy?: Proxy;
|
|
10
10
|
fetch?: Fetch;
|
|
11
|
+
domCaptureArgs?: {
|
|
12
|
+
styleProps?: string[] | boolean;
|
|
13
|
+
rectProps?: string[];
|
|
14
|
+
elementProps?: string[];
|
|
15
|
+
capturePseudo?: boolean;
|
|
16
|
+
addStats?: boolean;
|
|
17
|
+
fetchTimeLimit?: number;
|
|
18
|
+
};
|
|
11
19
|
};
|
|
12
20
|
export declare function takeDomCapture<TSpec extends SpecType>({ driver, settings, logger, }: {
|
|
13
21
|
driver: Driver<TSpec>;
|
package/types/make-manager.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ type Options<TSpec extends SpecType> = {
|
|
|
17
17
|
cwd?: string;
|
|
18
18
|
logger: Logger;
|
|
19
19
|
asyncCache?: AsyncCache;
|
|
20
|
+
offlineLocationPath?: string;
|
|
20
21
|
};
|
|
21
|
-
export declare function makeMakeManager<TSpec extends SpecType>({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd, logger: mainLogger, asyncCache, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
|
|
22
|
+
export declare function makeMakeManager<TSpec extends SpecType>({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd, logger: mainLogger, asyncCache, offlineLocationPath, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
|
|
22
23
|
type?: TType | undefined;
|
|
23
24
|
settings?: ManagerSettings | undefined;
|
|
24
25
|
logger?: Logger | undefined;
|
package/types/ufg/core.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type Options<TSpec extends SpecType> = {
|
|
|
17
17
|
agentId?: string;
|
|
18
18
|
cwd?: string;
|
|
19
19
|
logger?: Logger;
|
|
20
|
+
offlineLocationPath?: string;
|
|
20
21
|
};
|
|
21
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, concurrency, fetchConcurrency, agentId, cwd, logger: defaultLogger, }: Options<TSpec>): Core<TSpec>;
|
|
22
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId, cwd, logger: defaultLogger, }: Options<TSpec>): Core<TSpec>;
|
|
22
23
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UFGClient, RenderTarget } from '@applitools/ufg-client';
|
|
2
|
+
import { Snapshot } from './types';
|
|
3
|
+
import { Logger } from '@applitools/logger';
|
|
4
|
+
export declare function createRenderTargetFromSnapshot({ ufgClient, snapshot, logger, }: {
|
|
5
|
+
ufgClient: UFGClient;
|
|
6
|
+
snapshot: Snapshot;
|
|
7
|
+
logger: Logger;
|
|
8
|
+
}): Promise<RenderTarget>;
|
|
@@ -5,8 +5,9 @@ type Options = {
|
|
|
5
5
|
fetchConcurrency?: number;
|
|
6
6
|
logger: Logger;
|
|
7
7
|
asyncCache?: AsyncCache;
|
|
8
|
+
offlineLocationPath?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare function makeGetUFGClient({ client, fetchConcurrency, logger: mainLogger, asyncCache }: Options): (({ settings, logger }: {
|
|
10
|
+
export declare function makeGetUFGClient({ client, fetchConcurrency, offlineLocationPath, logger: mainLogger, asyncCache, }: Options): (({ settings, logger }: {
|
|
10
11
|
settings: UFGClientSettings;
|
|
11
12
|
logger?: Logger | undefined;
|
|
12
13
|
}) => Promise<UFGClient>) & {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type Environment as UFGEnvironment } from '@applitools/ufg-client';
|
|
1
|
+
import type { Core, SnapshotSettings, Account, Snapshot } from './types';
|
|
3
2
|
import { type AbortSignal } from 'abort-controller';
|
|
4
3
|
import { type Logger } from '@applitools/logger';
|
|
5
|
-
import { type SpecType, type SpecDriver } from '@applitools/driver';
|
|
4
|
+
import { type SpecType, type SpecDriver, type Driver } from '@applitools/driver';
|
|
6
5
|
type Options<TSpec extends SpecType> = {
|
|
7
6
|
core: Core<TSpec>;
|
|
8
7
|
spec: SpecDriver<TSpec>;
|
|
9
8
|
signal?: AbortSignal;
|
|
10
9
|
logger: Logger;
|
|
11
10
|
};
|
|
12
|
-
export declare function makeTakeSnapshots<TSpec extends SpecType>({ core, spec, signal, logger: mainLogger }: Options<TSpec>): ({
|
|
13
|
-
|
|
11
|
+
export declare function makeTakeSnapshots<TSpec extends SpecType>({ core, spec, signal, logger: mainLogger }: Options<TSpec>): ({ driver, settings, account, logger, }: {
|
|
12
|
+
driver: Driver<TSpec>;
|
|
14
13
|
settings?: SnapshotSettings<TSpec> | undefined;
|
|
15
|
-
environments?: UFGEnvironment[] | undefined;
|
|
16
14
|
account: Account;
|
|
17
15
|
logger?: Logger | undefined;
|
|
18
16
|
}) => Promise<Snapshot[]>;
|
package/types/ufg/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybeArray } from '@applitools/utils';
|
|
2
2
|
import type * as AutomationCore from '../automation/types';
|
|
3
|
-
import { type SpecType, type CommonSelector } from '@applitools/driver';
|
|
3
|
+
import { type SpecType, type CommonSelector, type Driver } from '@applitools/driver';
|
|
4
4
|
import { type Logger } from '@applitools/logger';
|
|
5
5
|
import { type Proxy } from '@applitools/req';
|
|
6
6
|
import { type UFGClient, type UFGClientSettings, type Selector as UFGSelector, type Environment as UFGEnvironment, type DomSnapshot as UFGDomSnapshot, type AndroidSnapshot as UFGAndroidSnapshot, type IOSSnapshot as UFGIOSSnapshot } from '@applitools/ufg-client';
|
|
@@ -13,7 +13,7 @@ export type DomSnapshot = UFGDomSnapshot & {
|
|
|
13
13
|
};
|
|
14
14
|
export type AndroidSnapshot = UFGAndroidSnapshot;
|
|
15
15
|
export type IOSSnapshot = UFGIOSSnapshot;
|
|
16
|
-
export type SnapshotTarget = MaybeArray<
|
|
16
|
+
export type SnapshotTarget = MaybeArray<Snapshot>;
|
|
17
17
|
export type Target<TSpec extends SpecType> = SnapshotTarget | AutomationCore.Target<TSpec>;
|
|
18
18
|
export interface Core<TSpec extends SpecType> extends AutomationCore.Core<TSpec> {
|
|
19
19
|
readonly type: 'ufg';
|
|
@@ -22,7 +22,7 @@ export interface Core<TSpec extends SpecType> extends AutomationCore.Core<TSpec>
|
|
|
22
22
|
logger?: Logger;
|
|
23
23
|
}): Promise<UFGClient>;
|
|
24
24
|
takeSnapshots?(options: {
|
|
25
|
-
|
|
25
|
+
driver: Driver<TSpec>;
|
|
26
26
|
settings?: SnapshotSettings<TSpec>;
|
|
27
27
|
account: AutomationCore.Account;
|
|
28
28
|
logger?: Logger;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { type SpecType, type Context, type ElementReference, type CommonSelector } from '@applitools/driver';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}): Promise<{
|
|
6
|
-
selectors: ({
|
|
7
|
-
safeSelector: null;
|
|
8
|
-
originalSelector: null;
|
|
9
|
-
elementReference: ElementReference<TSpec>;
|
|
10
|
-
} | {
|
|
11
|
-
safeSelector: CommonSelector;
|
|
2
|
+
type GeneratedSafeSelector<TSpec extends SpecType> = {
|
|
3
|
+
selectors: {
|
|
4
|
+
safeSelector: CommonSelector | null;
|
|
12
5
|
originalSelector: CommonSelector | null;
|
|
13
6
|
elementReference: ElementReference<TSpec>;
|
|
14
|
-
}
|
|
7
|
+
}[];
|
|
15
8
|
cleanupGeneratedSelectors: () => Promise<void>;
|
|
16
|
-
}
|
|
9
|
+
};
|
|
10
|
+
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
11
|
+
context: Context<TSpec>;
|
|
12
|
+
elementReferences: ElementReference<TSpec>[];
|
|
13
|
+
}): Promise<GeneratedSafeSelector<TSpec>>;
|
|
14
|
+
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
15
|
+
context: Context<TSpec>;
|
|
16
|
+
elementReferences: undefined | [];
|
|
17
|
+
}): Promise<undefined>;
|
|
18
|
+
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
19
|
+
context: Context<TSpec>;
|
|
20
|
+
elementReferences?: ElementReference<TSpec>[];
|
|
21
|
+
}): Promise<GeneratedSafeSelector<TSpec> | undefined>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureOfflineFolder(): string | undefined;
|
package/types/log-event.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { MaybeArray } from '@applitools/utils';
|
|
2
|
-
import type { Core, LogEventSettings } from './types';
|
|
3
|
-
import { type Logger } from '@applitools/logger';
|
|
4
|
-
type Options = {
|
|
5
|
-
core: Core<any>;
|
|
6
|
-
logger: Logger;
|
|
7
|
-
};
|
|
8
|
-
export declare function makeLogEvent({ core, logger: mainLogger }: Options): ({ settings, logger, }: {
|
|
9
|
-
settings: MaybeArray<LogEventSettings>;
|
|
10
|
-
logger?: Logger | undefined;
|
|
11
|
-
}) => Promise<void>;
|
|
12
|
-
export {};
|