selenium-cucumber 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/canned_steps.md +12 -0
- data/example/features/assertion_steps_Ex.feature +13 -5
- data/example/features/new.feature +17 -0
- data/example/features/screenshot_step_Ex.feature +5 -8
- data/example/test_page.html +8 -2
- data/lib/selenium-cucumber/assertion_steps.rb +8 -2
- data/lib/selenium-cucumber/methods/assertion_methods.rb +16 -1
- data/lib/selenium-cucumber/methods/navigate_methods.rb +19 -0
- data/lib/selenium-cucumber/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d724e0e3ee3efebe417033b395869a70825c43e
|
4
|
+
data.tar.gz: 495d6949f5db99ebc87562ae86ec07934b9c2cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7017731725dc4ef15e1f550aaa8c757eaf208922330e914e2d5758e4412091120f2346a1179421bb64ee4f4289927fd07f411e7101a6c9d8337032ae10e644ea
|
7
|
+
data.tar.gz: ea90be96b6aac6e26d62dce92b5cda714e664cdb2ce4ed9cd3d0dcb6d76a8e44ed65c67a0888e9fd7fad89b2018292d63324c7911117a6d007a423c28604d183
|
data/doc/canned_steps.md
CHANGED
@@ -82,12 +82,24 @@ To assert element text use any of the following steps :
|
|
82
82
|
Then element having class "([^\"]*)" should have text as "(.*?)"
|
83
83
|
Then element having xpath "([^\"]*)" should have text as "(.*?)"
|
84
84
|
Then element having css "([^\"]*)" should have text as "(.*?)"
|
85
|
+
|
86
|
+
Then element having id "([^\"]*)" should have partial text as "(.*?)"
|
87
|
+
Then element having name "([^\"]*)" should have partial text as "(.*?)"
|
88
|
+
Then element having class "([^\"]*)" should have partial text as "(.*?)"
|
89
|
+
Then element having xpath "([^\"]*)" should have partial text as "(.*?)"
|
90
|
+
Then element having css "([^\"]*)" should have partial text as "(.*?)"
|
85
91
|
|
86
92
|
Then element having id "([^\"]*)" should not have text as "(.*?)"
|
87
93
|
Then element having name "([^\"]*)" should not have text as "(.*?)"
|
88
94
|
Then element having class "([^\"]*)" should not have text as "(.*?)"
|
89
95
|
Then element having xpath "([^\"]*)" should not have text as "(.*?)"
|
90
96
|
Then element having css "([^\"]*)" should not have text as "(.*?)"
|
97
|
+
|
98
|
+
Then element having id "([^\"]*)" should not have partial text as "(.*?)"
|
99
|
+
Then element having name "([^\"]*)" should not have partial text as "(.*?)"
|
100
|
+
Then element having class "([^\"]*)" should not have partial text as "(.*?)"
|
101
|
+
Then element having xpath "([^\"]*)" should not have partial text as "(.*?)"
|
102
|
+
Then element having css "([^\"]*)" should not have partial text as "(.*?)"
|
91
103
|
|
92
104
|
#### Steps For Asserting Element Attribute
|
93
105
|
|
@@ -32,6 +32,18 @@ Feature: Assertion Steps
|
|
32
32
|
|
33
33
|
Then element having name "javascript_alert_msg" should not have text as "Click the button to display a confirm box."
|
34
34
|
|
35
|
+
Scenario: Partial text present
|
36
|
+
Then element having id "frm" should have partial text as "last"
|
37
|
+
|
38
|
+
Scenario: Partial text present - negative test
|
39
|
+
Then element having id "frm" should have partial text as "selenium"
|
40
|
+
|
41
|
+
Scenario: Partial text not present
|
42
|
+
Then element having id "frm" should not have partial text as "selenium"
|
43
|
+
|
44
|
+
Scenario: Partial text not present - negative test
|
45
|
+
Then element having id "frm" should not have partial text as "last"
|
46
|
+
|
35
47
|
Scenario: verify element accesibility
|
36
48
|
|
37
49
|
Then element having id "submit" should be enabled
|
@@ -134,8 +146,4 @@ Feature: Assertion Steps
|
|
134
146
|
Then actual image having url "http://s26.postimg.org/itpfqlcop/logo1.png" and expected image having image_name "logo-PNG.png" should be similar
|
135
147
|
|
136
148
|
Scenario: verify image by id and image_name - png image - negative test
|
137
|
-
Then actual image having id "img2_incorrect" and expected image having image_name "logo-PNG.png" should be similar
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
149
|
+
Then actual image having id "img2_incorrect" and expected image having image_name "logo-PNG.png" should be similar
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
Feature: click steps
|
3
|
+
As a user I should able to verify using assert steps
|
4
|
+
|
5
|
+
Scenario: Open test page
|
6
|
+
Given I open test page
|
7
|
+
|
8
|
+
Scenario: click on link
|
9
|
+
|
10
|
+
Then I click on link having text "video tutorials"
|
11
|
+
|
12
|
+
Scenario: click on link
|
13
|
+
|
14
|
+
Then I click on link having text "blog"
|
15
|
+
|
16
|
+
Scenario: switch to new window
|
17
|
+
Then I switch to new window
|
@@ -1,15 +1,12 @@
|
|
1
|
-
|
2
1
|
Feature: Screenshot Step
|
3
2
|
As a user I should able to take screenshot
|
4
|
-
|
3
|
+
|
5
4
|
Scenario: Open test page
|
6
|
-
|
7
|
-
Given I open test page
|
5
|
+
Given I open test page
|
8
6
|
|
9
7
|
Scenario: take screenshot
|
10
|
-
|
11
|
-
Then I take screenshot
|
8
|
+
Then I take screenshot
|
12
9
|
|
13
10
|
Scenario: close browser
|
14
|
-
|
15
|
-
|
11
|
+
Then I close browser
|
12
|
+
|
data/example/test_page.html
CHANGED
@@ -184,8 +184,14 @@
|
|
184
184
|
<legend>Links</legend>
|
185
185
|
<p>
|
186
186
|
<a href="https://rubygems.org/gems/selenium-cucumber">selenium-cucumber gem</a> <br>
|
187
|
-
|
188
|
-
<a href="https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md">Predefined-steps</a>
|
187
|
+
|
188
|
+
<a href="https://github.com/sameer49/selenium-cucumber/blob/master/doc/canned_steps.md">Predefined-steps</a><br>
|
189
|
+
|
190
|
+
<a href="http://seleniumcucumber.info/" onclick="window.open('http://seleniumcucumber.info/', 'newwindow', 'width=500, height=500'); return false;">selenium-cucumber website</a> <br>
|
191
|
+
|
192
|
+
<a href="http://seleniumcucumber.info/video-tutorials/" target="_blank">video tutorials</a> <br>
|
193
|
+
|
194
|
+
<a href="http://seleniumcucumber.info/blog/" target="_blank">blog</a> <br>
|
189
195
|
</p>
|
190
196
|
</fieldset>
|
191
197
|
|
@@ -11,6 +11,12 @@ Then(/^element having (.+) "([^\"]*)" should\s*((?:not)?)\s+have text as "(.*?)"
|
|
11
11
|
check_element_text(type, value, access_name, present.empty?)
|
12
12
|
end
|
13
13
|
|
14
|
+
# step to check element partial text
|
15
|
+
Then(/^element having (.+) "([^\"]*)" should\s*((?:not)?)\s+have partial text as "(.*?)"$/) do |type, access_name, present, value |
|
16
|
+
validate_locator type
|
17
|
+
check_element_partial_text(type, value, access_name, present.empty?)
|
18
|
+
end
|
19
|
+
|
14
20
|
# step to check attribute value
|
15
21
|
Then(/^element having (.+) "([^\"]*)" should\s*((?:not)?)\s+have attribute "(.*?)" with value "(.*?)"$/) do |type, access_name, present, attrb, value|
|
16
22
|
validate_locator type
|
@@ -53,11 +59,11 @@ Then(/^option "(.*?)" by (.+) from radio button group having (.+) "(.*?)" should
|
|
53
59
|
end
|
54
60
|
|
55
61
|
# steps to check link presence
|
56
|
-
Then(/^link having text "(.*?)" should\s*((?:not)?)\s+be present$/) do |
|
62
|
+
Then(/^link having text "(.*?)" should\s*((?:not)?)\s+be present$/) do |access_name, present|
|
57
63
|
check_element_presence('link', access_name, present.empty?)
|
58
64
|
end
|
59
65
|
|
60
|
-
Then(/^link having partial text "(.*?)" should\s*((?:not)?)\s+be present$/) do |
|
66
|
+
Then(/^link having partial text "(.*?)" should\s*((?:not)?)\s+be present$/) do |access_name, present|
|
61
67
|
check_element_presence('partial_link_text', access_name, present.empty?)
|
62
68
|
end
|
63
69
|
|
@@ -30,6 +30,21 @@ def check_element_text(access_type, actual_value, access_name, test_case)
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
# Method to check partial element text
|
34
|
+
def check_element_partial_text(access_type, actual_value, access_name, test_case)
|
35
|
+
element_text = get_element_text(access_type, access_name)
|
36
|
+
|
37
|
+
if test_case
|
38
|
+
if not element_text.include? "#{actual_value}"
|
39
|
+
raise TestCaseFailed, 'Text Not Matched'
|
40
|
+
end
|
41
|
+
else
|
42
|
+
if element_text.include? "#{actual_value}"
|
43
|
+
raise TestCaseFailed, 'Text Matched'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
33
48
|
# Method to return element status - enabled?
|
34
49
|
def is_element_enabled(access_type, access_name)
|
35
50
|
WAIT.until{ $driver.find_element(:"#{access_type}" => "#{access_name}") }.enabled?
|
@@ -84,7 +99,7 @@ def check_element_presence(access_type, access_name, test_case)
|
|
84
99
|
raise 'Present'
|
85
100
|
end
|
86
101
|
rescue Exception => e
|
87
|
-
if e.message == '
|
102
|
+
if e.message == 'Present'
|
88
103
|
raise TestCaseFailed, 'Element Present'
|
89
104
|
end
|
90
105
|
end
|
@@ -83,12 +83,31 @@ end
|
|
83
83
|
$old_win = nil
|
84
84
|
|
85
85
|
# Method to switch to new window
|
86
|
+
|
86
87
|
def switch_to_new_window
|
87
88
|
$old_win = $driver.window_handle
|
88
89
|
$driver.switch_to.window($driver.window_handles[1])
|
89
90
|
end
|
90
91
|
|
92
|
+
|
91
93
|
# Method to switch to old window
|
92
94
|
def switch_to_old_window
|
93
95
|
$driver.switch_to.window($old_win)
|
94
96
|
end
|
97
|
+
|
98
|
+
=begin
|
99
|
+
def switch_to_new_window
|
100
|
+
win_handles = $driver.window_handles
|
101
|
+
|
102
|
+
puts $driver.title
|
103
|
+
puts win_handles.length
|
104
|
+
|
105
|
+
$driver.switch_to.window($driver.window_handles[1])
|
106
|
+
puts $driver.window_handles[1]
|
107
|
+
puts $driver.title
|
108
|
+
|
109
|
+
$driver.switch_to.window($driver.window_handles[2])
|
110
|
+
puts $driver.window_handles[2]
|
111
|
+
puts $driver.title
|
112
|
+
end
|
113
|
+
=end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sameer Sawant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: |-
|
56
|
-
|
56
|
+
Behavior driven development (BDD) approach to write automation test script to test web applications.
|
57
57
|
It enables you to write and execute automated acceptance tests of web apps.
|
58
58
|
email: sameersawant1992@gmail.com
|
59
59
|
executables:
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- example/features/input_steps_Ex.feature
|
107
107
|
- example/features/javascript_steps_Ex.feature
|
108
108
|
- example/features/navigation_steps_Ex.feature
|
109
|
+
- example/features/new.feature
|
109
110
|
- example/features/progress_step_Ex.feature
|
110
111
|
- example/features/screenshots/test.png
|
111
112
|
- example/features/screenshot_step_Ex.feature
|
@@ -116,7 +117,7 @@ files:
|
|
116
117
|
- example/Gemfile.lock
|
117
118
|
- example/run_features.rb
|
118
119
|
- example/test_page.html
|
119
|
-
homepage: http://seleniumcucumber.
|
120
|
+
homepage: http://seleniumcucumber.info/
|
120
121
|
licenses:
|
121
122
|
- MIT
|
122
123
|
metadata: {}
|