@applitools/core 2.3.1 → 2.3.3
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 +13 -0
- package/dist/universal/core-server.js +6 -0
- package/dist/universal/history.js +86 -0
- package/package.json +14 -14
- package/types/automation/extract-text.d.ts +16 -0
- package/types/automation/get-viewport-size.d.ts +12 -0
- package/types/automation/locate-text.d.ts +15 -0
- package/types/automation/locate.d.ts +15 -0
- package/types/automation/set-viewport-size.d.ts +14 -0
- package/types/automation/types.d.ts +84 -0
- package/types/automation/utils/take-screenshot.d.ts +19 -0
- package/types/automation/utils/to-base-check-settings.d.ts +17 -0
- package/types/automation/utils/wait-for-lazy-load.d.ts +14 -0
- package/types/check-and-close.d.ts +18 -0
- package/types/check.d.ts +18 -0
- package/types/classic/abort.d.ts +16 -0
- package/types/classic/check-and-close.d.ts +19 -0
- package/types/classic/check.d.ts +15 -0
- package/types/classic/close.d.ts +16 -0
- package/types/classic/core.d.ts +13 -0
- package/types/classic/get-base-eyes.d.ts +17 -0
- package/types/classic/open-eyes.d.ts +16 -0
- package/types/classic/types.d.ts +34 -0
- package/types/classic/utils/take-dom-capture.d.ts +14 -0
- package/types/cli/cli.d.ts +2 -0
- package/types/close-batch.d.ts +13 -0
- package/types/close.d.ts +13 -0
- package/types/core.d.ts +14 -0
- package/types/delete-test.d.ts +13 -0
- package/types/errors/abort-error.d.ts +4 -0
- package/types/errors/internal-error.d.ts +6 -0
- package/types/errors/test-error.d.ts +5 -0
- package/types/extract-text.d.ts +17 -0
- package/types/get-eyes-results.d.ts +12 -0
- package/types/get-manager-results.d.ts +14 -0
- package/types/get-typed-eyes.d.ts +22 -0
- package/types/index.d.ts +8 -0
- package/types/locate-text.d.ts +16 -0
- package/types/locate.d.ts +17 -0
- package/types/make-ec-client.d.ts +16 -0
- package/types/make-manager.d.ts +22 -0
- package/types/open-eyes.d.ts +23 -0
- package/types/troubleshoot/check-network.d.ts +21 -0
- package/types/troubleshoot/eyes.d.ts +11 -0
- package/types/troubleshoot/ufg.d.ts +10 -0
- package/types/troubleshoot/utils.d.ts +2 -0
- package/types/types.d.ts +130 -0
- package/types/ufg/abort.d.ts +21 -0
- package/types/ufg/check-and-close.d.ts +33 -0
- package/types/ufg/check.d.ts +19 -0
- package/types/ufg/close.d.ts +19 -0
- package/types/ufg/core.d.ts +16 -0
- package/types/ufg/get-base-eyes.d.ts +23 -0
- package/types/ufg/get-results.d.ts +16 -0
- package/types/ufg/open-eyes.d.ts +18 -0
- package/types/ufg/types.d.ts +71 -0
- package/types/ufg/utils/extract-broker-url.d.ts +6 -0
- package/types/ufg/utils/generate-safe-selectors.d.ts +16 -0
- package/types/ufg/utils/take-dom-snapshot.d.ts +49 -0
- package/types/ufg/utils/take-dom-snapshots.d.ts +24 -0
- package/types/ufg/utils/take-snapshots.d.ts +21 -0
- package/types/ufg/utils/take-vhses.d.ts +17 -0
- package/types/ufg/utils/uniquify-renderers.d.ts +2 -0
- package/types/universal/core-server-process.d.ts +9 -0
- package/types/universal/core-server.d.ts +12 -0
- package/types/universal/core.d.ts +21 -0
- package/types/universal/history.d.ts +2 -0
- package/types/universal/refer.d.ts +8 -0
- package/types/universal/spec-driver.d.ts +11 -0
- package/types/universal/types.d.ts +191 -0
- package/types/universal/ws-server.d.ts +14 -0
- package/types/utils/extract-ci-provider.d.ts +1 -0
- package/types/utils/format-results.d.ts +16 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { MaybeArray } from '@applitools/utils';
|
|
2
|
+
import type * as BaseCore from '@applitools/core-base/types';
|
|
3
|
+
import type * as AutomationCore from '../automation/types';
|
|
4
|
+
import { type SpecType } from '@applitools/driver';
|
|
5
|
+
import { type Logger } from '@applitools/logger';
|
|
6
|
+
import { type Proxy } from '@applitools/req';
|
|
7
|
+
import { type Renderer, type DomSnapshot, type AndroidSnapshot, type IOSSnapshot } from '@applitools/ufg-client';
|
|
8
|
+
export * from '../automation/types';
|
|
9
|
+
export type SnapshotTarget = MaybeArray<DomSnapshot> | MaybeArray<AndroidSnapshot> | MaybeArray<IOSSnapshot>;
|
|
10
|
+
export type Target<TSpec extends SpecType> = SnapshotTarget | AutomationCore.Target<TSpec>;
|
|
11
|
+
export interface Core<TSpec extends SpecType, TTarget = AutomationCore.Target<TSpec>, TEyes extends Eyes<TSpec, TTarget | SnapshotTarget> = Eyes<TSpec, TTarget | SnapshotTarget>> extends AutomationCore.Core<TSpec, TTarget, TEyes> {
|
|
12
|
+
readonly type: 'ufg';
|
|
13
|
+
openEyes(options: {
|
|
14
|
+
target?: AutomationCore.DriverTarget<TSpec>;
|
|
15
|
+
settings: OpenSettings;
|
|
16
|
+
eyes?: BaseCore.Eyes[];
|
|
17
|
+
logger?: Logger;
|
|
18
|
+
}): Promise<TEyes>;
|
|
19
|
+
}
|
|
20
|
+
export interface Eyes<TSpec extends SpecType, TTarget = Target<TSpec>> extends AutomationCore.Eyes<TSpec, TTarget> {
|
|
21
|
+
readonly type: 'ufg';
|
|
22
|
+
getBaseEyes(options?: {
|
|
23
|
+
settings?: {
|
|
24
|
+
type: 'web' | 'native';
|
|
25
|
+
renderer: Renderer;
|
|
26
|
+
};
|
|
27
|
+
logger?: Logger;
|
|
28
|
+
}): Promise<BaseCore.Eyes[]>;
|
|
29
|
+
check(options?: {
|
|
30
|
+
target?: TTarget;
|
|
31
|
+
settings?: CheckSettings<TSpec>;
|
|
32
|
+
logger?: Logger;
|
|
33
|
+
}): Promise<CheckResult[]>;
|
|
34
|
+
checkAndClose(options?: {
|
|
35
|
+
target?: TTarget;
|
|
36
|
+
settings?: CheckSettings<TSpec> & AutomationCore.CloseSettings;
|
|
37
|
+
logger?: Logger;
|
|
38
|
+
}): Promise<TestResult[]>;
|
|
39
|
+
getResults(options?: {
|
|
40
|
+
settings?: AutomationCore.GetResultsSettings;
|
|
41
|
+
logger?: Logger;
|
|
42
|
+
}): Promise<TestResult[]>;
|
|
43
|
+
}
|
|
44
|
+
export type OpenSettings = AutomationCore.OpenSettings & {
|
|
45
|
+
renderConcurrency?: number;
|
|
46
|
+
};
|
|
47
|
+
export type CheckSettings<TSpec extends SpecType> = AutomationCore.CheckSettings<TSpec> & {
|
|
48
|
+
renderers?: Renderer[];
|
|
49
|
+
hooks?: {
|
|
50
|
+
beforeCaptureScreenshot: string;
|
|
51
|
+
};
|
|
52
|
+
disableBrowserFetching?: boolean;
|
|
53
|
+
layoutBreakpoints?: boolean | number[];
|
|
54
|
+
ufgOptions?: Record<string, any>;
|
|
55
|
+
nmgOptions?: Record<string, any>;
|
|
56
|
+
autProxy?: Proxy & {
|
|
57
|
+
mode?: 'Allow' | 'Block';
|
|
58
|
+
domains?: string[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export type CheckResult = AutomationCore.CheckResult & {
|
|
62
|
+
readonly renderer: Renderer;
|
|
63
|
+
readonly promise: Promise<Omit<CheckResult, 'promise'> & {
|
|
64
|
+
eyes: BaseCore.Eyes;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
67
|
+
export type TestResult = AutomationCore.TestResult & {
|
|
68
|
+
readonly renderer: Renderer;
|
|
69
|
+
} & {
|
|
70
|
+
eyes: BaseCore.Eyes;
|
|
71
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
export declare function extractBrokerUrl<TSpec extends SpecType>({ driver, logger, }: {
|
|
4
|
+
driver: Driver<TSpec>;
|
|
5
|
+
logger: Logger;
|
|
6
|
+
}): Promise<string | null>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SpecType, type Context, type ElementReference, type CommonSelector } from '@applitools/driver';
|
|
2
|
+
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
3
|
+
context: Context<TSpec>;
|
|
4
|
+
elementReferences: ElementReference<TSpec>[];
|
|
5
|
+
}): Promise<{
|
|
6
|
+
selectors: ({
|
|
7
|
+
safeSelector: null;
|
|
8
|
+
originalSelector: null;
|
|
9
|
+
elementReference: ElementReference<TSpec>;
|
|
10
|
+
} | {
|
|
11
|
+
safeSelector: CommonSelector<never>;
|
|
12
|
+
originalSelector: import("@applitools/driver").Selector<never> | null;
|
|
13
|
+
elementReference: ElementReference<TSpec>;
|
|
14
|
+
})[];
|
|
15
|
+
cleanupGeneratedSelectors: () => Promise<void>;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Logger } from '@applitools/logger';
|
|
2
|
+
import { type SpecType, type Context } from '@applitools/driver';
|
|
3
|
+
import { type DomSnapshot } from '@applitools/ufg-client';
|
|
4
|
+
type RawDomSnapshot = {
|
|
5
|
+
url: string;
|
|
6
|
+
selector: string;
|
|
7
|
+
cdt: {
|
|
8
|
+
attributes: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
}[];
|
|
13
|
+
crossFrames: {
|
|
14
|
+
selector: string;
|
|
15
|
+
index: number;
|
|
16
|
+
}[];
|
|
17
|
+
frames: RawDomSnapshot[];
|
|
18
|
+
resourceUrls: string[];
|
|
19
|
+
blobs: {
|
|
20
|
+
url: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
export type DomSnapshotSettings = {
|
|
25
|
+
disableBrowserFetching?: boolean;
|
|
26
|
+
skipResources?: string[];
|
|
27
|
+
chunkByteLength?: number;
|
|
28
|
+
executionTimeout?: number;
|
|
29
|
+
pollTimeout?: number;
|
|
30
|
+
showLogs?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function takeDomSnapshot<TSpec extends SpecType>({ context, settings, logger, }: {
|
|
33
|
+
context: Context<TSpec>;
|
|
34
|
+
settings?: DomSnapshotSettings;
|
|
35
|
+
logger: Logger;
|
|
36
|
+
}): Promise<DomSnapshot>;
|
|
37
|
+
export declare function deserializeDomSnapshot({ snapshot }: {
|
|
38
|
+
snapshot: RawDomSnapshot;
|
|
39
|
+
}): DomSnapshot;
|
|
40
|
+
export declare function extractCrossFrames({ snapshot, parent, logger, }: {
|
|
41
|
+
snapshot: RawDomSnapshot;
|
|
42
|
+
parent?: any;
|
|
43
|
+
logger: Logger;
|
|
44
|
+
}): {
|
|
45
|
+
cdtNode: RawDomSnapshot['cdt'][number];
|
|
46
|
+
reference: any;
|
|
47
|
+
parentSnapshot: RawDomSnapshot;
|
|
48
|
+
}[];
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Size } from '@applitools/utils';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
4
|
+
import { type DomSnapshot, type Renderer, type ChromeEmulationDevice, type IOSDevice, type ScreenOrientation } from '@applitools/ufg-client';
|
|
5
|
+
import { type DomSnapshotSettings } from './take-dom-snapshot';
|
|
6
|
+
export * from './take-dom-snapshot';
|
|
7
|
+
export type DomSnapshotsSettings = DomSnapshotSettings & {
|
|
8
|
+
renderers: Renderer[];
|
|
9
|
+
waitBeforeCapture?: number | (() => void);
|
|
10
|
+
layoutBreakpoints?: number[] | boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function takeDomSnapshots<TSpec extends SpecType>({ driver, settings, hooks, provides, logger, }: {
|
|
13
|
+
driver: Driver<TSpec>;
|
|
14
|
+
settings: DomSnapshotsSettings;
|
|
15
|
+
hooks?: {
|
|
16
|
+
beforeSnapshots?(): void | Promise<void>;
|
|
17
|
+
beforeEachSnapshot?(): void | Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
provides?: {
|
|
20
|
+
getChromeEmulationDevices(): Promise<Record<ChromeEmulationDevice, Record<ScreenOrientation, Size>>>;
|
|
21
|
+
getIOSDevices(): Promise<Record<IOSDevice, Record<ScreenOrientation, Size>>>;
|
|
22
|
+
};
|
|
23
|
+
logger: Logger;
|
|
24
|
+
}): Promise<DomSnapshot[]>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Size } from '@applitools/utils';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
4
|
+
import { type DomSnapshot, type AndroidSnapshot, type IOSSnapshot, type ChromeEmulationDevice, type IOSDevice, type ScreenOrientation } from '@applitools/ufg-client';
|
|
5
|
+
import { type DomSnapshotsSettings } from './take-dom-snapshots';
|
|
6
|
+
import { type VHSesSettings } from './take-vhses';
|
|
7
|
+
export * from './take-dom-snapshots';
|
|
8
|
+
export * from './take-vhses';
|
|
9
|
+
export declare function takeSnapshots<TSpec extends SpecType>({ driver, settings, hooks, provides, logger, }: {
|
|
10
|
+
driver: Driver<TSpec>;
|
|
11
|
+
settings: DomSnapshotsSettings & VHSesSettings;
|
|
12
|
+
hooks: {
|
|
13
|
+
beforeSnapshots?(): void | Promise<void>;
|
|
14
|
+
beforeEachSnapshot?(): void | Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
provides: {
|
|
17
|
+
getChromeEmulationDevices(): Promise<Record<ChromeEmulationDevice, Record<ScreenOrientation, Size>>>;
|
|
18
|
+
getIOSDevices(): Promise<Record<IOSDevice, Record<ScreenOrientation, Size>>>;
|
|
19
|
+
};
|
|
20
|
+
logger: Logger;
|
|
21
|
+
}): Promise<DomSnapshot[] | AndroidSnapshot[] | IOSSnapshot[]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServerSettings } from '../types';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
4
|
+
import { type Renderer, type AndroidSnapshot, type IOSSnapshot } from '@applitools/ufg-client';
|
|
5
|
+
export type VHSesSettings = ServerSettings & {
|
|
6
|
+
renderers: Renderer[];
|
|
7
|
+
waitBeforeCapture?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function takeVHSes<TSpec extends SpecType>({ driver, settings, hooks, logger, }: {
|
|
10
|
+
driver: Driver<TSpec>;
|
|
11
|
+
settings: VHSesSettings;
|
|
12
|
+
hooks?: {
|
|
13
|
+
beforeSnapshots?(): void | Promise<void>;
|
|
14
|
+
beforeEachSnapshot?(): void | Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
logger: Logger;
|
|
17
|
+
}): Promise<AndroidSnapshot[] | IOSSnapshot[]>;
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { type ServerOptions } from './ws-server';
|
|
2
|
+
export type Options = ServerOptions & {
|
|
3
|
+
debug?: boolean;
|
|
4
|
+
shutdownMode?: 'lazy' | 'stdin';
|
|
5
|
+
idleTimeout?: number;
|
|
6
|
+
printStdout?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function makeCoreServer({ debug, shutdownMode, idleTimeout, // 15min
|
|
9
|
+
printStdout, ...handlerOptions }?: Options): Promise<{
|
|
10
|
+
port: number;
|
|
11
|
+
close?: () => void;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Core, EyesManager, Eyes } from '../types';
|
|
2
|
+
import type { ClientSocket, Ref } from './types';
|
|
3
|
+
import type { SpecType, SpecDriver } from '@applitools/driver';
|
|
4
|
+
import { type Socket } from '@applitools/socket';
|
|
5
|
+
import { WebSocket } from 'ws';
|
|
6
|
+
export declare function makeCore<TSpec extends SpecType, TType extends 'classic' | 'ufg'>(options: {
|
|
7
|
+
agentId: string;
|
|
8
|
+
spec: 'webdriver' | SpecDriver<TSpec>;
|
|
9
|
+
}): Core<TSpec, TType>;
|
|
10
|
+
export declare function makeManager<TSpec extends SpecType, TType extends 'classic' | 'ufg'>({ socket, manager, }: {
|
|
11
|
+
socket: ClientSocket<TSpec, TType>;
|
|
12
|
+
manager: Ref<EyesManager<TSpec, TType>>;
|
|
13
|
+
}): EyesManager<TSpec, TType>;
|
|
14
|
+
export declare function makeEyes<TSpec extends SpecType, TType extends 'classic' | 'ufg'>({ socket, eyes, }: {
|
|
15
|
+
socket: ClientSocket<TSpec, TType>;
|
|
16
|
+
eyes: Ref<Eyes<TSpec, TType>>;
|
|
17
|
+
}): Eyes<TSpec, TType>;
|
|
18
|
+
export declare function makeClientSocket<TSpec extends SpecType>({ agentId, spec, }: {
|
|
19
|
+
agentId: string;
|
|
20
|
+
spec: 'webdriver' | SpecDriver<TSpec>;
|
|
21
|
+
}): Promise<ClientSocket<TSpec, 'classic' | 'ufg'> & Socket<WebSocket>>;
|
|
@@ -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,11 @@
|
|
|
1
|
+
import type { Ref, ServerSocket, UniversalSpecDriver } from './types';
|
|
2
|
+
import type { SpecType as BaseSpecType, SpecDriver, 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 SpecType = BaseSpecType<Driver, Context, Element, Selector>;
|
|
8
|
+
export declare function makeSpec({ socket, spec, }: {
|
|
9
|
+
socket: ServerSocket<SpecType, any>;
|
|
10
|
+
spec: (keyof UniversalSpecDriver<SpecType>)[];
|
|
11
|
+
}): SpecDriver<SpecType>;
|
|
@@ -0,0 +1,191 @@
|
|
|
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
|
+
agentId: string;
|
|
31
|
+
cwd: string;
|
|
32
|
+
spec: 'webdriver' | (keyof UniversalSpecDriver<TSpec>)[];
|
|
33
|
+
}): Promise<MainCore.Core<TSpec, TType>>;
|
|
34
|
+
}
|
|
35
|
+
export interface UniversalLogger {
|
|
36
|
+
log(options: {
|
|
37
|
+
level: string;
|
|
38
|
+
message: string;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface UniversalDebug<TSpec extends SpecType> {
|
|
42
|
+
getHistory(): Promise<any>;
|
|
43
|
+
checkSpecDriver(options: {
|
|
44
|
+
driver: TSpec['driver'];
|
|
45
|
+
commands: (keyof UniversalSpecDriver<TSpec>)[];
|
|
46
|
+
}): Promise<any>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Ideally would be transform SpecDriver type to the type with single object argument
|
|
50
|
+
* but typescript doesn't have a possibility to convert named tuples to object types at the moment
|
|
51
|
+
*/
|
|
52
|
+
export interface UniversalSpecDriver<T extends SpecType> {
|
|
53
|
+
isEqualElements(options: {
|
|
54
|
+
context: T['context'];
|
|
55
|
+
element1: T['element'];
|
|
56
|
+
element2: T['element'];
|
|
57
|
+
}): Promise<boolean>;
|
|
58
|
+
mainContext(options: {
|
|
59
|
+
context: T['context'];
|
|
60
|
+
}): Promise<T['context']>;
|
|
61
|
+
parentContext(options: {
|
|
62
|
+
context: T['context'];
|
|
63
|
+
}): Promise<T['context']>;
|
|
64
|
+
childContext(options: {
|
|
65
|
+
context: T['context'];
|
|
66
|
+
element: T['element'];
|
|
67
|
+
}): Promise<T['context']>;
|
|
68
|
+
executeScript(options: {
|
|
69
|
+
context: T['context'];
|
|
70
|
+
script: string;
|
|
71
|
+
arg?: any;
|
|
72
|
+
}): Promise<any>;
|
|
73
|
+
findElement(options: {
|
|
74
|
+
context: T['context'];
|
|
75
|
+
selector: T['selector'];
|
|
76
|
+
parent?: T['element'];
|
|
77
|
+
}): Promise<T['element'] | null>;
|
|
78
|
+
findElements(options: {
|
|
79
|
+
context: T['context'];
|
|
80
|
+
selector: T['selector'];
|
|
81
|
+
parent?: T['element'];
|
|
82
|
+
}): Promise<T['element'][]>;
|
|
83
|
+
waitForSelector(options: {
|
|
84
|
+
context: T['context'];
|
|
85
|
+
selector: T['selector'];
|
|
86
|
+
parent?: T['element'];
|
|
87
|
+
options?: WaitOptions;
|
|
88
|
+
}): Promise<T['element'] | null>;
|
|
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
|
+
setWindowSize(options: {
|
|
99
|
+
driver: T['driver'];
|
|
100
|
+
size: Size;
|
|
101
|
+
}): Promise<void>;
|
|
102
|
+
getWindowSize(options: {
|
|
103
|
+
driver: T['driver'];
|
|
104
|
+
}): Promise<Size>;
|
|
105
|
+
setViewportSize(options: {
|
|
106
|
+
driver: T['driver'];
|
|
107
|
+
size: Size;
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
getViewportSize(options: {
|
|
110
|
+
driver: T['driver'];
|
|
111
|
+
}): Promise<Size>;
|
|
112
|
+
getCookies(options: {
|
|
113
|
+
driver: T['driver'] | T['context'];
|
|
114
|
+
context?: boolean;
|
|
115
|
+
}): Promise<Cookie[]>;
|
|
116
|
+
getDriverInfo(options: {
|
|
117
|
+
driver: T['driver'];
|
|
118
|
+
}): Promise<DriverInfo>;
|
|
119
|
+
getCapabilities(options: {
|
|
120
|
+
driver: T['driver'];
|
|
121
|
+
}): Promise<Record<string, any>>;
|
|
122
|
+
getSessionMetadata(options: {
|
|
123
|
+
driver: T['driver'];
|
|
124
|
+
}): Promise<any[] | null>;
|
|
125
|
+
getTitle(options: {
|
|
126
|
+
driver: T['driver'];
|
|
127
|
+
}): Promise<string>;
|
|
128
|
+
getUrl(options: {
|
|
129
|
+
driver: T['driver'];
|
|
130
|
+
}): Promise<string>;
|
|
131
|
+
takeScreenshot(options: {
|
|
132
|
+
driver: T['driver'];
|
|
133
|
+
}): Promise<string>;
|
|
134
|
+
click(options: {
|
|
135
|
+
context: T['context'];
|
|
136
|
+
element: T['element'] | T['selector'];
|
|
137
|
+
}): Promise<void>;
|
|
138
|
+
visit(options: {
|
|
139
|
+
driver: T['driver'];
|
|
140
|
+
url: string;
|
|
141
|
+
}): Promise<void>;
|
|
142
|
+
getOrientation(options: {
|
|
143
|
+
driver: T['driver'];
|
|
144
|
+
}): Promise<'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary'>;
|
|
145
|
+
setOrientation(options: {
|
|
146
|
+
driver: T['driver'];
|
|
147
|
+
orientation: 'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary';
|
|
148
|
+
}): Promise<void>;
|
|
149
|
+
getSystemBars(options: {
|
|
150
|
+
driver: T['driver'];
|
|
151
|
+
}): Promise<{
|
|
152
|
+
statusBar: {
|
|
153
|
+
visible: boolean;
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
height: number;
|
|
157
|
+
width: number;
|
|
158
|
+
};
|
|
159
|
+
navigationBar: {
|
|
160
|
+
visible: boolean;
|
|
161
|
+
x: number;
|
|
162
|
+
y: number;
|
|
163
|
+
height: number;
|
|
164
|
+
width: number;
|
|
165
|
+
};
|
|
166
|
+
}>;
|
|
167
|
+
getElementRegion(options: {
|
|
168
|
+
driver: T['driver'];
|
|
169
|
+
element: T['element'];
|
|
170
|
+
}): Promise<Region>;
|
|
171
|
+
getElementAttribute(options: {
|
|
172
|
+
driver: T['driver'];
|
|
173
|
+
element: T['element'];
|
|
174
|
+
attr: string;
|
|
175
|
+
}): Promise<string>;
|
|
176
|
+
performAction(options: {
|
|
177
|
+
driver: T['driver'];
|
|
178
|
+
steps: any[];
|
|
179
|
+
}): Promise<void>;
|
|
180
|
+
getCurrentWorld(options: {
|
|
181
|
+
driver: T['driver'];
|
|
182
|
+
}): Promise<string>;
|
|
183
|
+
getWorlds(options: {
|
|
184
|
+
driver: T['driver'];
|
|
185
|
+
}): Promise<string[]>;
|
|
186
|
+
switchWorld(options: {
|
|
187
|
+
driver: T['driver'];
|
|
188
|
+
name: string;
|
|
189
|
+
}): Promise<void>;
|
|
190
|
+
}
|
|
191
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Server as WsServer } from 'ws';
|
|
3
|
+
export type ServerOptions = {
|
|
4
|
+
port?: number;
|
|
5
|
+
singleton?: boolean;
|
|
6
|
+
portResolutionMode?: 'next' | 'random' | 'lazy';
|
|
7
|
+
debug?: boolean;
|
|
8
|
+
key?: string | Buffer;
|
|
9
|
+
cert?: string | Buffer;
|
|
10
|
+
};
|
|
11
|
+
export declare function makeServer(options?: ServerOptions): Promise<{
|
|
12
|
+
server?: WsServer;
|
|
13
|
+
port: number;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractCIProvider(): string | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TestResult } from '@applitools/core-base';
|
|
2
|
+
export declare function toFormatterString(results: TestResult[], { includeSubTests, markNewAsPassed }?: {
|
|
3
|
+
includeSubTests?: boolean;
|
|
4
|
+
markNewAsPassed?: boolean;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare function toHierarchicTAPString(results: TestResult[], { includeSubTests, markNewAsPassed }?: {
|
|
7
|
+
includeSubTests?: boolean;
|
|
8
|
+
markNewAsPassed?: boolean;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function toFlattenedTAPString(results: TestResult[], { markNewAsPassed }?: {
|
|
11
|
+
markNewAsPassed?: boolean;
|
|
12
|
+
}): string;
|
|
13
|
+
export declare function toXmlOutput(results: TestResult[], { totalTime }?: {
|
|
14
|
+
totalTime?: number;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function toJsonOutput(results: TestResult[], space?: number | string): string;
|