sefiutils 1.0.0 → 1.0.1
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/lib/fiberUtils.d.ts +13 -0
- package/lib/fiberUtils.d.ts.map +1 -0
- package/lib/fiberUtils.js +60 -0
- package/lib/fiberUtils.js.map +1 -0
- package/lib/globalSetup.d.ts +22 -0
- package/lib/globalSetup.d.ts.map +1 -0
- package/lib/globalSetup.js +88 -0
- package/lib/globalSetup.js.map +1 -0
- package/{src/globalTeardown.ts → lib/globalTeardown.d.ts} +5 -12
- package/lib/globalTeardown.d.ts.map +1 -0
- package/lib/globalTeardown.js +34 -0
- package/lib/globalTeardown.js.map +1 -0
- package/lib/localSetup.d.ts +4 -0
- package/lib/localSetup.d.ts.map +1 -0
- package/lib/localSetup.js +139 -0
- package/lib/localSetup.js.map +1 -0
- package/lib/localTeardown.d.ts +6 -0
- package/lib/localTeardown.d.ts.map +1 -0
- package/lib/localTeardown.js +28 -0
- package/lib/localTeardown.js.map +1 -0
- package/lib/seUtils.d.ts +127 -0
- package/lib/seUtils.d.ts.map +1 -0
- package/lib/seUtils.js +510 -0
- package/lib/seUtils.js.map +1 -0
- package/package.json +4 -1
- package/.gitlab-ci.yml +0 -20
- package/jest.config.js +0 -11
- package/logo.graffle +0 -0
- package/logo.png +0 -0
- package/src/fiberUtils.ts +0 -60
- package/src/globalSetup.ts +0 -62
- package/src/localSetup.ts +0 -100
- package/src/localTeardown.ts +0 -14
- package/src/seUtils.ts +0 -448
- package/tests/tsconfig.json +0 -7
- package/tsconfig.json +0 -102
- /package/{src → lib}/execScripts/dom.js +0 -0
- /package/{src → lib}/execScripts/fiber.js +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WebDriver } from "selenium-webdriver";
|
|
2
|
+
export type ComponentType = "html" | "function" | "root" | "null" | "other";
|
|
3
|
+
export interface ComponentNode {
|
|
4
|
+
name: string;
|
|
5
|
+
kind: ComponentType;
|
|
6
|
+
props?: string[];
|
|
7
|
+
children: ComponentNode[];
|
|
8
|
+
}
|
|
9
|
+
export declare function getReactComponentTree(driver: WebDriver): Promise<ComponentNode>;
|
|
10
|
+
export declare function dumpComponentTree(node: ComponentNode): string;
|
|
11
|
+
export declare function findInComponentTree(node: ComponentNode, predicate: (node: ComponentNode) => boolean): ComponentNode | undefined;
|
|
12
|
+
export declare function findAllInComponentTree(node: ComponentNode, predicate: (node: ComponentNode) => boolean): ComponentNode[];
|
|
13
|
+
//# sourceMappingURL=fiberUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fiberUtils.d.ts","sourceRoot":"","sources":["../src/fiberUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5E,MAAM,WAAW,aAAa;IAE1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC5B;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAIrF;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,UAWpD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,GAAG,aAAa,GAAG,SAAS,CAW/H;AACD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,mBActG"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.findAllInComponentTree = exports.findInComponentTree = exports.dumpComponentTree = exports.getReactComponentTree = void 0;
|
|
13
|
+
const seUtils_1 = require("./seUtils");
|
|
14
|
+
function getReactComponentTree(driver) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const cmpTree = yield (0, seUtils_1.execScript)(driver, "execScripts/fiber.js", "uniDirFunctionComponentsTree");
|
|
17
|
+
return cmpTree;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.getReactComponentTree = getReactComponentTree;
|
|
21
|
+
function dumpComponentTree(node) {
|
|
22
|
+
let out = "";
|
|
23
|
+
dump(node);
|
|
24
|
+
return out;
|
|
25
|
+
function dump(node, indent = "") {
|
|
26
|
+
out += `${indent}${node.name} (${node.kind})${(node.props && node.props.length > 0) ? ": " + node.props.join(", ") : ""}\n`;
|
|
27
|
+
for (const child of node.children) {
|
|
28
|
+
dump(child, indent + " ");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.dumpComponentTree = dumpComponentTree;
|
|
33
|
+
function findInComponentTree(node, predicate) {
|
|
34
|
+
if (predicate(node)) {
|
|
35
|
+
return node;
|
|
36
|
+
}
|
|
37
|
+
for (const child of node.children) {
|
|
38
|
+
const found = findInComponentTree(child, predicate);
|
|
39
|
+
if (found) {
|
|
40
|
+
return found;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
exports.findInComponentTree = findInComponentTree;
|
|
46
|
+
function findAllInComponentTree(node, predicate) {
|
|
47
|
+
const res = [];
|
|
48
|
+
findAll(node);
|
|
49
|
+
return res;
|
|
50
|
+
function findAll(node) {
|
|
51
|
+
if (predicate(node)) {
|
|
52
|
+
return res.push(node);
|
|
53
|
+
}
|
|
54
|
+
for (const child of node.children) {
|
|
55
|
+
findAll(child);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.findAllInComponentTree = findAllInComponentTree;
|
|
60
|
+
//# sourceMappingURL=fiberUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fiberUtils.js","sourceRoot":"","sources":["../src/fiberUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uCAAuC;AAYvC,SAAsB,qBAAqB,CAAC,MAAiB;;QACzD,MAAM,OAAO,GAAkB,MAAM,IAAA,oBAAU,EAAC,MAAM,EAClD,sBAAsB,EAAE,8BAA8B,CAAC,CAAC;QAC5D,OAAO,OAAO,CAAC;IACnB,CAAC;CAAA;AAJD,sDAIC;AAGD,SAAgB,iBAAiB,CAAC,IAAmB;IACjD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC,IAAI,CAAC,CAAA;IACV,OAAO,GAAG,CAAC;IAEX,SAAS,IAAI,CAAC,IAAmB,EAAE,SAAiB,EAAE;QAClD,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QAC5H,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;SAC9B;IACL,CAAC;AACL,CAAC;AAXD,8CAWC;AAED,SAAgB,mBAAmB,CAAC,IAAmB,EAAE,SAA2C;IAChG,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,IAAI,CAAC;KACf;IACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;QAC/B,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACpD,IAAI,KAAK,EAAE;YACP,OAAO,KAAK,CAAC;SAChB;KACJ;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAXD,kDAWC;AACD,SAAgB,sBAAsB,CAAC,IAAmB,EAAE,SAA2C;IAEnG,MAAM,GAAG,GAAoB,EAAE,CAAC;IAChC,OAAO,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,GAAG,CAAC;IAEX,SAAS,OAAO,CAAC,IAAmB;QAChC,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE;YACjB,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACzB;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC/B,OAAO,CAAC,KAAK,CAAC,CAAC;SAClB;IACL,CAAC;AACL,CAAC;AAdD,wDAcC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
var server: any;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* This function is called by Jest once before all tests are executed.
|
|
6
|
+
* In order to get called, it must be referenced in the jest configuration file:
|
|
7
|
+
* ```
|
|
8
|
+
* "globalSetup": "<rootDir>/tests/globalSetup.ts"
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* **Important Note**: "Any global variables that are defined through globalSetup can only be
|
|
12
|
+
* read in globalTeardown. You cannot retrieve globals defined here in your test suites."
|
|
13
|
+
* [Jest Documentation](https://jestjs.io/docs/configuration#globalsetup-string)
|
|
14
|
+
*
|
|
15
|
+
* We only start the selenium server here if we are running in remote mode, which is the default.
|
|
16
|
+
* The mode can configured by setting the environment variable BROWSER to "chrome", "firefox" or "remote".
|
|
17
|
+
*
|
|
18
|
+
* Do not forget a global teardown function, which is called after all tests are executed,
|
|
19
|
+
* cf. globalTeardown.ts
|
|
20
|
+
*/
|
|
21
|
+
export default function setGlobalObjects(): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=globalSetup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../src/globalSetup.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACX,IAAI,MAAM,EAAE,GAAG,CAAC;CAEnB;AACD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAA8B,gBAAgB,kBAY7C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
/**
|
|
36
|
+
* This function is called by Jest once before all tests are executed.
|
|
37
|
+
* In order to get called, it must be referenced in the jest configuration file:
|
|
38
|
+
* ```
|
|
39
|
+
* "globalSetup": "<rootDir>/tests/globalSetup.ts"
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* **Important Note**: "Any global variables that are defined through globalSetup can only be
|
|
43
|
+
* read in globalTeardown. You cannot retrieve globals defined here in your test suites."
|
|
44
|
+
* [Jest Documentation](https://jestjs.io/docs/configuration#globalsetup-string)
|
|
45
|
+
*
|
|
46
|
+
* We only start the selenium server here if we are running in remote mode, which is the default.
|
|
47
|
+
* The mode can configured by setting the environment variable BROWSER to "chrome", "firefox" or "remote".
|
|
48
|
+
*
|
|
49
|
+
* Do not forget a global teardown function, which is called after all tests are executed,
|
|
50
|
+
* cf. globalTeardown.ts
|
|
51
|
+
*/
|
|
52
|
+
function setGlobalObjects() {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const browser = process.env.BROWSER || "remote";
|
|
55
|
+
// console.log(`Using browser: ${browser}`);
|
|
56
|
+
try {
|
|
57
|
+
if (browser === "remote") {
|
|
58
|
+
yield setUpSeleniumServer();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
console.error(`Error setting up server: ${err}`);
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.default = setGlobalObjects;
|
|
68
|
+
function setUpSeleniumServer() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const remote = yield Promise.resolve().then(() => __importStar(require("selenium-webdriver/remote")));
|
|
71
|
+
//@ts-ignore
|
|
72
|
+
const jar = yield Promise.resolve().then(() => __importStar(require('selenium-server-standalone-jar')));
|
|
73
|
+
if (globalThis.server) {
|
|
74
|
+
yield globalThis.server.kill();
|
|
75
|
+
console.log(`Server killed before starting again`);
|
|
76
|
+
}
|
|
77
|
+
// console.log(`Load selenium server from ${jar.path}`);
|
|
78
|
+
const s = new remote.SeleniumServer(jar.path, {
|
|
79
|
+
port: 4444,
|
|
80
|
+
env: Object.assign(Object.assign({}, process.env), { "SE_NODE_MAX_SESSIONS": "4", "SE_NODE_OVERRIDE_MAX_SESSIONS": "true" })
|
|
81
|
+
});
|
|
82
|
+
const address = yield s.start(3000);
|
|
83
|
+
globalThis.server = s;
|
|
84
|
+
// const address = await globalThis.server.address()
|
|
85
|
+
// console.log(`Selenium server started at address: ${address}`);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=globalSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalSetup.js","sourceRoot":"","sources":["../src/globalSetup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,SAA8B,gBAAgB;;QAC1C,MAAM,OAAO,GAAI,OAAO,CAAC,GAAG,CAAC,OAA2C,IAAI,QAAQ,CAAC;QAErF,4CAA4C;QAC5C,IAAI;YACA,IAAI,OAAO,KAAK,QAAQ,EAAE;gBACtB,MAAM,mBAAmB,EAAE,CAAC;aAC/B;SACJ;QAAC,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,4BAA4B,GAAG,EAAE,CAAC,CAAC;YACjD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;CAAA;AAZD,mCAYC;AAGD,SAAe,mBAAmB;;QAE9B,MAAM,MAAM,GAAG,wDAAa,2BAA2B,GAAC,CAAC;QACzD,YAAY;QACZ,MAAM,GAAG,GAAG,wDAAa,gCAAgC,GAAC,CAAC;QAE3D,IAAI,UAAU,CAAC,MAAM,EAAE;YACnB,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;SACtD;QAED,wDAAwD;QACxD,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE;YAC1C,IAAI,EAAE,IAAI;YACV,GAAG,kCACI,OAAO,CAAC,GAAG,KACd,sBAAsB,EAAE,GAAG,EAC3B,+BAA+B,EAAE,MAAM,GAE1C;SACJ,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;QACtB,oDAAoD;QACpD,iEAAiE;IACrE,CAAC;CAAA"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* This function is called by Jest once after tests have been executed.
|
|
2
|
+
* This function is called by Jest once after tests have been executed.
|
|
4
3
|
* In order to get called, it must be referenced in the jest configuration file:
|
|
5
4
|
* ```
|
|
6
5
|
* "globalTeardown": "<rootDir>/tests/globalTeardown.ts"
|
|
7
6
|
* ```
|
|
8
|
-
* **Important Note**: "Any global variables that are defined through globalSetup can only be
|
|
7
|
+
* **Important Note**: "Any global variables that are defined through globalSetup can only be
|
|
9
8
|
* read in globalTeardown. You cannot retrieve globals defined here in your test suites."
|
|
10
9
|
* [Jest Documentation](https://jestjs.io/docs/configuration#globalsetup-string)
|
|
11
|
-
*
|
|
10
|
+
*
|
|
12
11
|
* Here, we stop the remote selenium server if it was started in globalSetup.ts.
|
|
13
12
|
*/
|
|
14
|
-
export default
|
|
15
|
-
|
|
16
|
-
await server.kill();
|
|
17
|
-
console.log(`Server killed`);
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
globalThis.server = undefined;
|
|
21
|
-
}
|
|
13
|
+
export default function killServer(): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=globalTeardown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalTeardown.d.ts","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;GAWG;AACH,wBAA8B,UAAU,kBAOvC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**
|
|
13
|
+
* This function is called by Jest once after tests have been executed.
|
|
14
|
+
* In order to get called, it must be referenced in the jest configuration file:
|
|
15
|
+
* ```
|
|
16
|
+
* "globalTeardown": "<rootDir>/tests/globalTeardown.ts"
|
|
17
|
+
* ```
|
|
18
|
+
* **Important Note**: "Any global variables that are defined through globalSetup can only be
|
|
19
|
+
* read in globalTeardown. You cannot retrieve globals defined here in your test suites."
|
|
20
|
+
* [Jest Documentation](https://jestjs.io/docs/configuration#globalsetup-string)
|
|
21
|
+
*
|
|
22
|
+
* Here, we stop the remote selenium server if it was started in globalSetup.ts.
|
|
23
|
+
*/
|
|
24
|
+
function killServer() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (globalThis.server) {
|
|
27
|
+
yield server.kill();
|
|
28
|
+
console.log(`Server killed`);
|
|
29
|
+
}
|
|
30
|
+
globalThis.server = undefined;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.default = killServer;
|
|
34
|
+
//# sourceMappingURL=globalTeardown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":";;;;;;;;;;;AACA;;;;;;;;;;;GAWG;AACH,SAA8B,UAAU;;QACpC,IAAI,UAAU,CAAC,MAAM,EAAE;YACnB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;SAEhC;QACD,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC;IAClC,CAAC;CAAA;AAPD,6BAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSetup.d.ts","sourceRoot":"","sources":["../src/localSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGtE,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAM,EAAE,MAAM,SAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAM5F"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.localSetup = exports.LOCAL_SETUP_TIMEOUT = void 0;
|
|
36
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
37
|
+
const seUtils_1 = require("./seUtils");
|
|
38
|
+
exports.LOCAL_SETUP_TIMEOUT = 20000;
|
|
39
|
+
function localSetup(page, width = 500, height = 500) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const driver = yield getWebDriver();
|
|
42
|
+
console.log(`Load page: ${page}`);
|
|
43
|
+
yield driver.get(page);
|
|
44
|
+
yield (0, seUtils_1.setBrowserWindowSize)(driver, width, height);
|
|
45
|
+
return driver;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.localSetup = localSetup;
|
|
49
|
+
/**
|
|
50
|
+
* To be configured in jest setup file via globalSetup as it needs to be run before any tests in all files.
|
|
51
|
+
* Additionally,
|
|
52
|
+
* ```
|
|
53
|
+
* await driver.get(page);
|
|
54
|
+
* await setViewPortSize(500, 500);
|
|
55
|
+
* ```
|
|
56
|
+
* are to be called.
|
|
57
|
+
*/
|
|
58
|
+
function getWebDriver() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const browser = process.env.BROWSER || "remote";
|
|
61
|
+
// console.log(`Using browser: ${browser}`);
|
|
62
|
+
try {
|
|
63
|
+
if (browser === "chrome") {
|
|
64
|
+
return yield setUpWebDriverChrome();
|
|
65
|
+
}
|
|
66
|
+
else if (browser === "firefox") {
|
|
67
|
+
return yield setUpWebDriverFirefox();
|
|
68
|
+
}
|
|
69
|
+
else if (browser === "remote") {
|
|
70
|
+
return yield setUpWebDriverInDocker();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error(`Unknown browser: ${browser}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
console.error(`Error setting up driver: ${err}`);
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function setUpWebDriverInDocker() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const firefox = yield Promise.resolve().then(() => __importStar(require('selenium-webdriver/firefox')));
|
|
85
|
+
let address = "http://localhost:4444/wd/hub";
|
|
86
|
+
let start = Date.now();
|
|
87
|
+
const driver = yield new selenium_webdriver_1.Builder()
|
|
88
|
+
.usingServer(address)
|
|
89
|
+
.withCapabilities(selenium_webdriver_1.Capabilities.firefox())
|
|
90
|
+
.setFirefoxOptions(new firefox.Options().headless())
|
|
91
|
+
.build();
|
|
92
|
+
let duration = (Date.now() - start) / 1000;
|
|
93
|
+
// console.log(`Driver resolved and connected to ${address}, required ${duration}s.`);
|
|
94
|
+
return driver;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* To be called in the beforeAll() function of a test suite.
|
|
99
|
+
* Additionally,
|
|
100
|
+
* ```
|
|
101
|
+
* await driver.get(page);
|
|
102
|
+
* await setViewPortSize(500, 500);
|
|
103
|
+
* ```
|
|
104
|
+
* are to be called.
|
|
105
|
+
*/
|
|
106
|
+
function setUpWebDriverChrome() {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
//@ts-ignore
|
|
109
|
+
yield Promise.resolve().then(() => __importStar(require('chromedriver')));
|
|
110
|
+
const chrome = yield Promise.resolve().then(() => __importStar(require('selenium-webdriver/chrome')));
|
|
111
|
+
const driver = yield new selenium_webdriver_1.Builder()
|
|
112
|
+
.forBrowser('chrome')
|
|
113
|
+
.setChromeOptions(new chrome.Options().headless())
|
|
114
|
+
.build();
|
|
115
|
+
return driver;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* To be called in the beforeAll() function of a test suite.
|
|
120
|
+
* Additionally,
|
|
121
|
+
* ```
|
|
122
|
+
* await driver.get(page);
|
|
123
|
+
* await setViewPortSize(500, 500);
|
|
124
|
+
* ```
|
|
125
|
+
* are to be called.
|
|
126
|
+
*/
|
|
127
|
+
function setUpWebDriverFirefox() {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
//@ts-ignore
|
|
130
|
+
yield Promise.resolve().then(() => __importStar(require('geckodriver'))); // installed geckodriver will cause remote configuration to fail in docker...
|
|
131
|
+
const firefox = yield Promise.resolve().then(() => __importStar(require('selenium-webdriver/firefox')));
|
|
132
|
+
const driver = yield new selenium_webdriver_1.Builder()
|
|
133
|
+
.forBrowser('firefox')
|
|
134
|
+
.setFirefoxOptions(new firefox.Options().headless())
|
|
135
|
+
.build();
|
|
136
|
+
return driver;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=localSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSetup.js","sourceRoot":"","sources":["../src/localSetup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAsE;AACtE,uCAAkE;AAErD,QAAA,mBAAmB,GAAG,KAAK,CAAC;AAEzC,SAAsB,UAAU,CAAC,IAAY,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG;;QACpE,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;QAClC,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvB,MAAM,IAAA,8BAAoB,EAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC;IAClB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;QACZ,wDAAa,cAAc,GAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,wDAAa,2BAA2B,GAAC,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,IAAI,4BAAO,EAAE;aAC7B,UAAU,CAAC,QAAQ,CAAC;aACpB,gBAAgB,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;aACjD,KAAK,EAAE,CAAC;QACb,OAAO,MAAM,CAAC;IAClB,CAAC;CAAA;AAED;;;;;;;;GAQG;AACH,SAAe,qBAAqB;;QAChC,YAAY;QACZ,wDAAa,aAAa,GAAC,CAAC,CAAC,6EAA6E;QAC1G,MAAM,OAAO,GAAG,wDAAa,4BAA4B,GAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,MAAM,IAAI,4BAAO,EAAE;aAC7B,UAAU,CAAC,SAAS,CAAC;aACrB,iBAAiB,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;aACnD,KAAK,EAAE,CAAC;QAEb,OAAO,MAAM,CAAC;IAClB,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localTeardown.d.ts","sourceRoot":"","sources":["../src/localTeardown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,SAAS,iBAQpD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.localTeardown = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* To be called in the afterAll() function of a test suite.
|
|
15
|
+
*/
|
|
16
|
+
function localTeardown(driver) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (driver) {
|
|
19
|
+
yield driver.quit();
|
|
20
|
+
// console.log(`Driver quit`);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new Error("Driver not started yet");
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.localTeardown = localTeardown;
|
|
28
|
+
//# sourceMappingURL=localTeardown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localTeardown.js","sourceRoot":"","sources":["../src/localTeardown.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA;;GAEG;AACH,SAAsB,aAAa,CAAC,MAAiB;;QACjD,IAAI,MAAM,EAAE;YACR,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,8BAA8B;SACjC;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAE7C;IACL,CAAC;CAAA;AARD,sCAQC"}
|
package/lib/seUtils.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Locator, WebDriver, WebElement } from 'selenium-webdriver';
|
|
2
|
+
export declare function execScript<T>(driver: WebDriver, scriptName: string, fct: string): Promise<T>;
|
|
3
|
+
export interface Bounds {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
right: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function boundsToString(bounds: Bounds): string;
|
|
10
|
+
export declare function toFloor(bounds: Bounds[]): Bounds[];
|
|
11
|
+
/**
|
|
12
|
+
* Coordinates are sometimes floats. We compare two numbers with a delta of 1 to ignore rounding problems.
|
|
13
|
+
*/
|
|
14
|
+
export declare function circa(n1: number, n2: number): boolean;
|
|
15
|
+
export declare function waitFor<T>(callback: () => Promise<T>, timeout?: number, intervalTime?: number): Promise<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Takes screenshot of current window and saves it to the given file.
|
|
18
|
+
* The folder is created if it does not yet exists.
|
|
19
|
+
*/
|
|
20
|
+
export declare function saveScreenshot(driver: WebDriver, fileName: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Helper function for printing out an element (tag, id if present)
|
|
23
|
+
*/
|
|
24
|
+
export declare function describe(we: WebElement): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the element by means of `WebElement` by its id attribute.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getElementById(driver: WebDriver, id: string): Promise<WebElement>;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the first element by means of `WebElement` by its class attribute.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getElementByClass(driver: WebDriver, clazz: string): Promise<WebElement>;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the first element by means of `WebElement` by its tag name.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getElementByTag(driver: WebDriver, tagName: string): Promise<WebElement>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns first element containing given text or undefined.
|
|
39
|
+
*
|
|
40
|
+
* Test in browser console: `$x("//*[contains(text(), 'Hello')]")`
|
|
41
|
+
*/
|
|
42
|
+
export declare function getElementContainingText(driver: WebDriver, text: string): Promise<WebElement | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the bounding client rect (the bounding box relative to the viewport)
|
|
45
|
+
* of an element (found by its is attribute) by means of a JavaScript call.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getBoundingClientRect(driver: WebDriver, id: string): Promise<DOMRect>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns all {@link getBoundingClientRect} values of the elements
|
|
50
|
+
* found in the given element list.
|
|
51
|
+
* The element list is computed by means of JavaScript code,
|
|
52
|
+
* e.g. `document.getElementsByClassName('grid').item(0).children`.
|
|
53
|
+
*
|
|
54
|
+
* @param elementList JavaScript code to determine the element list
|
|
55
|
+
*/
|
|
56
|
+
export declare function getBoundingClientRects(driver: WebDriver, jsElementList: string): Promise<DOMRect[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the rects using the driver API.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getRects(driver: WebDriver, locator: Locator): Promise<Bounds[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the rects of the first child (of each found element) using the driver API.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getRectsOfContent(driver: WebDriver, locator: Locator): Promise<Bounds[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns all text content of the elements
|
|
67
|
+
* found in the given element list.
|
|
68
|
+
* The elements list is computed by means of JavaScript code,
|
|
69
|
+
* e.g. `document.getElementsByClassName('grid').item(0).children`.
|
|
70
|
+
*
|
|
71
|
+
* This is useful in combination with {@link getBoundingClientRects} in
|
|
72
|
+
* order to describe the items.
|
|
73
|
+
*
|
|
74
|
+
* @param elementList JavaScript code to determine the element list
|
|
75
|
+
*/
|
|
76
|
+
export declare function getTextContents(driver: WebDriver, jsElementList: string): Promise<string[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Returns all computed styles of the elements
|
|
79
|
+
* found in the given element list.
|
|
80
|
+
* The elements list is computed by means of JavaScript code,
|
|
81
|
+
* e.g. `document.getElementsByClassName('grid').item(0).children`.
|
|
82
|
+
*
|
|
83
|
+
* @param elementList JavaScript code to determine the element list
|
|
84
|
+
*/
|
|
85
|
+
export declare function getComputedStyles(driver: WebDriver, jsElementList: string, style: string): Promise<string[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the inner size of the windows bounding client rect (the bounding box relative to the viewport)
|
|
88
|
+
* of an element (found by its is attribute) by means of a JavaScript call.
|
|
89
|
+
* The window size contains the scrollbars. I.e. it is a bit larger than {@link getViewPortSize}.
|
|
90
|
+
*/
|
|
91
|
+
export declare function getInnerSizeOfWindow(driver: WebDriver): Promise<{
|
|
92
|
+
width: number;
|
|
93
|
+
height: number;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the viewport size, which is the inner window size but not with the scrollbars.
|
|
97
|
+
* I.e. the viewport size is a bit smaller than {@link getInnerSizeOfWindow} (if scrollbars are visible).
|
|
98
|
+
* The value is retrieved by means of JavaScript.
|
|
99
|
+
*/
|
|
100
|
+
export declare function getViewPortSize(driver: WebDriver): Promise<{
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Returns true if the element identified by its id attribute is with the view port.
|
|
106
|
+
* That does not necessarily means that it is visible, since its display or visible attribute may
|
|
107
|
+
* hide the element.
|
|
108
|
+
*/
|
|
109
|
+
export declare function isInViewPort(driver: WebDriver, id: string): Promise<boolean>;
|
|
110
|
+
/**
|
|
111
|
+
* Sets the window so that the {@link getViewPortSize} matches the given width and height.
|
|
112
|
+
*/
|
|
113
|
+
export declare function setBrowserWindowSize(driver: WebDriver, width: number, height: number): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Sets the window so that the {@link getViewPortSize} matches the given width and height. Warning: This does not work reliably.
|
|
116
|
+
*/
|
|
117
|
+
export declare function setViewPortSize(driver: WebDriver, width: number, height: number): Promise<void>;
|
|
118
|
+
export declare function getInheritedBackgroundColorsByJS(driver: WebDriver, nodelist: string): Promise<string[]>;
|
|
119
|
+
export declare function getInheritedColorsByJS(driver: WebDriver, nodelist: string): Promise<string[]>;
|
|
120
|
+
export declare function getAllTextNodes(driver: WebDriver): Promise<{
|
|
121
|
+
text: string;
|
|
122
|
+
color: string;
|
|
123
|
+
background: string;
|
|
124
|
+
line: string;
|
|
125
|
+
}[]>;
|
|
126
|
+
export declare function getButtonsAndHRefs(driver: WebDriver): Promise<WebElement[]>;
|
|
127
|
+
//# sourceMappingURL=seUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seUtils.d.ts","sourceRoot":"","sources":["../src/seUtils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAM,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExE,wBAAsB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAOlG;AAED,MAAM,WAAW,MAAM;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,UAE5C;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,YAWvC;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,WAG3C;AAID,wBAAsB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,SAAK,EAAE,YAAY,SAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAyBvG;AAGD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvF;AAID;;GAEG;AACH,wBAAsB,QAAQ,CAAC,EAAE,EAAE,UAAU,mBAc5C;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAGvF;AAED;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