@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/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
- */