testcentricity_web 0.8.1 → 0.8.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: 2100edbdb7c76973477b24ce275d367a891c2108
4
- data.tar.gz: 5ccc3816ad3410aee17fa7c951a121cedf203f8c
3
+ metadata.gz: e42ac93ef15779ceee1ea3c82e998a92e0dbf2d0
4
+ data.tar.gz: ad99dbd1f03c653cba860d51cf5707fbe8f02532
5
5
  SHA512:
6
- metadata.gz: 19137aed8261b00966dd2ea81325eb005ef7167d1086e837aab76d5e5d71d7c92a89990d2bf9eafb23c537784c165d667c5c0360c1fa5568159285c543f85036
7
- data.tar.gz: 2b3c95326197d5910f78ed5a2c1eeabdd26a68b1286d1ac3f393f92e0f439b9f84d3c9f01bccf0d42c99ed21427056e57f9bb2a1ff4e5482b7097593240b8362
6
+ metadata.gz: 228a1e59a8bf01d884bbf8dcc76e6471adea078244f55ec8cb2cd8a7c2996a700b8e66fdd2e6494f4b3dcde23a391d6bd59641ad849f01840df2c0ff48418b97
7
+ data.tar.gz: 107ddf980a20d340dc348863e122305e5ab6cbe49f53926f1ad35fc307a6afeb08a1203d1130fd811f6233dd0153e7ed1f4f59910ad2b75841a88eff279f5035
@@ -0,0 +1,80 @@
1
+ :iphone:
2
+ :css_width: 320
3
+ :css_height: 480
4
+ :default_orientation: portrait
5
+ :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
6
+ :iphone4:
7
+ :css_width: 320
8
+ :css_height: 480
9
+ :default_orientation: portrait
10
+ :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
11
+ :iphone5:
12
+ :css_width: 320
13
+ :css_height: 568
14
+ :default_orientation: portrait
15
+ :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
16
+ :iphone6:
17
+ :css_width: 375
18
+ :css_height: 667
19
+ :default_orientation: portrait
20
+ :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
21
+ :iphone6_plus:
22
+ :css_width: 414
23
+ :css_height: 736
24
+ :default_orientation: portrait
25
+ :user_agent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
26
+ :android_phone:
27
+ :css_width: 320
28
+ :css_height: 480
29
+ :default_orientation: portrait
30
+ :user_agent: "Mozilla/5.0 (Linux; U; Android 4.0.1; en-us; sdk Build/ICS_MR0) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"
31
+ :windows_phone8:
32
+ :css_width: 320
33
+ :css_height: 480
34
+ :default_orientation: portrait
35
+ :user_agent: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)"
36
+ :windows_phone7:
37
+ :css_width: 320
38
+ :css_height: 480
39
+ :default_orientation: portrait
40
+ :user_agent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)"
41
+ :ipad:
42
+ :css_width: 1024
43
+ :css_height: 768
44
+ :default_orientation: landscape
45
+ :user_agent: "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/3B143 Safari/601.1"
46
+ :ipad_pro:
47
+ :css_width: 1366
48
+ :css_height: 1024
49
+ :default_orientation: landscape
50
+ :user_agent: "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1"
51
+ :android_tablet:
52
+ :css_width: 1024
53
+ :css_height: 768
54
+ :default_orientation: landscape
55
+ :user_agent: "Mozilla/5.0 (Linux; U; Android 3.0; en-us; GT-P7100 Build/HRI83) AppleWebkit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13"
56
+ :kindle_fire:
57
+ :css_width: 1024
58
+ :css_height: 600
59
+ :default_orientation: landscape
60
+ :user_agent: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.141.16-Gen4_11004310) AppleWebkit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true"
61
+ :kindle_firehd7:
62
+ :css_width: 800
63
+ :css_height: 480
64
+ :default_orientation: landscape
65
+ :user_agent: "Mozilla/5.0 (Linux; U; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true"
66
+ :kindle_firehd8:
67
+ :css_width: 1280
68
+ :css_height: 800
69
+ :default_orientation: landscape
70
+ :user_agent: "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true"
71
+ :surface:
72
+ :css_width: 1366
73
+ :css_height: 768
74
+ :default_orientation: landscape
75
+ :user_agent: "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0; Touch)"
76
+ :blackberry_playbook:
77
+ :css_width: 1024
78
+ :css_height: 600
79
+ :default_orientation: landscape
80
+ :user_agent: "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+"
@@ -1,3 +1,6 @@
1
+ require 'yaml'
2
+
3
+
1
4
  module TestCentricity
2
5
  module Browsers
3
6
  include Capybara::DSL
@@ -81,21 +84,20 @@ module TestCentricity
81
84
  end
82
85
 
83
86
  def self.mobile_device_agent(device)
84
- key = device.gsub(/\s+/, "").downcase.to_sym
85
- devices = device_agents
86
- agent_string = devices[key]
87
+ device_name = device.gsub(/\s+/, "").downcase.to_sym
88
+ device = get_devices[device_name]
89
+ agent_string = device[:user_agent]
87
90
  raise "Device '#{device}' is not defined" unless agent_string
88
91
  agent_string
89
92
  end
90
93
 
91
94
  def self.browser_size(browser, orientation)
92
- key = browser.gsub(/\s+/, "").downcase.to_sym
93
- sizes = device_sizes
94
- browser_data = sizes[key]
95
- if browser_data
96
- width = browser_data[0]
97
- height = browser_data[1]
98
- default_orientation = browser_data[2]
95
+ device_name = browser.gsub(/\s+/, "").downcase.to_sym
96
+ device = get_devices[device_name]
97
+ if device
98
+ width = device[:css_width]
99
+ height = device[:css_height]
100
+ default_orientation = device[:default_orientation]
99
101
  if orientation
100
102
  (orientation.downcase.to_sym == default_orientation) ?
101
103
  size = [width, height] :
@@ -111,47 +113,8 @@ module TestCentricity
111
113
 
112
114
  private
113
115
 
114
- def self.device_agents
115
- devices = { :iphone => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
116
- :iphone4 => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
117
- :iphone5 => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
118
- :iphone6 => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
119
- :iphone6_plus => "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
120
- :ipad => "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/3B143 Safari/601.1",
121
- :ipad_pro => "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1",
122
- :android_phone => "Mozilla/5.0 (Linux; U; Android 4.0.1; en-us; sdk Build/ICS_MR0) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
123
- :android_tablet => "Mozilla/5.0 (Linux; U; Android 3.0; en-us; GT-P7100 Build/HRI83) AppleWebkit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
124
- :kindle_fire => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.141.16-Gen4_11004310) AppleWebkit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true",
125
- :kindle_firehd7 => "Mozilla/5.0 (Linux; U; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",
126
- :kindle_firehd8 => "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",
127
- :windows_phone10 => "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0",
128
- :windows_phone8 => "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
129
- :windows_phone7 => "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)",
130
- :surface => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0; Touch)",
131
- :blackberry_playbook => "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+"
132
- }
133
- devices
134
- end
135
-
136
- def self.device_sizes
137
- sizes = { :iphone => [320, 480, :portrait],
138
- :iphone4 => [320, 480, :portrait],
139
- :iphone5 => [320, 568, :portrait],
140
- :iphone6 => [375, 667, :portrait],
141
- :iphone6_plus => [414, 736, :portrait],
142
- :android_phone => [320, 480, :portrait],
143
- :windows_phone8 => [320, 480, :portrait],
144
- :windows_phone7 => [320, 480, :portrait],
145
- :ipad => [1024, 768, :landscape],
146
- :ipad_pro => [1366, 1024, :landscape],
147
- :android_tablet => [1024, 768, :landscape],
148
- :kindle_fire => [1024, 600, :landscape],
149
- :kindle_firehd7 => [800, 480, :landscape],
150
- :kindle_firehd8 => [1280, 800, :landscape],
151
- :surface => [1366, 768, :landscape],
152
- :blackberry_playbook => [1024, 600, :landscape]
153
- }
154
- sizes
116
+ def self.get_devices
117
+ YAML.load_file File.expand_path("../../devices/devices.yml", __FILE__)
155
118
  end
156
119
  end
157
120
  end
@@ -19,19 +19,19 @@ module TestCentricity
19
19
  object_not_found_exception(obj, nil)
20
20
  obj.native.attribute('complete')
21
21
  end
22
- end
23
22
 
24
- # Wait until the image is fully loaded, or until the specified wait time has expired.
25
- #
26
- # @param seconds [Integer or Float] wait time in seconds
27
- # @example
28
- # company_logo_image.wait_until_loaded(5)
29
- #
30
- def wait_until_loaded(seconds = nil)
31
- timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
32
- wait = Selenium::WebDriver::Wait.new(timeout: timeout)
33
- wait.until { is_loaded? }
34
- rescue
35
- raise "Image #{@locator} failed to load within #{timeout} seconds" unless is_loaded?
23
+ # Wait until the image is fully loaded, or until the specified wait time has expired.
24
+ #
25
+ # @param seconds [Integer or Float] wait time in seconds
26
+ # @example
27
+ # company_logo_image.wait_until_loaded(5)
28
+ #
29
+ def wait_until_loaded(seconds = nil)
30
+ timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
31
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
32
+ wait.until { is_loaded? }
33
+ rescue
34
+ raise "Image #{@locator} failed to load within #{timeout} seconds" unless is_loaded?
35
+ end
36
36
  end
37
37
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -166,6 +166,7 @@ files:
166
166
  - LICENSE.txt
167
167
  - README.md
168
168
  - Rakefile
169
+ - lib/devices/devices.yml
169
170
  - lib/testcentricity_web.rb
170
171
  - lib/testcentricity_web/browser_helper.rb
171
172
  - lib/testcentricity_web/data_objects_helper.rb