appium_lib_core 4.1.0 → 7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +286 -271
- data/README.md +65 -15
- data/Rakefile +5 -22
- data/appium_lib_core.gemspec +5 -8
- 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 +82 -4
- data/lib/appium_lib_core/common/base/bridge.rb +321 -90
- data/lib/appium_lib_core/common/base/capabilities.rb +8 -9
- data/lib/appium_lib_core/common/base/device_ime.rb +49 -0
- data/lib/appium_lib_core/common/base/driver.rb +272 -192
- 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 +15 -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 +20 -6
- data/lib/appium_lib_core/common/base.rb +1 -3
- data/lib/appium_lib_core/common/command.rb +260 -4
- data/lib/appium_lib_core/common/device/app_management.rb +8 -14
- data/lib/appium_lib_core/common/device/context.rb +1 -1
- 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/{command/mjsonwp.rb → device/orientation.rb} +14 -11
- data/lib/appium_lib_core/common/device/touch_actions.rb +2 -0
- data/lib/appium_lib_core/common/device/value.rb +6 -8
- data/lib/appium_lib_core/common/error.rb +4 -5
- data/lib/appium_lib_core/common/log.rb +4 -1
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +19 -0
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +16 -2
- data/lib/appium_lib_core/common/wait.rb +38 -6
- data/lib/appium_lib_core/device.rb +1 -5
- data/lib/appium_lib_core/driver.rb +182 -148
- data/lib/appium_lib_core/{patch.rb → element.rb} +75 -9
- 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/windows/device/app_management.rb +38 -0
- data/lib/appium_lib_core/windows/device.rb +2 -0
- data/lib/appium_lib_core.rb +21 -10
- metadata +31 -86
- 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/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.2', '< 4.18'
|
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.
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.19.0'
|
33
|
+
spec.add_development_dependency 'rubocop', '1.60.1'
|
35
34
|
spec.add_development_dependency 'appium_thor', '~> 1.0'
|
36
|
-
spec.add_development_dependency 'pry'
|
37
|
-
spec.add_development_dependency 'pry-byebug'
|
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,14 @@ module Appium
|
|
139
188
|
# @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
|
140
189
|
#
|
141
190
|
|
191
|
+
# @deprecated The method no longer exists. This method will be removed.
|
142
192
|
# @!method end_coverage(path, intent)
|
143
193
|
# Android only; Ends the test coverage and writes the results to the given path on device.
|
144
194
|
# @param [String] path Path on the device to write too.
|
145
195
|
# @param [String] intent Intent to broadcast when ending coverage.
|
146
196
|
#
|
147
197
|
|
198
|
+
# @deprecated Use 'mobile: startActivity' extension instead.
|
148
199
|
# @!method start_activity(opts)
|
149
200
|
# Android only. Start a new activity within the current app or launch a new app and start the target activity.
|
150
201
|
#
|
@@ -169,6 +220,7 @@ module Appium
|
|
169
220
|
# app_activity: '.accessibility.AccessibilityNodeProviderActivity'
|
170
221
|
#
|
171
222
|
|
223
|
+
# @deprecated Use 'mobile: setConnectivity' extension instead.
|
172
224
|
# @!method set_network_connection(mode)
|
173
225
|
# Set the device network connection mode
|
174
226
|
# Same as +#network_connection_type+ in selenium-webdriver.
|
@@ -191,6 +243,7 @@ module Appium
|
|
191
243
|
# @driver.network_connection_type = :airplane_mode # As selenium-webdriver
|
192
244
|
#
|
193
245
|
|
246
|
+
# @deprecated Use 'mobile: getPerformanceDataTypes' extension instead.
|
194
247
|
# @!method get_performance_data_types
|
195
248
|
# Get the information type of the system state which is supported to read such as
|
196
249
|
# cpu, memory, network, battery via adb commands.
|
@@ -201,6 +254,7 @@ module Appium
|
|
201
254
|
# @driver.get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
|
202
255
|
#
|
203
256
|
|
257
|
+
# @deprecated Use 'mobile: getPerformanceData' extension instead.
|
204
258
|
# @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
|
205
259
|
# Get the resource usage information of the application.
|
206
260
|
# https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
|
@@ -280,6 +334,7 @@ module Appium
|
|
280
334
|
# @driver.set_clipboard(content: 'happy testing') #=> {"protocol"=>"W3C"}
|
281
335
|
#
|
282
336
|
|
337
|
+
# @deprecated Use 'mobile: fingerprint' extension instead.
|
283
338
|
# @!method finger_print(finger_id)
|
284
339
|
# Authenticate users by using their finger print scans on supported emulators.
|
285
340
|
#
|
@@ -290,18 +345,22 @@ module Appium
|
|
290
345
|
# @driver.finger_print 1
|
291
346
|
#
|
292
347
|
|
293
|
-
# @!method execute_cdp(cmd, params)
|
348
|
+
# @!method execute_cdp(cmd, **params)
|
294
349
|
# Execute Chrome Devtools protocol commands
|
295
350
|
# https://chromedevtools.github.io/devtools-protocol
|
296
351
|
#
|
297
352
|
# @param [String] cmd The name of command
|
298
|
-
# @
|
353
|
+
# @option params The parameter for the command as keyword options.
|
299
354
|
#
|
300
355
|
# @example
|
301
356
|
#
|
302
|
-
# @driver.execute_cdp 'Page.captureScreenshot',
|
357
|
+
# @driver.execute_cdp 'Page.captureScreenshot', quality: 50, format: 'jpeg'
|
303
358
|
# @driver.execute_cdp 'Page.getResourceTree'
|
304
359
|
#
|
360
|
+
# # for Ruby 2,7 and 3+ compatibility
|
361
|
+
# params = {'timezoneId': 'Asia/Tokyo'}
|
362
|
+
# driver.execute_cdp 'Emulation.setTimezoneOverride', **params
|
363
|
+
#
|
305
364
|
|
306
365
|
####
|
307
366
|
## class << self
|
@@ -315,42 +374,56 @@ module Appium
|
|
315
374
|
|
316
375
|
::Appium::Core::Device.add_endpoint_method(:open_notifications) do
|
317
376
|
def open_notifications
|
377
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: openNotifications' extension instead"
|
378
|
+
|
318
379
|
execute :open_notifications
|
319
380
|
end
|
320
381
|
end
|
321
382
|
|
322
383
|
::Appium::Core::Device.add_endpoint_method(:current_activity) do
|
323
384
|
def current_activity
|
385
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentActivity' extension instead"
|
386
|
+
|
324
387
|
execute :current_activity
|
325
388
|
end
|
326
389
|
end
|
327
390
|
|
328
391
|
::Appium::Core::Device.add_endpoint_method(:current_package) do
|
329
392
|
def current_package
|
393
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentPackage' extension instead"
|
394
|
+
|
330
395
|
execute :current_package
|
331
396
|
end
|
332
397
|
end
|
333
398
|
|
334
399
|
::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
|
335
400
|
def get_system_bars
|
401
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
|
402
|
+
|
336
403
|
execute :get_system_bars
|
337
404
|
end
|
338
405
|
end
|
339
406
|
# as alias to get_system_bars
|
340
407
|
::Appium::Core::Device.add_endpoint_method(:system_bars) do
|
341
408
|
def system_bars
|
409
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
|
410
|
+
|
342
411
|
execute :get_system_bars
|
343
412
|
end
|
344
413
|
end
|
345
414
|
|
346
415
|
::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
|
347
416
|
def toggle_location_services
|
417
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: toggleGps' extension instead"
|
418
|
+
|
348
419
|
execute :toggle_location_services
|
349
420
|
end
|
350
421
|
end
|
351
422
|
|
352
423
|
::Appium::Core::Device.add_endpoint_method(:start_activity) do
|
353
424
|
def start_activity(opts)
|
425
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: startActivity' extension instead"
|
426
|
+
|
354
427
|
raise 'opts must be a hash' unless opts.is_a? Hash
|
355
428
|
|
356
429
|
option = {}
|
@@ -388,6 +461,8 @@ module Appium
|
|
388
461
|
# Android, Override included method in bridge
|
389
462
|
::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
|
390
463
|
def hide_keyboard(close_key = nil, strategy = nil)
|
464
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: hideKeyboard' extension instead"
|
465
|
+
|
391
466
|
option = {}
|
392
467
|
|
393
468
|
option[:key] = close_key if close_key
|
@@ -400,6 +475,8 @@ module Appium
|
|
400
475
|
# Android, Override included method in bridge
|
401
476
|
::Appium::Core::Device.add_endpoint_method(:background_app) do
|
402
477
|
def background_app(duration = 0)
|
478
|
+
::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: backgroundApp' extension instead"
|
479
|
+
|
403
480
|
execute :background_app, {}, seconds: duration
|
404
481
|
end
|
405
482
|
end
|
@@ -407,6 +484,7 @@ module Appium
|
|
407
484
|
# TODO: TEST ME
|
408
485
|
::Appium::Core::Device.add_endpoint_method(:end_coverage) do
|
409
486
|
def end_coverage(path, intent)
|
487
|
+
::Appium::Logger.warn '[DEPRECATION] The method no longer exists. This method will be removed.'
|
410
488
|
execute :end_coverage, {}, path: path, intent: intent
|
411
489
|
end
|
412
490
|
end
|
@@ -415,7 +493,7 @@ module Appium
|
|
415
493
|
# SeleniumWebdriver could already define this method
|
416
494
|
return if method_defined? :execute_cdp
|
417
495
|
|
418
|
-
def execute_cdp(cmd, params
|
496
|
+
def execute_cdp(cmd, **params)
|
419
497
|
execute :chrome_send_command, {}, { cmd: cmd, params: params }
|
420
498
|
end
|
421
499
|
end
|