Module: Calabash::Cucumber::EnvironmentHelpers
- Included in:
- Core
- Defined in:
- lib/calabash-cucumber/environment_helpers.rb
Overview
The ‘OS` environmental variable has been deprecated. It should never be set.
Methods to expose the runtime environment and details about the device under test.
Instance Method Summary collapse
-
#default_device ⇒ Calabash::Cucumber::Device
Returns the default Device that is connected the current launcher.
-
#device_family_iphone? ⇒ Boolean
Is the device under test an iPhone or iPod?.
-
#ios10? ⇒ Boolean
Is the device under test running iOS 10?.
-
#ios11? ⇒ Boolean
Is the device under test running iOS 11?.
-
#ios5? ⇒ Boolean
Is the device under test running iOS 5?.
-
#ios6? ⇒ Boolean
Is the device under test running iOS 6?.
-
#ios7? ⇒ Boolean
Is the device under test running iOS 7?.
-
#ios8? ⇒ Boolean
Is the device under test running iOS 8?.
-
#ios9? ⇒ Boolean
Is the device under test running iOS 9?.
-
#ios_gte_11? ⇒ Boolean
Is the device under test running iOS 11 or greater?.
-
#ios_version ⇒ RunLoop::Version
The iOS version on the device under test.
-
#ipad? ⇒ Boolean
Is the device under test an iPad?.
-
#ipad_pro? ⇒ Boolean
Is the device under test an iPad Pro.
-
#iphone? ⇒ Boolean
Is the device under test an iPhone?.
-
#iphone_35in? ⇒ Boolean
Is the device under test an iPhone 3.5in?.
-
#iphone_4in? ⇒ Boolean
Is the device under test have a 4 inch screen?.
-
#iphone_6? ⇒ Boolean
Is the device under test an iPhone 6.
-
#iphone_6_plus? ⇒ Boolean
Is the device under test an iPhone 6+?.
-
#iphone_app_emulated_on_ipad? ⇒ Boolean
Is the app that is being tested an iPhone app emulated on an iPad?.
-
#ipod? ⇒ Boolean
Is the device under test an iPod?.
-
#screen_dimensions ⇒ RunLoop::Version
The screen dimensions of the device under test.
-
#simulator? ⇒ Boolean
Is the device under test a simulator?.
-
#uia_available? ⇒ Boolean
Are the uia* methods available?.
-
#uia_not_available? ⇒ Boolean
Are the uia* methods un-available?.
-
#xamarin_test_cloud? ⇒ Boolean
Are we running in the Xamarin Test Cloud?.
Instance Method Details
#default_device ⇒ Calabash::Cucumber::Device
Returns the default Device that is connected the current launcher.
48 49 50 51 52 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 48 def default_device require "calabash-cucumber/launcher" l = Calabash::Cucumber::Launcher.launcher_if_used l && l.device end |
#device_family_iphone? ⇒ Boolean
Is the device under test an iPhone or iPod?
90 91 92 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 90 def device_family_iphone? iphone? or ipod? end |
#ios10? ⇒ Boolean
Is the device under test running iOS 10?
199 200 201 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 199 def ios10? _default_device_or_create.ios10? end |
#ios11? ⇒ Boolean
Is the device under test running iOS 11?
207 208 209 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 207 def ios11? _default_device_or_create.ios11? end |
#ios5? ⇒ Boolean
Is the device under test running iOS 5?
159 160 161 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 159 def ios5? _default_device_or_create.ios5? end |
#ios6? ⇒ Boolean
Is the device under test running iOS 6?
167 168 169 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 167 def ios6? _default_device_or_create.ios6? end |
#ios7? ⇒ Boolean
Is the device under test running iOS 7?
175 176 177 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 175 def ios7? _default_device_or_create.ios7? end |
#ios8? ⇒ Boolean
Is the device under test running iOS 8?
183 184 185 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 183 def ios8? _default_device_or_create.ios8? end |
#ios9? ⇒ Boolean
Is the device under test running iOS 9?
191 192 193 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 191 def ios9? _default_device_or_create.ios9? end |
#ios_gte_11? ⇒ Boolean
Is the device under test running iOS 11 or greater?
215 216 217 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 215 def ios_gte_11? _default_device_or_create.ios_gte_11? end |
#ios_version ⇒ RunLoop::Version
The iOS version on the device under test.
135 136 137 138 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 135 def ios_version require "run_loop/version" RunLoop::Version.new(_default_device_or_create.ios_version) end |
#ipad? ⇒ Boolean
Is the device under test an iPad?
58 59 60 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 58 def ipad? _default_device_or_create.ipad? end |
#ipad_pro? ⇒ Boolean
Is the device under test an iPad Pro
82 83 84 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 82 def ipad_pro? _default_device_or_create.ipad_pro? end |
#iphone? ⇒ Boolean
Is the device under test an iPhone?
66 67 68 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 66 def iphone? _default_device_or_create.iphone? end |
#iphone_35in? ⇒ Boolean
Is the device under test an iPhone 3.5in?
127 128 129 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 127 def iphone_35in? _default_device_or_create.iphone_35in? end |
#iphone_4in? ⇒ Boolean
Is the device under test have a 4 inch screen?
106 107 108 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 106 def iphone_4in? _default_device_or_create.iphone_4in? end |
#iphone_6? ⇒ Boolean
Is the device under test an iPhone 6.
113 114 115 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 113 def iphone_6? _default_device_or_create.iphone_6? end |
#iphone_6_plus? ⇒ Boolean
Is the device under test an iPhone 6+?
120 121 122 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 120 def iphone_6_plus? _default_device_or_create.iphone_6_plus? end |
#iphone_app_emulated_on_ipad? ⇒ Boolean
Is the app that is being tested an iPhone app emulated on an iPad?
225 226 227 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 225 def iphone_app_emulated_on_ipad? _default_device_or_create.iphone_app_emulated_on_ipad? end |
#ipod? ⇒ Boolean
Is the device under test an iPod?
74 75 76 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 74 def ipod? _default_device_or_create.ipod? end |
#screen_dimensions ⇒ RunLoop::Version
The screen dimensions of the device under test.
This is a hash of form:
{
:sample => 1,
:height => 1334,
:width => 750,
:scale" => 2
}
151 152 153 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 151 def screen_dimensions _default_device_or_create.screen_dimensions end |
#simulator? ⇒ Boolean
Is the device under test a simulator?
98 99 100 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 98 def simulator? _default_device_or_create.simulator? end |
#uia_available? ⇒ Boolean
UIAutomation is only available if the app has been launched with instruments.
Are the uia* methods available?
22 23 24 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 22 def uia_available? Calabash::Cucumber::Launcher.instruments? end |
#uia_not_available? ⇒ Boolean
UIAutomation is only available if the app has been launched with instruments.
Are the uia* methods un-available?
34 35 36 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 34 def uia_not_available? not uia_available? end |
#xamarin_test_cloud? ⇒ Boolean
Are we running in the Xamarin Test Cloud?
41 42 43 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 41 def xamarin_test_cloud? ENV['XAMARIN_TEST_CLOUD'] == '1' end |