page-object 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/Guardfile +2 -2
- data/cucumber.yml +2 -2
- data/features/frames.feature +6 -0
- data/features/html/frames.html +3 -3
- data/features/html/iframes.html +3 -3
- data/features/javascript.feature +10 -0
- data/features/step_definitions/frames_steps.rb +12 -7
- data/features/step_definitions/javascript_steps.rb +10 -1
- data/lib/page-object.rb +8 -2
- data/lib/page-object/accessors.rb +1 -0
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +2 -2
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +8 -4
- data/lib/page-object/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbb1492aa820c4b4bd9cd23ca1411705ceb1f6de
|
4
|
+
data.tar.gz: 41135828618efb81087f3da5bf7e8ac3f9bad78f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f9c8de327b1647a9ddc4e90f6bf104da0188d9ec1797b06a4bb011e459874dedb9be24893f9cfe24ccdd294e7105c1126b125cb9a3e86eca06019307321827f
|
7
|
+
data.tar.gz: cad31706a84243504cb2431885f9aa34e04fd9c5c7579cd6849194d018d5b17900f415087f9c985152d1d6d910247de98dbef4068a24dd49d72c62d0c5c210e2
|
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== Version 0.9.4 / 2013-11-29
|
2
|
+
* Enhancements
|
3
|
+
* Added ability for execute_scripts to accept arguments (Thanks Justin Ko)
|
4
|
+
* Added ability to identify frame using a regular expression when using Watir
|
5
|
+
|
1
6
|
=== Version 0.9.3 / 2013-10-24
|
2
7
|
* Enhancements
|
3
8
|
* Added class_name method to Element
|
data/Guardfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
4
|
|
5
|
-
guard
|
5
|
+
guard :rspec, cmd: 'rspec --color --format Fuubar' do
|
6
6
|
watch(%r{^spec/.+_spec\.rb$})
|
7
7
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
8
8
|
watch(%r{^lib/page-object/platforms/(.+)/.+\.rb$}) do |m|
|
@@ -11,7 +11,7 @@ guard 'rspec', :cli => '--color --format Fuubar' do
|
|
11
11
|
watch('spec/spec_helper.rb') { "spec" }
|
12
12
|
end
|
13
13
|
|
14
|
-
guard 'cucumber', :
|
14
|
+
guard 'cucumber', notification: true, all_after_pass: false, cli: '--profile focus' do
|
15
15
|
watch(%r{^features/.+\.feature$})
|
16
16
|
watch(%r{^features/support/.+$}) { "features" }
|
17
17
|
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
data/cucumber.yml
CHANGED
@@ -5,6 +5,6 @@ std_opts = "--no-source --color --format pretty" # Cucumber::Formatter::Fuubar"
|
|
5
5
|
default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
|
6
6
|
watir_webdriver: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
|
7
7
|
selenium_webdriver: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
|
8
|
-
focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
|
9
|
-
|
8
|
+
#focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
|
9
|
+
focus: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus
|
10
10
|
|
data/features/frames.feature
CHANGED
@@ -10,6 +10,12 @@ Feature: Handling frames
|
|
10
10
|
Then I should verify "page-object" is in the text field for frame 2 using "index"
|
11
11
|
#And I should be able to get the text fields text from frame 2 using "index"
|
12
12
|
|
13
|
+
@watir_only
|
14
|
+
Scenario: Accessing elements withing the frame using Regexp
|
15
|
+
Given I am on the frame elements page
|
16
|
+
When I type "page-object" into the text field for frame 2 using "regex"
|
17
|
+
Then I should verify "page-object" is in the text field for frame 2 using "regex"
|
18
|
+
|
13
19
|
Scenario: Switching between frames
|
14
20
|
Given I am on the frame elements page
|
15
21
|
When I type "page-object" into the text field for frame 2 using "id"
|
data/features/html/frames.html
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
</head>
|
7
7
|
<frameset cols="40%, 40%, 20%">
|
8
|
-
<frame src="frame_1.html" id="
|
9
|
-
<frame src="frame_2.html" id="
|
10
|
-
<frame src="frame_3.html" id="
|
8
|
+
<frame src="frame_1.html" id="frame_one_1" name="frame1"/>
|
9
|
+
<frame src="frame_2.html" id="frame_two_2" name="frame2"/>
|
10
|
+
<frame src="frame_3.html" id="frame_three_3" name="frame3"/>
|
11
11
|
</frameset>
|
12
12
|
</html>
|
data/features/html/iframes.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
</head>
|
7
7
|
<body>
|
8
8
|
<h1>Iframes</h1>
|
9
|
-
<iframe src="frame_1.html" id="
|
10
|
-
<iframe src="frame_2.html" id="
|
9
|
+
<iframe src="frame_1.html" id="frame_one_1" name="frame1" class="iframe"></iframe>
|
10
|
+
<iframe src="frame_2.html" id="frame_two_2" name="frame2" class="iframe"></iframe>
|
11
11
|
</body>
|
12
|
-
</html>
|
12
|
+
</html>
|
data/features/javascript.feature
CHANGED
@@ -16,3 +16,13 @@ Feature: Handling javascript events
|
|
16
16
|
Given I am on the static elements page
|
17
17
|
Given I execute the javascript "return 2 + 2;"
|
18
18
|
Then I should get the answer "4"
|
19
|
+
|
20
|
+
Scenario: Executing javascript in the browser with value argument
|
21
|
+
Given I am on the static elements page
|
22
|
+
Given I execute the javascript "return 2 + Number(arguments[0]);" with an argument of "2"
|
23
|
+
Then I should get the answer "4"
|
24
|
+
|
25
|
+
Scenario: Executing javascript in the browser with element argument
|
26
|
+
Given I am on the static elements page
|
27
|
+
Given I execute the javascript "arguments[0].value = 'abcDEF';" with a text field argument
|
28
|
+
Then the text field should contain "abcDEF"
|
@@ -8,10 +8,10 @@ class FramePage
|
|
8
8
|
text_field(:text_field_1_index, :name => 'senderElement', :frame => frame)
|
9
9
|
end
|
10
10
|
|
11
|
-
in_frame(:id => '
|
11
|
+
in_frame(:id => 'frame_two_2') do |frame|
|
12
12
|
text_field(:text_field_2_id, :name => 'recieverElement', :frame => frame)
|
13
13
|
end
|
14
|
-
in_frame(:id => '
|
14
|
+
in_frame(:id => 'frame_one_1') do |frame|
|
15
15
|
text_field(:text_field_1_id, :name => 'senderElement', :frame => frame)
|
16
16
|
end
|
17
17
|
|
@@ -21,6 +21,11 @@ class FramePage
|
|
21
21
|
in_frame(:name => 'frame1') do |frame|
|
22
22
|
text_field(:text_field_1_name, :name => 'senderElement', :frame => frame)
|
23
23
|
end
|
24
|
+
|
25
|
+
in_frame(:id => /frame_two_\d+/) do |frame|
|
26
|
+
text_field(:text_field_2_regex, :name => 'recieverElement', :frame => frame)
|
27
|
+
end
|
28
|
+
|
24
29
|
end
|
25
30
|
|
26
31
|
Given /^I am on the frame elements page$/ do
|
@@ -76,19 +81,19 @@ Then /^I should be able to click the link in the frame$/ do
|
|
76
81
|
end
|
77
82
|
|
78
83
|
When /^I type "([^\"]*)" into the text field from frame 1 identified dynamically$/ do |value|
|
79
|
-
@page.in_frame(:id => '
|
84
|
+
@page.in_frame(:id => 'frame_one_1') do |frame|
|
80
85
|
@page.text_field_element(:name => 'senderElement', :frame => frame).value = value
|
81
86
|
end
|
82
87
|
end
|
83
88
|
|
84
89
|
Then /^I should verify "([^\"]*)" in the text field for frame 1 identified dynamically$/ do |value|
|
85
|
-
@page.in_frame(:id => '
|
90
|
+
@page.in_frame(:id => 'frame_one_1') do |frame|
|
86
91
|
@page.text_field_element(:name => 'senderElement', :frame => frame).value.should == value
|
87
92
|
end
|
88
93
|
end
|
89
94
|
|
90
95
|
When /^I trigger an alert within a frame$/ do
|
91
|
-
@page.in_frame(:id => '
|
96
|
+
@page.in_frame(:id => 'frame_three_3') do |frame|
|
92
97
|
@msg = @page.alert(frame) do
|
93
98
|
@page.button_element(:id => 'alert_button', :frame => frame).click
|
94
99
|
end
|
@@ -96,7 +101,7 @@ When /^I trigger an alert within a frame$/ do
|
|
96
101
|
end
|
97
102
|
|
98
103
|
When /^I trigger a confirm within a frame$/ do
|
99
|
-
@page.in_frame(:id => '
|
104
|
+
@page.in_frame(:id => 'frame_three_3') do |frame|
|
100
105
|
@msg = @page.confirm(true, frame) do
|
101
106
|
@page.button_element(:id => 'confirm_button', :frame => frame).click
|
102
107
|
end
|
@@ -104,7 +109,7 @@ When /^I trigger a confirm within a frame$/ do
|
|
104
109
|
end
|
105
110
|
|
106
111
|
When /^I trigger a prompt within a frame$/ do
|
107
|
-
@page.in_frame(:id => '
|
112
|
+
@page.in_frame(:id => 'frame_three_3') do |frame|
|
108
113
|
@msg = @page.prompt("Cheezy", frame) do
|
109
114
|
@page.button_element(:id => 'prompt_button', :frame => frame).click
|
110
115
|
end
|
@@ -39,6 +39,15 @@ Given /^I execute the javascript "([^\"]*)"$/ do |script|
|
|
39
39
|
@answer = @page.execute_script script
|
40
40
|
end
|
41
41
|
|
42
|
+
Given /^I execute the javascript "([^\"]*)" with an argument of "([^\"]*)"$/ do |script, arg|
|
43
|
+
@answer = @page.execute_script script, arg
|
44
|
+
end
|
45
|
+
|
46
|
+
Given /^I execute the javascript "([^\"]*)" with a text field argument$/ do |script|
|
47
|
+
text_field = @page.text_field_element(:id => 'text_field_id')
|
48
|
+
@page.execute_script(script, text_field)
|
49
|
+
end
|
50
|
+
|
42
51
|
Then /^I should get the answer "([^\"]*)"$/ do |answer|
|
43
52
|
@answer.should == answer.to_i
|
44
|
-
end
|
53
|
+
end
|
data/lib/page-object.rb
CHANGED
@@ -249,8 +249,14 @@ module PageObject
|
|
249
249
|
#
|
250
250
|
# Execute javascript on the browser
|
251
251
|
#
|
252
|
-
|
253
|
-
|
252
|
+
# @example Get inner HTML of element
|
253
|
+
# span = @page.span_element
|
254
|
+
# @page.execute_script "return arguments[0].innerHTML", span
|
255
|
+
# #=> "Span innerHTML"
|
256
|
+
#
|
257
|
+
def execute_script(script, *args)
|
258
|
+
args.map! { |e| e.kind_of?(PageObject::Elements::Element) ? e.element : e }
|
259
|
+
platform.execute_script(script, *args)
|
254
260
|
end
|
255
261
|
|
256
262
|
#
|
@@ -146,6 +146,7 @@ module PageObject
|
|
146
146
|
# * :id => Watir and Selenium
|
147
147
|
# * :index => Watir and Selenium
|
148
148
|
# * :name => Watir and Selenium
|
149
|
+
# * :regexp => Watir only
|
149
150
|
# @param frame passed from a previous call to in_frame. Used to nest calls
|
150
151
|
# @param block that contains the calls to elements that exist inside the frame.
|
151
152
|
#
|
@@ -111,8 +111,8 @@ module PageObject
|
|
111
111
|
# platform method to execute javascript on the browser
|
112
112
|
# See PageObject#execute_script
|
113
113
|
#
|
114
|
-
def execute_script(script)
|
115
|
-
@browser.execute_script
|
114
|
+
def execute_script(script, *args)
|
115
|
+
@browser.execute_script(script, *args)
|
116
116
|
end
|
117
117
|
|
118
118
|
#
|
@@ -115,8 +115,8 @@ module PageObject
|
|
115
115
|
# platform method to execute javascript on the browser
|
116
116
|
# See PageObject#execute_script
|
117
117
|
#
|
118
|
-
def execute_script(script)
|
119
|
-
@browser.execute_script(script)
|
118
|
+
def execute_script(script, *args)
|
119
|
+
@browser.execute_script(script, *args)
|
120
120
|
end
|
121
121
|
|
122
122
|
#
|
@@ -996,8 +996,12 @@ module PageObject
|
|
996
996
|
frame_str = ''
|
997
997
|
frame_identifiers.each do |id|
|
998
998
|
value = id.values.first
|
999
|
-
|
1000
|
-
|
999
|
+
if value.is_a?(Regexp)
|
1000
|
+
frame_str += "frame(:#{id.keys.first} => #{value.inspect})."
|
1001
|
+
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
|
1004
|
+
end
|
1001
1005
|
end
|
1002
1006
|
frame_str
|
1003
1007
|
end
|
data/lib/page-object/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: watir-webdriver
|