@appium/fake-driver 6.0.2 → 6.1.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/LICENSE +201 -0
- package/build/lib/commands/alert.d.ts +10 -13
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +39 -46
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/contexts.d.ts +9 -13
- package/build/lib/commands/contexts.d.ts.map +1 -1
- package/build/lib/commands/contexts.js +55 -62
- package/build/lib/commands/contexts.js.map +1 -1
- package/build/lib/commands/element.d.ts +23 -26
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +100 -89
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/find.d.ts +14 -17
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +66 -63
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +25 -28
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +90 -75
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/desired-caps.d.ts +14 -0
- package/build/lib/desired-caps.d.ts.map +1 -0
- package/build/lib/desired-caps.js +16 -0
- package/build/lib/desired-caps.js.map +1 -0
- package/build/lib/doctor/common.d.ts +11 -0
- package/build/lib/doctor/common.d.ts.map +1 -0
- package/build/lib/doctor/common.js +25 -0
- package/build/lib/doctor/common.js.map +1 -0
- package/build/lib/doctor/fake1.d.ts +3 -0
- package/build/lib/doctor/fake1.d.ts.map +1 -0
- package/build/lib/doctor/fake1.js +6 -0
- package/build/lib/doctor/fake1.js.map +1 -0
- package/build/lib/doctor/fake2.d.ts +3 -0
- package/build/lib/doctor/fake2.d.ts.map +1 -0
- package/build/lib/doctor/fake2.js +6 -0
- package/build/lib/doctor/fake2.js.map +1 -0
- package/build/lib/driver.d.ts +128 -156
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +146 -154
- package/build/lib/driver.js.map +1 -1
- package/build/lib/fake-app.d.ts +37 -45
- package/build/lib/fake-app.d.ts.map +1 -1
- package/build/lib/fake-app.js +57 -34
- package/build/lib/fake-app.js.map +1 -1
- package/build/lib/fake-driver-schema.d.ts +16 -11
- package/build/lib/fake-driver-schema.d.ts.map +1 -1
- package/build/lib/fake-driver-schema.js +2 -17
- package/build/lib/fake-driver-schema.js.map +1 -1
- package/build/lib/fake-element.d.ts +27 -26
- package/build/lib/fake-element.d.ts.map +1 -1
- package/build/lib/fake-element.js +19 -19
- package/build/lib/fake-element.js.map +1 -1
- package/build/lib/index.d.ts +2 -3
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +2 -6
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.d.ts +1 -2
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +2 -2
- package/build/lib/logger.js.map +1 -1
- package/build/lib/scripts/fake-error.d.ts.map +1 -1
- package/build/lib/scripts/fake-error.js.map +1 -1
- package/build/lib/scripts/fake-stdin.d.ts.map +1 -1
- package/build/lib/scripts/fake-stdin.js.map +1 -1
- package/build/lib/scripts/fake-success.d.ts.map +1 -1
- package/build/lib/scripts/fake-success.js +3 -6
- package/build/lib/scripts/fake-success.js.map +1 -1
- package/build/lib/server.d.ts +2 -1
- package/build/lib/server.d.ts.map +1 -1
- package/build/lib/server.js +3 -5
- package/build/lib/server.js.map +1 -1
- package/build/lib/types.d.ts +1 -1
- package/build/lib/types.d.ts.map +1 -1
- package/lib/commands/alert.ts +31 -61
- package/lib/commands/contexts.ts +50 -73
- package/lib/commands/element.ts +122 -135
- package/lib/commands/find.ts +100 -115
- package/lib/commands/general.ts +122 -127
- package/lib/desired-caps.ts +16 -0
- package/lib/doctor/common.ts +26 -0
- package/lib/doctor/fake1.ts +3 -0
- package/lib/doctor/fake2.ts +3 -0
- package/lib/driver.ts +321 -0
- package/lib/fake-app.ts +234 -0
- package/lib/fake-driver-schema.ts +43 -0
- package/lib/fake-element.ts +128 -0
- package/lib/{index.js → index.ts} +5 -9
- package/lib/logger.ts +3 -0
- package/lib/scripts/{fake-success.js → fake-success.ts} +1 -1
- package/lib/{server.js → server.ts} +3 -4
- package/lib/types.ts +1 -1
- package/package.json +11 -14
- package/tsconfig.json +2 -1
- package/build/lib/commands/index.d.ts +0 -14
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -16
- package/build/lib/commands/index.js.map +0 -1
- package/build/lib/commands/mixin.d.ts +0 -11
- package/build/lib/commands/mixin.d.ts.map +0 -1
- package/build/lib/commands/mixin.js +0 -16
- package/build/lib/commands/mixin.js.map +0 -1
- package/lib/commands/index.ts +0 -14
- package/lib/commands/mixin.ts +0 -13
- package/lib/driver.js +0 -356
- package/lib/fake-app.js +0 -190
- package/lib/fake-driver-schema.js +0 -35
- package/lib/fake-element.js +0 -117
- package/lib/logger.js +0 -5
- package/test/fixtures/app.xml +0 -38
- /package/lib/scripts/{fake-error.js → fake-error.ts} +0 -0
- /package/lib/scripts/{fake-stdin.js → fake-stdin.ts} +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import XMLDom from '@xmldom/xmldom';
|
|
3
|
+
import type {Document as XMLDocument, Node as XMLNode} from '@xmldom/xmldom';
|
|
4
|
+
import type {FakeApp} from './fake-app';
|
|
5
|
+
|
|
6
|
+
export interface XmlNodeLike {
|
|
7
|
+
tagName: string;
|
|
8
|
+
attributes: {name: string; value: string}[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Wrapper around an XML node from the fake app DOM; supports attrs, css, visibility, click, alerts. */
|
|
12
|
+
export class FakeElement {
|
|
13
|
+
readonly app: FakeApp;
|
|
14
|
+
readonly type: string;
|
|
15
|
+
readonly nodeAttrs: Record<string, string>;
|
|
16
|
+
readonly node: XmlNodeLike;
|
|
17
|
+
attrs: Record<string, string>;
|
|
18
|
+
css: Record<string, string>;
|
|
19
|
+
|
|
20
|
+
constructor(xmlNode: XmlNodeLike, app: FakeApp) {
|
|
21
|
+
this.app = app;
|
|
22
|
+
this.node = xmlNode;
|
|
23
|
+
this.nodeAttrs = {};
|
|
24
|
+
this.type = xmlNode.tagName;
|
|
25
|
+
this.attrs = {};
|
|
26
|
+
this.css = {};
|
|
27
|
+
// Support both DOM Attr (name/value) and nodeName/nodeValue (e.g. @xmldom/xmldom).
|
|
28
|
+
const attrs = this.node.attributes as unknown as Array<{
|
|
29
|
+
name?: string; nodeName?: string; value?: string; nodeValue?: string
|
|
30
|
+
}>;
|
|
31
|
+
for (const attr of _.values(attrs)) {
|
|
32
|
+
const name = attr.name ?? attr.nodeName ?? '';
|
|
33
|
+
const value = attr.value ?? attr.nodeValue ?? '';
|
|
34
|
+
if (name) {
|
|
35
|
+
this.nodeAttrs[name] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
this.parseCss();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private parseCss(): void {
|
|
42
|
+
if (this.nodeAttrs.style) {
|
|
43
|
+
const segments = this.nodeAttrs.style.split(';');
|
|
44
|
+
for (const s of segments) {
|
|
45
|
+
let [prop, val] = s.split(':');
|
|
46
|
+
prop = prop.trim();
|
|
47
|
+
val = val.trim();
|
|
48
|
+
this.css[prop] = val;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get tagName(): string {
|
|
54
|
+
return this.node.tagName;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setAttr(k: string, v: string): void {
|
|
58
|
+
this.attrs[k] = v;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
getAttr(k: string): string {
|
|
62
|
+
return this.attrs[k] || '';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
isVisible(): boolean {
|
|
66
|
+
return this.nodeAttrs.visible !== 'false';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
isEnabled(): boolean {
|
|
70
|
+
return this.nodeAttrs.enabled !== 'false';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
isSelected(): boolean {
|
|
74
|
+
return this.nodeAttrs.selected === 'true';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getLocation(): {x: number; y: number} {
|
|
78
|
+
return {
|
|
79
|
+
x: parseFloat(this.nodeAttrs.left || '0'),
|
|
80
|
+
y: parseFloat(this.nodeAttrs.top || '0'),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getElementRect(): {x: number; y: number; width: number; height: number} {
|
|
85
|
+
return {...this.getLocation(), ...this.getSize()};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getSize(): {width: number; height: number} {
|
|
89
|
+
return {
|
|
90
|
+
width: parseFloat(this.nodeAttrs.width || '0'),
|
|
91
|
+
height: parseFloat(this.nodeAttrs.height || '0'),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
click(): void {
|
|
96
|
+
const curClicks = Number(this.getAttr('clicks') || 0);
|
|
97
|
+
this.setAttr('clicks', String(curClicks + 1));
|
|
98
|
+
const alertId = this.nodeAttrs.showAlert;
|
|
99
|
+
if (alertId) {
|
|
100
|
+
this.app.showAlert(alertId);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
equals(other: FakeElement): boolean {
|
|
105
|
+
return this.node === other.node;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
hasPrompt(): boolean {
|
|
109
|
+
return this.nodeAttrs.hasPrompt === 'true';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
getCss(prop: string): string | null {
|
|
113
|
+
if (_.has(this.css, prop)) {
|
|
114
|
+
return this.css[prop];
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get xmlFragment(): XMLDocument {
|
|
120
|
+
const frag = new XMLDom.XMLSerializer().serializeToString(
|
|
121
|
+
this.node as unknown as XMLNode
|
|
122
|
+
);
|
|
123
|
+
return new XMLDom.DOMParser().parseFromString(
|
|
124
|
+
frag,
|
|
125
|
+
XMLDom.MIME_TYPE.XML_TEXT
|
|
126
|
+
) as XMLDocument;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -4,19 +4,15 @@ import {startServer} from './server';
|
|
|
4
4
|
const DEFAULT_HOST = 'localhost';
|
|
5
5
|
const DEFAULT_PORT = 4774;
|
|
6
6
|
|
|
7
|
-
async function main() {
|
|
8
|
-
const getArgValue = (
|
|
7
|
+
export async function main() {
|
|
8
|
+
const getArgValue = (argName: string): string | null => {
|
|
9
9
|
const argIndex = process.argv.indexOf(argName);
|
|
10
|
-
return argIndex > 0 ? process.argv[argIndex + 1] : null;
|
|
10
|
+
return argIndex > 0 ? process.argv[argIndex + 1] ?? null : null;
|
|
11
11
|
};
|
|
12
12
|
const port = parseInt(String(getArgValue('--port')), 10) || DEFAULT_PORT;
|
|
13
13
|
const host = getArgValue('--host') || DEFAULT_HOST;
|
|
14
14
|
return await startServer(port, host);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export {FakeDriver, startServer
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {import('./types').W3CFakeDriverCaps} W3CFakeDriverCaps
|
|
21
|
-
* @typedef {import('./types').FakeDriverCaps} FakeDriverCaps
|
|
22
|
-
*/
|
|
17
|
+
export {FakeDriver, startServer};
|
|
18
|
+
export type {FakeDriverCaps, W3CFakeDriverCaps} from './types';
|
package/lib/logger.ts
ADDED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import log from './logger';
|
|
1
|
+
import {log} from './logger';
|
|
2
2
|
import {server as baseServer, routeConfiguringFunction} from 'appium/driver';
|
|
3
3
|
import {FakeDriver} from './driver';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/** Start HTTP server with FakeDriver and default WebDriver routes. */
|
|
6
|
+
export async function startServer(port: number, hostname: string) {
|
|
6
7
|
const d = new FakeDriver();
|
|
7
8
|
const server = await baseServer({
|
|
8
9
|
routeConfiguringFunction: routeConfiguringFunction(d),
|
|
@@ -12,5 +13,3 @@ async function startServer(port, hostname) {
|
|
|
12
13
|
log.info(`FakeDriver server listening on http://${hostname}:${port}`);
|
|
13
14
|
return server;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
export {startServer};
|
package/lib/types.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/fake-driver",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Mock driver used internally by Appium for testing. Ignore",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -28,24 +28,21 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"lib",
|
|
31
|
-
"build",
|
|
32
|
-
"
|
|
33
|
-
"tsconfig.json",
|
|
34
|
-
"!build/tsconfig.tsbuildinfo",
|
|
35
|
-
"!build/test"
|
|
31
|
+
"build/lib",
|
|
32
|
+
"tsconfig.json"
|
|
36
33
|
],
|
|
37
34
|
"scripts": {
|
|
38
35
|
"build": "cpy lib/screen.png build",
|
|
39
36
|
"clean": "npx rimraf build/lib/screen.png",
|
|
40
37
|
"test": "npm run test:unit",
|
|
41
|
-
"test:e2e": "mocha --exit --timeout 20s --slow 10s \"./test/e2e/**/*.spec.
|
|
38
|
+
"test:e2e": "mocha --exit --timeout 20s --slow 10s \"./test/e2e/**/*.spec.ts\"",
|
|
42
39
|
"test:smoke": "node ./build/lib/index.js",
|
|
43
|
-
"test:unit": "mocha --exit --timeout 10s --slow 5s \"./test/unit/**/*.spec.
|
|
40
|
+
"test:unit": "mocha --exit --timeout 10s --slow 5s \"./test/unit/**/*.spec.ts\""
|
|
44
41
|
},
|
|
45
42
|
"dependencies": {
|
|
46
|
-
"@xmldom/xmldom": "0.9.
|
|
47
|
-
"
|
|
48
|
-
"lodash": "4.
|
|
43
|
+
"@xmldom/xmldom": "0.9.9",
|
|
44
|
+
"asyncbox": "6.1.0",
|
|
45
|
+
"lodash": "4.18.1",
|
|
49
46
|
"xpath": "0.0.34"
|
|
50
47
|
},
|
|
51
48
|
"peerDependencies": {
|
|
@@ -74,12 +71,12 @@
|
|
|
74
71
|
},
|
|
75
72
|
"doctor": {
|
|
76
73
|
"checks": [
|
|
77
|
-
"./doctor/fake1.js",
|
|
78
|
-
"./doctor/fake2.js"
|
|
74
|
+
"./build/lib/doctor/fake1.js",
|
|
75
|
+
"./build/lib/doctor/fake2.js"
|
|
79
76
|
]
|
|
80
77
|
}
|
|
81
78
|
},
|
|
82
79
|
"main": "./build/lib/index.js",
|
|
83
80
|
"types": "./build/lib/index.d.ts",
|
|
84
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "7a8965f5c30ffec2ad04ce75903b3960537cef06"
|
|
85
82
|
}
|
package/tsconfig.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "build",
|
|
5
5
|
"checkJs": true,
|
|
6
|
+
"types": ["mocha", "chai", "chai-as-promised", "node"],
|
|
6
7
|
"paths": {
|
|
7
8
|
"@appium/types": ["../types"],
|
|
8
9
|
"appium/support": ["../appium/support"],
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
"@appium/driver-test-support": ["../driver-test-support"]
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
|
-
"include": ["lib"],
|
|
14
|
+
"include": ["lib", "test"],
|
|
14
15
|
"references": [
|
|
15
16
|
{"path": "../types"},
|
|
16
17
|
{"path": "../support"},
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Export all of the "stuff" from these mixin files. The mixins themselves are not exported,
|
|
3
|
-
* but any types/interfaces that they export (e.g., options objects for some command) are exported.
|
|
4
|
-
*
|
|
5
|
-
* Mixins must not use `Object.assign()` and are expected to use the `mixin` function in the sibling
|
|
6
|
-
* `mixin` module.
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import './alert';
|
|
10
|
-
import './contexts';
|
|
11
|
-
import './element';
|
|
12
|
-
import './find';
|
|
13
|
-
import './general';
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,CAAC;AACjB,OAAO,YAAY,CAAC;AACpB,OAAO,WAAW,CAAC;AACnB,OAAO,QAAQ,CAAC;AAChB,OAAO,WAAW,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Export all of the "stuff" from these mixin files. The mixins themselves are not exported,
|
|
4
|
-
* but any types/interfaces that they export (e.g., options objects for some command) are exported.
|
|
5
|
-
*
|
|
6
|
-
* Mixins must not use `Object.assign()` and are expected to use the `mixin` function in the sibling
|
|
7
|
-
* `mixin` module.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
require("./alert");
|
|
12
|
-
require("./contexts");
|
|
13
|
-
require("./element");
|
|
14
|
-
require("./find");
|
|
15
|
-
require("./general");
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/commands/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAEH,mBAAiB;AACjB,sBAAoB;AACpB,qBAAmB;AACnB,kBAAgB;AAChB,qBAAmB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FakeDriver } from '../driver';
|
|
2
|
-
/**
|
|
3
|
-
* This function assigns a mixin `T` to the `FakeDriver` class' prototype.
|
|
4
|
-
* While each mixin has its own interface which is (in isolation) unrelated to `FakeDriver`, the constraint
|
|
5
|
-
* on this generic type `T` is that it must be a partial of `FakeDriver`'s interface. This enforces
|
|
6
|
-
* that it does not conflict with the existing interface of `FakeDriver`. In that way, you can
|
|
7
|
-
* think of it as a type guard.
|
|
8
|
-
* @param mixin Mixin implementation
|
|
9
|
-
*/
|
|
10
|
-
export declare function mixin<T extends Partial<FakeDriver>>(mixin: T): void;
|
|
11
|
-
//# sourceMappingURL=mixin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../../lib/commands/mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAEnE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mixin = mixin;
|
|
4
|
-
const driver_1 = require("../driver");
|
|
5
|
-
/**
|
|
6
|
-
* This function assigns a mixin `T` to the `FakeDriver` class' prototype.
|
|
7
|
-
* While each mixin has its own interface which is (in isolation) unrelated to `FakeDriver`, the constraint
|
|
8
|
-
* on this generic type `T` is that it must be a partial of `FakeDriver`'s interface. This enforces
|
|
9
|
-
* that it does not conflict with the existing interface of `FakeDriver`. In that way, you can
|
|
10
|
-
* think of it as a type guard.
|
|
11
|
-
* @param mixin Mixin implementation
|
|
12
|
-
*/
|
|
13
|
-
function mixin(mixin) {
|
|
14
|
-
Object.assign(driver_1.FakeDriver.prototype, mixin);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=mixin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mixin.js","sourceRoot":"","sources":["../../../lib/commands/mixin.ts"],"names":[],"mappings":";;AAUA,sBAEC;AAZD,sCAAqC;AAErC;;;;;;;GAOG;AACH,SAAgB,KAAK,CAAgC,KAAQ;IAC3D,MAAM,CAAC,MAAM,CAAC,mBAAU,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC"}
|
package/lib/commands/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Export all of the "stuff" from these mixin files. The mixins themselves are not exported,
|
|
3
|
-
* but any types/interfaces that they export (e.g., options objects for some command) are exported.
|
|
4
|
-
*
|
|
5
|
-
* Mixins must not use `Object.assign()` and are expected to use the `mixin` function in the sibling
|
|
6
|
-
* `mixin` module.
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import './alert';
|
|
11
|
-
import './contexts';
|
|
12
|
-
import './element';
|
|
13
|
-
import './find';
|
|
14
|
-
import './general';
|
package/lib/commands/mixin.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {FakeDriver} from '../driver';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This function assigns a mixin `T` to the `FakeDriver` class' prototype.
|
|
5
|
-
* While each mixin has its own interface which is (in isolation) unrelated to `FakeDriver`, the constraint
|
|
6
|
-
* on this generic type `T` is that it must be a partial of `FakeDriver`'s interface. This enforces
|
|
7
|
-
* that it does not conflict with the existing interface of `FakeDriver`. In that way, you can
|
|
8
|
-
* think of it as a type guard.
|
|
9
|
-
* @param mixin Mixin implementation
|
|
10
|
-
*/
|
|
11
|
-
export function mixin<T extends Partial<FakeDriver>>(mixin: T): void {
|
|
12
|
-
Object.assign(FakeDriver.prototype, mixin);
|
|
13
|
-
}
|