test-factory 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/test-factory/data_factory.rb +52 -0
- data/lib/test-factory/gem_ext.rb +6 -0
- data/test-factory.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTYyZTZkODZkOTMwNGI0Yjc2ZjI1Mzc0ZDA3MWUyOGY2NTFmMTk1OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzdiZjY2OTliZGE2NGMwNjNmYWVmOWJhMDkwZWQxNGM2OTI5YWI5Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmU3ZWE4NzZkM2E3ZDA4NzYzN2Q0MWJkNmM1ZWRkOTU1MDQ3MDk3N2E0YWM1
|
10
|
+
MWE5OTEzZTcxMGI2YzM1ZWJmODBhOGI3ZjY2NmUxZTdlNTY3M2MzMTcxMGEy
|
11
|
+
NDQwNTAxOWFhMmU3YzdmMTVkYTIyZDgxNDI3YTRmMDlkYjExZTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWI3NmNjY2QwZWJjMTJmOGYzNTU5OWU3YTJhYmE1OGI3NzBlZWM2MjQ5MWY2
|
14
|
+
M2NmMmU0OWRkOGMzYWRlODQxZDVjMzQ1MjFkY2E0MzVlMmE0MjkyZGJhMTBi
|
15
|
+
ZTM0NDMwY2E1MTFjNmRkM2NlYzYyODEwNGVhMzM1M2IxNTdkMjA=
|
@@ -82,6 +82,58 @@ module DataFactory
|
|
82
82
|
end
|
83
83
|
alias radio_setting checkbox_setting
|
84
84
|
|
85
|
+
# A shortcut method for filling out fields on a page. The
|
86
|
+
# method's first parameter is the page class that contains the fields
|
87
|
+
# you want to fill out. That is followed by the list of field name(s)
|
88
|
+
# (as Symbols).
|
89
|
+
#
|
90
|
+
# This method has a number of requirements:
|
91
|
+
# 1) The field name and the instance variable name in your data object
|
92
|
+
# must be identical. For this reason, this method can only
|
93
|
+
# be used in your data objects' create methods.
|
94
|
+
# 2) Your checkbox data object variables
|
95
|
+
# 3) Since the listed fields get filled out in random order, be sure that
|
96
|
+
# this is okay in the context of your page--in other words, if field A
|
97
|
+
# needs to be specified before field B then having them both in your
|
98
|
+
# fill_out step would be inappropriate.
|
99
|
+
# 4) This method supports text fields, select lists, check boxes, and
|
100
|
+
# radio buttons, but only if their element definitions don't take a
|
101
|
+
# parameter. Please use the #fill_out_item with elements that do need
|
102
|
+
# a parameter defined.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
#
|
106
|
+
# on PageClass do |page|
|
107
|
+
# fill_out page, :text_field_name, :radio_name, :select_list_name, :checkbox_name
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
def fill_out(page, *fields)
|
111
|
+
watir_methods=[ lambda{|p, f| p.send(f).fit(instance_variable_get f) },
|
112
|
+
lambda{|p, f| p.send(f).pick!(instance_variable_get f) } ]
|
113
|
+
fields.shuffle.each do |field|
|
114
|
+
x = page.send(field).class.to_s=='Watir::Select' ? 1 : 0
|
115
|
+
watir_methods[x].call(page, field)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Same as #fill_out, but used with methods that take a
|
120
|
+
# parameter to identify the target element...
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
#
|
124
|
+
# on PageClass do |page|
|
125
|
+
# fill_out_item 'Joe Schmoe', page, :text_field_name, :radio_name, :select_list_name, :checkbox_name
|
126
|
+
# end
|
127
|
+
#
|
128
|
+
def fill_out_item(name, page, *fields)
|
129
|
+
watir_methods=[ lambda{|n, p, f| p.send(f, n).fit(instance_variable_get f) },
|
130
|
+
lambda{|n, p, f| p.send(f, n).pick!(instance_variable_get f) } ]
|
131
|
+
fields.shuffle.each do |field|
|
132
|
+
x = page.send(field, name).class.to_s=='Watir::Select' ? 1 : 0
|
133
|
+
watir_methods[x].call(name, page, field)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
85
137
|
# This is a specialized method for use with any select list boxes
|
86
138
|
# that exist in the site you're testing and will contain
|
87
139
|
# unpredictable default values.
|
data/lib/test-factory/gem_ext.rb
CHANGED
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.3.
|
3
|
+
s.version = '0.3.6'
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abraham Heward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: watir-webdriver
|