calios-uia-extension 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afb1d699cf345ff257d2858ca30e6f85aa22e9db
4
- data.tar.gz: 4e536b0bcd50176ec4b907feedab7b93f883b4fe
3
+ metadata.gz: d17f56356ce1ac86135ead194db42cdfed0d6dfc
4
+ data.tar.gz: b76208114389cf1509579985032e308ed3f1cff4
5
5
  SHA512:
6
- metadata.gz: e8fb8157b9eb74196f881f62bd9c11be7cefc350a3415d0d2b244b98abd843d694be773fc04f1a17ff156512f28ebd4765a286bb179c22b1585fb37edf2fe4d7
7
- data.tar.gz: ad4093621889c7464d5def8a1e85dd54ac70f40c0a95b8a3692d2aea44489678f44755fb6c7b43e740878a4c357e3e2ad0b93b35fa6a3b017c5b7ad85c168e6d
6
+ metadata.gz: 5e8cf3a2aadd5572ecaa0fd4180f8ecfefbb03f031c30e615d179955c03e2c4915261405a167ee0a8171a311809c2474b68be0396e4a4e2560f995cc4359975f
7
+ data.tar.gz: 0a3c8a0ed86b9b99380bbc2f743063e74d78fbf57fd0f412e401200b09f3ef420ca9786272edff969585022fedaf142c2984ba20232dc6b6c600809e193f28a8
@@ -7,3 +7,4 @@ require 'calios-uia-extension/version'
7
7
  require 'calios-uia-extension/uia_base'
8
8
  require 'calios-uia-extension/uia_alert'
9
9
  require 'calios-uia-extension/uia_popover'
10
+ require 'calios-uia-extension/uia_target'
@@ -0,0 +1,26 @@
1
+ require_relative 'uia_base'
2
+
3
+ # Use these constant values when setting device orientation
4
+ UIA_DEVICE_ORIENTATION_UNKNOWN = 0
5
+ UIA_DEVICE_ORIENTATION_PORTRAIT = 1
6
+ UIA_DEVICE_ORIENTATION_PORTRAIT_UPSIDEDOWN = 2
7
+ UIA_DEVICE_ORIENTATION_LANDSCAPELEFT = 3
8
+ UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT = 4
9
+ UIA_DEVICE_ORIENTATION_FACEUP = 5
10
+ UIA_DEVICE_ORIENTATION_FACEDOWN = 6
11
+ # Not defined in UIAutomation API reference. This is just a shorthand.
12
+ UIA_DEVICE_ORIENTATION_LANDSCAPE = UIA_DEVICE_ORIENTATION_LANDSCAPELEFT
13
+
14
+ class UIATarget < UIABase
15
+ class << self
16
+ def set_device_orientation(aOrientation)
17
+ res = execute("target.setDeviceOrientation(#{aOrientation})")
18
+ response(res)
19
+ end
20
+
21
+ def device_orientation
22
+ res = execute('target.deviceOrientation()')
23
+ response(res)
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module CaliosUIAExtension
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,72 @@
1
+ require_relative 'spec_helper'
2
+
3
+ class SpecUIATarget < Minitest::Spec
4
+ before do
5
+ $uia_command = nil
6
+ $uia_opts = nil
7
+ end
8
+
9
+ after do
10
+ # nop
11
+ end
12
+
13
+ describe 'UIATarget' do
14
+ describe 'UIATarget.set_device_orientation' do
15
+ it 'should call Calabash uia command with correct parameters and return correct response' do
16
+ $stub_uia_response =
17
+ {
18
+ 'status' => 'success',
19
+ 'value' => false,
20
+ 'index' => 4
21
+ }
22
+
23
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_UNKNOWN)
24
+ $uia_command.must_equal('target.setDeviceOrientation(0)')
25
+ res.must_equal(false)
26
+
27
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_PORTRAIT)
28
+ $uia_command.must_equal('target.setDeviceOrientation(1)')
29
+ res.must_equal(false)
30
+
31
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_PORTRAIT_UPSIDEDOWN)
32
+ $uia_command.must_equal('target.setDeviceOrientation(2)')
33
+ res.must_equal(false)
34
+
35
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_LANDSCAPELEFT)
36
+ $uia_command.must_equal('target.setDeviceOrientation(3)')
37
+ res.must_equal(false)
38
+
39
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT)
40
+ $uia_command.must_equal('target.setDeviceOrientation(4)')
41
+ res.must_equal(false)
42
+
43
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_FACEUP)
44
+ $uia_command.must_equal('target.setDeviceOrientation(5)')
45
+ res.must_equal(false)
46
+
47
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_FACEDOWN)
48
+ $uia_command.must_equal('target.setDeviceOrientation(6)')
49
+ res.must_equal(false)
50
+
51
+ res = UIATarget.set_device_orientation(UIA_DEVICE_ORIENTATION_LANDSCAPE)
52
+ $uia_command.must_equal('target.setDeviceOrientation(3)')
53
+ res.must_equal(false)
54
+ end
55
+ end
56
+
57
+ describe 'UIATarget.device_orientation' do
58
+ it 'should call Calabash uia command with correct parameters and return correct response' do
59
+ $stub_uia_response =
60
+ {
61
+ 'status' => 'success',
62
+ 'value' => 3,
63
+ 'index' => 5
64
+ }
65
+
66
+ res = UIATarget.device_orientation
67
+ $uia_command.must_equal('target.deviceOrientation()')
68
+ res.must_equal(3)
69
+ end
70
+ end
71
+ end
72
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calios-uia-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jani Jegoroff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-21 00:00:00.000000000 Z
11
+ date: 2014-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: calabash-cucumber
@@ -92,11 +92,13 @@ files:
92
92
  - lib/calios-uia-extension/uia_alert.rb
93
93
  - lib/calios-uia-extension/uia_base.rb
94
94
  - lib/calios-uia-extension/uia_popover.rb
95
+ - lib/calios-uia-extension/uia_target.rb
95
96
  - lib/calios-uia-extension/version.rb
96
97
  - spec/spec_helper.rb
97
98
  - spec/spec_uia_alert.rb
98
99
  - spec/spec_uia_base.rb
99
100
  - spec/spec_uia_popover.rb
101
+ - spec/spec_uia_target.rb
100
102
  - spec/stubs/calabash_cucumber_core_stub.rb
101
103
  - spec/stubs/calabash_cucumber_uia_stub.rb
102
104
  homepage: http://github.com/JaniJegoroff/calios-uia-extension
@@ -128,5 +130,6 @@ test_files:
128
130
  - spec/spec_uia_alert.rb
129
131
  - spec/spec_uia_base.rb
130
132
  - spec/spec_uia_popover.rb
133
+ - spec/spec_uia_target.rb
131
134
  - spec/stubs/calabash_cucumber_core_stub.rb
132
135
  - spec/stubs/calabash_cucumber_uia_stub.rb