Module: Calabash::Cucumber::EnvironmentHelpers
- Includes:
- Logging
- Included in:
- Core, IOS7Operations
- 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?.
-
#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?.
-
#ipad? ⇒ Boolean
Is the device under test an iPad?.
-
#iphone? ⇒ Boolean
Is the device under test an iPhone?.
-
#iphone_4in? ⇒ Boolean
Does the device under test have 4in screen?.
-
#iphone_5? ⇒ Boolean
deprecated
Deprecated.
0.9.168 replaced with ‘iphone_4in?`
-
#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?.
-
#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?.
Methods included from Logging
#calabash_info, #calabash_warn
Instance Method Details
#default_device ⇒ Calabash::Cucumber::Device
Returns the default Device that is connected the current launcher.
52 53 54 55 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 52 def default_device l = Calabash::Cucumber::Launcher.launcher_if_used l && l.device end |
#device_family_iphone? ⇒ Boolean
Is the device under test an iPhone or iPod?
85 86 87 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 85 def device_family_iphone? iphone? or ipod? end |
#ios5? ⇒ Boolean
WARNING: The ‘OS` env variable has been deprecated and should never be set.
*WARNING: Setting the ‘OS` env variable will override the value returned by querying the device.
Is the device under test running iOS 5?
123 124 125 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 123 def ios5? _OS_ENV.eql?(_canonical_os_version(:ios5)) || _default_device_or_create().ios5? end |
#ios6? ⇒ Boolean
WARNING: The ‘OS` env variable has been deprecated and should never be set.
*WARNING: Setting the ‘OS` env variable will override the value returned by querying the device.
Is the device under test running iOS 6?
138 139 140 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 138 def ios6? _OS_ENV.eql?(_canonical_os_version(:ios6)) || _default_device_or_create().ios6? end |
#ios7? ⇒ Boolean
WARNING: The ‘OS` env variable has been deprecated and should never be set.
*WARNING: Setting the ‘OS` env variable will override the value returned by querying the device.
Is the device under test running iOS 7?
154 155 156 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 154 def ios7? _OS_ENV.eql?(_canonical_os_version(:ios7)) || _default_device_or_create().ios7? end |
#ios8? ⇒ Boolean
WARNING: The ‘OS` env variable has been deprecated and should never be set.
Is the device under test running iOS 8?
166 167 168 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 166 def ios8? _default_device_or_create.ios8? end |
#ipad? ⇒ Boolean
Is the device under test an iPad?
61 62 63 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 61 def ipad? _default_device_or_create().ipad? end |
#iphone? ⇒ Boolean
Is the device under test an iPhone?
69 70 71 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 69 def iphone? _default_device_or_create().iphone? end |
#iphone_4in? ⇒ Boolean
Does the device under test have 4in screen?
108 109 110 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 108 def iphone_4in? _default_device_or_create().iphone_4in? end |
#iphone_5? ⇒ Boolean
0.9.168 replaced with ‘iphone_4in?`
99 100 101 102 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 99 def iphone_5? _deprecated('0.9.168', "use 'iphone_4in?' instead", :warn) iphone_4in? end |
#iphone_app_emulated_on_ipad? ⇒ Boolean
Is the app that is being tested an iPhone app emulated on an iPad?
176 177 178 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 176 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?
77 78 79 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 77 def ipod? _default_device_or_create().ipod? end |
#simulator? ⇒ Boolean
Is the device under test a simulator?
93 94 95 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 93 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?
26 27 28 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 26 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?
38 39 40 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 38 def uia_not_available? not uia_available? end |
#xamarin_test_cloud? ⇒ Boolean
Are we running in the Xamarin Test Cloud?
45 46 47 |
# File 'lib/calabash-cucumber/environment_helpers.rb', line 45 def xamarin_test_cloud? ENV['XAMARIN_TEST_CLOUD'] == '1' end |