Skip to content

Commit b91caf8

Browse files
authored
test: use newer app for testing and drop ios 13 and lower versions (#653)
* test: use the newer app for testing * add download_content * download content * use join * remove ios 13 and lower * remove old app file names as well * consider redirect as well up to 5 * remove comment * remove unnecessary comment * simplify with case and when * remove env var after the run * fix android path * add workaround to download with ssl for github actions * add rubocop workaround.. * fix rubocop * update test for the download * fix syntax * change the way to run tests * modify tests to reduce error
1 parent 2c24e87 commit b91caf8

37 files changed

+144
-192
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AllCops:
22
TargetRubyVersion: 3.1
33
Layout/LineLength:
4-
Max: 128
4+
Enabled: false
55
Layout/RescueEnsureAlignment:
66
Enabled: false
77
Layout/EmptyLinesAroundAttributeAccessor:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Run unit tests which check each method and command, URL, using the webmock.
3131

3232
```bash
3333
$ bundle install
34-
$ bundle exec parallel_test test/unit/
34+
$ UNIT_TEST=1 bundle exec parallel_test test/unit/
3535
```
3636

3737
or
3838

3939
```bash
4040
$ bundle install
41-
$ bundle exec rake test:unit
41+
$ UNIT_TEST=1 bundle exec rake test:unit
4242
```
4343

4444
### Functional Tests

Rakefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,27 @@ namespace :test do
3838
namespace :unit do
3939
desc('Run all iOS related unit tests in test directory')
4040
Rake::TestTask.new(:ios) do |t|
41-
ENV['UNIT_TEST'] = '1'
4241
t.libs << 'test'
4342
t.libs << 'lib'
4443
t.test_files = FileList['test/unit/ios/**/*_test.rb']
4544
end
4645

4746
desc('Run all Android related unit tests in test directory')
4847
Rake::TestTask.new(:android) do |t|
49-
ENV['UNIT_TEST'] = '1'
5048
t.libs << 'test'
5149
t.libs << 'lib'
5250
t.test_files = FileList['test/unit/android/**/*_test.rb']
5351
end
5452

5553
desc('Run all common related unit tests in test directory')
5654
Rake::TestTask.new(:common) do |t|
57-
ENV['UNIT_TEST'] = '1'
5855
t.libs << 'test'
5956
t.libs << 'lib'
6057
t.test_files = FileList['test/unit/common/**/*_test.rb']
6158
end
6259

6360
desc('Run all Windows related unit tests in test directory')
6461
Rake::TestTask.new(:windows) do |t|
65-
ENV['UNIT_TEST'] = '1'
6662
t.libs << 'test'
6763
t.libs << 'lib'
6864
t.test_files = FileList['test/unit/windows/**/*_test.rb']

lib/appium_lib_core/android/device.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ module Android
2424
module Device
2525
extend Forwardable
2626

27-
# rubocop:disable Layout/LineLength
28-
2927
# @!method open_notifications
3028
# Open Android notifications
3129
#
@@ -244,8 +242,6 @@ module Device
244242
## class << self
245243
####
246244

247-
# rubocop:enable Layout/LineLength
248-
249245
class << self
250246
def extended(_mod)
251247
::Appium::Core::Device.extend_webdriver_with_forwardable

lib/appium_lib_core/android/device/emulator.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def send_sms(phone_number:, message:)
121121

122122
::Appium::Core::Device.add_endpoint_method(:gsm_call) do
123123
def gsm_call(phone_number:, action:)
124-
unless GSM_CALL_ACTIONS.member? action.to_sym
125-
raise ::Appium::Core::Error::ArgumentError, "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}."
126-
end
124+
raise ::Appium::Core::Error::ArgumentError, "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}." unless GSM_CALL_ACTIONS.member? action.to_sym
127125

128126
execute_script 'mobile:gsmCall', { phoneNumber: phone_number, action: action }
129127
end
@@ -142,9 +140,7 @@ def gsm_signal(signal_strength)
142140

143141
::Appium::Core::Device.add_endpoint_method(:gsm_voice) do
144142
def gsm_voice(state)
145-
unless GSM_VOICE_STATES.member? state.to_sym
146-
raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{GSM_VOICE_STATES}. Not #{state}."
147-
end
143+
raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{GSM_VOICE_STATES}. Not #{state}." unless GSM_VOICE_STATES.member? state.to_sym
148144

149145
execute_script 'mobile:gsmVoice', { state: state }
150146
end
@@ -163,19 +159,15 @@ def set_network_speed(netspeed)
163159

164160
::Appium::Core::Device.add_endpoint_method(:set_power_capacity) do
165161
def set_power_capacity(percent)
166-
unless (0..100).member? percent
167-
::Appium::Logger.warn "The percent should be between 0 and 100. Not #{percent}."
168-
end
162+
::Appium::Logger.warn "The percent should be between 0 and 100. Not #{percent}." unless (0..100).member? percent
169163

170164
execute_script 'mobile:powerCapacity', { percent: percent }
171165
end
172166
end
173167

174168
::Appium::Core::Device.add_endpoint_method(:set_power_ac) do
175169
def set_power_ac(state)
176-
unless POWER_AC_STATE.member? state.to_sym
177-
raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{POWER_AC_STATE}. Not #{state}."
178-
end
170+
raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{POWER_AC_STATE}. Not #{state}." unless POWER_AC_STATE.member? state.to_sym
179171

180172
execute_script 'mobile:powerAc', { state: state }
181173
end

lib/appium_lib_core/android/device/screen.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT'
3939
option[:bitRate] = bit_rate unless bit_rate.nil?
4040

4141
unless bug_report.nil?
42-
unless [true, false].member?(bug_report)
43-
raise ::Appium::Core::Error::ArgumentError, 'bug_report should be true or false'
44-
end
42+
raise ::Appium::Core::Error::ArgumentError, 'bug_report should be true or false' unless [true, false].member?(bug_report)
4543

4644
option[:bugReport] = bug_report
4745
end

lib/appium_lib_core/common/base/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def attach_to(session_id, platform_name, automation_name)
9696
# caps: {
9797
# platformName: :ios,
9898
# automationName: 'XCUITest',
99-
# app: 'test/functional/app/UICatalog.app.zip',
99+
# app: 'test/functional/app/UIKitCatalog-iphonesimulator.zip',
100100
# platformVersion: '11.4',
101101
# deviceName: 'iPhone Simulator',
102102
# useNewWDA: true,

lib/appium_lib_core/common/base/driver.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ def update_sending_request_to(protocol:, host:, port:, path:)
196196
# @driver.test_action_command(e.id, 'action')
197197
#
198198
def add_command(method:, url:, name:, &block)
199-
unless AVAILABLE_METHODS.include? method
200-
raise ::Appium::Core::Error::ArgumentError, "Available method is either #{AVAILABLE_METHODS}"
201-
end
199+
raise ::Appium::Core::Error::ArgumentError, "Available method is either #{AVAILABLE_METHODS}" unless AVAILABLE_METHODS.include? method
202200

203201
@bridge.add_command method: method, url: url, name: name, &block
204202
end

lib/appium_lib_core/common/base/has_location.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def location
4040
# driver.location = ::Appium::Location.new(10, 10, 10)
4141
#
4242
def location=(location)
43-
unless location.is_a?(::Appium::Location)
44-
raise TypeError, "expected #{::Appium::Location}, got #{location.inspect}:#{location.class}"
45-
end
43+
raise TypeError, "expected #{::Appium::Location}, got #{location.inspect}:#{location.class}" unless location.is_a?(::Appium::Location)
4644

4745
@bridge.set_location location.latitude, location.longitude, location.altitude
4846
end

lib/appium_lib_core/common/base/rotable.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ module Rotatable
3535
#
3636
#
3737
def rotation=(orientation)
38-
unless ORIENTATIONS.include?(orientation)
39-
raise ::Appium::Core::Error::ArgumentError, "expected #{ORIENTATIONS.inspect}, got #{orientation.inspect}"
40-
end
38+
raise ::Appium::Core::Error::ArgumentError, "expected #{ORIENTATIONS.inspect}, got #{orientation.inspect}" unless ORIENTATIONS.include?(orientation)
4139

4240
bridge.screen_orientation = orientation.to_s.upcase
4341
end

0 commit comments

Comments
 (0)