@appium/base-driver 8.3.0 → 8.4.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/build/lib/basedriver/capabilities.d.ts +80 -0
- package/build/lib/basedriver/capabilities.d.ts.map +1 -0
- package/build/lib/basedriver/capabilities.js +12 -13
- package/build/lib/basedriver/commands/event.d.ts +9 -0
- package/build/lib/basedriver/commands/event.d.ts.map +1 -0
- package/build/lib/basedriver/commands/event.js +21 -23
- package/build/lib/basedriver/commands/find.d.ts +11 -0
- package/build/lib/basedriver/commands/find.d.ts.map +1 -0
- package/build/lib/basedriver/commands/find.js +42 -37
- package/build/lib/basedriver/commands/index.d.ts +8 -0
- package/build/lib/basedriver/commands/index.d.ts.map +1 -0
- package/build/lib/basedriver/commands/index.js +17 -16
- package/build/lib/basedriver/commands/log.d.ts +12 -0
- package/build/lib/basedriver/commands/log.d.ts.map +1 -0
- package/build/lib/basedriver/commands/log.js +23 -27
- package/build/lib/basedriver/commands/session.d.ts +11 -0
- package/build/lib/basedriver/commands/session.d.ts.map +1 -0
- package/build/lib/basedriver/commands/session.js +21 -149
- package/build/lib/basedriver/commands/settings.d.ts +10 -0
- package/build/lib/basedriver/commands/settings.d.ts.map +1 -0
- package/build/lib/basedriver/commands/settings.js +19 -19
- package/build/lib/basedriver/commands/timeout.d.ts +8 -0
- package/build/lib/basedriver/commands/timeout.d.ts.map +1 -0
- package/build/lib/basedriver/commands/timeout.js +118 -139
- package/build/lib/basedriver/core.d.ts +235 -0
- package/build/lib/basedriver/core.d.ts.map +1 -0
- package/build/lib/basedriver/core.js +283 -0
- package/build/lib/basedriver/desired-caps.d.ts +5 -0
- package/build/lib/basedriver/desired-caps.d.ts.map +1 -0
- package/build/lib/basedriver/desired-caps.js +2 -4
- package/build/lib/basedriver/device-settings.d.ts +32 -0
- package/build/lib/basedriver/device-settings.d.ts.map +1 -0
- package/build/lib/basedriver/device-settings.js +20 -14
- package/build/lib/basedriver/driver.d.ts +83 -0
- package/build/lib/basedriver/driver.d.ts.map +1 -0
- package/build/lib/basedriver/driver.js +101 -256
- package/build/lib/basedriver/helpers.d.ts +132 -0
- package/build/lib/basedriver/helpers.d.ts.map +1 -0
- package/build/lib/basedriver/helpers.js +16 -2
- package/build/lib/basedriver/logger.d.ts +3 -0
- package/build/lib/basedriver/logger.d.ts.map +1 -0
- package/build/lib/basedriver/logger.js +2 -4
- package/build/lib/constants.d.ts +9 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +2 -4
- package/build/lib/express/crash.d.ts +3 -0
- package/build/lib/express/crash.d.ts.map +1 -0
- package/build/lib/express/crash.js +2 -4
- package/build/lib/express/express-logging.d.ts +3 -0
- package/build/lib/express/express-logging.d.ts.map +1 -0
- package/build/lib/express/express-logging.js +2 -4
- package/build/lib/express/idempotency.d.ts +2 -0
- package/build/lib/express/idempotency.d.ts.map +1 -0
- package/build/lib/express/idempotency.js +2 -4
- package/build/lib/express/logger.d.ts +3 -0
- package/build/lib/express/logger.d.ts.map +1 -0
- package/build/lib/express/logger.js +2 -4
- package/build/lib/express/middleware.d.ts +9 -0
- package/build/lib/express/middleware.d.ts.map +1 -0
- package/build/lib/express/middleware.js +2 -4
- package/build/lib/express/server.d.ts +10 -0
- package/build/lib/express/server.d.ts.map +1 -0
- package/build/lib/express/server.js +2 -4
- package/build/lib/express/static.d.ts +6 -0
- package/build/lib/express/static.d.ts.map +1 -0
- package/build/lib/express/static.js +2 -4
- package/build/lib/express/websocket.d.ts +64 -0
- package/build/lib/express/websocket.d.ts.map +1 -0
- package/build/lib/express/websocket.js +40 -41
- package/build/lib/helpers/capabilities.d.ts +13 -0
- package/build/lib/helpers/capabilities.d.ts.map +1 -0
- package/build/lib/helpers/capabilities.js +40 -2
- package/build/lib/index.d.ts +183 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +41 -23
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts +48 -0
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts.map +1 -0
- package/build/lib/jsonwp-proxy/protocol-converter.js +2 -4
- package/build/lib/jsonwp-proxy/proxy.d.ts +41 -0
- package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -0
- package/build/lib/jsonwp-proxy/proxy.js +25 -9
- package/build/lib/jsonwp-status/status.d.ts +159 -0
- package/build/lib/jsonwp-status/status.d.ts.map +1 -0
- package/build/lib/jsonwp-status/status.js +2 -4
- package/build/lib/protocol/errors.d.ts +310 -0
- package/build/lib/protocol/errors.d.ts.map +1 -0
- package/build/lib/protocol/errors.js +82 -5
- package/build/lib/protocol/helpers.d.ts +22 -0
- package/build/lib/protocol/helpers.d.ts.map +1 -0
- package/build/lib/protocol/helpers.js +2 -4
- package/build/lib/protocol/index.d.ts +16 -0
- package/build/lib/protocol/index.d.ts.map +1 -0
- package/build/lib/protocol/index.js +8 -10
- package/build/lib/protocol/protocol.d.ts +11 -0
- package/build/lib/protocol/protocol.d.ts.map +1 -0
- package/build/lib/protocol/protocol.js +3 -9
- package/build/lib/protocol/routes.d.ts +6 -0
- package/build/lib/protocol/routes.d.ts.map +1 -0
- package/build/lib/protocol/routes.js +18 -4
- package/build/lib/protocol/validators.d.ts +8 -0
- package/build/lib/protocol/validators.d.ts.map +1 -0
- package/build/lib/protocol/validators.js +2 -4
- package/build/test/basedriver/README.md +5 -0
- package/build/test/basedriver/driver-e2e-tests.js +2 -4
- package/build/test/basedriver/driver-tests.js +31 -6
- package/build/test/basedriver/index.js +2 -4
- package/build/test/e2e/basedriver/driver.e2e.spec.js +15 -0
- package/build/test/e2e/basedriver/helpers.e2e.spec.js +192 -0
- package/build/test/e2e/basedriver/websockets.e2e.spec.js +87 -0
- package/build/test/e2e/express/server.e2e.spec.js +159 -0
- package/build/test/e2e/jsonwp-proxy/proxy.e2e.spec.js +59 -0
- package/build/test/e2e/protocol/fake-driver.js +163 -0
- package/build/test/e2e/protocol/helpers.js +25 -0
- package/build/test/e2e/protocol/protocol.e2e.spec.js +1186 -0
- package/build/test/helpers.js +2 -4
- package/build/test/unit/basedriver/capabilities.spec.js +672 -0
- package/build/test/unit/basedriver/capability.spec.js +353 -0
- package/build/test/unit/basedriver/commands/event.spec.js +110 -0
- package/build/test/unit/basedriver/commands/log.spec.js +92 -0
- package/build/test/unit/basedriver/driver.spec.js +15 -0
- package/build/test/unit/basedriver/helpers.spec.js +151 -0
- package/build/test/unit/basedriver/timeout.spec.js +135 -0
- package/build/test/unit/express/server.spec.js +155 -0
- package/build/test/unit/express/static.spec.js +26 -0
- package/build/test/unit/jsonwp-proxy/mock-request.js +91 -0
- package/build/test/unit/jsonwp-proxy/protocol-converter.spec.js +171 -0
- package/build/test/unit/jsonwp-proxy/proxy.spec.js +292 -0
- package/build/test/unit/jsonwp-proxy/url.spec.js +165 -0
- package/build/test/unit/jsonwp-status/status.spec.js +34 -0
- package/build/test/unit/protocol/errors.spec.js +390 -0
- package/build/test/unit/protocol/routes.spec.js +80 -0
- package/build/test/unit/protocol/validator.spec.js +149 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/lib/basedriver/capabilities.js +49 -10
- package/lib/basedriver/commands/event.js +49 -31
- package/lib/basedriver/commands/find.js +108 -43
- package/lib/basedriver/commands/index.js +25 -19
- package/lib/basedriver/commands/log.js +60 -33
- package/lib/basedriver/commands/session.js +39 -141
- package/lib/basedriver/commands/settings.js +33 -13
- package/lib/basedriver/commands/timeout.js +153 -153
- package/lib/basedriver/core.js +497 -0
- package/lib/basedriver/desired-caps.js +1 -1
- package/lib/basedriver/device-settings.js +47 -12
- package/lib/basedriver/driver.js +272 -383
- package/lib/basedriver/helpers.js +18 -2
- package/lib/express/websocket.js +35 -32
- package/lib/helpers/capabilities.js +60 -1
- package/lib/index.js +16 -12
- package/lib/jsonwp-proxy/proxy.js +26 -6
- package/lib/protocol/errors.js +42 -42
- package/lib/protocol/index.js +4 -4
- package/lib/protocol/protocol.js +1 -3
- package/lib/protocol/routes.js +9 -0
- package/package.json +22 -14
- package/test/basedriver/README.md +5 -0
- package/test/basedriver/driver-e2e-tests.js +1 -1
- package/test/basedriver/driver-tests.js +31 -2
- package/build/test/basedriver/capabilities-specs.js +0 -674
- package/build/test/basedriver/capability-specs.js +0 -355
- package/build/test/basedriver/commands/event-specs.js +0 -112
- package/build/test/basedriver/commands/log-specs.js +0 -87
- package/build/test/basedriver/driver-e2e-specs.js +0 -17
- package/build/test/basedriver/driver-specs.js +0 -17
- package/build/test/basedriver/helpers-e2e-specs.js +0 -194
- package/build/test/basedriver/helpers-specs.js +0 -153
- package/build/test/basedriver/timeout-specs.js +0 -137
- package/build/test/basedriver/websockets-e2e-specs.js +0 -84
- package/build/test/express/server-e2e-specs.js +0 -161
- package/build/test/express/server-specs.js +0 -157
- package/build/test/express/static-specs.js +0 -28
- package/build/test/jsonwp-proxy/mock-request.js +0 -93
- package/build/test/jsonwp-proxy/protocol-converter-specs.js +0 -173
- package/build/test/jsonwp-proxy/proxy-e2e-specs.js +0 -61
- package/build/test/jsonwp-proxy/proxy-specs.js +0 -294
- package/build/test/jsonwp-proxy/url-specs.js +0 -167
- package/build/test/jsonwp-status/status-specs.js +0 -36
- package/build/test/protocol/errors-specs.js +0 -388
- package/build/test/protocol/fake-driver.js +0 -165
- package/build/test/protocol/helpers.js +0 -27
- package/build/test/protocol/protocol-e2e-specs.js +0 -1188
- package/build/test/protocol/routes-specs.js +0 -82
- package/build/test/protocol/validator-specs.js +0 -151
- package/index.d.ts +0 -386
- package/test/basedriver/capabilities-specs.js +0 -537
- package/test/basedriver/capability-specs.js +0 -383
- package/test/basedriver/commands/event-specs.js +0 -74
- package/test/basedriver/commands/log-specs.js +0 -79
- package/test/basedriver/driver-e2e-specs.js +0 -8
- package/test/basedriver/driver-specs.js +0 -8
- package/test/basedriver/fixtures/BadZippedApp.zip +0 -1
- package/test/basedriver/fixtures/FakeAndroidApp.apk +0 -1
- package/test/basedriver/fixtures/FakeAndroidApp.asd +0 -0
- package/test/basedriver/fixtures/FakeIOSApp.app +0 -1
- package/test/basedriver/fixtures/FakeIOSApp.app.zip +0 -0
- package/test/basedriver/fixtures/FakeIOSApp.ipa +0 -0
- package/test/basedriver/fixtures/custom-element-finder-bad.js +0 -5
- package/test/basedriver/fixtures/custom-element-finder.js +0 -29
- package/test/basedriver/helpers-e2e-specs.js +0 -187
- package/test/basedriver/helpers-specs.js +0 -137
- package/test/basedriver/timeout-specs.js +0 -128
- package/test/basedriver/websockets-e2e-specs.js +0 -75
package/lib/protocol/protocol.js
CHANGED
|
@@ -16,8 +16,6 @@ const CREATE_SESSION_COMMAND = 'createSession';
|
|
|
16
16
|
const DELETE_SESSION_COMMAND = 'deleteSession';
|
|
17
17
|
const GET_STATUS_COMMAND = 'getStatus';
|
|
18
18
|
|
|
19
|
-
class Protocol {}
|
|
20
|
-
|
|
21
19
|
function determineProtocol (createSessionArgs) {
|
|
22
20
|
return _.some(createSessionArgs, isW3cCaps) ? PROTOCOLS.W3C : PROTOCOLS.MJSONWP;
|
|
23
21
|
}
|
|
@@ -456,7 +454,7 @@ async function doJwpProxy (driver, req, res) {
|
|
|
456
454
|
|
|
457
455
|
|
|
458
456
|
export {
|
|
459
|
-
|
|
457
|
+
routeConfiguringFunction, isSessionCommand,
|
|
460
458
|
driverShouldDoJwpProxy, determineProtocol, CREATE_SESSION_COMMAND,
|
|
461
459
|
DELETE_SESSION_COMMAND, GET_STATUS_COMMAND,
|
|
462
460
|
};
|
package/lib/protocol/routes.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
1
3
|
import _ from 'lodash';
|
|
2
4
|
import { util } from '@appium/support';
|
|
3
5
|
import { PROTOCOLS, DEFAULT_BASE_PATH } from '../constants';
|
|
@@ -14,6 +16,7 @@ const SET_ALERT_TEXT_PAYLOAD_PARAMS = {
|
|
|
14
16
|
// define the routes, mapping of HTTP methods to particular driver commands,
|
|
15
17
|
// and any parameters that are expected in a request
|
|
16
18
|
// parameters can be `required` or `optional`
|
|
19
|
+
/** @type {import('@appium/types').MethodMap} */
|
|
17
20
|
const METHOD_MAP = {
|
|
18
21
|
'/status': {
|
|
19
22
|
GET: {command: 'getStatus'}
|
|
@@ -240,6 +243,12 @@ const METHOD_MAP = {
|
|
|
240
243
|
'/session/:sessionId/element/:elementId/shadow': {
|
|
241
244
|
GET: {command: 'elementShadowRoot'}
|
|
242
245
|
},
|
|
246
|
+
'/session/:sessionId/shadow/:shadowId/element': {
|
|
247
|
+
POST: {command: 'findElementFromShadowRoot', payloadParams: {required: ['using', 'value']}}
|
|
248
|
+
},
|
|
249
|
+
'/session/:sessionId/shadow/:shadowId/elements': {
|
|
250
|
+
POST: {command: 'findElementsFromShadowRoot', payloadParams: {required: ['using', 'value']}}
|
|
251
|
+
},
|
|
243
252
|
'/session/:sessionId/element/:elementId/css/:propertyName': {
|
|
244
253
|
GET: {command: 'getCssProperty'}
|
|
245
254
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/base-driver",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"description": "Base driver class for Appium drivers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -32,36 +32,43 @@
|
|
|
32
32
|
"lib",
|
|
33
33
|
"static",
|
|
34
34
|
"test/basedriver",
|
|
35
|
-
"!test/
|
|
35
|
+
"!test/e2e/fixtures",
|
|
36
36
|
"build",
|
|
37
|
-
"!build/test/
|
|
37
|
+
"!build/test/e2e/fixtures"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"
|
|
41
|
-
"build": "
|
|
42
|
-
"test": "
|
|
43
|
-
"
|
|
40
|
+
"build": "npm run build:distfiles && npm run build:test",
|
|
41
|
+
"build:distfiles": "babel lib --root-mode=upward --out-dir=build/lib",
|
|
42
|
+
"build:test": "babel test --root-mode=upward --out-dir=build/test --copy-files",
|
|
43
|
+
"dev": "run-p \"build:distfiles -- --watch\" \"build:test -- --watch\"",
|
|
44
|
+
"fix": "npm run lint -- --fix",
|
|
45
|
+
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
46
|
+
"test": "npm run test:unit",
|
|
47
|
+
"test:e2e": "mocha --require ../../test/setup-babel.js --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
|
|
48
|
+
"test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
|
|
44
49
|
},
|
|
45
50
|
"dependencies": {
|
|
46
|
-
"@appium/support": "
|
|
47
|
-
"@babel/runtime": "7.17.
|
|
51
|
+
"@appium/support": "file:../support",
|
|
52
|
+
"@babel/runtime": "7.17.9",
|
|
48
53
|
"@colors/colors": "1.5.0",
|
|
49
54
|
"async-lock": "1.3.1",
|
|
50
55
|
"asyncbox": "2.9.2",
|
|
51
56
|
"axios": "0.26.1",
|
|
52
57
|
"bluebird": "3.7.2",
|
|
53
|
-
"body-parser": "1.
|
|
58
|
+
"body-parser": "1.20.0",
|
|
54
59
|
"es6-error": "4.1.1",
|
|
55
60
|
"express": "4.17.3",
|
|
56
61
|
"http-status-codes": "2.2.0",
|
|
57
62
|
"lodash": "4.17.21",
|
|
58
|
-
"lru-cache": "7.
|
|
63
|
+
"lru-cache": "7.8.1",
|
|
59
64
|
"method-override": "3.0.0",
|
|
60
65
|
"morgan": "1.10.0",
|
|
61
66
|
"serve-favicon": "2.5.0",
|
|
62
67
|
"source-map-support": "0.5.21",
|
|
63
|
-
"validate.js": "0.13.1"
|
|
64
|
-
|
|
68
|
+
"validate.js": "0.13.1"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"ws": "8.5.0"
|
|
65
72
|
},
|
|
66
73
|
"engines": {
|
|
67
74
|
"node": ">=12",
|
|
@@ -70,5 +77,6 @@
|
|
|
70
77
|
"publishConfig": {
|
|
71
78
|
"access": "public"
|
|
72
79
|
},
|
|
73
|
-
"
|
|
80
|
+
"types": "./build/lib/index.d.ts",
|
|
81
|
+
"gitHead": "ec6a90a797d2dadb407922426be16efaec9def07"
|
|
74
82
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Driver Test Helpers
|
|
2
|
+
|
|
3
|
+
This directory contains modules which expose test suites that an external driver can use to test against the base implementation. They are published in the `@appium/base-driver` package.
|
|
4
|
+
|
|
5
|
+
Drivers wanting to leverage these suites will want to add `@appium/base-driver` to their `devDependencies`.
|
|
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|
|
2
2
|
import { BaseDriver, server, routeConfiguringFunction, DeviceSettings } from '../../lib';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import B from 'bluebird';
|
|
5
|
-
import {TEST_HOST, getTestPort, createAppiumURL, METHODS} from '../helpers';
|
|
5
|
+
import { TEST_HOST, getTestPort, createAppiumURL, METHODS } from '../helpers';
|
|
6
6
|
import { PREFIXED_APPIUM_OPTS_CAP } from '../../lib/basedriver/capabilities';
|
|
7
7
|
const {POST, DELETE} = METHODS;
|
|
8
8
|
|
|
@@ -10,6 +10,35 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) {
|
|
|
10
10
|
// to display the driver under test in report
|
|
11
11
|
const className = DriverClass.name || '(unknown driver)';
|
|
12
12
|
|
|
13
|
+
describe('static property', function () {
|
|
14
|
+
describe('baseVersion', function () {
|
|
15
|
+
it('should exist', function () {
|
|
16
|
+
DriverClass.baseVersion.should.exist;
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Log prefix', function () {
|
|
22
|
+
|
|
23
|
+
it('should setup log prefix', async function () {
|
|
24
|
+
const d = new DriverClass();
|
|
25
|
+
const previousPrefix = d.log.prefix;
|
|
26
|
+
await d.createSession({
|
|
27
|
+
alwaysMatch: Object.assign({}, defaultCaps, {
|
|
28
|
+
platformName: 'Fake',
|
|
29
|
+
'appium:deviceName': 'Commodore 64',
|
|
30
|
+
}),
|
|
31
|
+
firstMatch: [{}],
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
previousPrefix.should.not.eql(d.log.prefix);
|
|
35
|
+
} finally {
|
|
36
|
+
await d.deleteSession();
|
|
37
|
+
previousPrefix.should.eql(d.log.prefix);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
});
|
|
13
42
|
|
|
14
43
|
describe(`BaseDriver (as ${className})`, function () {
|
|
15
44
|
let d, w3cCaps;
|
|
@@ -183,8 +212,8 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) {
|
|
|
183
212
|
throw new Error('multipass');
|
|
184
213
|
}.bind(d);
|
|
185
214
|
|
|
186
|
-
afterEach(function () {
|
|
187
|
-
d.clearNewCommandTimeout();
|
|
215
|
+
afterEach(async function () {
|
|
216
|
+
await d.clearNewCommandTimeout();
|
|
188
217
|
});
|
|
189
218
|
|
|
190
219
|
it('should queue commands and.executeCommand/respond in the order received', async function () {
|