@appium/driver-test-support 1.0.5 → 1.1.0
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/e2e-suite.d.ts +4 -73
- package/build/lib/e2e-suite.d.ts.map +1 -1
- package/build/lib/e2e-suite.js +41 -140
- package/build/lib/e2e-suite.js.map +1 -1
- package/build/lib/helpers.d.ts +6 -7
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +5 -30
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/index.d.ts +4 -6
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +0 -8
- package/build/lib/index.js.map +1 -1
- package/build/lib/types.d.ts +26 -0
- package/build/lib/types.d.ts.map +1 -0
- package/build/lib/types.js +3 -0
- package/build/lib/types.js.map +1 -0
- package/build/lib/unit-suite.d.ts +2 -9
- package/build/lib/unit-suite.d.ts.map +1 -1
- package/build/lib/unit-suite.js +59 -92
- package/build/lib/unit-suite.js.map +1 -1
- package/lib/{e2e-suite.js → e2e-suite.ts} +86 -185
- package/lib/helpers.ts +44 -0
- package/lib/index.ts +4 -0
- package/lib/types.ts +36 -0
- package/lib/{unit-suite.js → unit-suite.ts} +98 -134
- package/package.json +18 -19
- package/tsconfig.json +1 -2
- package/build/test/unit/index.spec.d.ts +0 -2
- package/build/test/unit/index.spec.d.ts.map +0 -1
- package/build/test/unit/index.spec.js +0 -58
- package/build/test/unit/index.spec.js.map +0 -1
- package/index.js +0 -1
- package/lib/helpers.js +0 -68
- package/lib/index.js +0 -13
package/lib/helpers.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import getPort from 'get-port';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Default test host
|
|
6
|
-
*/
|
|
7
|
-
const TEST_HOST = '127.0.0.1';
|
|
8
|
-
|
|
9
|
-
let testPort;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns a free port; one per process
|
|
13
|
-
* @param {boolean} [force] - If true, do not reuse the port (if it already exists)
|
|
14
|
-
* @returns {Promise<number>} a free port
|
|
15
|
-
*/
|
|
16
|
-
async function getTestPort(force = false) {
|
|
17
|
-
if (force || !testPort) {
|
|
18
|
-
let port = await getPort();
|
|
19
|
-
if (!testPort) {
|
|
20
|
-
testPort = port;
|
|
21
|
-
}
|
|
22
|
-
return port;
|
|
23
|
-
}
|
|
24
|
-
return testPort;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Build an Appium URL from components.
|
|
29
|
-
*
|
|
30
|
-
* **All** parameters are required. Provide an empty string (`''`) if you don't need one.
|
|
31
|
-
* To rearrange arguments (if needed), use the placeholder from Lodash (`_`).
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
const createAppiumURL = _.curry(
|
|
35
|
-
/**
|
|
36
|
-
* @param {string} address - Base address (w/ optional protocol)
|
|
37
|
-
* @param {string|number} port - Port number
|
|
38
|
-
* @param {string?} session - Session ID
|
|
39
|
-
* @param {string} pathname - Extra path
|
|
40
|
-
* @returns {string} New URL
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* import _ from 'lodash';
|
|
44
|
-
*
|
|
45
|
-
* // http://127.0.0.1:31337/session
|
|
46
|
-
* createAppiumURL('127.0.0.1', 31337, '', 'session')
|
|
47
|
-
*
|
|
48
|
-
* // http://127.0.0.1:31337/session/asdfgjkl
|
|
49
|
-
* const createSessionURL = createAppiumURL('127.0.0.1', 31337, _, 'session')
|
|
50
|
-
* createSessionURL('asdfgjkl')
|
|
51
|
-
*
|
|
52
|
-
* // http://127.0.0.1:31337/session/asdfgjkl/appium/execute
|
|
53
|
-
* const createURLWithPath = createAppiumURL('127.0.0.1', 31337, 'asdfgjkl');
|
|
54
|
-
* createURLWithPath('appium/execute')
|
|
55
|
-
*/
|
|
56
|
-
(address, port, session, pathname) => {
|
|
57
|
-
if (!/^https?:\/\//.test(address)) {
|
|
58
|
-
address = `http://${address}`;
|
|
59
|
-
}
|
|
60
|
-
let path = session ? `session/${session}` : '';
|
|
61
|
-
if (pathname) {
|
|
62
|
-
path = `${path}/${pathname}`;
|
|
63
|
-
}
|
|
64
|
-
return new URL(path, `${address}:${port}`).href;
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export {TEST_HOST, getTestPort, createAppiumURL};
|
package/lib/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export {createSessionHelpers, driverE2ETestSuite} from './e2e-suite';
|
|
2
|
-
export * from './unit-suite';
|
|
3
|
-
export * from './helpers';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import('@appium/types').DriverClass} DriverClass
|
|
7
|
-
* @typedef {import('@appium/types').BaseNSCapabilities} BaseNSCapabilities
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @template {import('@appium/types').Constraints} C
|
|
12
|
-
* @typedef {import('@appium/types').W3CCapabilities<C>} W3CCapabilities
|
|
13
|
-
*/
|