appium_lib_core 4.1.0 → 9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +331 -270
- data/README.md +65 -15
- data/Rakefile +5 -22
- data/appium_lib_core.gemspec +6 -9
- data/bin/console +0 -4
- data/lib/appium_lib_core/android/device/auth_finger_print.rb +4 -1
- data/lib/appium_lib_core/android/device/network.rb +10 -0
- data/lib/appium_lib_core/android/device/performance.rb +3 -0
- data/lib/appium_lib_core/android/device/screen.rb +2 -0
- data/lib/appium_lib_core/android/device.rb +80 -17
- data/lib/appium_lib_core/common/base/bridge.rb +255 -93
- data/lib/appium_lib_core/common/base/capabilities.rb +21 -8
- data/lib/appium_lib_core/common/{command/mjsonwp.rb → base/device_ime.rb} +33 -12
- data/lib/appium_lib_core/common/base/driver.rb +263 -334
- data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
- data/lib/appium_lib_core/common/base/has_location.rb +80 -0
- data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
- data/lib/appium_lib_core/common/base/http_default.rb +22 -38
- data/lib/appium_lib_core/{ios/uiautomation/bridge.rb → common/base/remote_status.rb} +9 -8
- data/lib/appium_lib_core/common/base/rotable.rb +62 -0
- data/lib/appium_lib_core/common/base/screenshot.rb +8 -8
- data/lib/appium_lib_core/common/base/search_context.rb +98 -172
- data/lib/appium_lib_core/common/base.rb +1 -5
- data/lib/appium_lib_core/common/command.rb +244 -4
- data/lib/appium_lib_core/common/device/app_management.rb +2 -26
- data/lib/appium_lib_core/common/device/context.rb +1 -5
- data/lib/appium_lib_core/common/device/image_comparison.rb +12 -4
- data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
- data/lib/appium_lib_core/common/device/{touch_actions.rb → orientation.rb} +6 -10
- data/lib/appium_lib_core/common/error.rb +4 -5
- data/lib/appium_lib_core/common/log.rb +5 -4
- data/lib/appium_lib_core/common/wait.rb +38 -6
- data/lib/appium_lib_core/device.rb +3 -9
- data/lib/appium_lib_core/driver.rb +191 -160
- data/lib/appium_lib_core/{patch.rb → element.rb} +64 -26
- data/lib/appium_lib_core/ios/xcuitest/device.rb +2 -0
- data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
- data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
- data/lib/appium_lib_core/mac2/device.rb +92 -0
- data/lib/appium_lib_core/{ios.rb → mac2.rb} +2 -5
- data/lib/appium_lib_core/support/event_firing_bridge.rb +57 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core.rb +23 -10
- metadata +28 -94
- data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
- data/.github/contributing.md +0 -26
- data/.github/issue_template.md +0 -20
- data/.github/workflows/unittest.yml +0 -68
- data/.gitignore +0 -18
- data/.rubocop.yml +0 -58
- data/azure-pipelines.yml +0 -15
- data/ci-jobs/functional/android_setup.yml +0 -3
- data/ci-jobs/functional/ios_setup.yml +0 -7
- data/ci-jobs/functional/publish_test_result.yml +0 -18
- data/ci-jobs/functional/run_appium.yml +0 -25
- data/ci-jobs/functional/start-emulator.sh +0 -26
- data/ci-jobs/functional_test.yml +0 -298
- data/docs/mobile_command.md +0 -34
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
- data/lib/appium_lib_core/common/command/common.rb +0 -110
- data/lib/appium_lib_core/common/command/w3c.rb +0 -56
- data/lib/appium_lib_core/common/device/value.rb +0 -52
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +0 -56
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +0 -203
- data/lib/appium_lib_core/ios/uiautomation/device.rb +0 -44
- data/lib/appium_lib_core/ios/uiautomation/patch.rb +0 -34
- data/release_notes.md +0 -816
- data/script/commands.rb +0 -200
data/README.md
CHANGED
@@ -10,7 +10,14 @@ This library wraps [selenium-webdriver](https://github.com/SeleniumHQ/selenium/w
|
|
10
10
|
|
11
11
|
# Documentation
|
12
12
|
|
13
|
-
-
|
13
|
+
- https://www.rubydoc.info/gems/appium_lib_core
|
14
|
+
- You can find working API examples in test code, [test/functional](test/functional)
|
15
|
+
- Appium 2.0
|
16
|
+
- https://appium.github.io/appium/docs/en/2.0/ (Not completed yet)
|
17
|
+
|
18
|
+
# Migration from v4 to v5
|
19
|
+
|
20
|
+
Please read [`[5.0.0]`](CHANGELOG.md#500---2021-11-05) section in [CHANGELOG](CHANGELOG.md)
|
14
21
|
|
15
22
|
# Related library
|
16
23
|
- https://github.com/appium/ruby_lib
|
@@ -18,27 +25,36 @@ This library wraps [selenium-webdriver](https://github.com/SeleniumHQ/selenium/w
|
|
18
25
|
# How to start
|
19
26
|
## Run tests
|
20
27
|
### Unit Tests
|
21
|
-
Run unit tests which check each method and
|
28
|
+
Run unit tests which check each method and command, URL, using the webmock.
|
22
29
|
|
23
30
|
```bash
|
24
31
|
$ bundle install
|
25
32
|
$ bundle exec parallel_test test/unit/
|
26
33
|
```
|
27
34
|
|
35
|
+
or
|
36
|
+
|
37
|
+
```bash
|
38
|
+
$ bundle install
|
39
|
+
$ bundle exec rake test:unit
|
40
|
+
```
|
41
|
+
|
28
42
|
### Functional Tests
|
29
43
|
Run functional tests which require the Appium server and real device, Simulator/Emulator.
|
30
44
|
|
31
|
-
- Start Appium server
|
45
|
+
- Start Appium server (Appium 2.0 base)
|
32
46
|
```bash
|
33
|
-
$ npm install
|
34
|
-
$ appium
|
47
|
+
$ npm install --location=global appium
|
48
|
+
$ appium driver install xcuitest
|
49
|
+
$ appium driver install uiautomator2 # etc
|
50
|
+
$ appium --base-path=/wd/hub --relaxed-security # To run all tests in local
|
35
51
|
```
|
36
52
|
|
37
53
|
- Conduct tests
|
38
54
|
```bash
|
39
55
|
$ bundle install
|
40
56
|
$ rake test:func:android # Andorid, uiautomator2
|
41
|
-
$
|
57
|
+
$ APPIUM_DRIVER=espresso rake test:func:android # Andorid, uiautomator2
|
42
58
|
$ rake test:func:ios # iOS
|
43
59
|
```
|
44
60
|
|
@@ -78,7 +94,7 @@ $ PARALLEL=1 bundle exec parallel_test test/functional/ios -n 2
|
|
78
94
|
|
79
95
|
- Runs on CI environment (on Azure)
|
80
96
|
- Non `IGNORE_VERSION_SKIP` or `IGNORE_VERSION_SKIP=true` runs all tests ignoring `skip` them by Appium versions
|
81
|
-
- `IGNORE_VERSION_SKIP=false` skips the following tests if the Appium version is lower than the requirement
|
97
|
+
- `IGNORE_VERSION_SKIP=false` skips the following tests if the Appium version is lower than the requirement
|
82
98
|
|
83
99
|
```
|
84
100
|
$ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
@@ -92,14 +108,14 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
|
92
108
|
```ruby
|
93
109
|
require 'rubygems'
|
94
110
|
require 'appium_lib_core'
|
95
|
-
|
111
|
+
|
96
112
|
opts = {
|
97
|
-
|
98
|
-
platformName:
|
113
|
+
capabilities: { # Append capabilities
|
114
|
+
platformName: 'ios',
|
99
115
|
platformVersion: '11.0',
|
100
116
|
deviceName: 'iPhone Simulator',
|
101
|
-
|
102
|
-
|
117
|
+
# app: '/path/to/MyiOS.app', # Without 'app' capability, an appium session starts with the home screen
|
118
|
+
automationName: 'XCUITest'
|
103
119
|
},
|
104
120
|
appium_lib: {
|
105
121
|
wait: 30
|
@@ -107,7 +123,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
|
107
123
|
}
|
108
124
|
@core = Appium::Core.for(opts) # create a core driver with `opts`
|
109
125
|
@driver = @core.start_driver
|
110
|
-
|
126
|
+
|
111
127
|
# Launch iPhone Simulator and `MyiOS.app`
|
112
128
|
@driver.find_element(:accessibility_id, 'some accessibility') # find an element
|
113
129
|
```
|
@@ -115,18 +131,52 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
|
|
115
131
|
```bash
|
116
132
|
# shell 1
|
117
133
|
$ appium --log-level warn:error # show only warning and error logs
|
118
|
-
|
134
|
+
|
119
135
|
# shell 2
|
120
136
|
$ ruby test.rb
|
121
137
|
```
|
122
138
|
|
123
|
-
|
139
|
+
[Appium::Core.for](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver#for-class_method) documentation has more example to build a new driver instance.
|
140
|
+
|
141
|
+
More examples are in [test/functional](test/functional)
|
142
|
+
|
143
|
+
As of version 5.8.0, the client can attach to an existing session. The main purpose is for debugging.
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
# @driver is the driver instance of an existing session
|
147
|
+
attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'XCUITest', platform_name: 'ios'
|
148
|
+
assert attached_driver.session_id == @driver.session_id
|
149
|
+
attached_driver.page_source
|
150
|
+
```
|
124
151
|
|
125
152
|
### Capabilities
|
126
153
|
|
127
154
|
Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
|
128
155
|
Capabilities affect only ruby_lib is [Appium/Core/Options](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
|
129
156
|
|
157
|
+
|
158
|
+
### Gives custom listener
|
159
|
+
|
160
|
+
An example to define a customer listener with [Selenium::WebDriver::Support::AbstractEventListener](https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Support/AbstractEventListener.html)
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener
|
164
|
+
// something
|
165
|
+
end
|
166
|
+
capabilities: {
|
167
|
+
platformName: :ios,
|
168
|
+
platformVersion: '11.0',
|
169
|
+
deviceName: 'iPhone Simulator',
|
170
|
+
automationName: 'XCUITest',
|
171
|
+
app: '/path/to/MyiOS.app'
|
172
|
+
},
|
173
|
+
appium_lib: {
|
174
|
+
listener: CustomListener.new
|
175
|
+
}
|
176
|
+
@core = Appium::Core.for capabilities: capabilities, appium_lib: appium_lib
|
177
|
+
@core.start_driver
|
178
|
+
```
|
179
|
+
|
130
180
|
# Development
|
131
181
|
- Demo app
|
132
182
|
- https://android.googlesource.com/platform/development/+/master/samples/ApiDemos
|
data/Rakefile
CHANGED
@@ -38,6 +38,7 @@ namespace :test do
|
|
38
38
|
namespace :unit do
|
39
39
|
desc('Run all iOS related unit tests in test directory')
|
40
40
|
Rake::TestTask.new(:ios) do |t|
|
41
|
+
ENV['UNIT_TEST'] = '1'
|
41
42
|
t.libs << 'test'
|
42
43
|
t.libs << 'lib'
|
43
44
|
t.test_files = FileList['test/unit/ios/**/*_test.rb']
|
@@ -45,6 +46,7 @@ namespace :test do
|
|
45
46
|
|
46
47
|
desc('Run all Android related unit tests in test directory')
|
47
48
|
Rake::TestTask.new(:android) do |t|
|
49
|
+
ENV['UNIT_TEST'] = '1'
|
48
50
|
t.libs << 'test'
|
49
51
|
t.libs << 'lib'
|
50
52
|
t.test_files = FileList['test/unit/android/**/*_test.rb']
|
@@ -52,6 +54,7 @@ namespace :test do
|
|
52
54
|
|
53
55
|
desc('Run all common related unit tests in test directory')
|
54
56
|
Rake::TestTask.new(:common) do |t|
|
57
|
+
ENV['UNIT_TEST'] = '1'
|
55
58
|
t.libs << 'test'
|
56
59
|
t.libs << 'lib'
|
57
60
|
t.test_files = FileList['test/unit/common/**/*_test.rb']
|
@@ -59,6 +62,7 @@ namespace :test do
|
|
59
62
|
|
60
63
|
desc('Run all Windows related unit tests in test directory')
|
61
64
|
Rake::TestTask.new(:windows) do |t|
|
65
|
+
ENV['UNIT_TEST'] = '1'
|
62
66
|
t.libs << 'test'
|
63
67
|
t.libs << 'lib'
|
64
68
|
t.test_files = FileList['test/unit/windows/**/*_test.rb']
|
@@ -109,28 +113,7 @@ end
|
|
109
113
|
|
110
114
|
desc('Execute RuboCop static code analysis')
|
111
115
|
RuboCop::RakeTask.new(:rubocop) do |t|
|
112
|
-
t.patterns = %w(lib test
|
116
|
+
t.patterns = %w(lib test)
|
113
117
|
t.options = %w(-D)
|
114
118
|
t.fail_on_error = true
|
115
119
|
end
|
116
|
-
|
117
|
-
desc('print commands which Ruby client has not implemented them yet')
|
118
|
-
namespace :commands do
|
119
|
-
require './script/commands'
|
120
|
-
|
121
|
-
desc('Mobile JSON protocol')
|
122
|
-
task :mjsonwp do |_t, _args|
|
123
|
-
c = Script::CommandsChecker.new
|
124
|
-
c.get_mjsonwp_routes
|
125
|
-
c.get_all_command_path './mjsonwp_routes.js'
|
126
|
-
c.all_diff_commands_mjsonwp.each { |key, value| puts("command: #{key}, method: #{value}") }
|
127
|
-
end
|
128
|
-
|
129
|
-
desc('W3C protocol')
|
130
|
-
task :w3c do |_t, _args|
|
131
|
-
c = Script::CommandsChecker.new
|
132
|
-
c.get_mjsonwp_routes
|
133
|
-
c.get_all_command_path './mjsonwp_routes.js'
|
134
|
-
c.all_diff_commands_w3c.each { |key, value| puts("command: #{key}, method: #{value}") }
|
135
|
-
end
|
136
|
-
end
|
data/appium_lib_core.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'appium_lib_core/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version = '>=
|
7
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.0')
|
8
8
|
|
9
9
|
spec.name = 'appium_lib_core'
|
10
10
|
spec.version = Appium::Core::VERSION
|
@@ -16,25 +16,22 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = 'https://github.com/appium/ruby_lib_core/'
|
17
17
|
spec.license = 'Apache-2.0'
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
-
f.match(%r{^(doc|test|spec|features)
|
19
|
+
f.match(%r{(^(doc|docs|test|spec|features|ci-jobs|.github|script)/|release_notes.md|.gitignore|azure-pipelines.yml|.rubocop.yml)})
|
20
20
|
end
|
21
21
|
spec.bindir = 'exe'
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'selenium-webdriver', '~>
|
25
|
+
spec.add_runtime_dependency 'selenium-webdriver', '~> 4.21'
|
26
26
|
spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
|
27
27
|
|
28
|
-
spec.add_development_dependency 'bundler', '>= 1.14'
|
29
28
|
spec.add_development_dependency 'rake', '~> 13.0'
|
30
29
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
31
30
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
32
31
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
33
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
34
|
-
spec.add_development_dependency 'rubocop', '1.
|
35
|
-
spec.add_development_dependency 'appium_thor', '~>
|
36
|
-
spec.add_development_dependency 'pry'
|
37
|
-
spec.add_development_dependency 'pry-byebug'
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.23.0'
|
33
|
+
spec.add_development_dependency 'rubocop', '1.63.5'
|
34
|
+
spec.add_development_dependency 'appium_thor', '~> 2.0'
|
38
35
|
spec.add_development_dependency 'parallel_tests'
|
39
36
|
spec.add_development_dependency 'simplecov'
|
40
37
|
end
|
data/bin/console
CHANGED
@@ -6,9 +6,5 @@ require "appium_lib_core"
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
9
|
require "irb"
|
14
10
|
IRB.start(__FILE__)
|
@@ -20,8 +20,11 @@ module Appium
|
|
20
20
|
def self.add_methods
|
21
21
|
::Appium::Core::Device.add_endpoint_method(:finger_print) do
|
22
22
|
def finger_print(finger_id)
|
23
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: fingerprint' extension instead"
|
24
|
+
|
23
25
|
unless (1..10).cover? finger_id.to_i
|
24
|
-
raise ArgumentError,
|
26
|
+
raise ::Appium::Core::Error::ArgumentError,
|
27
|
+
"finger_id should be integer between 1 to 10. Not #{finger_id}"
|
25
28
|
end
|
26
29
|
|
27
30
|
execute(:finger_print, {}, { fingerprintId: finger_id.to_i })
|
@@ -20,24 +20,32 @@ module Appium
|
|
20
20
|
def self.add_methods
|
21
21
|
::Appium::Core::Device.add_endpoint_method(:get_network_connection) do
|
22
22
|
def get_network_connection
|
23
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getConnectivity' extension instead"
|
24
|
+
|
23
25
|
execute :get_network_connection
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
29
|
::Appium::Core::Device.add_endpoint_method(:toggle_wifi) do
|
28
30
|
def toggle_wifi
|
31
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
|
32
|
+
|
29
33
|
execute :toggle_wifi
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
33
37
|
::Appium::Core::Device.add_endpoint_method(:toggle_data) do
|
34
38
|
def toggle_data
|
39
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
|
40
|
+
|
35
41
|
execute :toggle_data
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
39
45
|
::Appium::Core::Device.add_endpoint_method(:set_network_connection) do
|
40
46
|
def set_network_connection(mode)
|
47
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
|
48
|
+
|
41
49
|
# same as ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection
|
42
50
|
# But this method accept number
|
43
51
|
connection_type = { airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0 }
|
@@ -49,6 +57,8 @@ module Appium
|
|
49
57
|
|
50
58
|
::Appium::Core::Device.add_endpoint_method(:toggle_airplane_mode) do
|
51
59
|
def toggle_airplane_mode
|
60
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: setConnectivity' extension instead"
|
61
|
+
|
52
62
|
execute :toggle_airplane_mode
|
53
63
|
end
|
54
64
|
alias_method :toggle_flight_mode, :toggle_airplane_mode
|
@@ -20,12 +20,15 @@ module Appium
|
|
20
20
|
def self.add_methods
|
21
21
|
::Appium::Core::Device.add_endpoint_method(:get_performance_data_types) do
|
22
22
|
def get_performance_data_types
|
23
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getPerformanceDataTypes' extension instead"
|
23
24
|
execute :get_performance_data_types
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
::Appium::Core::Device.add_endpoint_method(:get_performance_data) do
|
28
29
|
def get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
|
30
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getPerformanceData' extension instead"
|
31
|
+
|
29
32
|
execute(:get_performance_data, {},
|
30
33
|
packageName: package_name, dataType: data_type, dataReadTimeout: data_read_timeout)
|
31
34
|
end
|
@@ -20,6 +20,8 @@ module Appium
|
|
20
20
|
def self.add_methods
|
21
21
|
::Appium::Core::Device.add_endpoint_method(:get_display_density) do
|
22
22
|
def get_display_density
|
23
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getDisplayDensity' extension instead"
|
24
|
+
|
23
25
|
execute :get_display_density
|
24
26
|
end
|
25
27
|
end
|
@@ -27,6 +27,7 @@ module Appium
|
|
27
27
|
|
28
28
|
# rubocop:disable Layout/LineLength
|
29
29
|
|
30
|
+
# @deprecated Use 'mobile: openNotifications' extension instead.
|
30
31
|
# @!method open_notifications
|
31
32
|
# Open Android notifications
|
32
33
|
#
|
@@ -35,6 +36,7 @@ module Appium
|
|
35
36
|
# @driver.open_notifications
|
36
37
|
#
|
37
38
|
|
39
|
+
# @deprecated Use 'mobile: getCurrentActivity' extension instead.
|
38
40
|
# @!method current_activity
|
39
41
|
# Get current activity name
|
40
42
|
# @return [String] An activity name
|
@@ -44,6 +46,7 @@ module Appium
|
|
44
46
|
# @driver.current_activity # '.ApiDemos'
|
45
47
|
#
|
46
48
|
|
49
|
+
# @deprecated Use 'mobile: getCurrentPackage' extension instead.
|
47
50
|
# @!method current_package
|
48
51
|
# Get current package name
|
49
52
|
# @return [String] A package name
|
@@ -53,6 +56,7 @@ module Appium
|
|
53
56
|
# @driver.current_package # 'com.example.android.apis'
|
54
57
|
#
|
55
58
|
|
59
|
+
# @deprecated Use 'mobile: getSystemBars' extension instead.
|
56
60
|
# @!method get_system_bars
|
57
61
|
# Get system bar's information
|
58
62
|
# @return [String]
|
@@ -63,6 +67,7 @@ module Appium
|
|
63
67
|
# @driver.system_bars
|
64
68
|
#
|
65
69
|
|
70
|
+
# @deprecated Use 'mobile: getDisplayDensity' extension instead.
|
66
71
|
# @!method get_display_density
|
67
72
|
# Get connected device's density.
|
68
73
|
# @return [Integer] The size of density
|
@@ -72,6 +77,7 @@ module Appium
|
|
72
77
|
# @driver.get_display_density # 320
|
73
78
|
#
|
74
79
|
|
80
|
+
# @deprecated Use 'mobile: getConnectivity' extension instead.
|
75
81
|
# @!method get_network_connection
|
76
82
|
# Get the device network connection current status
|
77
83
|
# See set_network_connection method for return value
|
@@ -86,6 +92,7 @@ module Appium
|
|
86
92
|
# @driver.get_network_connection #=> 6
|
87
93
|
#
|
88
94
|
|
95
|
+
# @deprecated Use 'mobile: getConnectivity' extension instead.
|
89
96
|
# @!method toggle_wifi
|
90
97
|
# Switch the state of the wifi service only for Android
|
91
98
|
#
|
@@ -96,6 +103,7 @@ module Appium
|
|
96
103
|
# @driver.toggle_wifi
|
97
104
|
#
|
98
105
|
|
106
|
+
# @deprecated Use 'mobile: getConnectivity' extension instead.
|
99
107
|
# @!method toggle_data
|
100
108
|
# Switch the state of data service only for Android, and the device should be rooted
|
101
109
|
#
|
@@ -106,6 +114,45 @@ module Appium
|
|
106
114
|
# @driver.toggle_data
|
107
115
|
#
|
108
116
|
|
117
|
+
# @deprecated Use 'mobile: getConnectivity' extension instead.
|
118
|
+
# @!method location
|
119
|
+
# Get the location of the device.
|
120
|
+
#
|
121
|
+
# @return [::Appium::Location]
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
#
|
125
|
+
# driver.location #=> ::Appium::Location.new(10, 10, 10)
|
126
|
+
#
|
127
|
+
|
128
|
+
# @!method location=
|
129
|
+
# Set the location of the device.
|
130
|
+
#
|
131
|
+
# @param [::Appium::Location] location Set the location.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
#
|
135
|
+
# driver.location = ::Appium::Location.new(10, 10, 10)
|
136
|
+
#
|
137
|
+
|
138
|
+
# @!method set_location
|
139
|
+
# Set the location of the device.
|
140
|
+
#
|
141
|
+
# @param [String, Number] latitude Set the latitude.
|
142
|
+
# @param [String, Number] longitude Set the longitude.
|
143
|
+
# @param [String, Number] altitude Set the altitude.
|
144
|
+
# @param [String, Number] speed Set the speed to apply the location on Android real devices
|
145
|
+
# in meters/second @since Appium 1.21.0 and in knots for emulators @since Appium 1.22.0.
|
146
|
+
# @param [String, Number] satellites Sets the count of geo satellites being tracked in range 1..12 @since Appium 1.22.0.
|
147
|
+
# This number is respected on Emulators.
|
148
|
+
# @param [::Appium::Location]
|
149
|
+
#
|
150
|
+
# @example
|
151
|
+
#
|
152
|
+
# driver.set_location 10, 10, 0
|
153
|
+
#
|
154
|
+
|
155
|
+
# @deprecated Use 'mobile: toggleGps' extension instead.
|
109
156
|
# @!method toggle_location_services
|
110
157
|
# Switch the state of the location service
|
111
158
|
#
|
@@ -116,6 +163,7 @@ module Appium
|
|
116
163
|
# @driver.toggle_location_services
|
117
164
|
#
|
118
165
|
|
166
|
+
# @deprecated Use 'mobile: getConnectivity' extension instead.
|
119
167
|
# @!method toggle_airplane_mode
|
120
168
|
# Toggle flight mode on or off
|
121
169
|
#
|
@@ -124,6 +172,7 @@ module Appium
|
|
124
172
|
# @driver.toggle_airplane_mode
|
125
173
|
#
|
126
174
|
|
175
|
+
# @deprecated Use 'mobile: hideKeyboard' extension instead.
|
127
176
|
# @!method hide_keyboard(close_key = nil, strategy = nil)
|
128
177
|
# Hide the onscreen keyboard
|
129
178
|
# @param [String] close_key The name of the key which closes the keyboard.
|
@@ -139,12 +188,7 @@ module Appium
|
|
139
188
|
# @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
|
140
189
|
#
|
141
190
|
|
142
|
-
#
|
143
|
-
# Android only; Ends the test coverage and writes the results to the given path on device.
|
144
|
-
# @param [String] path Path on the device to write too.
|
145
|
-
# @param [String] intent Intent to broadcast when ending coverage.
|
146
|
-
#
|
147
|
-
|
191
|
+
# @deprecated Use 'mobile: startActivity' extension instead.
|
148
192
|
# @!method start_activity(opts)
|
149
193
|
# Android only. Start a new activity within the current app or launch a new app and start the target activity.
|
150
194
|
#
|
@@ -169,6 +213,7 @@ module Appium
|
|
169
213
|
# app_activity: '.accessibility.AccessibilityNodeProviderActivity'
|
170
214
|
#
|
171
215
|
|
216
|
+
# @deprecated Use 'mobile: setConnectivity' extension instead.
|
172
217
|
# @!method set_network_connection(mode)
|
173
218
|
# Set the device network connection mode
|
174
219
|
# Same as +#network_connection_type+ in selenium-webdriver.
|
@@ -191,6 +236,7 @@ module Appium
|
|
191
236
|
# @driver.network_connection_type = :airplane_mode # As selenium-webdriver
|
192
237
|
#
|
193
238
|
|
239
|
+
# @deprecated Use 'mobile: getPerformanceDataTypes' extension instead.
|
194
240
|
# @!method get_performance_data_types
|
195
241
|
# Get the information type of the system state which is supported to read such as
|
196
242
|
# cpu, memory, network, battery via adb commands.
|
@@ -201,6 +247,7 @@ module Appium
|
|
201
247
|
# @driver.get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
|
202
248
|
#
|
203
249
|
|
250
|
+
# @deprecated Use 'mobile: getPerformanceData' extension instead.
|
204
251
|
# @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
|
205
252
|
# Get the resource usage information of the application.
|
206
253
|
# https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
|
@@ -280,6 +327,7 @@ module Appium
|
|
280
327
|
# @driver.set_clipboard(content: 'happy testing') #=> {"protocol"=>"W3C"}
|
281
328
|
#
|
282
329
|
|
330
|
+
# @deprecated Use 'mobile: fingerprint' extension instead.
|
283
331
|
# @!method finger_print(finger_id)
|
284
332
|
# Authenticate users by using their finger print scans on supported emulators.
|
285
333
|
#
|
@@ -290,18 +338,22 @@ module Appium
|
|
290
338
|
# @driver.finger_print 1
|
291
339
|
#
|
292
340
|
|
293
|
-
# @!method execute_cdp(cmd, params)
|
341
|
+
# @!method execute_cdp(cmd, **params)
|
294
342
|
# Execute Chrome Devtools protocol commands
|
295
343
|
# https://chromedevtools.github.io/devtools-protocol
|
296
344
|
#
|
297
345
|
# @param [String] cmd The name of command
|
298
|
-
# @
|
346
|
+
# @option params The parameter for the command as keyword options.
|
299
347
|
#
|
300
348
|
# @example
|
301
349
|
#
|
302
|
-
# @driver.execute_cdp 'Page.captureScreenshot',
|
350
|
+
# @driver.execute_cdp 'Page.captureScreenshot', quality: 50, format: 'jpeg'
|
303
351
|
# @driver.execute_cdp 'Page.getResourceTree'
|
304
352
|
#
|
353
|
+
# # for Ruby 2,7 and 3+ compatibility
|
354
|
+
# params = {'timezoneId': 'Asia/Tokyo'}
|
355
|
+
# driver.execute_cdp 'Emulation.setTimezoneOverride', **params
|
356
|
+
#
|
305
357
|
|
306
358
|
####
|
307
359
|
## class << self
|
@@ -315,42 +367,56 @@ module Appium
|
|
315
367
|
|
316
368
|
::Appium::Core::Device.add_endpoint_method(:open_notifications) do
|
317
369
|
def open_notifications
|
370
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: openNotifications' extension instead"
|
371
|
+
|
318
372
|
execute :open_notifications
|
319
373
|
end
|
320
374
|
end
|
321
375
|
|
322
376
|
::Appium::Core::Device.add_endpoint_method(:current_activity) do
|
323
377
|
def current_activity
|
378
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentActivity' extension instead"
|
379
|
+
|
324
380
|
execute :current_activity
|
325
381
|
end
|
326
382
|
end
|
327
383
|
|
328
384
|
::Appium::Core::Device.add_endpoint_method(:current_package) do
|
329
385
|
def current_package
|
386
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentPackage' extension instead"
|
387
|
+
|
330
388
|
execute :current_package
|
331
389
|
end
|
332
390
|
end
|
333
391
|
|
334
392
|
::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
|
335
393
|
def get_system_bars
|
394
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
|
395
|
+
|
336
396
|
execute :get_system_bars
|
337
397
|
end
|
338
398
|
end
|
339
399
|
# as alias to get_system_bars
|
340
400
|
::Appium::Core::Device.add_endpoint_method(:system_bars) do
|
341
401
|
def system_bars
|
402
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
|
403
|
+
|
342
404
|
execute :get_system_bars
|
343
405
|
end
|
344
406
|
end
|
345
407
|
|
346
408
|
::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
|
347
409
|
def toggle_location_services
|
410
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: toggleGps' extension instead"
|
411
|
+
|
348
412
|
execute :toggle_location_services
|
349
413
|
end
|
350
414
|
end
|
351
415
|
|
352
416
|
::Appium::Core::Device.add_endpoint_method(:start_activity) do
|
353
417
|
def start_activity(opts)
|
418
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: startActivity' extension instead"
|
419
|
+
|
354
420
|
raise 'opts must be a hash' unless opts.is_a? Hash
|
355
421
|
|
356
422
|
option = {}
|
@@ -388,6 +454,8 @@ module Appium
|
|
388
454
|
# Android, Override included method in bridge
|
389
455
|
::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
|
390
456
|
def hide_keyboard(close_key = nil, strategy = nil)
|
457
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: hideKeyboard' extension instead"
|
458
|
+
|
391
459
|
option = {}
|
392
460
|
|
393
461
|
option[:key] = close_key if close_key
|
@@ -400,14 +468,9 @@ module Appium
|
|
400
468
|
# Android, Override included method in bridge
|
401
469
|
::Appium::Core::Device.add_endpoint_method(:background_app) do
|
402
470
|
def background_app(duration = 0)
|
403
|
-
|
404
|
-
end
|
405
|
-
end
|
471
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: backgroundApp' extension instead"
|
406
472
|
|
407
|
-
|
408
|
-
::Appium::Core::Device.add_endpoint_method(:end_coverage) do
|
409
|
-
def end_coverage(path, intent)
|
410
|
-
execute :end_coverage, {}, path: path, intent: intent
|
473
|
+
execute :background_app, {}, seconds: duration
|
411
474
|
end
|
412
475
|
end
|
413
476
|
|
@@ -415,7 +478,7 @@ module Appium
|
|
415
478
|
# SeleniumWebdriver could already define this method
|
416
479
|
return if method_defined? :execute_cdp
|
417
480
|
|
418
|
-
def execute_cdp(cmd, params
|
481
|
+
def execute_cdp(cmd, **params)
|
419
482
|
execute :chrome_send_command, {}, { cmd: cmd, params: params }
|
420
483
|
end
|
421
484
|
end
|