@appium/fake-plugin 4.0.0 → 4.0.2
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/build/lib/plugin.js +61 -56
- package/build/lib/plugin.js.map +1 -1
- package/package.json +4 -4
package/build/lib/plugin.js
CHANGED
|
@@ -8,20 +8,76 @@ exports.FakePlugin = void 0;
|
|
|
8
8
|
const plugin_1 = require("appium/plugin");
|
|
9
9
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
10
10
|
class FakePlugin extends plugin_1.BasePlugin {
|
|
11
|
+
/**
|
|
12
|
+
* @type {string}
|
|
13
|
+
* @readonly
|
|
14
|
+
*/
|
|
15
|
+
fakeThing;
|
|
16
|
+
/**
|
|
17
|
+
* @type {any}
|
|
18
|
+
*/
|
|
19
|
+
pluginThing = null;
|
|
20
|
+
_clockRunning = true;
|
|
11
21
|
/**
|
|
12
22
|
* @param {string} name
|
|
13
23
|
* @param {Record<string,unknown>} cliArgs
|
|
14
24
|
*/
|
|
15
25
|
constructor(name, cliArgs) {
|
|
16
26
|
super(name, cliArgs);
|
|
17
|
-
/**
|
|
18
|
-
* @type {any}
|
|
19
|
-
*/
|
|
20
|
-
this.pluginThing = null;
|
|
21
|
-
this._clockRunning = true;
|
|
22
27
|
this.fakeThing = 'PLUGIN_FAKE_THING';
|
|
23
28
|
this.startClock();
|
|
24
29
|
}
|
|
30
|
+
static newMethodMap = /** @type {const} */ ({
|
|
31
|
+
'/session/:sessionId/fake_data': {
|
|
32
|
+
GET: { command: 'getFakeSessionData', neverProxy: true },
|
|
33
|
+
POST: {
|
|
34
|
+
command: 'setFakeSessionData',
|
|
35
|
+
payloadParams: { required: ['data'] },
|
|
36
|
+
neverProxy: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
'/session/:sessionId/fakepluginargs': {
|
|
40
|
+
GET: { command: 'getFakePluginArgs', neverProxy: true },
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
static newBidiCommands = /** @type {const} */ ({
|
|
44
|
+
'appium:fake': {
|
|
45
|
+
getPluginThing: {
|
|
46
|
+
command: 'getPluginThing',
|
|
47
|
+
},
|
|
48
|
+
setPluginThing: {
|
|
49
|
+
command: 'setPluginThing',
|
|
50
|
+
params: {
|
|
51
|
+
required: ['thing'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
doSomeMath: {
|
|
55
|
+
command: 'doSomeMath',
|
|
56
|
+
params: {
|
|
57
|
+
required: ['num1', 'num2'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
doSomeMath2: {
|
|
61
|
+
command: 'doSomeMath2',
|
|
62
|
+
params: {
|
|
63
|
+
required: ['num1', 'num2'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
/** @type {string?} */
|
|
69
|
+
static _unexpectedData = null;
|
|
70
|
+
static executeMethodMap = /** @type {const} */ ({
|
|
71
|
+
// this execute method overrides fake-drivers fake: getThing, for testing
|
|
72
|
+
'fake: getThing': {
|
|
73
|
+
command: 'getFakeThing',
|
|
74
|
+
},
|
|
75
|
+
// this is a totally new execute method
|
|
76
|
+
'fake: plugMeIn': {
|
|
77
|
+
command: 'plugMeIn',
|
|
78
|
+
params: { required: ['socket'] },
|
|
79
|
+
},
|
|
80
|
+
});
|
|
25
81
|
static fakeRoute(req, res) {
|
|
26
82
|
res.send(JSON.stringify({ fake: 'fakeResponse' }));
|
|
27
83
|
}
|
|
@@ -118,56 +174,5 @@ class FakePlugin extends plugin_1.BasePlugin {
|
|
|
118
174
|
}
|
|
119
175
|
}
|
|
120
176
|
exports.FakePlugin = FakePlugin;
|
|
121
|
-
FakePlugin.newMethodMap = ({
|
|
122
|
-
'/session/:sessionId/fake_data': {
|
|
123
|
-
GET: { command: 'getFakeSessionData', neverProxy: true },
|
|
124
|
-
POST: {
|
|
125
|
-
command: 'setFakeSessionData',
|
|
126
|
-
payloadParams: { required: ['data'] },
|
|
127
|
-
neverProxy: true,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
'/session/:sessionId/fakepluginargs': {
|
|
131
|
-
GET: { command: 'getFakePluginArgs', neverProxy: true },
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
FakePlugin.newBidiCommands = ({
|
|
135
|
-
'appium:fake': {
|
|
136
|
-
getPluginThing: {
|
|
137
|
-
command: 'getPluginThing',
|
|
138
|
-
},
|
|
139
|
-
setPluginThing: {
|
|
140
|
-
command: 'setPluginThing',
|
|
141
|
-
params: {
|
|
142
|
-
required: ['thing'],
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
doSomeMath: {
|
|
146
|
-
command: 'doSomeMath',
|
|
147
|
-
params: {
|
|
148
|
-
required: ['num1', 'num2'],
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
doSomeMath2: {
|
|
152
|
-
command: 'doSomeMath2',
|
|
153
|
-
params: {
|
|
154
|
-
required: ['num1', 'num2'],
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
/** @type {string?} */
|
|
160
|
-
FakePlugin._unexpectedData = null;
|
|
161
|
-
FakePlugin.executeMethodMap = ({
|
|
162
|
-
// this execute method overrides fake-drivers fake: getThing, for testing
|
|
163
|
-
'fake: getThing': {
|
|
164
|
-
command: 'getFakeThing',
|
|
165
|
-
},
|
|
166
|
-
// this is a totally new execute method
|
|
167
|
-
'fake: plugMeIn': {
|
|
168
|
-
command: 'plugMeIn',
|
|
169
|
-
params: { required: ['socket'] },
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
177
|
exports.default = FakePlugin;
|
|
173
178
|
//# sourceMappingURL=plugin.js.map
|
package/build/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../lib/plugin.js"],"names":[],"mappings":";AAAA,YAAY;;;;;;AAGZ,0CAAyC;AAC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QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QAC5B,OAAO,KAAK,MAAM,IAAI,CAAC;IACzB,CAAC;IAGD,KAAK,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK;QACtC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,UAAU,CAAC,eAAe,GAAG,yBAAyB,KAAK,EAAE,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI;QACtC,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAI;QACtB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;;AAGK,gCAAU;AAClB,kBAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/fake-plugin",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "A fake Appium plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@appium/base-plugin": "^3.0.
|
|
43
|
-
"@appium/support": "^7.0.
|
|
42
|
+
"@appium/base-plugin": "^3.0.2",
|
|
43
|
+
"@appium/support": "^7.0.1",
|
|
44
44
|
"bluebird": "3.7.2",
|
|
45
45
|
"lodash": "4.17.21",
|
|
46
46
|
"source-map-support": "0.5.21"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "606e4c1f58fa68d96c04be4313ccab86ccd48361",
|
|
67
67
|
"tags": [
|
|
68
68
|
"appium"
|
|
69
69
|
]
|