appium 2.3.0 → 2.4.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.
Files changed (69) hide show
  1. package/README.md +129 -158
  2. package/build/lib/appium.d.ts +72 -0
  3. package/build/lib/appium.d.ts.map +1 -1
  4. package/build/lib/appium.js +326 -0
  5. package/build/lib/appium.js.map +1 -1
  6. package/build/lib/cli/args.d.ts.map +1 -1
  7. package/build/lib/cli/args.js +24 -2
  8. package/build/lib/cli/args.js.map +1 -1
  9. package/build/lib/cli/driver-command.d.ts +16 -0
  10. package/build/lib/cli/driver-command.d.ts.map +1 -1
  11. package/build/lib/cli/driver-command.js +16 -0
  12. package/build/lib/cli/driver-command.js.map +1 -1
  13. package/build/lib/cli/extension-command.d.ts +26 -2
  14. package/build/lib/cli/extension-command.d.ts.map +1 -1
  15. package/build/lib/cli/extension-command.js +126 -1
  16. package/build/lib/cli/extension-command.js.map +1 -1
  17. package/build/lib/cli/parser.d.ts.map +1 -1
  18. package/build/lib/cli/parser.js +11 -7
  19. package/build/lib/cli/parser.js.map +1 -1
  20. package/build/lib/cli/plugin-command.d.ts +16 -0
  21. package/build/lib/cli/plugin-command.d.ts.map +1 -1
  22. package/build/lib/cli/plugin-command.js +16 -0
  23. package/build/lib/cli/plugin-command.js.map +1 -1
  24. package/build/lib/cli/utils.d.ts.map +1 -1
  25. package/build/lib/cli/utils.js +3 -4
  26. package/build/lib/cli/utils.js.map +1 -1
  27. package/build/lib/config.d.ts +1 -1
  28. package/build/lib/config.d.ts.map +1 -1
  29. package/build/lib/config.js +25 -29
  30. package/build/lib/config.js.map +1 -1
  31. package/build/lib/constants.d.ts +10 -0
  32. package/build/lib/constants.d.ts.map +1 -1
  33. package/build/lib/constants.js +11 -1
  34. package/build/lib/constants.js.map +1 -1
  35. package/build/lib/doctor/doctor.d.ts +55 -0
  36. package/build/lib/doctor/doctor.d.ts.map +1 -0
  37. package/build/lib/doctor/doctor.js +201 -0
  38. package/build/lib/doctor/doctor.js.map +1 -0
  39. package/build/lib/extension/index.d.ts.map +1 -1
  40. package/build/lib/extension/index.js +10 -4
  41. package/build/lib/extension/index.js.map +1 -1
  42. package/build/lib/grid-register.d.ts.map +1 -1
  43. package/build/lib/grid-register.js +1 -2
  44. package/build/lib/grid-register.js.map +1 -1
  45. package/build/lib/main.d.ts.map +1 -1
  46. package/build/lib/main.js +6 -0
  47. package/build/lib/main.js.map +1 -1
  48. package/build/lib/utils.d.ts +1 -0
  49. package/build/lib/utils.d.ts.map +1 -1
  50. package/build/lib/utils.js +2 -1
  51. package/build/lib/utils.js.map +1 -1
  52. package/build/types/cli.d.ts +1 -1
  53. package/build/types/cli.d.ts.map +1 -1
  54. package/lib/appium.js +387 -1
  55. package/lib/cli/args.js +27 -2
  56. package/lib/cli/driver-command.js +18 -0
  57. package/lib/cli/extension-command.js +148 -2
  58. package/lib/cli/parser.js +22 -8
  59. package/lib/cli/plugin-command.js +18 -0
  60. package/lib/cli/utils.js +5 -7
  61. package/lib/config.js +18 -24
  62. package/lib/constants.js +12 -0
  63. package/lib/doctor/doctor.js +209 -0
  64. package/lib/extension/index.js +10 -4
  65. package/lib/grid-register.js +1 -2
  66. package/lib/main.js +6 -0
  67. package/lib/utils.js +2 -1
  68. package/package.json +13 -13
  69. package/types/cli.ts +1 -1
package/README.md CHANGED
@@ -1,214 +1,185 @@
1
- ## Appium
1
+ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine/)
2
+
3
+ <p align="center">
4
+ <a href="https://appium.io/">
5
+ <img alt="Appium" src="https://raw.githubusercontent.com/appium/appium/master/packages/appium/docs/assets/images/appium-logo-horiz.png" width="500">
6
+ </a>
7
+ </p>
8
+ <p align="center">
9
+ Cross-platform test automation for native, hybrid, mobile web and desktop apps.
10
+ </p>
2
11
 
3
12
  [![NPM version](https://badge.fury.io/js/appium.svg)](https://npmjs.org/package/appium)
4
13
  [![Monthly Downloads](https://img.shields.io/npm/dm/appium.svg)](https://npmjs.org/package/appium)
5
-
6
14
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fappium%2Fappium.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fappium%2Fappium?ref=badge_shield)
7
-
8
15
  [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/)
9
16
 
10
- [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine/)
17
+ ***
11
18
 
12
- Appium is an open-source, cross-platform test automation tool for native,
13
- hybrid, mobile web and desktop apps. Initially created to automate iOS and Android mobile
14
- applications Appium has grown to a full-featured platform that provides [WebDriver](https://www.w3.org/TR/webdriver/)-based automation possibilities for the whole set of different mobile and desktop platforms.
15
- See the full list of
16
- [officially-supported](https://appium.io/docs/en/latest/ecosystem/#drivers) and
17
- [third-party](https://appium.io/docs/en/latest/ecosystem/#other-drivers) drivers for more details.
19
+ <p align="center"><b>
20
+ <a href="https://appium.io">Documentation</a> |
21
+ <a href="https://appium.io/docs/en/latest/intro/">Get Started</a> |
22
+ <a href="https://appium.io/docs/en/latest/ecosystem/">Ecosystem</a> |
23
+ <a href="https://github.com/appium/appium/blob/master/packages/appium/CHANGELOG.md">Changelog</a> |
24
+ <a href="https://github.com/appium/appium/blob/master/ROADMAP.md">Roadmap</a> |
25
+ <a href="https://discuss.appium.io">Discussion Forum</a>
26
+ </b></p>
18
27
 
19
- :bangbang: Appium core team does not maintain Appium 1.x anymore since the 1st of January 2022. All recent versions of officially supported platform drivers are not compatible to Appium 1.x, and require Appium 2 to run. [Please read the migration guide from 1.x to 2.0](https://appium.io/docs/en/latest/guides/migrating-1-to-2/) to manage the Appium server.
28
+ ***
20
29
 
21
- :bangbang: If you still use the deprecated Appium Desktop containing the built-in server then you won't be able to upgrade to Appium 2. Consider switching to [Appium Inspector](https://github.com/appium/appium-inspector) instead.
30
+ Appium is an open-source automation framework that provides
31
+ [WebDriver](https://www.w3.org/TR/webdriver/)-based automation possibilities for a wide range of
32
+ different mobile, desktop and IoT platforms. Appium is modular and extensible, and supports multiple
33
+ programming languages, which means there is an entire ecosystem of related software:
34
+ * [__Drivers__](#drivers) add support for automating specific platforms
35
+ * [__Clients__](#clients) allow writing Appium tests in your programming language of choice
36
+ * [__Plugins__](#plugins) allow to further extend Appium functionality
22
37
 
23
- ### Documentation
38
+ ## Migrating From Appium 1 to Appium 2
24
39
 
25
- The current Appium documentation is available at [__https://appium.io__](https://appium.io).
40
+ As of January 1st, 2022, the Appium team no longer maintains or supports Appium 1. All officially
41
+ supported platform drivers are only compatible with Appium 2.
26
42
 
27
- ### Requirements
43
+ __[Please read the Migration Guide](https://appium.io/docs/en/latest/guides/migrating-1-to-2/) if you
44
+ are still using Appium 1.__
28
45
 
29
- - macOS, Linux or Windows operating system
30
- - Node.js 16+. Any relevant [LTS release](https://nodejs.dev/en/about/releases/) should work just fine.
31
- - NPM (Node Package Manager) 8+
46
+ > [!WARNING]
47
+ > If you use Appium Desktop or Appium Server GUI, you will not be able to upgrade to Appium 2, as
48
+ both of these tools have been deprecated. Please use [Appium Inspector](https://github.com/appium/appium-inspector)
49
+ in combination with a standalone Appium 2 server.
32
50
 
33
- These are only server requirements. Each driver might have its own requirements. Consider checking the corresponding driver tutorial for more details.
51
+ ## Installation
34
52
 
35
- ### Server
53
+ Appium can be installed using `npm` (other package managers are not currently supported). Please
54
+ check the [installation docs](http://appium.io/docs/en/latest/quickstart/install/) for the
55
+ system requirements and further information.
36
56
 
37
- To install Appium 2 server using Node Package Manager (npm) run the following command:
57
+ If upgrading from Appium 1, make sure Appium 1 is fully uninstalled (`npm uninstall -g appium`).
58
+ Unexpected errors might appear if this has not been done.
38
59
 
39
60
  ```bash
40
61
  npm i -g appium
41
62
  ```
42
63
 
43
- To update Appium 2 server using Node Package Manager (npm) run the following command:
64
+ Note that this will only install the core Appium server, which cannot automate anything on its own.
65
+ Please install [drivers](#drivers) for your target platforms in order to automate them.
44
66
 
45
- ```bash
46
- npm i -g appium@latest
47
- ```
48
-
49
- :bangbang: Make sure Appium 1 is fully uninstalled before upgrading it to Appium 2 (`npm uninstall -g appium`). Unexpected errors might appear if this has not been done.
67
+ ## Drivers
50
68
 
51
- ### Drivers
69
+ Appium supports app automation across a variety of platforms, like iOS, Android, macOS, Windows,
70
+ and more. Each platform is supported by one or more "drivers", which know how to automate that
71
+ particular platform. You can find a full list of officially-supported and third-party drivers in
72
+ [Appium Ecosystem's Drivers page](http://appium.io/docs/en/latest/ecosystem/drivers/).
52
73
 
53
- Appium supports app automation across a variety of platforms, like iOS,
54
- Android, and Windows. Each platform is supported by one or more "drivers",
55
- which know how to automate that particular platform. Since version 2.0
56
- all drivers have been isolated from the Appium server app and can
57
- be managed independently using the [appium driver](https://appiumpro.com/editions/122-installing-appium-20-and-the-driver-and-plugins-cli) command line interface.
58
-
59
- In general, the drivers management in Appium 2 is as simple as:
74
+ Driver management is done using [Appium's Extension command-line interface](http://appium.io/docs/en/latest/cli/extensions/):
60
75
 
61
76
  ```bash
62
- # To install a new driver from npm
63
- appium driver install --source=npm appium-xcuitest-driver[@<version>]
64
- # To install a driver from a local folder (useful for developers)
65
- appium driver install --source=local /Users/me/sources/appium-xcuitest-driver
66
- # To install a new driver from github (hm, maybe it's time to publish it to NPM?)
67
- appium driver install --source=github --package=appium-xcuitest-driver appium/appium-xcuitest-driver
68
-
69
- # To list already installed drivers
70
- appium driver list --installed
77
+ # Install an official driver from npm (see documentation for a list of such drivers)
78
+ appium driver install <driver-name>
79
+ # Install any driver from npm
80
+ appium driver install --source=npm <driver-name>
81
+ # See documentation for installation from other sources
71
82
 
72
- # To update a driver (it must be already installed)
73
- appium driver update xcuitest
74
-
75
- # To uninstall a driver (it won't last forever, wouldn't it?)
76
- appium driver uninstall xcuitest
83
+ # List already installed drivers
84
+ appium driver list --installed
85
+ # Update a driver (it must be already installed)
86
+ # This will NOT update the major version, in order to prevent breaking changes
87
+ appium driver update <driver-name>
88
+ # Update a driver to the most recent version (may include breaking changes)
89
+ appium driver update <driver-name> --unsafe
90
+ # Uninstall a driver (it won't last forever, will it?)
91
+ appium driver uninstall <driver-name>
77
92
  ```
78
93
 
79
- You can find a full list of
80
- [officially-supported](https://appium.io/docs/en/latest/ecosystem/#drivers) and
81
- [third-party](https://appium.io/docs/en/latest/ecosystem/#other-drivers) drivers at
82
- the current Appium 2.0 documentation.
94
+ ## Clients
83
95
 
84
- ### Plugins
96
+ Client libraries enable writing Appium tests in different programming languages. There are
97
+ officially-supported clients for Java, Python, Ruby, and .NET C#, as well as third-party clients
98
+ for other languages. You can find a full list of clients in
99
+ [Appium Ecosystem's Clients page](http://appium.io/docs/en/latest/ecosystem/clients/).
85
100
 
86
- The concept of plugins is something new that has been added exclusively to Appium2. Plugins allow you to extend server functionality without changing the server code. Plugins could be managed similarly to drivers:
87
-
88
- ```bash
89
- # To install an officially supported plugin
90
- appium plugin install images
91
- # To install a plugin from a local folder (useful for developers)
92
- appium plugin install --source=local /Users/me/sources/images
93
- # To install a new plugin from npm
94
- appium plugin install --source=npm appium-device-farm
95
-
96
- # To list already installed plugins
97
- appium plugin list --installed
101
+ ## Plugins
98
102
 
99
- # To update a plugins (it must be already installed)
100
- appium plugin update appium-device-farm
103
+ Plugins allow you to extend server functionality without changing the server code. The main
104
+ difference between drivers and plugins is that the latter must be explicitly enabled on
105
+ Appium server startup (all installed drivers are enabled by default):
101
106
 
102
- # To uninstall a plugin
103
- appium plugin uninstall appium-device-farm
107
+ ```bash
108
+ appium --use-plugins=<plugin-name>
104
109
  ```
105
110
 
106
- The main difference between drivers and plugins is that the latter must be explicitly enabled on server startup after it was installed (drivers are enabled by default after installation):
111
+ You can find a full list of officially-supported and third-party plugins in
112
+ [Appium Ecosystem's Plugins page](http://appium.io/docs/en/latest/ecosystem/plugins/).
107
113
 
108
- ```bash
109
- appium server --use-plugins=device-farm,images
110
- ```
114
+ Similarly to drivers, plugin management is also done using
115
+ [Appium's Extension command-line interface](http://appium.io/docs/en/latest/cli/extensions/):
111
116
 
112
- You can find a full list of
113
- [officially-supported](https://appium.io/docs/en/latest/ecosystem/#plugins) and
114
- [third-party](https://appium.io/docs/en/latest/ecosystem/#other-plugins) plugins at
115
- the current Appium 2.0 documentation.
117
+ ```bash
118
+ # Install an official plugin from npm (see documentation for a list of such plugins)
119
+ appium plugin install <plugin-name>
120
+ # Install any plugin from npm
121
+ appium plugin install --source=npm <plugin-name>
122
+ # See documentation for installation from other sources
116
123
 
124
+ # List already installed plugins
125
+ appium plugin list --installed
126
+ # Update a plugin (it must be already installed)
127
+ # This will NOT update the major version, in order to prevent breaking changes
128
+ appium plugin update <plugin-name>
129
+ # Update a plugin to the most recent version (may include breaking changes)
130
+ appium plugin update <plugin-name> --unsafe
131
+ # Uninstall a plugin
132
+ appium plugin uninstall <plugin-name>
133
+ ```
117
134
 
118
- ### Server Command Line Interface
135
+ ## Server Command Line Interface
119
136
 
120
- In order to start sending commands to Appium over the wire it must be listening
121
- on the URL where your client library expects it to listen.
122
- Use the following commands to run and configure Appium server:
137
+ In order to start sending commands to the Appium server, it must be running on the URL and port
138
+ where your client library expects it to listen. [Appium's command-line interface](http://appium.io/docs/en/latest/cli/args/)
139
+ is used to launch and configure the server:
123
140
 
124
141
  ```bash
125
- # Start the server on the default port and host (e.g. http://0.0.0.0:4723/)
142
+ # Start the server on the default host (0.0.0.0) and port (4723)
126
143
  appium server
127
- # Start the server on the given port, host and use the base path prefix (the default prefix is /)
128
- appium server -p 9000 -a 127.0.0.1 -pa /wd/hub
129
-
130
- # Get the list of all supported command line parameters.
131
- # This list would also include descriptions of driver-specific
132
- # command line arguments for all installed drivers.
133
- # Each driver and plugin must have their command line arguments
134
- # exposed in a special JSON schema declared as a part of the corresponding
135
- # package.json file.
136
- appium server --help
144
+ # You can also omit the 'server' subcommand
145
+ appium
146
+ # Start the server on the given host, port and use a custom base path prefix (the default prefix is '/')
147
+ appium --address 127.0.0.1 --port 9000 --base-path /wd/hub
137
148
  ```
138
149
 
139
- Appium supports execution of parallel server processes as well as parallel driver sessions within
150
+ Appium supports execution of parallel server processes, as well as parallel driver sessions within a
140
151
  single server process. Refer the corresponding driver documentations regarding which mode is optimal
141
152
  for the particular driver or whether it supports parallel sessions.
142
153
 
143
- ### Why Appium?
144
-
145
- 1. You usually don't have to recompile your app or modify it in any way, due
146
- to the use of standard automation APIs on all platforms.
147
- 2. You can write tests with your favorite dev tools using any
148
- [WebDriver](https://w3c.github.io/webdriver/webdriver-spec.html)-compatible
149
- language such as [Java](https://github.com/appium/java-client),
150
- [JavaScript](https://webdriver.io/), [Python](https://github.com/appium/python-client),
151
- [Ruby](https://github.com/appium/ruby_lib), [C#](https://github.com/appium/dotnet-client)
152
- with the Selenium WebDriver API. There are also various third party
153
- client implementations for other languages.
154
- 3. You can use any testing framework.
155
- 4. Some drivers, like xcuitest and uiautomator2 ones have built-in mobile web and
156
- hybrid app support. Within the same script, you can switch seamlessly between native
157
- app automation and webview automation, all using the WebDriver model that's already
158
- the standard for web automation.
159
- 5. You can run your automated tests locally and in a cloud. There are multiple
160
- cloud providers that support various Appium drivers (mostly
161
- targeting iOS and Android mobile automation).
162
- 6. [Appium Inspector](https://github.com/appium/appium-inspector) allows
163
- visual debugging of automated tests and could be extremely useful for
164
- beginners.
165
-
166
- Investing in the
167
- [WebDriver](https://w3c.github.io/webdriver/webdriver-spec.html) protocol means
168
- you are betting on a single, free, and open protocol for testing that has become
169
- a web standard. Don't lock yourself into a proprietary stack.
170
-
171
- For example, if you use Apple's XCUITest library without Appium you can only
172
- write tests using Obj-C/Swift, and you can only run tests through Xcode.
173
- Similarly, with Google's UiAutomator or Espresso, you can only write tests in
174
- Java/Kotlin. Appium opens up the possibility of true cross-platform native app
175
- automation, for mobile and beyond. Finally!
176
-
177
- If you're new to Appium or want a more comprehensive description of what this is all
178
- about, please read our [Intro to Appium](https://appium.io/docs/en/latest/intro/).
179
-
180
- ### Quickstart
154
+ ## Why Appium?
181
155
 
182
- Check out our [Quickstart](https://appium.io/docs/en/latest/quickstart/) guide
183
- to get going with Appium.
184
-
185
- There is also a sample code that contains [many examples of tests in a variety
186
- of different languages](https://github.com/appium/appium/tree/1.x/sample-code)!
187
-
188
- ### Documentation
189
-
190
- For prettily-rendered docs, please visit [Appium Documentation](https://appium.io).
191
- You can always find the full list of Appium doc pages at [Appium's GitHub
192
- Repo](https://github.com/appium/appium/tree/master/packages/appium/docs) as well.
193
-
194
- ### Contributing
195
-
196
- Please take a look at our [contribution documentation](CONTRIBUTING.md)
197
- for instructions on how to build, test, and run Appium from the source.
198
-
199
- ### Project History, Credits & Inspiration
200
-
201
- * [History](https://appium.io/docs/en/latest/intro/history/)
156
+ 1. You usually don't have to recompile your app or modify it in any way, due to the use of standard
157
+ automation APIs on all platforms.
158
+ 2. You can write tests with your favorite dev tools using any WebDriver-compatible language such as
159
+ Java, Python, Ruby and C#. There are also third party client implementations for other languages.
160
+ 3. You can use any testing framework.
161
+ 4. Some drivers like `xcuitest` and `uiautomator2` have built-in mobile web and hybrid app support.
162
+ Within the same script, you can switch seamlessly between native app automation and webview
163
+ automation, all using the WebDriver model that's already the standard for web automation.
164
+ 5. You can run your automated tests locally and in a cloud. There are multiple cloud providers that
165
+ support various Appium drivers (mostly targeting iOS and Android mobile automation).
166
+ 6. [Appium Inspector](https://github.com/appium/appium-inspector) can be used to visually inspect
167
+ the page source of applications across different platforms, facilitating easier test development.
202
168
 
203
- ### User Forums
169
+ Investing in the [WebDriver](https://w3c.github.io/webdriver/webdriver-spec.html) protocol means you
170
+ are betting on a single, free, and open protocol for testing that has become a web standard. Don't
171
+ lock yourself into a proprietary stack.
204
172
 
205
- Announcements and debates often take place on the [Discussion Group](https://discuss.appium.io),
206
- be sure to sign up!
173
+ For example, if you use Apple's XCUITest library without Appium, you can only write tests using
174
+ Obj-C/Swift, and you can only run tests through Xcode. Similarly, with Google's UiAutomator or
175
+ Espresso, you can only write tests in Java/Kotlin. Appium opens up the possibility of true
176
+ cross-platform native app automation, for mobile and beyond!
207
177
 
208
- ### Troubleshooting
178
+ If you are looking for a more comprehensive description of what this is all about, please read our
179
+ documentation on [How Does Appium Work?](https://appium.io/docs/en/latest/intro/appium/).
209
180
 
210
- Please find the troubleshooting guide at the corresponding driver repository/documentation.
181
+ ## License
211
182
 
212
- ### License
183
+ [Apache-2.0](./LICENSE)
213
184
 
214
185
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fappium%2Fappium.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fappium%2Fappium?ref=badge_large)
@@ -91,6 +91,10 @@ export class AppiumDriver extends DriverCore<{
91
91
  driverConfig: DriverConfig;
92
92
  /** @type {AppiumServer} */
93
93
  server: AppiumServer;
94
+ /** @type {Record<string, import('ws').WebSocket[]>} */
95
+ bidiSockets: Record<string, import('ws').WebSocket[]>;
96
+ /** @type {Record<string, import('ws').WebSocket>} */
97
+ bidiProxyClients: Record<string, import('ws').WebSocket>;
94
98
  /**
95
99
  * @type {AppiumDriverConstraints}
96
100
  * @readonly
@@ -131,6 +135,69 @@ export class AppiumDriver extends DriverCore<{
131
135
  * @returns {StringRecord|undefined} Arguments object. If none, `undefined`
132
136
  */
133
137
  getCliArgsForDriver(extName: string): StringRecord | undefined;
138
+ /**
139
+ * Initialize a new bidi connection and set up handlers
140
+ * @param {import('ws').WebSocket} ws The websocket connection object
141
+ * @param {import('http').IncomingMessage} req The connection pathname, which might include the session id
142
+ */
143
+ onBidiConnection(ws: import('ws').WebSocket, req: import('http').IncomingMessage): void;
144
+ /**
145
+ * Initialize a new bidi connection
146
+ * @param {import('ws').WebSocket} ws The websocket connection object
147
+ * @param {import('http').IncomingMessage} req The connection pathname, which might include the session id
148
+ */
149
+ initBidiSocket(ws: import('ws').WebSocket, req: import('http').IncomingMessage): {
150
+ bidiHandlerDriver: AppiumDriver | import("@appium/types").ExternalDriver<import("@appium/types").Constraints, string, import("@appium/types").StringRecord, import("@appium/types").StringRecord, import("@appium/types").DefaultCreateSessionResult<import("@appium/types").Constraints>, void, import("@appium/types").StringRecord>;
151
+ proxyClient: WebSocket.WebSocket | null;
152
+ send: (data: string | Buffer) => Promise<void>;
153
+ sendToProxy: ((data: string | Buffer) => Promise<void>) | null;
154
+ logSocketErr: (err: Error) => void;
155
+ };
156
+ /**
157
+ * Set up handlers on upstream bidi socket we are proxying to/from
158
+ *
159
+ * @param {import('ws').WebSocket | null} proxyClient - the websocket connection to/from the
160
+ * upstream socket (the one we're proxying to/from)
161
+ * @param {import('ws').WebSocket} ws - the websocket connection to/from the client
162
+ * @param {(data: string | Buffer) => Promise<void>} send - a method used to send data to the
163
+ * client
164
+ */
165
+ initBidiProxyHandlers(proxyClient: import('ws').WebSocket | null, ws: import('ws').WebSocket, send: (data: string | Buffer) => Promise<void>): void;
166
+ /**
167
+ * Set up handlers on the bidi socket connection to the client
168
+ *
169
+ * @param {import('ws').WebSocket} ws - the websocket connection to/from the client
170
+ * @param {import('ws').WebSocket | null} proxyClient - the websocket connection to/from the
171
+ * upstream socket (the one we're proxying to/from, if we're proxying)
172
+ * @param {(data: string | Buffer) => Promise<void>} send - a method used to send data to the
173
+ * client
174
+ * @param {((data: string | Buffer) => Promise<void>) | null} sendToProxy - a method used to send data to the
175
+ * upstream socket
176
+ * @param {import('@appium/types').ExternalDriver | AppiumDriver} bidiHandlerDriver - the driver
177
+ * handling the bidi commands
178
+ * @param {(err: Error) => void} logSocketErr - a special prefixed logger
179
+ */
180
+ initBidiSocketHandlers(ws: import('ws').WebSocket, proxyClient: import('ws').WebSocket | null, send: (data: string | Buffer) => Promise<void>, sendToProxy: ((data: string | Buffer) => Promise<void>) | null, bidiHandlerDriver: import('@appium/types').ExternalDriver | AppiumDriver, logSocketErr: (err: Error) => void): void;
181
+ /**
182
+ * Set up bidi event listeners
183
+ *
184
+ * @param {import('ws').WebSocket} ws - the websocket connection to/from the client
185
+ * @param {import('@appium/types').ExternalDriver | AppiumDriver} bidiHandlerDriver - the driver
186
+ * handling the bidi commands
187
+ * @param {(data: string | Buffer) => Promise<void>} send - a method used to send data to the
188
+ * client
189
+ */
190
+ initBidiEventListeners(ws: import('ws').WebSocket, bidiHandlerDriver: import('@appium/types').ExternalDriver | AppiumDriver, send: (data: string | Buffer) => Promise<void>): void;
191
+ /**
192
+ * @param {Buffer} data
193
+ * @param {ExternalDriver | AppiumDriver} driver
194
+ */
195
+ onBidiMessage(data: Buffer, driver: ExternalDriver | AppiumDriver): Promise<any>;
196
+ /**
197
+ * Log a bidi server error
198
+ * @param {Error} err
199
+ */
200
+ onBidiServerError(err: Error): void;
134
201
  /**
135
202
  * Create a new session
136
203
  * @param {W3CAppiumDriverCaps} jsonwpCaps JSONWP formatted desired capabilities
@@ -165,6 +232,10 @@ export class AppiumDriver extends DriverCore<{
165
232
  error: any;
166
233
  value?: undefined;
167
234
  }>;
235
+ /**
236
+ * @param {string} sessionId
237
+ */
238
+ cleanupBidiSockets(sessionId: string): void;
168
239
  deleteAllSessions(opts?: {}): Promise<void>;
169
240
  /**
170
241
  * Get the appropriate plugins for a session (or sessionless plugins)
@@ -232,5 +303,6 @@ declare namespace desiredCapabilityConstraints {
232
303
  }
233
304
  }
234
305
  import { DriverCore } from '@appium/base-driver';
306
+ import WebSocket from 'ws';
235
307
  export {};
236
308
  //# sourceMappingURL=appium.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appium.d.ts","sourceRoot":"","sources":["../../lib/appium.js"],"names":[],"mappings":"AAy2BA;;;GAGG;AACH;IAME,cAOC;IAZD;;OAEG;IACH,MAFU,SAAS,MAAM,CAAC,CAEgB;CAU3C;yBAKY,OAAO,eAAe,EAAE,UAAU;yBAClC,OAAO,eAAe,EAAE,UAAU;0BAClC,OAAO,eAAe,EAAE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CACV;IAEb,2BAA2B;IAC3B,QADW,YAAY,CAChB;IAEP;;;OAGG;IACH,gCAHU,uBAAuB,CAGX;IAEtB,0EAA0E;IAC1E,MADW,OAAO,eAAe,EAAE,UAAU,CAAC,uBAAuB,CAAC,CACjE;IAwBH,yBAA4B;IA+B9B,uCAGC;IAED,uUAEC;IAGD;;;;OAeC;IAED;;OAEG;IACH,kBAFW,MAAM,GAAC,IAAI,iBAQrB;IAED;;;SAKC;IAED,+FAiBC;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;;;;;OAQG;IACH,6BAHW,MAAM,GACJ,YAAY,GAAC,SAAS,CAclC;IAED;;;;;;OAMG;IACH,0BALW,mBAAmB,iGAGjB,QAAQ,0BAA0B,CAAC,CA+K/C;IAED;;;;OAIG;IACH,wCAHW,cAAc,kBACd,MAAM,QAsChB;IAED;;;;;;OAMG;IACH,gDALsB,GAAG,EAAE,KAAK,GAAG,mBAAgB,GAAG,EAAE,KAAK,GAAG,IACnD,QAAQ,UAAU,EAAE,CAAC,CAmBjC;IAED;;OAEG;IACH,yBAFW,MAAM;;;;;;;;OA0ChB;IAED,4CAqBC;IAED;;;;;OAKG;IACH,8BAHY,MAAM,gBAejB;IAED;;;;;;;;;OASG;IACH,wBAJW,MAAM,cACL,MAAM,gBASjB;IAED;;;OAGG;IACH,yBAFa,MAAM,EAAE,CAWpB;IAED;;;;;OAKG;IACH,oBAJW,MAAM,WACF,GAAG,kBA0JjB;IAED;;;;;;;YAwBC;IAED;;;aAoBC;IAED;;;;;;;OAwBC;IAED,qCAGC;IAYD,kCAGC;CACF;;;;;;;;;;;;;2BAp1BM,qBAAqB"}
1
+ {"version":3,"file":"appium.d.ts","sourceRoot":"","sources":["../../lib/appium.js"],"names":[],"mappings":"AA2uCA;;;GAGG;AACH;IAME,cAOC;IAZD;;OAEG;IACH,MAFU,SAAS,MAAM,CAAC,CAEgB;CAU3C;yBAKY,OAAO,eAAe,EAAE,UAAU;y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