@applitools/core 4.58.2 → 4.59.1-debug.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 +180 -0
- package/dist/cli/cli.js +160 -0
- package/dist/core.js +1 -1
- package/dist/ufg/check-and-close.js +1 -1
- package/dist/ufg/check.js +1 -1
- package/dist/ufg/core.js +1 -1
- package/dist/ufg/create-render-target-from-snapshot.js +1 -0
- package/dist/ufg/take-snapshots.js +3 -18
- package/dist/ufg/utils/take-dom-snapshot.js +1 -0
- package/dist/ufg/utils/to-generated-selectors.js +3 -9
- package/dist/universal/core-server-process.js +31 -0
- package/dist/universal/core-server.js +216 -0
- package/dist/universal/history.js +90 -0
- package/dist/universal/refer.js +67 -0
- package/dist/universal/spec-driver.js +189 -0
- package/dist/universal/types.js +2 -0
- package/dist/universal/ws-server.js +66 -0
- package/dist/utils/extract-git-info.js +23 -8
- package/package.json +20 -19
- package/types/automation/types.d.ts +2 -0
- package/types/cli/cli.d.ts +2 -0
- package/types/ufg/check-and-close.d.ts +1 -0
- package/types/ufg/take-snapshots.d.ts +2 -3
- package/types/ufg/types.d.ts +2 -0
- package/types/ufg/utils/take-dom-snapshot.d.ts +2 -0
- package/types/ufg/utils/to-generated-selectors.d.ts +1 -2
- package/types/universal/core-server-process.d.ts +9 -0
- package/types/universal/core-server.d.ts +18 -0
- package/types/universal/history.d.ts +2 -0
- package/types/universal/refer.d.ts +8 -0
- package/types/universal/spec-driver.d.ts +15 -0
- package/types/universal/types.d.ts +205 -0
- package/types/universal/ws-server.d.ts +15 -0
- package/types/utils/extract-git-info.d.ts +1 -0
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.extractBranchLookupFallbackList = exports.isISODate = exports.extractBranchingTimestamp = exports.extractBuildIdFromCI = exports.extractGitRepo = exports.extractGitBranch = exports.extractLatestCommitInfo = exports.getPrimaryRemoteName = exports.cacheKey = void 0;
|
|
29
|
+
exports.extractBranchLookupFallbackList = exports.isISODate = exports.extractBranchingTimestamp = exports.extractBuildIdFromCI = exports.extractCIBranchName = exports.extractGitRepo = exports.extractGitBranch = exports.extractLatestCommitInfo = exports.getPrimaryRemoteName = exports.cacheKey = void 0;
|
|
30
30
|
const utils = __importStar(require("@applitools/utils"));
|
|
31
31
|
const fs_1 = __importDefault(require("fs"));
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
@@ -89,20 +89,24 @@ exports.extractLatestCommitInfo = utils.general.cachify(async function ({ execOp
|
|
|
89
89
|
}
|
|
90
90
|
}, () => exports.cacheKey);
|
|
91
91
|
exports.extractGitBranch = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
92
|
+
// 1. Try CI environment variables first (fast, no subprocess, handles detached HEAD in CI)
|
|
93
|
+
const ciBranch = extractCIBranchName();
|
|
94
|
+
if (ciBranch) {
|
|
95
|
+
logger.log(`Extracted branch name from CI environment: "${ciBranch}"`);
|
|
96
|
+
return ciBranch;
|
|
97
97
|
}
|
|
98
|
+
// 2. Fall back to git command (works when on an actual branch locally)
|
|
98
99
|
const result = await executeWithLog('git branch --show-current', { execOptions, logger });
|
|
99
100
|
if (result.stderr) {
|
|
100
101
|
logger.log(`Error during extracting current branch from git`, result.stderr);
|
|
101
102
|
}
|
|
102
103
|
else {
|
|
103
104
|
const branch = result.stdout.trim();
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
if (branch) {
|
|
106
|
+
logger.log(`Extracted current git branch: "${branch}"`);
|
|
107
|
+
return branch;
|
|
108
|
+
}
|
|
109
|
+
logger.log('git branch --show-current returned empty (detached HEAD), no branch name available');
|
|
106
110
|
}
|
|
107
111
|
}, args => { var _a, _b, _c; return ({ cwd: (_b = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.execOptions) === null || _b === void 0 ? void 0 : _b.cwd, ignoreGitBranching: (_c = args[0]) === null || _c === void 0 ? void 0 : _c.ignoreGitBranching }); });
|
|
108
112
|
exports.extractGitRepo = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
|
|
@@ -139,6 +143,17 @@ exports.extractGitRepo = utils.general.cachify(async function ({ execOptions, lo
|
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
}, () => exports.cacheKey);
|
|
146
|
+
function extractCIBranchName() {
|
|
147
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
148
|
+
return ((_j = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = (process.env.GITHUB_HEAD_REF || // github (pull requests)
|
|
149
|
+
extractGithubRefBranch() || // github (push events)
|
|
150
|
+
process.env.CI_COMMIT_REF_NAME)) !== null && _a !== void 0 ? _a : process.env.CIRCLE_BRANCH) !== null && _b !== void 0 ? _b : process.env.BRANCH_NAME) !== null && _c !== void 0 ? _c : process.env.GIT_BRANCH) !== null && _d !== void 0 ? _d : process.env.BUILD_SOURCEBRANCHNAME) !== null && _e !== void 0 ? _e : process.env.BITBUCKET_BRANCH) !== null && _f !== void 0 ? _f : process.env.TRAVIS_BRANCH) !== null && _g !== void 0 ? _g : process.env.BUILDKITE_BRANCH) !== null && _h !== void 0 ? _h : process.env.CODEBUILD_WEBHOOK_HEAD_REF) !== null && _j !== void 0 ? _j : undefined);
|
|
151
|
+
}
|
|
152
|
+
exports.extractCIBranchName = extractCIBranchName;
|
|
153
|
+
function extractGithubRefBranch() {
|
|
154
|
+
var _a;
|
|
155
|
+
return (_a = process.env.GITHUB_REF) === null || _a === void 0 ? void 0 : _a.split('/').splice(2).join('/');
|
|
156
|
+
}
|
|
142
157
|
async function extractBuildIdFromCI() {
|
|
143
158
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
144
159
|
return ((_k = (_j = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = process.env.GITHUB_RUN_ID) !== null && _a !== void 0 ? _a : process.env.CI_JOB_ID) !== null && _b !== void 0 ? _b : process.env.CIRCLE_BUILD_NUM) !== null && _c !== void 0 ? _c : process.env.BUILD_BUILDID) !== null && _d !== void 0 ? _d : process.env.BITBUCKET_BUILD_NUMBER) !== null && _e !== void 0 ? _e : process.env.CODEBUILD_BUILD_ID) !== null && _f !== void 0 ? _f : process.env.BUILD_ID) !== null && _g !== void 0 ? _g : process.env.BUILD_NUMBER) !== null && _h !== void 0 ? _h : process.env.TRAVIS_BUILD_ID) !== null && _j !== void 0 ? _j : process.env.BUILDKITE_BUILD_ID) !== null && _k !== void 0 ? _k : process.env.BAMBOO // TODO: Bamboo
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.59.1-debug.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -60,19 +60,19 @@
|
|
|
60
60
|
"setup:standalone": "sh -c 'yarn chromedriver --port=4444 --verbose &'"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@applitools/core-base": "1.32.
|
|
64
|
-
"@applitools/dom-capture": "11.
|
|
65
|
-
"@applitools/dom-snapshot": "4.16.
|
|
66
|
-
"@applitools/driver": "1.25.
|
|
67
|
-
"@applitools/ec-client": "1.12.
|
|
68
|
-
"@applitools/logger": "2.2.
|
|
69
|
-
"@applitools/nml-client": "1.11.
|
|
70
|
-
"@applitools/req": "1.9.
|
|
71
|
-
"@applitools/screenshoter": "3.12.
|
|
72
|
-
"@applitools/snippets": "2.8.
|
|
73
|
-
"@applitools/socket": "1.3.
|
|
74
|
-
"@applitools/ufg-client": "1.20.
|
|
75
|
-
"@applitools/utils": "1.14.
|
|
63
|
+
"@applitools/core-base": "1.32.4",
|
|
64
|
+
"@applitools/dom-capture": "11.7.0",
|
|
65
|
+
"@applitools/dom-snapshot": "4.16.3",
|
|
66
|
+
"@applitools/driver": "1.25.4",
|
|
67
|
+
"@applitools/ec-client": "1.12.24",
|
|
68
|
+
"@applitools/logger": "2.2.10",
|
|
69
|
+
"@applitools/nml-client": "1.11.23",
|
|
70
|
+
"@applitools/req": "1.9.2",
|
|
71
|
+
"@applitools/screenshoter": "3.12.17",
|
|
72
|
+
"@applitools/snippets": "2.8.1",
|
|
73
|
+
"@applitools/socket": "1.3.11",
|
|
74
|
+
"@applitools/ufg-client": "1.20.2",
|
|
75
|
+
"@applitools/utils": "1.14.3",
|
|
76
76
|
"abort-controller": "3.0.0",
|
|
77
77
|
"chalk": "4.1.2",
|
|
78
78
|
"node-fetch": "2.6.7",
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@applitools/bongo": "^5.10.0",
|
|
84
|
-
"@applitools/spec-driver-puppeteer": "^1.7.
|
|
85
|
-
"@applitools/spec-driver-selenium": "^1.7.
|
|
86
|
-
"@applitools/test-server": "^1.4.
|
|
84
|
+
"@applitools/spec-driver-puppeteer": "^1.7.4",
|
|
85
|
+
"@applitools/spec-driver-selenium": "^1.7.15",
|
|
86
|
+
"@applitools/test-server": "^1.4.2",
|
|
87
87
|
"@applitools/test-utils": "^1.5.17",
|
|
88
|
-
"@applitools/tunnel-client": "^1.11.
|
|
88
|
+
"@applitools/tunnel-client": "^1.11.9",
|
|
89
89
|
"@types/mocha": "^10.0.7",
|
|
90
90
|
"@types/node": "^12.20.55",
|
|
91
91
|
"@types/selenium-webdriver": "^4.1.2",
|
|
@@ -113,5 +113,6 @@
|
|
|
113
113
|
"selenium-webdriver>ws>bufferutil": false,
|
|
114
114
|
"selenium-webdriver>ws>utf-8-validate": false
|
|
115
115
|
}
|
|
116
|
-
}
|
|
116
|
+
},
|
|
117
|
+
"stableVersion": "4.59.1-debug.0"
|
|
117
118
|
}
|
|
@@ -158,6 +158,8 @@ export interface ScreenshotSettings<TSpec extends SpecType> extends BaseCore.Ima
|
|
|
158
158
|
sendDom?: boolean;
|
|
159
159
|
captureStatusBar?: boolean;
|
|
160
160
|
mobileOptions?: MobileOptions;
|
|
161
|
+
/** @internal */
|
|
162
|
+
skipRootHtmlResource?: boolean;
|
|
161
163
|
}
|
|
162
164
|
export type LocateSettings<TLocator extends string, TSpec extends SpecType> = BaseCore.LocateSettings<TLocator, Region | ElementReference<TSpec>> & ScreenshotSettings<TSpec>;
|
|
163
165
|
export type LocateTextSettings<TPattern extends string, TSpec extends SpecType> = BaseCore.LocateTextSettings<TPattern, Region | ElementReference<TSpec>> & ScreenshotSettings<TSpec>;
|
|
@@ -32,6 +32,7 @@ export declare function makeCheckAndClose<TSpec extends SpecType>({ eyes, target
|
|
|
32
32
|
domains?: string[] | undefined;
|
|
33
33
|
}) | undefined;
|
|
34
34
|
headers?: Record<string, string> | undefined;
|
|
35
|
+
skipRootHtmlResource?: boolean | undefined;
|
|
35
36
|
} & import("@applitools/core-base").CloseSettings & {
|
|
36
37
|
environments?: Environment[] | undefined;
|
|
37
38
|
}) | undefined;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { Core, SnapshotSettings, Account, Snapshot } from './types';
|
|
2
2
|
import { type AbortSignal } from 'abort-controller';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
|
-
import { type SpecType, type
|
|
4
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
5
5
|
type Options<TSpec extends SpecType> = {
|
|
6
6
|
core: Core<TSpec>;
|
|
7
|
-
spec: SpecDriver<TSpec>;
|
|
8
7
|
fetchConcurrency?: number;
|
|
9
8
|
signal?: AbortSignal;
|
|
10
9
|
logger: Logger;
|
|
11
10
|
};
|
|
12
|
-
export declare function makeTakeSnapshots<TSpec extends SpecType>({ core,
|
|
11
|
+
export declare function makeTakeSnapshots<TSpec extends SpecType>({ core, fetchConcurrency, signal, logger: mainLogger, }: Options<TSpec>): ({ driver, settings, account, logger, }: {
|
|
13
12
|
driver: Driver<TSpec>;
|
|
14
13
|
settings?: SnapshotSettings<TSpec> | undefined;
|
|
15
14
|
account: Account;
|
package/types/ufg/types.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ export type SnapshotSettings<TSpec extends SpecType> = AutomationCore.CheckSetti
|
|
|
67
67
|
domains?: string[];
|
|
68
68
|
};
|
|
69
69
|
headers?: Record<string, string>;
|
|
70
|
+
/** @internal */
|
|
71
|
+
skipRootHtmlResource?: boolean;
|
|
70
72
|
};
|
|
71
73
|
export type CheckSettings<TSpec extends SpecType> = SnapshotSettings<TSpec>;
|
|
72
74
|
export type SafeCheckSettings = CheckSettings<SpecType<never, never, UFGSelector, never, never>>;
|
|
@@ -31,6 +31,8 @@ export type RawDomSnapshot = {
|
|
|
31
31
|
export type DomSnapshotSettings<TSpec extends SpecType> = {
|
|
32
32
|
disableBrowserFetching?: boolean;
|
|
33
33
|
skipResources?: string[];
|
|
34
|
+
/** @internal */
|
|
35
|
+
skipRootHtmlResource?: boolean;
|
|
34
36
|
fetchConcurrency?: number;
|
|
35
37
|
chunkByteLength?: number;
|
|
36
38
|
executionTimeout?: number;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type SpecType, type ElementReference } from '@applitools/driver';
|
|
2
2
|
import type { Logger } from '@applitools/logger';
|
|
3
3
|
import { type Selector as UFGSelector } from '@applitools/ufg-client';
|
|
4
|
-
export declare function toGeneratedSelectors<TSpec extends SpecType>({ elementReferences, logger,
|
|
4
|
+
export declare function toGeneratedSelectors<TSpec extends SpecType>({ elementReferences, logger, logDeprecations, }: {
|
|
5
5
|
elementReferences: {
|
|
6
6
|
target?: ElementReference<TSpec>;
|
|
7
7
|
scrolling?: ElementReference<TSpec>;
|
|
8
8
|
calculate?: ElementReference<TSpec>[];
|
|
9
9
|
};
|
|
10
|
-
transformElementReference: (elementReference: ElementReference<TSpec>) => UFGSelector | undefined;
|
|
11
10
|
logger: Logger;
|
|
12
11
|
logDeprecations: (...args: string[]) => void;
|
|
13
12
|
}): {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { type Options } from './core-server';
|
|
3
|
+
import { type ForkOptions } from 'child_process';
|
|
4
|
+
export declare function makeCoreServerProcess(options: Options & {
|
|
5
|
+
forkOptions?: ForkOptions;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
port: number;
|
|
8
|
+
close: () => void;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ServerOptions } from './ws-server';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
export type Options = ServerOptions & {
|
|
4
|
+
environment?: Record<string, any>;
|
|
5
|
+
agentIdPrefix?: string;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
shutdownMode?: 'lazy' | 'stdin';
|
|
8
|
+
idleTimeout?: number;
|
|
9
|
+
printStdout?: boolean;
|
|
10
|
+
isProcess?: boolean;
|
|
11
|
+
maskLog?: boolean;
|
|
12
|
+
logger?: Logger;
|
|
13
|
+
};
|
|
14
|
+
export declare function makeCoreServer({ environment: defaultEnvironment, agentIdPrefix, debug, shutdownMode, idleTimeout, // 15min
|
|
15
|
+
printStdout, isProcess, maskLog, logger, ...handlerOptions }?: Options): Promise<{
|
|
16
|
+
port: number;
|
|
17
|
+
close?: () => void;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Ref } from './types';
|
|
2
|
+
export interface Refer {
|
|
3
|
+
isRef<TValue = any>(ref: any): ref is Ref<TValue>;
|
|
4
|
+
ref<TValue>(value: TValue, parentRef?: Ref<unknown>): Ref<TValue>;
|
|
5
|
+
deref<TValue>(ref: Ref<TValue>): TValue;
|
|
6
|
+
destroy(ref: Ref<any>): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function makeRefer(): Refer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Ref, ServerSocket, UniversalSpecDriver } from './types';
|
|
2
|
+
import type { SpecType, SpecDriver as BaseSpecDriver, CommonSelector } from '@applitools/driver';
|
|
3
|
+
export type Driver = Ref;
|
|
4
|
+
export type Context = Ref;
|
|
5
|
+
export type Element = Ref;
|
|
6
|
+
export type Selector = string | CommonSelector | Ref;
|
|
7
|
+
export type UserFunction = Ref;
|
|
8
|
+
export type PrimarySpecType = SpecType<Driver, Context, Element, Selector, never, UserFunction>;
|
|
9
|
+
export type SpecDriver = BaseSpecDriver<PrimarySpecType>;
|
|
10
|
+
type CommandName = keyof UniversalSpecDriver<PrimarySpecType>;
|
|
11
|
+
export declare function makeSpec({ socket, spec, }: {
|
|
12
|
+
socket: ServerSocket<PrimarySpecType, any>;
|
|
13
|
+
spec: CommandName[];
|
|
14
|
+
}): SpecDriver;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { Size, Region } from '@applitools/utils';
|
|
2
|
+
import type { Emitter, Listener, Client, Server } from '@applitools/socket';
|
|
3
|
+
import type { SpecType, DriverInfo, Cookie, WaitOptions } from '@applitools/driver';
|
|
4
|
+
import type * as MainCore from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Wraps the type with a ref if it vas to be refed
|
|
7
|
+
*/
|
|
8
|
+
type Refify<TValue> = TValue extends string | number | boolean | null | undefined ? TValue : TValue extends Array<infer TItem> ? Refify<TItem>[] : Extract<TValue[keyof TValue], (...args: any) => any> extends never ? TValue : Ref<TValue>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates universalized object out of an ordinary interface:
|
|
11
|
+
* - Filters out properties that are not of async function type
|
|
12
|
+
* - Adds domain to the method names (`Domain.methodName`)
|
|
13
|
+
* - Keep only first (`options`) argument of the methods
|
|
14
|
+
* - Introduces additional option to the methods with a ref of the current instance
|
|
15
|
+
* - Refifies return values of the methods
|
|
16
|
+
*/
|
|
17
|
+
type Universalize<TTarget extends Record<string, any>, TDomain extends string, TRefKey extends string = never> = {
|
|
18
|
+
[TKey in keyof TTarget as NonNullable<TTarget[TKey]> extends (...args: any[]) => Promise<any> ? `${TDomain}.${TKey & string}` : never]: NonNullable<TTarget[TKey]> extends (options: infer TOptions) => Promise<infer TResult> ? (options: TOptions & {
|
|
19
|
+
[TKey in TRefKey]: Ref<TTarget>;
|
|
20
|
+
}) => Promise<Refify<TResult>> : never;
|
|
21
|
+
};
|
|
22
|
+
export type Ref<TValue = never> = {
|
|
23
|
+
'applitools-ref-id': string;
|
|
24
|
+
type?: string;
|
|
25
|
+
};
|
|
26
|
+
export type ClientSocket<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = unknown & Emitter<Universalize<UniversalCore<TSpec, TType>, 'Core'>> & Client<Universalize<MainCore.Core<TSpec, TType>, 'Core'>> & Client<Universalize<MainCore.EyesManager<TSpec, TType>, 'EyesManager', 'manager'>> & Client<Universalize<MainCore.Eyes<TSpec, TType>, 'Eyes', 'eyes'>> & Client<Universalize<UniversalDebug<TSpec>, 'Debug'>> & Server<Universalize<UniversalSpecDriver<TSpec>, 'Driver'>>;
|
|
27
|
+
export type ServerSocket<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = unknown & Listener<Universalize<UniversalCore<TSpec, TType>, 'Core'>> & Emitter<Universalize<UniversalLogger, 'Logger'>> & Server<Universalize<MainCore.Core<TSpec, TType>, 'Core'>> & Server<Universalize<MainCore.EyesManager<TSpec, TType>, 'EyesManager', 'manager'>> & Server<Universalize<MainCore.Eyes<TSpec, TType>, 'Eyes', 'eyes'>> & Server<Universalize<UniversalDebug<TSpec>, 'Debug'>> & Client<Universalize<UniversalSpecDriver<TSpec>, 'Driver'>>;
|
|
28
|
+
export interface UniversalCore<TSpec extends SpecType, TType extends 'classic' | 'ufg'> {
|
|
29
|
+
makeCore(options: {
|
|
30
|
+
spec: 'webdriver' | (keyof UniversalSpecDriver<TSpec>)[];
|
|
31
|
+
agentId: string;
|
|
32
|
+
environment?: Record<string, any>;
|
|
33
|
+
cwd: string;
|
|
34
|
+
}): Promise<MainCore.Core<TSpec, TType>>;
|
|
35
|
+
}
|
|
36
|
+
export interface UniversalLogger {
|
|
37
|
+
log(options: {
|
|
38
|
+
level: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export interface UniversalDebug<TSpec extends SpecType> {
|
|
43
|
+
getHistory(): Promise<any>;
|
|
44
|
+
checkSpecDriver(options: {
|
|
45
|
+
driver: TSpec['driver'];
|
|
46
|
+
commands: (keyof UniversalSpecDriver<TSpec>)[];
|
|
47
|
+
}): Promise<any>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Ideally would be transform SpecDriver type to the type with single object argument
|
|
51
|
+
* but typescript doesn't have a possibility to convert named tuples to object types at the moment
|
|
52
|
+
*/
|
|
53
|
+
export interface UniversalSpecDriver<T extends SpecType> {
|
|
54
|
+
isEqualElements(options: {
|
|
55
|
+
context: T['context'];
|
|
56
|
+
element1: T['element'];
|
|
57
|
+
element2: T['element'];
|
|
58
|
+
}): Promise<boolean>;
|
|
59
|
+
executeScript(options: {
|
|
60
|
+
context: T['context'];
|
|
61
|
+
script: string;
|
|
62
|
+
arg?: any;
|
|
63
|
+
}): Promise<any>;
|
|
64
|
+
findElement(options: {
|
|
65
|
+
context: T['context'];
|
|
66
|
+
selector: T['selector'];
|
|
67
|
+
parent?: T['element'];
|
|
68
|
+
}): Promise<T['element'] | null>;
|
|
69
|
+
findElements(options: {
|
|
70
|
+
context: T['context'];
|
|
71
|
+
selector: T['selector'];
|
|
72
|
+
parent?: T['element'];
|
|
73
|
+
}): Promise<T['element'][]>;
|
|
74
|
+
waitForSelector(options: {
|
|
75
|
+
context: T['context'];
|
|
76
|
+
selector: T['selector'];
|
|
77
|
+
parent?: T['element'];
|
|
78
|
+
options?: WaitOptions;
|
|
79
|
+
}): Promise<T['element'] | null>;
|
|
80
|
+
getElementRegion(options: {
|
|
81
|
+
context: T['context'];
|
|
82
|
+
element: T['element'];
|
|
83
|
+
}): Promise<Region>;
|
|
84
|
+
getElementAttribute(options: {
|
|
85
|
+
context: T['context'];
|
|
86
|
+
element: T['element'];
|
|
87
|
+
attr: string;
|
|
88
|
+
}): Promise<string>;
|
|
89
|
+
setElementText(options: {
|
|
90
|
+
context: T['context'];
|
|
91
|
+
element: T['element'];
|
|
92
|
+
text: string;
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
getElementText(options: {
|
|
95
|
+
context: T['context'];
|
|
96
|
+
element: T['element'];
|
|
97
|
+
}): Promise<string>;
|
|
98
|
+
hover(options: {
|
|
99
|
+
context: T['context'];
|
|
100
|
+
element: T['element'];
|
|
101
|
+
}): Promise<void>;
|
|
102
|
+
click(options: {
|
|
103
|
+
context: T['context'];
|
|
104
|
+
element: T['element'];
|
|
105
|
+
}): Promise<void>;
|
|
106
|
+
mainContext(options: {
|
|
107
|
+
context: T['context'];
|
|
108
|
+
}): Promise<T['context']>;
|
|
109
|
+
parentContext(options: {
|
|
110
|
+
context: T['context'];
|
|
111
|
+
}): Promise<T['context']>;
|
|
112
|
+
childContext(options: {
|
|
113
|
+
context: T['context'];
|
|
114
|
+
element: T['element'];
|
|
115
|
+
}): Promise<T['context']>;
|
|
116
|
+
getDriverInfo(options: {
|
|
117
|
+
driver: T['driver'];
|
|
118
|
+
}): Promise<DriverInfo>;
|
|
119
|
+
getCapabilities(options: {
|
|
120
|
+
driver: T['driver'];
|
|
121
|
+
}): Promise<Record<string, any>>;
|
|
122
|
+
setWindowSize(options: {
|
|
123
|
+
driver: T['driver'];
|
|
124
|
+
size: Size;
|
|
125
|
+
}): Promise<void>;
|
|
126
|
+
getWindowSize(options: {
|
|
127
|
+
driver: T['driver'];
|
|
128
|
+
}): Promise<Size>;
|
|
129
|
+
setViewportSize(options: {
|
|
130
|
+
driver: T['driver'];
|
|
131
|
+
size: Size;
|
|
132
|
+
}): Promise<void>;
|
|
133
|
+
getViewportSize(options: {
|
|
134
|
+
driver: T['driver'];
|
|
135
|
+
}): Promise<Size>;
|
|
136
|
+
getSystemBars(options: {
|
|
137
|
+
driver: T['driver'];
|
|
138
|
+
}): Promise<{
|
|
139
|
+
statusBar: {
|
|
140
|
+
visible: boolean;
|
|
141
|
+
x: number;
|
|
142
|
+
y: number;
|
|
143
|
+
height: number;
|
|
144
|
+
width: number;
|
|
145
|
+
};
|
|
146
|
+
navigationBar: {
|
|
147
|
+
visible: boolean;
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
height: number;
|
|
151
|
+
width: number;
|
|
152
|
+
};
|
|
153
|
+
}>;
|
|
154
|
+
getOrientation(options: {
|
|
155
|
+
driver: T['driver'];
|
|
156
|
+
}): Promise<'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary'>;
|
|
157
|
+
setOrientation(options: {
|
|
158
|
+
driver: T['driver'];
|
|
159
|
+
orientation: 'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary';
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
getCookies(options: {
|
|
162
|
+
driver: T['driver'] | T['context'];
|
|
163
|
+
context?: boolean;
|
|
164
|
+
}): Promise<Cookie[]>;
|
|
165
|
+
getTitle(options: {
|
|
166
|
+
driver: T['driver'];
|
|
167
|
+
}): Promise<string>;
|
|
168
|
+
getUrl(options: {
|
|
169
|
+
driver: T['driver'];
|
|
170
|
+
}): Promise<string>;
|
|
171
|
+
takeScreenshot(options: {
|
|
172
|
+
driver: T['driver'];
|
|
173
|
+
}): Promise<string>;
|
|
174
|
+
performAction(options: {
|
|
175
|
+
driver: T['driver'];
|
|
176
|
+
steps: any[];
|
|
177
|
+
}): Promise<void>;
|
|
178
|
+
visit(options: {
|
|
179
|
+
driver: T['driver'];
|
|
180
|
+
url: string;
|
|
181
|
+
}): Promise<void>;
|
|
182
|
+
getCurrentWorld(options: {
|
|
183
|
+
driver: T['driver'];
|
|
184
|
+
}): Promise<string>;
|
|
185
|
+
getWorlds(options: {
|
|
186
|
+
driver: T['driver'];
|
|
187
|
+
}): Promise<string[]>;
|
|
188
|
+
switchWorld(options: {
|
|
189
|
+
driver: T['driver'];
|
|
190
|
+
name: string;
|
|
191
|
+
}): Promise<void>;
|
|
192
|
+
reload(options: {
|
|
193
|
+
driver: T['driver'];
|
|
194
|
+
}): Promise<void>;
|
|
195
|
+
isUserFunction(ref: any): Promise<boolean>;
|
|
196
|
+
executeUserFunction(userFunction: Ref): Promise<any>;
|
|
197
|
+
executeBrowserCommands(options: {
|
|
198
|
+
driver?: T['driver'];
|
|
199
|
+
commands: any[];
|
|
200
|
+
}): Promise<any>;
|
|
201
|
+
bringToFront(options: {
|
|
202
|
+
driver: T['driver'];
|
|
203
|
+
}): Promise<void>;
|
|
204
|
+
}
|
|
205
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Server as WsServer } from 'ws';
|
|
3
|
+
import { Logger } from '@applitools/logger';
|
|
4
|
+
export type ServerOptions = {
|
|
5
|
+
port?: number;
|
|
6
|
+
singleton?: boolean;
|
|
7
|
+
portResolutionMode?: 'next' | 'random' | 'lazy';
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
key?: string | Buffer;
|
|
10
|
+
cert?: string | Buffer;
|
|
11
|
+
};
|
|
12
|
+
export declare function makeServer(options: ServerOptions | undefined, logger: Logger): Promise<{
|
|
13
|
+
server?: WsServer;
|
|
14
|
+
port: number;
|
|
15
|
+
}>;
|
|
@@ -66,6 +66,7 @@ export declare const extractGitRepo: (({ execOptions, logger }: Options) => Prom
|
|
|
66
66
|
clearCache(): void;
|
|
67
67
|
TTL?: number | undefined;
|
|
68
68
|
};
|
|
69
|
+
export declare function extractCIBranchName(): string | undefined;
|
|
69
70
|
export declare function extractBuildIdFromCI(): Promise<string | undefined>;
|
|
70
71
|
export declare const extractBranchingTimestamp: (({ branchName, parentBranchName, execOptions, logger, }: ExtractGitBranchingTimestampOptions) => Promise<string | undefined>) & {
|
|
71
72
|
getCachedValues(): Promise<string | undefined>[];
|