page-object 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +7 -1
- data/features/frames.feature +7 -1
- data/features/step_definitions/frames_steps.rb +7 -4
- data/features/support/env.rb +1 -1
- data/lib/page-object/accessors.rb +0 -8
- data/lib/page-object/platforms/selenium_webdriver/select_list.rb +1 -1
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +12 -10
- data/lib/page-object/platforms/watir_webdriver/select_list.rb +1 -1
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +0 -1
- metadata +2 -4
- data/spec/page-object/accessors_spec.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8826d6f078421cd039c214d90e20423cb348a223
|
4
|
+
data.tar.gz: c17ebadedafc8bd8ef1ad9f9cfc040378d341cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 914761fe9b6dcdc4db770bdc2b25e16f616fb9162635037539a8405f887695c4cb3c084c54d3447647a70872e17d1015482d842b1d14ad7ec05dcfb10421f218
|
7
|
+
data.tar.gz: 9a24a8127ba2f34183d77018ca89df9ccb7d0c7ed528fcee0040e8712060bbe6823387bdd3d2514d2fbde25e7b2f2c54867325d5898fc7ae829fe90fe4d63306
|
data/ChangeLog
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
=== Version 1.0.
|
1
|
+
=== Version 1.0.2 / 2014-7-21
|
2
|
+
* Enhancements
|
3
|
+
* Added support to use multiple identifiers when locating nested frames / iframes (Thanks Justin Ko)
|
4
|
+
* Fixes
|
5
|
+
* Reverted the method name check due to unintended consequences
|
6
|
+
|
7
|
+
=== Version 1.0.1 / 2014-7-19
|
2
8
|
* Enhancements
|
3
9
|
* Checks the name of generated methods to ensure they do not colide with existing page-object methods
|
4
10
|
* Removed old legacy css code and now delegate everything to Watir
|
data/features/frames.feature
CHANGED
@@ -11,11 +11,17 @@ Feature: Handling frames
|
|
11
11
|
#And I should be able to get the text fields text from frame 2 using "index"
|
12
12
|
|
13
13
|
@watir_only
|
14
|
-
Scenario: Accessing elements
|
14
|
+
Scenario: Accessing elements within the frame using Regexp
|
15
15
|
Given I am on the frame elements page
|
16
16
|
When I type "page-object" into the text field for frame 2 using "regex"
|
17
17
|
Then I should verify "page-object" is in the text field for frame 2 using "regex"
|
18
18
|
|
19
|
+
@watir_only
|
20
|
+
Scenario: Accessing elements within the frame using multiple identifiers
|
21
|
+
Given I am on the iframe elements page
|
22
|
+
When I type "page-object" into the text field for frame 2 using "multiple identifiers"
|
23
|
+
Then I should verify "page-object" is in the text field for frame 2 using "multiple identifiers"
|
24
|
+
|
19
25
|
Scenario: Switching between frames
|
20
26
|
Given I am on the frame elements page
|
21
27
|
When I type "page-object" into the text field for frame 2 using "id"
|
@@ -52,6 +52,9 @@ class IFramePage
|
|
52
52
|
text_field(:text_field_1_index, :name => 'senderElement', :frame => frame)
|
53
53
|
end
|
54
54
|
|
55
|
+
in_iframe(:class => 'iframe', :name => 'frame2') do |frame|
|
56
|
+
text_field(:text_field_2_multiple_identifiers, :name => 'recieverElement', :frame => frame)
|
57
|
+
end
|
55
58
|
end
|
56
59
|
|
57
60
|
|
@@ -66,11 +69,11 @@ Given /^I am on the iframe elements page$/ do
|
|
66
69
|
end
|
67
70
|
|
68
71
|
When /^I type "([^\"]*)" into the text field for frame 2 using "([^\"]*)"$/ do |text, arg_type|
|
69
|
-
@page.send "text_field_2_#{arg_type}=".to_sym, text
|
72
|
+
@page.send "text_field_2_#{arg_type.gsub(' ', '_')}=".to_sym, text
|
70
73
|
end
|
71
74
|
|
72
75
|
Then /^I should verify "([^\"]*)" is in the text field for frame 2 using "([^\"]*)"$/ do |text, arg_type|
|
73
|
-
result = @page.send "text_field_2_#{arg_type}".to_sym
|
76
|
+
result = @page.send "text_field_2_#{arg_type.gsub(' ', '_')}".to_sym
|
74
77
|
result.should == text
|
75
78
|
end
|
76
79
|
|
@@ -79,11 +82,11 @@ end
|
|
79
82
|
#end
|
80
83
|
|
81
84
|
When /^I type "([^\"]*)" into the text field from frame 1 using "([^\"]*)"$/ do |text, arg_type|
|
82
|
-
@page.send "text_field_1_#{arg_type}=".to_sym, text
|
85
|
+
@page.send "text_field_1_#{arg_type.gsub(' ', '_')}=".to_sym, text
|
83
86
|
end
|
84
87
|
|
85
88
|
Then /^I should verify "([^\"]*)" is in the text field for frame 1 using "([^\"]*)"$/ do |text, arg_type|
|
86
|
-
result = @page.send "text_field_1_#{arg_type}".to_sym
|
89
|
+
result = @page.send "text_field_1_#{arg_type.gsub(' ', '_')}".to_sym
|
87
90
|
result.should == text
|
88
91
|
end
|
89
92
|
|
data/features/support/env.rb
CHANGED
@@ -466,7 +466,6 @@ module PageObject
|
|
466
466
|
# * :name => Watir and Selenium
|
467
467
|
#
|
468
468
|
def radio_button_group(name, identifier)
|
469
|
-
check_name(name)
|
470
469
|
define_method("select_#{name}") do |value|
|
471
470
|
platform.radio_buttons_for(identifier.clone).each do |radio_elem|
|
472
471
|
if radio_elem.value == value
|
@@ -1171,7 +1170,6 @@ module PageObject
|
|
1171
1170
|
# @param optional block to be invoked when element method is called
|
1172
1171
|
#
|
1173
1172
|
def element(name, tag, identifier={:index => 0}, &block)
|
1174
|
-
check_name(name)
|
1175
1173
|
define_method("#{name}") do
|
1176
1174
|
self.send("#{name}_element").text
|
1177
1175
|
end
|
@@ -1205,7 +1203,6 @@ module PageObject
|
|
1205
1203
|
# @param optional block to be invoked when element method is called
|
1206
1204
|
#
|
1207
1205
|
def elements(name, tag, identifier={:index => 0}, &block)
|
1208
|
-
check_name(name)
|
1209
1206
|
define_method("#{name}_elements") do
|
1210
1207
|
return call_block(&block) if block_given?
|
1211
1208
|
platform.elements_for(tag, identifier.clone)
|
@@ -1246,7 +1243,6 @@ module PageObject
|
|
1246
1243
|
end
|
1247
1244
|
|
1248
1245
|
def standard_methods(name, identifier, method, &block)
|
1249
|
-
check_name(name)
|
1250
1246
|
define_method("#{name}_element") do
|
1251
1247
|
return call_block(&block) if block_given?
|
1252
1248
|
platform.send(method, identifier.clone)
|
@@ -1314,9 +1310,5 @@ module PageObject
|
|
1314
1310
|
end
|
1315
1311
|
end
|
1316
1312
|
end
|
1317
|
-
|
1318
|
-
def check_name(name)
|
1319
|
-
raise NameError, "Identifier '#{name}' conflicts with page-object method of the same name" if self.instance_methods.include? name
|
1320
|
-
end
|
1321
1313
|
end
|
1322
1314
|
end
|
@@ -974,24 +974,26 @@ module PageObject
|
|
974
974
|
identifier[:tag_name] = tag if identifier[:name]
|
975
975
|
identifier
|
976
976
|
end
|
977
|
-
|
977
|
+
|
978
978
|
def nested_frames(frame_identifiers)
|
979
979
|
return if frame_identifiers.nil?
|
980
980
|
frame_str = ''
|
981
981
|
frame_identifiers.each do |frame|
|
982
|
-
id = frame.values.first
|
983
982
|
type = frame.keys.first
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
983
|
+
identifier = frame.values.first.map do |key, value|
|
984
|
+
if value.is_a?(Regexp)
|
985
|
+
":#{key} => #{value.inspect}"
|
986
|
+
elsif value.to_s.is_integer
|
987
|
+
":#{key} => #{value}"
|
988
|
+
else
|
989
|
+
":#{key} => '#{value}'"
|
990
|
+
end
|
991
|
+
end.join(', ')
|
992
|
+
frame_str += "#{type.to_s}(#{identifier})."
|
991
993
|
end
|
992
994
|
frame_str
|
993
995
|
end
|
994
|
-
|
996
|
+
|
995
997
|
def switch_to_default_content(frame_identifiers)
|
996
998
|
@browser.wd.switch_to.default_content unless frame_identifiers.nil?
|
997
999
|
end
|
data/lib/page-object/version.rb
CHANGED
data/lib/page-object/widgets.rb
CHANGED
@@ -30,7 +30,6 @@ module PageObject
|
|
30
30
|
def self.define_accessors(base, widget_tag, widget_class)
|
31
31
|
accessors_module = Module.new do
|
32
32
|
define_method widget_tag do |name, *identifier_args, &block|
|
33
|
-
check_name(name)
|
34
33
|
|
35
34
|
identifier = identifier_args.first
|
36
35
|
identifier = {:index => 0} if identifier.nil?
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
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-07-
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: watir-webdriver
|
@@ -330,7 +330,6 @@ files:
|
|
330
330
|
- lib/page-object/widgets.rb
|
331
331
|
- page-object.gemspec
|
332
332
|
- pageobject.gems
|
333
|
-
- spec/page-object/accessors_spec.rb
|
334
333
|
- spec/page-object/element_locators_spec.rb
|
335
334
|
- spec/page-object/elements/area_spec.rb
|
336
335
|
- spec/page-object/elements/button_spec.rb
|
@@ -519,7 +518,6 @@ test_files:
|
|
519
518
|
- features/text_field.feature
|
520
519
|
- features/unordered_list.feature
|
521
520
|
- features/video.feature
|
522
|
-
- spec/page-object/accessors_spec.rb
|
523
521
|
- spec/page-object/element_locators_spec.rb
|
524
522
|
- spec/page-object/elements/area_spec.rb
|
525
523
|
- spec/page-object/elements/button_spec.rb
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
include RSpec::Matchers
|
4
|
-
|
5
|
-
describe PageObject::Accessors do
|
6
|
-
context 'when declaring new elements on the page' do
|
7
|
-
|
8
|
-
it "should check the name when adding an element" do
|
9
|
-
class TestPage
|
10
|
-
include PageObject
|
11
|
-
|
12
|
-
def self.elements
|
13
|
-
[
|
14
|
-
'text_field',
|
15
|
-
'hidden_field',
|
16
|
-
'text_area',
|
17
|
-
'select_list',
|
18
|
-
'link',
|
19
|
-
'checkbox',
|
20
|
-
'radio_button',
|
21
|
-
'radio_button_group',
|
22
|
-
'button',
|
23
|
-
'div',
|
24
|
-
'span',
|
25
|
-
'table',
|
26
|
-
'cell',
|
27
|
-
'image',
|
28
|
-
'form',
|
29
|
-
'list_item',
|
30
|
-
'unordered_list',
|
31
|
-
'ordered_list',
|
32
|
-
'h1',
|
33
|
-
'h2',
|
34
|
-
'h3',
|
35
|
-
'h4',
|
36
|
-
'h5',
|
37
|
-
'h6',
|
38
|
-
'paragraph',
|
39
|
-
'file_field',
|
40
|
-
'label',
|
41
|
-
'area',
|
42
|
-
'canvas',
|
43
|
-
'audio',
|
44
|
-
'video',
|
45
|
-
'svg',
|
46
|
-
'address',
|
47
|
-
'figure'
|
48
|
-
]
|
49
|
-
end
|
50
|
-
|
51
|
-
elements.each do |ele|
|
52
|
-
expect {
|
53
|
-
self.send ele, :platform, :id => 'foo'
|
54
|
-
}.to raise_error(NameError, "Identifier \'platform\' conflicts with page-object method of the same name")
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|