@applitools/spec-driver-selenium 1.5.25 → 1.5.26
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/dist/spec-driver.js +16 -21
- package/package.json +8 -26
- package/types/index.d.ts +11 -11
package/dist/spec-driver.js
CHANGED
|
@@ -91,7 +91,7 @@ function transformSelector(selector) {
|
|
|
91
91
|
else if (utils.types.has(selector, 'selector')) {
|
|
92
92
|
if (!utils.types.isString(selector.selector))
|
|
93
93
|
return selector.selector;
|
|
94
|
-
if (!utils.types.has(selector, 'type'))
|
|
94
|
+
if (!utils.types.has(selector, 'type') || !selector.type)
|
|
95
95
|
return { css: selector.selector };
|
|
96
96
|
if (selector.type === 'css')
|
|
97
97
|
return { css: selector.selector };
|
|
@@ -176,21 +176,19 @@ async function findElements(driver, selector, parent) {
|
|
|
176
176
|
}
|
|
177
177
|
exports.findElements = findElements;
|
|
178
178
|
async function waitForSelector(driver, selector, _parent, options) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return driver.wait(Selenium.until.elementLocated(selector), options === null || options === void 0 ? void 0 : options.timeout);
|
|
182
|
-
}
|
|
183
|
-
else if ((options === null || options === void 0 ? void 0 : options.state) === 'visible') {
|
|
184
|
-
const element = await findElement(driver, selector);
|
|
179
|
+
if ((options === null || options === void 0 ? void 0 : options.state) === 'visible') {
|
|
180
|
+
const element = await driver.findElement(selector);
|
|
185
181
|
return driver.wait(Selenium.until.elementIsVisible(element), options === null || options === void 0 ? void 0 : options.timeout);
|
|
186
182
|
}
|
|
183
|
+
else {
|
|
184
|
+
return driver.wait(Selenium.until.elementLocated(selector), options === null || options === void 0 ? void 0 : options.timeout);
|
|
185
|
+
}
|
|
187
186
|
}
|
|
188
187
|
exports.waitForSelector = waitForSelector;
|
|
189
188
|
async function setElementText(driver, element, keys) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
await
|
|
193
|
-
await element.sendKeys(keys);
|
|
189
|
+
const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
|
|
190
|
+
await (resolvedElement === null || resolvedElement === void 0 ? void 0 : resolvedElement.clear());
|
|
191
|
+
await (resolvedElement === null || resolvedElement === void 0 ? void 0 : resolvedElement.sendKeys(keys));
|
|
194
192
|
}
|
|
195
193
|
exports.setElementText = setElementText;
|
|
196
194
|
async function getElementText(_driver, element) {
|
|
@@ -286,28 +284,25 @@ async function takeScreenshot(driver) {
|
|
|
286
284
|
}
|
|
287
285
|
exports.takeScreenshot = takeScreenshot;
|
|
288
286
|
async function click(driver, element) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
await element.click();
|
|
287
|
+
const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
|
|
288
|
+
await (resolvedElement === null || resolvedElement === void 0 ? void 0 : resolvedElement.click());
|
|
292
289
|
}
|
|
293
290
|
exports.click = click;
|
|
294
291
|
async function hover(driver, element) {
|
|
295
|
-
|
|
296
|
-
element = await findElement(driver, element);
|
|
292
|
+
const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
|
|
297
293
|
if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
|
|
298
294
|
const { ActionSequence } = require('selenium-webdriver');
|
|
299
295
|
const action = new ActionSequence(driver);
|
|
300
|
-
await action.mouseMove(
|
|
296
|
+
await action.mouseMove(resolvedElement).perform();
|
|
301
297
|
}
|
|
302
298
|
else {
|
|
303
|
-
await driver.actions().move({ origin:
|
|
299
|
+
await driver.actions().move({ origin: resolvedElement }).perform();
|
|
304
300
|
}
|
|
305
301
|
}
|
|
306
302
|
exports.hover = hover;
|
|
307
303
|
async function scrollIntoView(driver, element, align = false) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
await driver.executeScript('arguments[0].scrollIntoView(arguments[1])', element, align);
|
|
304
|
+
const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
|
|
305
|
+
await driver.executeScript('arguments[0].scrollIntoView(arguments[1])', resolvedElement, align);
|
|
311
306
|
}
|
|
312
307
|
exports.scrollIntoView = scrollIntoView;
|
|
313
308
|
async function waitUntilDisplayed(driver, selector, timeout) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/spec-driver-selenium",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.26",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"selenium",
|
|
6
6
|
"selenium-webdriver",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"types"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
-
"lint": "eslint '**/*.ts'",
|
|
45
|
-
"build": "ttsc",
|
|
44
|
+
"lint": "node ../../node_modules/.bin/eslint '**/*.ts'",
|
|
45
|
+
"build": "node ../../node_modules/.bin/ttsc --project ./tsconfig.build.json",
|
|
46
46
|
"test": "mocha ./test/**/*.spec.ts --no-timeouts -r ts-node/register -r @applitools/test-utils/mocha-hooks/docker",
|
|
47
47
|
"test:sanity": "yarn test",
|
|
48
48
|
"setup": "yarn docker:setup",
|
|
49
|
-
"docker:setup": "node
|
|
49
|
+
"docker:setup": "node ../../scripts/generate-docker-compose-config.js && docker-compose up -d",
|
|
50
50
|
"docker:teardown": "docker-compose down",
|
|
51
51
|
"upgrade:framework": "if [ ! -z $APPLITOOLS_SELENIUM_MAJOR_VERSION ]; then packagejson=`cat package.json`; yarn upgrade --no-lockfile selenium-webdriver@$APPLITOOLS_SELENIUM_MAJOR_VERSION; echo \"$packagejson\" > package.json; fi",
|
|
52
52
|
"deps": "bongo deps",
|
|
@@ -56,38 +56,20 @@
|
|
|
56
56
|
"version": "bongo version",
|
|
57
57
|
"postversion": "bongo postversion --skip-release-notification"
|
|
58
58
|
},
|
|
59
|
-
"husky": {
|
|
60
|
-
"hooks": {
|
|
61
|
-
"pre-push": "yarn bongo lint"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
59
|
"dependencies": {
|
|
65
|
-
"@applitools/driver": "1.11.
|
|
66
|
-
"@applitools/utils": "1.3.
|
|
60
|
+
"@applitools/driver": "1.11.28",
|
|
61
|
+
"@applitools/utils": "1.3.30"
|
|
67
62
|
},
|
|
68
63
|
"devDependencies": {
|
|
69
64
|
"@applitools/api-extractor": "^1.2.11",
|
|
70
65
|
"@applitools/bongo": "2.2.2",
|
|
71
|
-
"@applitools/
|
|
72
|
-
"@applitools/test-utils": "1.5.10",
|
|
66
|
+
"@applitools/test-utils": "1.5.12",
|
|
73
67
|
"@types/mocha": "^9.1.1",
|
|
74
68
|
"@types/node": "12",
|
|
75
69
|
"@types/selenium-webdriver": "^4.1.1",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
77
|
-
"@typescript-eslint/parser": "^5.27.0",
|
|
78
|
-
"eslint": "^8.16.0",
|
|
79
|
-
"eslint-config-prettier": "^8.5.0",
|
|
80
|
-
"eslint-plugin-mocha-no-only": "^1.1.1",
|
|
81
|
-
"eslint-plugin-node": "^11.1.0",
|
|
82
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
83
|
-
"husky": "^4.3.7",
|
|
84
70
|
"mocha": "^9.2.2",
|
|
85
71
|
"nock": "^13.2.9",
|
|
86
|
-
"
|
|
87
|
-
"selenium-webdriver": "4.4.0",
|
|
88
|
-
"ts-node": "^10.8.0",
|
|
89
|
-
"ttypescript": "^1.5.13",
|
|
90
|
-
"typescript": "^4.7.2"
|
|
72
|
+
"selenium-webdriver": "4.4.0"
|
|
91
73
|
},
|
|
92
74
|
"peerDependencies": {
|
|
93
75
|
"selenium-webdriver": ">=3.6.0"
|
package/types/index.d.ts
CHANGED
|
@@ -4,23 +4,23 @@ export function isDriver(driver: any): driver is Driver;
|
|
|
4
4
|
export function isElement(element: any): element is Element;
|
|
5
5
|
export function isSelector(selector: any): selector is Selector;
|
|
6
6
|
export function transformDriver(driver: Driver): Driver;
|
|
7
|
-
export function transformSelector(selector: string | { selector: string | Selector; type?: string; }): Selector;
|
|
8
|
-
export function untransformSelector(selector: Selector): string | { selector: string; type?: string; };
|
|
7
|
+
export function transformSelector(selector: string | { selector: string | Selector; type?: undefined | string; }): Selector;
|
|
8
|
+
export function untransformSelector(selector: Selector): null | (string | { selector: string; type?: undefined | string; });
|
|
9
9
|
export function isStaleElementError(error: any): boolean;
|
|
10
10
|
export function isEqualElements(_driver: Driver, element1: Element, element2: Element): Promise<boolean>;
|
|
11
11
|
export function executeScript(driver: Driver, script: string | ((arg: any) => any), arg: any): Promise<any>;
|
|
12
12
|
export function mainContext(driver: Driver): Promise<Driver>;
|
|
13
13
|
export function parentContext(driver: Driver): Promise<Driver>;
|
|
14
14
|
export function childContext(driver: Driver, element: Element): Promise<Driver>;
|
|
15
|
-
export function findElement(driver: Driver, selector: Selector, parent?: Element): Promise<Element>;
|
|
16
|
-
export function findElements(driver: Driver, selector: Selector, parent?: Element): Promise<Array<Element>>;
|
|
17
|
-
export function waitForSelector(driver: Driver, selector: Selector, _parent?: Element, options?: import('@applitools/driver').WaitOptions): Promise<Element>;
|
|
15
|
+
export function findElement(driver: Driver, selector: Selector, parent?: undefined | Element): Promise<null | Element>;
|
|
16
|
+
export function findElements(driver: Driver, selector: Selector, parent?: undefined | Element): Promise<Array<Element>>;
|
|
17
|
+
export function waitForSelector(driver: Driver, selector: Selector, _parent?: undefined | Element, options?: undefined | import('@applitools/driver').WaitOptions): Promise<null | Element>;
|
|
18
18
|
export function setElementText(driver: Driver, element: Element | Selector, keys: string): Promise<void>;
|
|
19
19
|
export function getElementText(_driver: Driver, element: Element): Promise<string>;
|
|
20
20
|
export function getWindowSize(driver: Driver): Promise<{ width: number; height: number; }>;
|
|
21
21
|
export function setWindowSize(driver: Driver, size: { width: number; height: number; }): Promise<void>;
|
|
22
22
|
export function getSessionMetadata(driver: Driver): Promise<void | []>;
|
|
23
|
-
export function getCookies(driver: Driver, context?: boolean): Promise<Array<import('@applitools/driver').Cookie>>;
|
|
23
|
+
export function getCookies(driver: Driver, context?: undefined | boolean): Promise<Array<import('@applitools/driver').Cookie>>;
|
|
24
24
|
export function getDriverInfo(driver: Driver): Promise<import('@applitools/driver').DriverInfo>;
|
|
25
25
|
export function getCapabilities(driver: Driver): Promise<Record<string, any>>;
|
|
26
26
|
export function getTitle(driver: Driver): Promise<string>;
|
|
@@ -45,7 +45,7 @@ export function getSystemBars(driver: Driver): Promise<{ statusBar: {
|
|
|
45
45
|
width: number;
|
|
46
46
|
}; }>;
|
|
47
47
|
export function setOrientation(driver: Driver, orientation: import('@applitools/driver').ScreenOrientation): Promise<void>;
|
|
48
|
-
export function getOrientation(driver: Driver): Promise<"
|
|
48
|
+
export function getOrientation(driver: Driver): Promise<"landscape" | "portrait">;
|
|
49
49
|
export function getElementRegion(_driver: Driver, element: Element): Promise<{
|
|
50
50
|
x: number;
|
|
51
51
|
y: number;
|
|
@@ -57,7 +57,7 @@ export function performAction(driver: Driver, steps: Array<any>): Promise<void>;
|
|
|
57
57
|
export function getCurrentWorld(driver: Driver): Promise<string>;
|
|
58
58
|
export function getWorlds(driver: Driver): Promise<Array<string>>;
|
|
59
59
|
export function switchWorld(driver: Driver, name: string): Promise<void>;
|
|
60
|
-
export function build(__0: any): Promise<[import('selenium-webdriver').WebDriver & { __applitoolsBrand?:
|
|
61
|
-
export type Driver = import('selenium-webdriver').WebDriver & { __applitoolsBrand?:
|
|
62
|
-
export type Element = import('selenium-webdriver').WebElement & { __applitoolsBrand?:
|
|
63
|
-
export type Selector = (import('selenium-webdriver').By | import('selenium-webdriver').RelativeBy | import('selenium-webdriver').ByHash | { using: string; value: string; } | ((webdriver: import('selenium-webdriver').WebDriver) => Promise<any>)) & { __applitoolsBrand?:
|
|
60
|
+
export function build(__0: any): Promise<[import('selenium-webdriver').WebDriver & { __applitoolsBrand?: undefined; } & { __serverUrl?: undefined | string; }, () => Promise<void>]>;
|
|
61
|
+
export type Driver = import('selenium-webdriver').WebDriver & { __applitoolsBrand?: undefined; };
|
|
62
|
+
export type Element = import('selenium-webdriver').WebElement & { __applitoolsBrand?: undefined; };
|
|
63
|
+
export type Selector = (import('selenium-webdriver').By | import('selenium-webdriver').RelativeBy | import('selenium-webdriver').ByHash | { using: string; value: string; } | ((webdriver: import('selenium-webdriver').WebDriver) => Promise<any>)) & { __applitoolsBrand?: undefined; };
|