test-factory 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/test-factory/page_factory.rb +35 -6
- data/test-factory.gemspec +1 -1
- metadata +2 -2
@@ -96,9 +96,17 @@ class PageFactory
|
|
96
96
|
# @example
|
97
97
|
# link("Click Me For Fun!") => Creates the methods #click_me_for_fun and #click_me_for_fun_link
|
98
98
|
#
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
# The last parameter in the method is optional. Use it when
|
100
|
+
# you need the method name to be different from the text of
|
101
|
+
# the link--for example if the link text changes and you don't
|
102
|
+
# want to have to go through all your data objects and step
|
103
|
+
# definitions to update them to the new method name.
|
104
|
+
#
|
105
|
+
# @example
|
106
|
+
# link("Click Me For Fun!", :click_me) => Creates the methods #click_me and #click_me_link
|
107
|
+
#
|
108
|
+
def link(link_text, *alias_name)
|
109
|
+
elementize(:link, link_text, *alias_name)
|
102
110
|
end
|
103
111
|
|
104
112
|
# Use this for buttons that are safe to define by their value attribute.
|
@@ -114,9 +122,17 @@ class PageFactory
|
|
114
122
|
# @example
|
115
123
|
# button("Click Me For Fun!") => Creates the methods #click_me_for_fun and #click_me_for_fun_button
|
116
124
|
#
|
117
|
-
|
118
|
-
|
119
|
-
|
125
|
+
# The last parameter in the method is optional. Use it when
|
126
|
+
# you need the method name to be different from the text of
|
127
|
+
# the button--for example if the button text changes and you don't
|
128
|
+
# want to have to go through all your data objects and step
|
129
|
+
# definitions to update them to the new method name.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# link("Click Me For Fun!", :click_me) => Creates the methods #click_me and #click_me_link
|
133
|
+
#
|
134
|
+
def button(button_text, *alias_name)
|
135
|
+
elementize(:button, button_text, *alias_name)
|
120
136
|
end
|
121
137
|
|
122
138
|
private
|
@@ -127,6 +143,19 @@ class PageFactory
|
|
127
143
|
StringFactory::damballa(text)
|
128
144
|
end
|
129
145
|
|
146
|
+
def elementize(type, text, *alias_name)
|
147
|
+
hash={:link=>:text, :button=>:value}
|
148
|
+
if alias_name.empty?
|
149
|
+
el_name=damballa("#{text}_#{type}")
|
150
|
+
act_name=damballa(text)
|
151
|
+
else
|
152
|
+
el_name="#{alias_name[0]}_#{type}".to_sym
|
153
|
+
act_name=alias_name[0]
|
154
|
+
end
|
155
|
+
element(el_name) { |b| b.send(type, hash[type]=>text) }
|
156
|
+
action(act_name) { |b| b.send(type, hash[type]=>text).click }
|
157
|
+
end
|
158
|
+
|
130
159
|
end
|
131
160
|
|
132
161
|
end # PageFactory
|
data/test-factory.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'test-factory'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.4'
|
4
4
|
s.summary = %q{rSmart's framework for creating automated testing scripts}
|
5
5
|
s.description = %q{This gem provides a set of modules and methods to help quickly and DRYly create a test automation framework using Ruby and Watir (or watir-webdriver).}
|
6
6
|
s.files = Dir.glob("**/**/**")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|