Module: Calabash::Cucumber::IPad
- Included in:
- Operations
- Defined in:
- lib/calabash-cucumber/ipad_1x_2x.rb
Overview
Contains methods for interacting with the iPad.
Instance Method Summary collapse
-
#ensure_ipad_emulation_1x(opts = {}) ⇒ void
Ensures that iPhone apps emulated on an iPad are displayed at ‘1X`.
-
#ensure_ipad_emulation_scale(scale, opts = {}) ⇒ void
Ensures that iPhone apps emulated on an iPad are displayed at scale.
Instance Method Details
#ensure_ipad_emulation_1x(opts = {}) ⇒ void
If this is not an iPhone app emulated on an iPad, then calling this method has no effect.
In order to use this method, you must allow Calabash to launch your app with instruments.
This method returns an undefined value.
Ensures that iPhone apps emulated on an iPad are displayed at ‘1X`.
Starting in iOS 7, iPhone apps emulated on the iPad always launch at 2x. calabash cannot currently interact with such apps in 2x mode (trust us, we’ve tried).
230 231 232 |
# File 'lib/calabash-cucumber/ipad_1x_2x.rb', line 230 def ensure_ipad_emulation_1x(opts={}) ensure_ipad_emulation_scale(:emulated_1x, opts) end |
#ensure_ipad_emulation_scale(scale, opts = {}) ⇒ void
It is recommended that clients call this ‘ensure_ipad_emulation_1x` instead of this method.
If this is not an iPhone app emulated on an iPad, then calling this method has no effect.
In order to use this method, you must allow Calabash to launch your app with instruments.
This method returns an undefined value.
Ensures that iPhone apps emulated on an iPad are displayed at scale.
Starting in iOS 7, iPhone apps emulated on the iPad always launch at 2x. calabash cannot currently interact with such apps in 2x mode (trust us, we’ve tried).
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/calabash-cucumber/ipad_1x_2x.rb', line 167 def ensure_ipad_emulation_scale(scale, opts={}) return unless iphone_app_emulated_on_ipad? unless uia_available? raise 'this function requires the app be launched with instruments' end allowed = [:emulated_1x, :emulated_2x] unless allowed.include?(scale) raise "'#{scale}' is not one of '#{allowed}' allowed args" end default_opts = {:lang_code => :en, :wait_after_touch => 0.4} merged_opts = default_opts.merge(opts) obj = Emulation.new(merged_opts[:lang_code]) actual_scale = obj.scale if actual_scale != scale obj. end sleep(merged_opts[:wait_after_touch]) end |