page-object 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b60613a20247f2e26ec7fe5df521f0622035c18
4
- data.tar.gz: bc07cf9b7590f3077227ed25750494c527b36892
3
+ metadata.gz: b4427749437df9f9b92f059425594d069c769766
4
+ data.tar.gz: 4da711511069744d4412b5c68fc1ad531144eb22
5
5
  SHA512:
6
- metadata.gz: c150363a5db1f94851f6b680de80b2f2b2fac5172071ce799b18f2ed1c01280c2ff83837026abf21f1ce31efcb7ebe7a776e1cf49b70f4a54e6bba4a5330d36b
7
- data.tar.gz: 2871e1bbe2d0a64441bc722fc45db5e72175e685f691642c04024193b20b0cc9e614aebae9f68becd11048d2e8966fc75471d617909e7b8d8a71525e4a324f5a
6
+ metadata.gz: c1cb457f915d76893f24078e0f28f329a428c85df32c2e4b8161504fa53366d24fce799a6c5e104670c8d3864dda6813a94b8a6eb23de10186fa7eb17441582e
7
+ data.tar.gz: 6501e40f5db81abc012c9cea21dbc274a8118fe453150ff5f716a026baae9754180ba8222a541c678dd900403923eb31376608ee615dbdeef7e5ad5fcc323c12
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ === Version 0.9.6 / 2014-2-4
2
+ * Enhancements
3
+ * Updated to use the latest watir-webdriver 0.6.7
4
+ * Fixes
5
+ * Added in_iframe methods to match the updates to the watir-webdriver gem.
6
+
1
7
  === Version 0.9.5 / 2014-1-22
2
8
  * Enhancements
3
9
  * Updated to use the latest selenium-webdriver 2.39.0
@@ -28,13 +28,40 @@ class FramePage
28
28
 
29
29
  end
30
30
 
31
+ class IFramePage
32
+ include PageObject
33
+
34
+ in_iframe(:id => 'frame_two_2') do |frame|
35
+ text_field(:text_field_2_id, :name => 'recieverElement', :frame => frame)
36
+ end
37
+ in_iframe(:id => 'frame_one_1') do |frame|
38
+ text_field(:text_field_1_id, :name => 'senderElement', :frame => frame)
39
+ end
40
+
41
+ in_iframe(:name => 'frame2') do |frame|
42
+ text_field(:text_field_2_name, :name => 'recieverElement', :frame => frame)
43
+ end
44
+ in_iframe(:name => 'frame1') do |frame|
45
+ text_field(:text_field_1_name, :name => 'senderElement', :frame => frame)
46
+ end
47
+
48
+ in_iframe(:index => 1) do |frame|
49
+ text_field(:text_field_2_index, :name => 'recieverElement', :frame => frame)
50
+ end
51
+ in_iframe(:index => 0) do |frame|
52
+ text_field(:text_field_1_index, :name => 'senderElement', :frame => frame)
53
+ end
54
+
55
+ end
56
+
57
+
31
58
  Given /^I am on the frame elements page$/ do
32
59
  @page = FramePage.new(@browser)
33
60
  @page.navigate_to(UrlHelper.frame_elements)
34
61
  end
35
62
 
36
63
  Given /^I am on the iframe elements page$/ do
37
- @page = FramePage.new(@browser)
64
+ @page = IFramePage.new(@browser)
38
65
  @page.navigate_to(UrlHelper.iframe_elements)
39
66
  end
40
67
 
@@ -64,7 +91,7 @@ class NestedFramePage
64
91
  include PageObject
65
92
 
66
93
  in_frame(:id => 'two') do |frame|
67
- in_frame({:id => 'three'}, frame) do |nested_frame|
94
+ in_iframe({:id => 'three'}, frame) do |nested_frame|
68
95
  link(:nested_link, :id => 'four', :frame => nested_frame)
69
96
  end
70
97
  end
@@ -133,7 +133,7 @@ module PageObject
133
133
  end
134
134
 
135
135
  #
136
- # Identify an element as existing within a frame or iframe. A frame parameter
136
+ # Identify an element as existing within a frame . A frame parameter
137
137
  # is passed to the block and must be passed to the other calls to PageObject.
138
138
  # You can nest calls to in_frame by passing the frame to the next level.
139
139
  #
@@ -152,7 +152,31 @@ module PageObject
152
152
  #
153
153
  def in_frame(identifier, frame=nil, &block)
154
154
  frame = [] if frame.nil?
155
- frame << identifier
155
+ frame << {frame: identifier}
156
+ block.call(frame)
157
+ end
158
+
159
+ #
160
+ # Identify an element as existing within an iframe. A frame parameter
161
+ # is passed to the block and must be passed to the other calls to PageObject.
162
+ # You can nest calls to in_frame by passing the frame to the next level.
163
+ #
164
+ # @example
165
+ # in_iframe(:id => 'frame_id') do |frame|
166
+ # text_field(:first_name, :id => 'fname', :frame => frame)
167
+ # end
168
+ #
169
+ # @param [Hash] identifier how we find the frame. The valid keys are:
170
+ # * :id => Watir and Selenium
171
+ # * :index => Watir and Selenium
172
+ # * :name => Watir and Selenium
173
+ # * :regexp => Watir only
174
+ # @param frame passed from a previous call to in_iframe. Used to nest calls
175
+ # @param block that contains the calls to elements that exist inside the iframe.
176
+ #
177
+ def in_iframe(identifier, frame=nil, &block)
178
+ frame = [] if frame.nil?
179
+ frame << {iframe: identifier}
156
180
  block.call(frame)
157
181
  end
158
182
 
@@ -147,7 +147,17 @@ module PageObject
147
147
  # See PageObject#in_frame
148
148
  #
149
149
  def in_frame(identifier, frame=nil, &block)
150
- switch_to_frame([identifier])
150
+ switch_to_frame([frame: identifier])
151
+ block.call(nil)
152
+ @browser.switch_to.default_content
153
+ end
154
+
155
+ #
156
+ # platform method to switch to an iframe and execute a block
157
+ # See PageObject#in_frame
158
+ #
159
+ def in_iframe(identifier, frame=nil, &block)
160
+ switch_to_frame([iframe: identifier])
151
161
  block.call(nil)
152
162
  @browser.switch_to.default_content
153
163
  end
@@ -1088,7 +1098,8 @@ module PageObject
1088
1098
 
1089
1099
  def switch_to_frame(frame_identifiers)
1090
1100
  unless frame_identifiers.nil?
1091
- frame_identifiers.each do |frame_id|
1101
+ frame_identifiers.each do |frame|
1102
+ frame_id = frame.values.first
1092
1103
  value = frame_id.values.first
1093
1104
  @browser.switch_to.frame(value)
1094
1105
  end
@@ -141,7 +141,17 @@ module PageObject
141
141
  #
142
142
  def in_frame(identifier, frame=nil, &block)
143
143
  frame = [] if frame.nil?
144
- frame << identifier
144
+ frame << {frame: identifier}
145
+ block.call(frame)
146
+ end
147
+
148
+ #
149
+ # platform method to switch to an iframe and execute a block
150
+ # See PageObject#in_frame
151
+ #
152
+ def in_iframe(identifier, frame=nil, &block)
153
+ frame = [] if frame.nil?
154
+ frame << {iframe: identifier}
145
155
  block.call(frame)
146
156
  end
147
157
 
@@ -994,13 +1004,15 @@ module PageObject
994
1004
  def nested_frames(frame_identifiers)
995
1005
  return if frame_identifiers.nil?
996
1006
  frame_str = ''
997
- frame_identifiers.each do |id|
1007
+ frame_identifiers.each do |frame|
1008
+ id = frame.values.first
1009
+ type = frame.keys.first
998
1010
  value = id.values.first
999
1011
  if value.is_a?(Regexp)
1000
- frame_str += "frame(:#{id.keys.first} => #{value.inspect})."
1012
+ frame_str += "#{type.to_s}(:#{id.keys.first} => #{value.inspect})."
1001
1013
  else
1002
- frame_str += "frame(:#{id.keys.first} => #{value})." if value.to_s.is_integer
1003
- frame_str += "frame(:#{id.keys.first} => '#{value}')." unless value.to_s.is_integer
1014
+ frame_str += "#{type.to_s}(:#{id.keys.first} => #{value})." if value.to_s.is_integer
1015
+ frame_str += "#{type.to_s}(:#{id.keys.first} => '#{value}')." unless value.to_s.is_integer
1004
1016
  end
1005
1017
  end
1006
1018
  frame_str
@@ -1028,7 +1040,8 @@ module PageObject
1028
1040
 
1029
1041
  def switch_to_frame(frame_identifiers)
1030
1042
  unless frame_identifiers.nil?
1031
- frame_identifiers.each do |frame_id|
1043
+ frame_identifiers.each do |frame|
1044
+ frame_id = frame.values.first
1032
1045
  value = frame_id.values.first
1033
1046
  @browser.wd.switch_to.frame(value)
1034
1047
  end
@@ -1,4 +1,4 @@
1
1
  module PageObject
2
2
  # @private
3
- VERSION = "0.9.5"
3
+ VERSION = "0.9.6"
4
4
  end
data/page-object.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_dependency 'watir-webdriver', '>= 0.6.4'
23
+ s.add_dependency 'watir-webdriver', '>= 0.6.7'
24
24
  s.add_dependency 'selenium-webdriver', '>= 2.39.0'
25
25
  s.add_dependency 'page_navigation', '>= 0.9'
26
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-23 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.4
19
+ version: 0.6.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.4
26
+ version: 0.6.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement