appium 2.0.0-beta.48 → 2.0.0-beta.52

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.
@@ -8,6 +8,7 @@ const REQ_DRIVER_FIELDS = ['driverName', 'automationName', 'platformNames', 'mai
8
8
  /**
9
9
  * @extends {ExtensionCommand<DriverType>}
10
10
  */
11
+
11
12
  export default class DriverCommand extends ExtensionCommand {
12
13
  /**
13
14
  * @param {import('./extension-command').ExtensionCommandOptions<DriverType>} opts
@@ -21,6 +22,7 @@ export default class DriverCommand extends ExtensionCommand {
21
22
  * Install a driver
22
23
  *
23
24
  * @param {DriverInstallOpts} opts
25
+ * @return {Promise<ExtRecord<DriverType>>}
24
26
  */
25
27
  async install({driver, installType, packageName}) {
26
28
  return await super._install({
@@ -30,18 +32,40 @@ export default class DriverCommand extends ExtensionCommand {
30
32
  });
31
33
  }
32
34
 
35
+ /**
36
+ * Uninstall a driver
37
+ *
38
+ * @param {DriverUninstallOpts} opts
39
+ * @return {Promise<ExtRecord<DriverType>>}
40
+ */
33
41
  async uninstall({driver}) {
34
42
  return await super._uninstall({installSpec: driver});
35
43
  }
36
44
 
45
+ /**
46
+ * Update a driver
47
+ *
48
+ * @param {DriverUpdateOpts} opts
49
+ * @return {Promise<import('./extension-command').ExtensionUpdateResult>}
50
+ */
37
51
  async update({driver, unsafe}) {
38
52
  return await super._update({installSpec: driver, unsafe});
39
53
  }
40
54
 
55
+ /**
56
+ *
57
+ * @param {DriverRunOptions} opts
58
+ * @return {Promise<import('./extension-command').RunOutput>}
59
+ */
41
60
  async run({driver, scriptName, extraArgs}) {
42
61
  return await super._run({installSpec: driver, scriptName, extraArgs});
43
62
  }
44
63
 
64
+ /**
65
+ *
66
+ * @param {import('./extension-command').ExtensionArgs} opts
67
+ * @returns {string}
68
+ */
45
69
  getPostInstallText({extName, extData}) {
46
70
  return (
47
71
  `Driver ${extName}@${extData.version} successfully installed\n`.green +
@@ -75,17 +99,23 @@ export default class DriverCommand extends ExtensionCommand {
75
99
  }
76
100
 
77
101
  /**
78
- * @typedef DriverCommandOptions
79
- * @property {import('../extension/extension-config').ExtensionConfig<DriverType>} config
80
- * @property {boolean} json
102
+ * @typedef {import('@appium/types').ExtensionType} ExtensionType
103
+ * @typedef {import('@appium/types').DriverType} DriverType
81
104
  */
82
105
 
83
106
  /**
84
- * @typedef {import('@appium/types').DriverType} DriverType
107
+ * @template {ExtensionType} ExtType
108
+ * @typedef {import('appium/types').ExtRecord<ExtType>} ExtRecord
109
+ */
110
+
111
+ /**
112
+ * @typedef DriverCommandOptions
113
+ * @property {import('../extension/extension-config').ExtensionConfig<DriverType>} config
114
+ * @property {boolean} json
85
115
  */
86
116
 
87
117
  /**
88
- * Options for {@linkcode ExtensionCommand._install}
118
+ * Options for {@linkcode DriverCommand.install}
89
119
  * @typedef DriverInstallOpts
90
120
  * @property {string} driver - the name or spec of a driver to install
91
121
  * @property {InstallType} installType - how to install this driver. One of the INSTALL_TYPES
@@ -95,3 +125,24 @@ export default class DriverCommand extends ExtensionCommand {
95
125
  /**
96
126
  * @typedef {import('appium/types').InstallType} InstallType
97
127
  */
128
+
129
+ /**
130
+ * Options for {@linkcode DriverCommand.uninstall}
131
+ * @typedef DriverUninstallOpts
132
+ * @property {string} driver - the name or spec of a driver to uninstall
133
+ */
134
+
135
+ /**
136
+ * Options for {@linkcode DriverCommand.update}
137
+ * @typedef DriverUpdateOpts
138
+ * @property {string} driver - the name of the driver to update
139
+ * @property {boolean} unsafe - if true, will perform unsafe updates past major revision boundaries
140
+ */
141
+
142
+ /**
143
+ * Options for {@linkcode DriverCommand.run}.
144
+ * @typedef DriverRunOptions
145
+ * @property {string} driver - name of the driver to run a script from
146
+ * @property {string} scriptName - name of the script to run
147
+ * @property {string[]} [extraArgs] - arguments to pass to the script
148
+ */
@@ -75,7 +75,7 @@ class ExtensionCommand {
75
75
  * nor is something like `@returns {never}` which does not imply a thrown exception.
76
76
  * @param {string} message
77
77
  * @protected
78
- * @returns {Error}
78
+ * @throws {Error}
79
79
  */
80
80
  _createFatalError(message) {
81
81
  return new Error(this.log.decorate(message, 'error'));
@@ -17,6 +17,12 @@ export default class PluginCommand extends ExtensionCommand {
17
17
  this.knownExtensions = KNOWN_PLUGINS;
18
18
  }
19
19
 
20
+ /**
21
+ * Install a plugin
22
+ *
23
+ * @param {PluginInstallOpts} opts
24
+ * @returns {Promise<ExtRecord<PluginType>>}
25
+ */
20
26
  async install({plugin, installType, packageName}) {
21
27
  return await super._install({
22
28
  installSpec: plugin,
@@ -25,26 +31,48 @@ export default class PluginCommand extends ExtensionCommand {
25
31
  });
26
32
  }
27
33
 
34
+ /**
35
+ * Uninstall a plugin
36
+ *
37
+ * @param {PluginUninstallOpts} opts
38
+ * @returns {Promise<ExtRecord<PluginType>>}
39
+ */
28
40
  async uninstall({plugin}) {
29
41
  return await super._uninstall({installSpec: plugin});
30
42
  }
31
43
 
44
+ /**
45
+ * Update a plugin
46
+ *
47
+ * @param {PluginUpdateOpts} opts
48
+ * @returns {Promise<import('./extension-command').ExtensionUpdateResult>}
49
+ */
32
50
  async update({plugin, unsafe}) {
33
51
  return await super._update({installSpec: plugin, unsafe});
34
52
  }
35
53
 
54
+ /**
55
+ *
56
+ * @param {PluginRunOptions} opts
57
+ * @returns {Promise<import('./extension-command').RunOutput>}
58
+ */
36
59
  async run({plugin, scriptName, extraArgs}) {
37
60
  return await super._run({installSpec: plugin, scriptName, extraArgs});
38
61
  }
39
62
 
63
+ /**
64
+ *
65
+ * @param {import('./extension-command').ExtensionArgs} opts
66
+ * @returns {string}
67
+ */
40
68
  getPostInstallText({extName, extData}) {
41
69
  return `Plugin ${extName}@${extData.version} successfully installed`.green;
42
70
  }
43
71
 
44
72
  /**
45
- * Validates fields in `appium` field of `driverMetadata`
73
+ * Validates fields in `appium` field of `pluginMetadata`
46
74
  *
47
- * For any `package.json` fields which a driver requires, validate the type of
75
+ * For any `package.json` fields which a plugin requires, validate the type of
48
76
  * those fields on the `package.json` data, throwing an error if anything is
49
77
  * amiss.
50
78
  * @param {import('appium/types').ExtMetadata<PluginType>} pluginMetadata
@@ -67,5 +95,44 @@ export default class PluginCommand extends ExtensionCommand {
67
95
  }
68
96
 
69
97
  /**
98
+ * @typedef {import('@appium/types').ExtensionType} ExtensionType
70
99
  * @typedef {import('@appium/types').PluginType} PluginType
71
100
  */
101
+
102
+ /**
103
+ * @template {ExtensionType} ExtType
104
+ * @typedef {import('appium/types').ExtRecord<ExtType>} ExtRecord
105
+ */
106
+
107
+ /**
108
+ * Options for {@linkcode PluginCommand.install}
109
+ * @typedef PluginInstallOpts
110
+ * @property {string} plugin - the name or spec of a plugin to install
111
+ * @property {InstallType} installType - how to install this plugin. One of the INSTALL_TYPES
112
+ * @property {string} [packageName] - for git/github installs, the plugin node package name
113
+ */
114
+
115
+ /**
116
+ * @typedef {import('appium/types').InstallType} InstallType
117
+ */
118
+
119
+ /**
120
+ * Options for {@linkcode PluginCommand.uninstall}
121
+ * @typedef PluginUninstallOpts
122
+ * @property {string} plugin - the name or spec of a plugin to uninstall
123
+ */
124
+
125
+ /**
126
+ * Options for {@linkcode PluginCommand.update}
127
+ * @typedef PluginUpdateOpts
128
+ * @property {string} plugin - the name of the plugin to update
129
+ * @property {boolean} unsafe - if true, will perform unsafe updates past major revision boundaries
130
+ */
131
+
132
+ /**
133
+ * Options for {@linkcode PluginCommand.run}.
134
+ * @typedef PluginRunOptions
135
+ * @property {string} plugin - name of the plugin to run a script from
136
+ * @property {string} scriptName - name of the script to run
137
+ * @property {string[]} [extraArgs] - arguments to pass to the script
138
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium",
3
- "version": "2.0.0-beta.48",
3
+ "version": "2.0.0-beta.52",
4
4
  "description": "Automation for Apps.",
5
5
  "keywords": [
6
6
  "automation",
@@ -38,7 +38,8 @@
38
38
  "support.*",
39
39
  "plugin.*",
40
40
  "scripts/autoinstall-extensions.js",
41
- "types"
41
+ "types",
42
+ "tsconfig.json"
42
43
  ],
43
44
  "scripts": {
44
45
  "build:docs": "node docs/scripts/build-docs.js",
@@ -57,12 +58,12 @@
57
58
  "test:unit": "mocha \"./test/unit/**/*.spec.js\""
58
59
  },
59
60
  "dependencies": {
60
- "@appium/base-driver": "^9.1.0",
61
- "@appium/base-plugin": "^2.0.1",
62
- "@appium/docutils": "^0.1.1",
63
- "@appium/schema": "^0.1.0",
64
- "@appium/support": "^3.0.1",
65
- "@appium/types": "^0.7.0",
61
+ "@appium/base-driver": "^9.2.3",
62
+ "@appium/base-plugin": "^2.1.3",
63
+ "@appium/docutils": "^0.1.5",
64
+ "@appium/schema": "^0.2.3",
65
+ "@appium/support": "^3.1.3",
66
+ "@appium/types": "^0.8.3",
66
67
  "@sidvind/better-ajv-errors": "2.1.0",
67
68
  "@types/argparse": "2.0.10",
68
69
  "@types/bluebird": "3.5.38",
@@ -70,12 +71,12 @@
70
71
  "@types/semver": "7.3.13",
71
72
  "@types/teen_process": "2.0.0",
72
73
  "@types/wrap-ansi": "3.0.0",
73
- "ajv": "8.11.2",
74
+ "ajv": "8.12.0",
74
75
  "ajv-formats": "2.1.1",
75
76
  "argparse": "2.0.1",
76
77
  "async-lock": "1.4.0",
77
78
  "asyncbox": "2.9.4",
78
- "axios": "1.2.1",
79
+ "axios": "1.2.2",
79
80
  "bluebird": "3.7.2",
80
81
  "cross-env": "7.0.3",
81
82
  "find-up": "5.0.0",
@@ -90,10 +91,10 @@
90
91
  "semver": "7.3.8",
91
92
  "source-map-support": "0.5.21",
92
93
  "teen_process": "2.0.2",
93
- "type-fest": "3.4.0",
94
+ "type-fest": "3.5.1",
94
95
  "winston": "3.8.2",
95
96
  "wrap-ansi": "7.0.0",
96
- "yaml": "2.1.3"
97
+ "yaml": "2.2.1"
97
98
  },
98
99
  "engines": {
99
100
  "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
@@ -103,8 +104,8 @@
103
104
  "access": "public",
104
105
  "tag": "next"
105
106
  },
106
- "gitHead": "2e76ba9607729f59ca967e47c2cba738e90a57b8",
107
+ "gitHead": "67c9bdfbceeb049aa134bf1d9b107543ff0a80b0",
107
108
  "typedoc": {
108
- "entryPoint": "./build/lib/main.js"
109
+ "entryPoint": "./lib/main.js"
109
110
  }
110
111
  }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "@appium/tsconfig/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "outDir": "build",
6
+ "paths": {
7
+ "@appium/support": ["../support"],
8
+ "@appium/base-driver": ["../base-driver"],
9
+ "@appium/base-plugin": ["../base-plugin"],
10
+ "@appium/types": ["../types"],
11
+ "@appium/schema": ["../schema"],
12
+ "appium": ["."]
13
+ },
14
+ "checkJs": true
15
+ },
16
+ "include": ["lib", "types"],
17
+ "references": [
18
+ {"path": "../schema"},
19
+ {"path": "../types"},
20
+ {"path": "../support"},
21
+ {"path": "../base-driver"},
22
+ {"path": "../base-plugin"},
23
+ {"path": "../test-support"}
24
+ ]
25
+ }