appium 2.2.3 → 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 (90) hide show
  1. package/README.md +131 -158
  2. package/build/lib/appium.d.ts +76 -4
  3. package/build/lib/appium.d.ts.map +1 -1
  4. package/build/lib/appium.js +327 -1
  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 +135 -4
  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-file.d.ts +1 -1
  28. package/build/lib/config.d.ts +8 -7
  29. package/build/lib/config.d.ts.map +1 -1
  30. package/build/lib/config.js +54 -64
  31. package/build/lib/config.js.map +1 -1
  32. package/build/lib/constants.d.ts +10 -0
  33. package/build/lib/constants.d.ts.map +1 -1
  34. package/build/lib/constants.js +11 -1
  35. package/build/lib/constants.js.map +1 -1
  36. package/build/lib/doctor/doctor.d.ts +55 -0
  37. package/build/lib/doctor/doctor.d.ts.map +1 -0
  38. package/build/lib/doctor/doctor.js +201 -0
  39. package/build/lib/doctor/doctor.js.map +1 -0
  40. package/build/lib/extension/driver-config.d.ts +2 -2
  41. package/build/lib/extension/driver-config.d.ts.map +1 -1
  42. package/build/lib/extension/driver-config.js +4 -4
  43. package/build/lib/extension/driver-config.js.map +1 -1
  44. package/build/lib/extension/extension-config.d.ts +10 -3
  45. package/build/lib/extension/extension-config.d.ts.map +1 -1
  46. package/build/lib/extension/extension-config.js +32 -14
  47. package/build/lib/extension/extension-config.js.map +1 -1
  48. package/build/lib/extension/index.d.ts +6 -4
  49. package/build/lib/extension/index.d.ts.map +1 -1
  50. package/build/lib/extension/index.js +74 -32
  51. package/build/lib/extension/index.js.map +1 -1
  52. package/build/lib/extension/manifest.js +1 -1
  53. package/build/lib/extension/manifest.js.map +1 -1
  54. package/build/lib/extension/plugin-config.js +1 -1
  55. package/build/lib/extension/plugin-config.js.map +1 -1
  56. package/build/lib/grid-register.d.ts.map +1 -1
  57. package/build/lib/grid-register.js +1 -2
  58. package/build/lib/grid-register.js.map +1 -1
  59. package/build/lib/main.d.ts +4 -0
  60. package/build/lib/main.d.ts.map +1 -1
  61. package/build/lib/main.js +31 -52
  62. package/build/lib/main.js.map +1 -1
  63. package/build/lib/schema/schema.d.ts +5 -0
  64. package/build/lib/schema/schema.d.ts.map +1 -1
  65. package/build/lib/schema/schema.js +7 -7
  66. package/build/lib/schema/schema.js.map +1 -1
  67. package/build/lib/utils.d.ts +3 -0
  68. package/build/lib/utils.d.ts.map +1 -1
  69. package/build/lib/utils.js +2 -1
  70. package/build/lib/utils.js.map +1 -1
  71. package/build/types/cli.d.ts +1 -1
  72. package/build/types/cli.d.ts.map +1 -1
  73. package/lib/appium.js +388 -2
  74. package/lib/cli/args.js +27 -2
  75. package/lib/cli/driver-command.js +18 -0
  76. package/lib/cli/extension-command.js +160 -9
  77. package/lib/cli/parser.js +22 -8
  78. package/lib/cli/plugin-command.js +18 -0
  79. package/lib/cli/utils.js +5 -7
  80. package/lib/config.js +46 -65
  81. package/lib/constants.js +12 -0
  82. package/lib/doctor/doctor.js +209 -0
  83. package/lib/extension/driver-config.js +3 -3
  84. package/lib/extension/extension-config.js +33 -15
  85. package/lib/extension/index.js +80 -43
  86. package/lib/grid-register.js +1 -2
  87. package/lib/main.js +42 -61
  88. package/lib/utils.js +2 -1
  89. package/package.json +15 -18
  90. package/types/cli.ts +1 -1
package/README.md CHANGED
@@ -1,212 +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: The current Appium 2.0 documentation can be found [here](https://appium.io/docs/en/latest/).
28
+ ***
20
29
 
21
- :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.
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
- :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.
38
+ ## Migrating From Appium 1 to Appium 2
24
39
 
25
- ### Requirements
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
- - macOS, Linux or Windows operating system
28
- - Node.js 16+. Any relevant [LTS release](https://nodejs.dev/en/about/releases/) should work just fine.
29
- - NPM (Node Package Manager) 8+
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.__
30
45
 
31
- These are only server requirements. Each driver might have its own requirements. Consider checking the corresponding driver tutorial for more details.
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
- ### Server
51
+ ## Installation
34
52
 
35
- To install Appium 2 server using Node Package Manager (npm) run the following command:
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
- ```bash
38
- npm i --location=global appium
39
- ```
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.
40
59
 
41
- To update Appium 2 server using Node Package Manager (npm) run the following command:
42
-
43
- ```bash
44
- npm install --location=global appium@latest
60
+ ```bash
61
+ npm i -g appium
45
62
  ```
46
63
 
47
- :bangbang: Make sure Appium 1 is fully uninstalled before upgrading it to Appium 2 (`npm uninstall --location=global appium`). Unexpected errors might appear if this has not been done.
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.
48
66
 
49
- ### Drivers
67
+ ## Drivers
50
68
 
51
- Appium supports app automation across a variety of platforms, like iOS,
52
- Android, and Windows. Each platform is supported by one or more "drivers",
53
- which know how to automate that particular platform. Since version 2.0
54
- all drivers have been isolated from the Appium server app and can
55
- be managed independently using the [appium driver](https://appiumpro.com/editions/122-installing-appium-20-and-the-driver-and-plugins-cli) command line interface.
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/).
56
73
 
57
- 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/):
58
75
 
59
76
  ```bash
60
- # To install a new driver from npm
61
- appium driver install --source=npm appium-xcuitest-driver[@<version>]
62
- # To install a driver from a local folder (useful for developers)
63
- appium driver install --source=local /Users/me/sources/appium-xcuitest-driver
64
- # To install a new driver from github (hm, maybe it's time to publish it to NPM?)
65
- appium driver install --source=github --package=appium-xcuitest-driver appium/appium-xcuitest-driver
66
-
67
- # To list already installed drivers
68
- appium driver list --installed
69
-
70
- # To update a driver (it must be already installed)
71
- appium driver update xcuitest
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
72
82
 
73
- # To uninstall a driver (it won't last forever, wouldn't it?)
74
- 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>
75
92
  ```
76
93
 
77
- You can find a full list of
78
- [officially-supported](https://appium.io/docs/en/latest/ecosystem/#drivers) and
79
- [third-party](https://appium.io/docs/en/latest/ecosystem/#other-drivers) drivers at
80
- the current Appium 2.0 documentation.
81
-
82
- ### Plugins
94
+ ## Clients
83
95
 
84
- 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:
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
- ```bash
87
- # To install an officially supported plugin
88
- appium plugin install images
89
- # To install a plugin from a local folder (useful for developers)
90
- appium plugin install --source=local /Users/me/sources/images
91
- # To install a new plugin from npm
92
- appium plugin install --source=npm appium-device-farm
93
-
94
- # To list already installed plugins
95
- appium plugin list --installed
101
+ ## Plugins
96
102
 
97
- # To update a plugins (it must be already installed)
98
- 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):
99
106
 
100
- # To uninstall a plugin
101
- appium plugin uninstall appium-device-farm
107
+ ```bash
108
+ appium --use-plugins=<plugin-name>
102
109
  ```
103
110
 
104
- 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/).
105
113
 
106
- ```bash
107
- appium server --use-plugins=device-farm,images
108
- ```
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/):
109
116
 
110
- You can find a full list of
111
- [officially-supported](https://appium.io/docs/en/latest/ecosystem/#plugins) and
112
- [third-party](https://appium.io/docs/en/latest/ecosystem/#other-plugins) plugins at
113
- 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
114
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
+ ```
115
134
 
116
- ### Server Command Line Interface
135
+ ## Server Command Line Interface
117
136
 
118
- In order to start sending commands to Appium over the wire it must be listening
119
- on the URL where your client library expects it to listen.
120
- 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:
121
140
 
122
141
  ```bash
123
- # 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)
124
143
  appium server
125
- # Start the server on the given port, host and use the base path prefix (the default prefix is /)
126
- appium server -p 9000 -a 127.0.0.1 -pa /wd/hub
127
-
128
- # Get the list of all supported command line parameters.
129
- # This list would also include descriptions of driver-specific
130
- # command line arguments for all installed drivers.
131
- # Each driver and plugin must have their command line arguments
132
- # exposed in a special JSON schema declared as a part of the corresponding
133
- # package.json file.
134
- 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
135
148
  ```
136
149
 
137
- 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
138
151
  single server process. Refer the corresponding driver documentations regarding which mode is optimal
139
152
  for the particular driver or whether it supports parallel sessions.
140
153
 
141
- ### Why Appium?
142
-
143
- 1. You usually don't have to recompile your app or modify it in any way, due
144
- to the use of standard automation APIs on all platforms.
145
- 2. You can write tests with your favorite dev tools using any
146
- [WebDriver](https://w3c.github.io/webdriver/webdriver-spec.html)-compatible
147
- language such as [Java](https://github.com/appium/java-client),
148
- [JavaScript](https://webdriver.io/), [Python](https://github.com/appium/python-client),
149
- [Ruby](https://github.com/appium/ruby_lib), [C#](https://github.com/appium/dotnet-client)
150
- with the Selenium WebDriver API. There are also various third party
151
- client implementations for other languages.
152
- 3. You can use any testing framework.
153
- 4. Some drivers, like xcuitest and uiautomator2 ones have built-in mobile web and
154
- hybrid app support. Within the same script, you can switch seamlessly between native
155
- app automation and webview automation, all using the WebDriver model that's already
156
- the standard for web automation.
157
- 5. You can run your automated tests locally and in a cloud. There are multiple
158
- cloud providers that support various Appium drivers (mostly
159
- targeting iOS and Android mobile automation).
160
- 6. [Appium Inspector](https://github.com/appium/appium-inspector) allows
161
- visual debugging of automated tests and could be extremely useful for
162
- beginners.
163
-
164
- Investing in the
165
- [WebDriver](https://w3c.github.io/webdriver/webdriver-spec.html) protocol means
166
- you are betting on a single, free, and open protocol for testing that has become
167
- a web standard. Don't lock yourself into a proprietary stack.
168
-
169
- For example, if you use Apple's XCUITest library without Appium you can only
170
- write tests using Obj-C/Swift, and you can only run tests through Xcode.
171
- Similarly, with Google's UiAutomator or Espresso, you can only write tests in
172
- Java/Kotlin. Appium opens up the possibility of true cross-platform native app
173
- automation, for mobile and beyond. Finally!
174
-
175
- If you're new to Appium or want a more comprehensive description of what this is all
176
- about, please read our [Intro to Appium](https://appium.io/docs/en/latest/intro/).
177
-
178
- ### Quickstart
154
+ ## Why Appium?
179
155
 
180
- Check out our [Quickstart](https://appium.io/docs/en/latest/quickstart/) guide
181
- to get going with Appium.
182
-
183
- There is also a sample code that contains [many examples of tests in a variety
184
- of different languages](https://github.com/appium/appium/tree/1.x/sample-code)!
185
-
186
- ### Documentation
187
-
188
- For prettily-rendered docs, please visit [Appium Documentation](https://appium.io).
189
- You can always find the full list of Appium doc pages at [Appium's GitHub
190
- Repo](https://github.com/appium/appium/tree/master/packages/appium/docs) as well.
191
-
192
- ### Contributing
193
-
194
- Please take a look at our [contribution documentation](CONTRIBUTING.md)
195
- for instructions on how to build, test, and run Appium from the source.
196
-
197
- ### Project History, Credits & Inspiration
198
-
199
- * [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.
200
168
 
201
- ### 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.
202
172
 
203
- Announcements and debates often take place on the [Discussion Group](https://discuss.appium.io),
204
- 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!
205
177
 
206
- ### 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/).
207
180
 
208
- Please find the troubleshooting guide at the corresponding driver repository/documentation.
181
+ ## License
209
182
 
210
- ### License
183
+ [Apache-2.0](./LICENSE)
211
184
 
212
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)
@@ -221,16 +292,17 @@ export class AppiumDriver extends DriverCore<{
221
292
  }
222
293
  declare namespace desiredCapabilityConstraints {
223
294
  namespace automationName {
224
- const presence: true;
225
- const isString: true;
295
+ let presence: true;
296
+ let isString: true;
226
297
  }
227
298
  namespace platformName {
228
- const presence_1: true;
299
+ let presence_1: true;
229
300
  export { presence_1 as presence };
230
- const isString_1: true;
301
+ let isString_1: true;
231
302
  export { isString_1 as isString };
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,WAAW;2BACnC,OAAO,eAAe,EAAE,YAAY;4BACpC,OAAO,eAAe,EAAE,aAAa;2BACrC,OAAO,2BAA2B,EAAE,YAAY;yBAChD,OAAO,eAAe,EAAE,UAAU;yBAClC,OAAO,eAAe,EAAE,UAAU;2BAClC,OAAO,eAAe,EAAE,YAAY;6BACpC,OAAO,eAAe,EAAE,cAAc;0BACtC,OAAO,eAAe,EAAE,WAAW;qBACnC,OAAO,eAAe,EAAE,MAAM;0BAC9B,OAAO,eAAe,EAAE,WAAW,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