@applitools/driver 1.20.4 → 1.21.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 +29 -0
- package/dist/driver.js +12 -0
- package/dist/fake/spec-driver.js +9 -1
- package/package.json +3 -3
- package/types/driver.d.ts +1 -0
- package/types/fake/spec-driver.d.ts +2 -0
- package/types/spec-driver.d.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.21.0](https://github.com/Applitools-Dev/sdk/compare/js/driver@1.20.5...js/driver@1.21.0) (2025-03-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/utils bumped to 1.8.0
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
|
|
17
|
+
* @applitools/logger bumped to 2.1.2
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [1.20.5](https://github.com/Applitools-Dev/sdk/compare/js/driver@1.20.4...js/driver@1.20.5) (2025-02-26)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Dependencies
|
|
24
|
+
|
|
25
|
+
* @applitools/utils bumped to 1.7.8
|
|
26
|
+
#### Performance Improvements
|
|
27
|
+
|
|
28
|
+
* ufg client dedup job info elements ([#2811](https://github.com/Applitools-Dev/sdk/issues/2811)) ([c04c147](https://github.com/Applitools-Dev/sdk/commit/c04c14776736a422292ada1029820e975adc3d31))
|
|
29
|
+
* @applitools/logger bumped to 2.1.1
|
|
30
|
+
|
|
31
|
+
|
|
3
32
|
## [1.20.4](https://github.com/Applitools-Dev/sdk/compare/js/driver@1.20.3...js/driver@1.20.4) (2025-01-30)
|
|
4
33
|
|
|
5
34
|
|
package/dist/driver.js
CHANGED
|
@@ -884,6 +884,18 @@ class Driver {
|
|
|
884
884
|
async execute(script, arg) {
|
|
885
885
|
return this.currentContext.execute(script, arg);
|
|
886
886
|
}
|
|
887
|
+
async executeUserFunction(func) {
|
|
888
|
+
var _a, _b;
|
|
889
|
+
if (await ((_b = (_a = this._spec).isUserFunction) === null || _b === void 0 ? void 0 : _b.call(_a, func))) {
|
|
890
|
+
return this._spec.executeUserFunction(func);
|
|
891
|
+
}
|
|
892
|
+
else if (typeof func === 'function') {
|
|
893
|
+
return func();
|
|
894
|
+
}
|
|
895
|
+
else {
|
|
896
|
+
throw new Error(`User function is not supported (${JSON.stringify(func)})`);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
887
899
|
async visit(url) {
|
|
888
900
|
var _a, _b;
|
|
889
901
|
await ((_b = (_a = this._spec).visit) === null || _b === void 0 ? void 0 : _b.call(_a, this.target, url));
|
package/dist/fake/spec-driver.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getCapabilities = exports.performAction = exports.getElementAttribute = exports.getElementRegion = exports.getCurrentWorld = exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.getElementText = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.toSimpleCommonSelector = exports.toSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
26
|
+
exports.executeUserFunction = exports.isUserFunction = exports.getCapabilities = exports.performAction = exports.getElementAttribute = exports.getElementRegion = exports.getCurrentWorld = exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.getElementText = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.toSimpleCommonSelector = exports.toSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
27
27
|
const utils = __importStar(require("@applitools/utils"));
|
|
28
28
|
function isDriver(driver) {
|
|
29
29
|
return driver && driver.constructor.name === 'MockDriver';
|
|
@@ -157,3 +157,11 @@ async function getCapabilities(driver) {
|
|
|
157
157
|
return driver.capabilities;
|
|
158
158
|
}
|
|
159
159
|
exports.getCapabilities = getCapabilities;
|
|
160
|
+
async function isUserFunction(_ref) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
exports.isUserFunction = isUserFunction;
|
|
164
|
+
async function executeUserFunction(_userFunction) {
|
|
165
|
+
throw new Error(`executeUserFunction is not supported in FakeDriver. userFunction: ${_userFunction}`);
|
|
166
|
+
}
|
|
167
|
+
exports.executeUserFunction = executeUserFunction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"test": "run --top-level mocha './test/**/*.spec.ts'"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@applitools/logger": "2.1.
|
|
76
|
+
"@applitools/logger": "2.1.2",
|
|
77
77
|
"@applitools/snippets": "2.6.4",
|
|
78
|
-
"@applitools/utils": "1.
|
|
78
|
+
"@applitools/utils": "1.8.0",
|
|
79
79
|
"semver": "7.6.2"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
package/types/driver.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export declare class Driver<T extends SpecType> {
|
|
|
102
102
|
elements(selector: Selector<T>): Promise<Element<T>[]>;
|
|
103
103
|
waitFor(selector: Selector<T>, options?: WaitOptions): Promise<Element<T> | null>;
|
|
104
104
|
execute(script: ((arg: any) => any) | string, arg?: any): Promise<any>;
|
|
105
|
+
executeUserFunction<T>(func: SpecType['userFunction'] | (() => T)): Promise<any>;
|
|
105
106
|
visit(url: string): Promise<void>;
|
|
106
107
|
}
|
|
107
108
|
export declare function isDriverInstance<T extends SpecType>(driver: any): driver is Driver<T>;
|
|
@@ -40,4 +40,6 @@ export declare function getElementRegion(_driver: Driver, element: Element): Pro
|
|
|
40
40
|
export declare function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
|
|
41
41
|
export declare function performAction(_driver: Driver, _steps: any[]): Promise<void>;
|
|
42
42
|
export declare function getCapabilities(driver: Driver): Promise<Record<string, any>>;
|
|
43
|
+
export declare function isUserFunction(_ref: any): Promise<boolean>;
|
|
44
|
+
export declare function executeUserFunction(_userFunction: any): Promise<void>;
|
|
43
45
|
export {};
|
package/types/spec-driver.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Size, Region } from '@applitools/utils';
|
|
2
2
|
import type { DriverInfo, Capabilities, ScreenOrientation, Cookie } from './types';
|
|
3
3
|
import { type CommonSelector } from './selector';
|
|
4
|
-
export type SpecType<TDriver = unknown, TContext = unknown, TElement = unknown, TSelector = unknown, TSecondary extends SpecType = SpecType<unknown, unknown, unknown, unknown, never
|
|
4
|
+
export type SpecType<TDriver = unknown, TContext = unknown, TElement = unknown, TSelector = unknown, TSecondary extends SpecType = SpecType<unknown, unknown, unknown, unknown, never>, UserFunction = unknown> = {
|
|
5
5
|
driver: TDriver;
|
|
6
6
|
context: TContext;
|
|
7
7
|
element: TElement;
|
|
8
8
|
selector: TSelector;
|
|
9
9
|
secondary: TSecondary;
|
|
10
|
+
userFunction: UserFunction;
|
|
10
11
|
};
|
|
11
12
|
export interface SpecDriver<T extends SpecType> {
|
|
12
13
|
/**
|
|
@@ -82,6 +83,8 @@ export interface SpecDriver<T extends SpecType> {
|
|
|
82
83
|
* Executes given script in the given contexts with given argument.
|
|
83
84
|
*/
|
|
84
85
|
executeScript(context: T['context'], script: ((arg?: any) => any) | string, arg?: any): Promise<any>;
|
|
86
|
+
isUserFunction?(ref: any): Promise<boolean>;
|
|
87
|
+
executeUserFunction?(userFunction: T['userFunction']): Promise<any>;
|
|
85
88
|
findElement(context: T['context'], selector: T['selector'], parent?: T['element']): Promise<T['element'] | null>;
|
|
86
89
|
findElements(context: T['context'], selector: T['selector'], parent?: T['element']): Promise<T['element'][]>;
|
|
87
90
|
waitForSelector?(context: T['context'], selector: T['selector'], parent?: T['element'], options?: WaitOptions): Promise<T['element'] | null>;
|