test-factory 0.0.5 → 0.0.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.
- data/Gemfile.lock +1 -1
- data/README.md +6 -1
- data/lib/test-factory/page_factory.rb +12 -0
- data/test-factory.gemspec +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,6 +8,12 @@ This gem contains the basic framework for [dryly](http://en.wikipedia.org/wiki/D
|
|
8
8
|
|
9
9
|
Use it to abstract away from the underlying [Watir](http://www.watir.com) code and create your own [DSL](http://en.wikipedia.org/wiki/Domain_specific_language).
|
10
10
|
|
11
|
+
With TestFactory you have the ability to...
|
12
|
+
|
13
|
+
1. Easily instantiate pages in a consistent manner
|
14
|
+
2. Concisely describe elements on a page, keeping it DRY by avoiding repetition of element identifiers
|
15
|
+
3. Provide higher-level methods that use the elements to perform user-0oriented functions
|
16
|
+
|
11
17
|
Tremendous thanks is due to [Alister Scott](http://watirmelon.com), whose [custom page object code](https://github.com/alisterscott/wmf-custom-page-object) for the Wikimedia Foundation provided the inspiration for this gem.
|
12
18
|
|
13
19
|
How to Start
|
@@ -135,7 +141,6 @@ on MyPage do |page|
|
|
135
141
|
# Very contrived example. You should be using your favorite verification framework here:
|
136
142
|
page.description==@my_thing.description ? puts "Passed" : puts "Failed"
|
137
143
|
end
|
138
|
-
|
139
144
|
```
|
140
145
|
|
141
146
|
Notice
|
@@ -41,6 +41,9 @@ class PageFactory
|
|
41
41
|
|
42
42
|
# The basic building block of the page object classes.
|
43
43
|
# Use in conjunction with Watir to define all elements on a given page that are important to validate.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# element(:title) { |b| b.frm.text_field(:id=>"title-id") }
|
44
47
|
def element element_name
|
45
48
|
raise "#{element_name} is being defined twice in #{self}!" if self.instance_methods.include?(element_name.to_sym)
|
46
49
|
define_method element_name.to_s do
|
@@ -50,6 +53,15 @@ class PageFactory
|
|
50
53
|
alias :value :element
|
51
54
|
|
52
55
|
# The basic building block for interacting with elements on a page, such as links and buttons.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# action(:continue) { |b| b.frm.button(:value=>"Continue").click }
|
59
|
+
#
|
60
|
+
# This can also be used to create methods that take parameters. Like so...
|
61
|
+
#
|
62
|
+
# @example
|
63
|
+
# action(:select_style) { |stylename, b| b.div(:text=>/#{Regexp.escape(stylename)}/).link(:text=>"Select").click }
|
64
|
+
#
|
53
65
|
def action method_name, &block
|
54
66
|
define_method method_name.to_s do |*thing|
|
55
67
|
Proc.new(&block).call *thing, self
|
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.0.
|
3
|
+
s.version = '0.0.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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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: 2012-11-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|