watir_drops 0.1.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/watir_drops.rb +3 -4
- data/lib/watir_drops/page_object.rb +35 -9
- data/watir_drops.gemspec +6 -5
- metadata +61 -7
- data/lib/watir_drops/session.rb +0 -17
- data/lib/watir_drops/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299a92e87b3d647d0607b8494ebb96530d288dc6
|
4
|
+
data.tar.gz: 864b1daef08f0d67bf59cf3f73aaa06e0a85411f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14f394a58a009bcd29ddddae1510a6bb054830b9b632ce7634f9df3f802119075cf697cca32e1242b8e8866709512af02084ec229ecac751e9abd79c82f316d0
|
7
|
+
data.tar.gz: 7ad1570992eca4938bb2a9b6b425952eda61dd3109593347c03a32b178442b3e617bac343a7336494e232c1c0b6a632de03045fd16086b12b677f2b7bc21ee8f
|
data/lib/watir_drops.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require "active_support/inflector"
|
2
|
+
|
1
3
|
module WatirDrops
|
2
4
|
class PageObject
|
3
5
|
|
4
6
|
class << self
|
5
|
-
def page_url
|
6
|
-
define_method("goto") do
|
7
|
-
browser.goto
|
7
|
+
def page_url
|
8
|
+
define_method("goto") do |*args|
|
9
|
+
browser.goto yield(*args)
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
@@ -17,11 +19,18 @@ module WatirDrops
|
|
17
19
|
self.instance_exec(*args, &block)
|
18
20
|
end
|
19
21
|
|
22
|
+
define_method(name.to_s.pluralize) do |*args|
|
23
|
+
selector = self.instance_exec(*args, &block).instance_variable_get('@selector')
|
24
|
+
element_type = selector.delete :tag_name
|
25
|
+
browser.send(element_type.pluralize, selector)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
20
29
|
define_method("#{name}=") do |val|
|
21
30
|
watir_element = self.instance_exec &block
|
22
31
|
case watir_element
|
23
32
|
when Watir::Radio
|
24
|
-
watir_element.set val
|
33
|
+
watir_element.set if val
|
25
34
|
when Watir::CheckBox
|
26
35
|
val ? watir_element.set : watir_element.clear
|
27
36
|
when Watir::Select
|
@@ -36,22 +45,39 @@ module WatirDrops
|
|
36
45
|
elements << {name.to_sym => block}
|
37
46
|
end
|
38
47
|
|
48
|
+
def visit(*args)
|
49
|
+
new.tap do |page|
|
50
|
+
page.goto(*args)
|
51
|
+
yield if block_given?
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def use
|
56
|
+
new.tap { yield if block_given? }
|
57
|
+
end
|
58
|
+
|
39
59
|
end
|
40
60
|
|
41
61
|
attr_reader :browser
|
42
62
|
|
43
|
-
def initialize
|
44
|
-
@browser =
|
63
|
+
def initialize
|
64
|
+
@browser = WatirSession.browser
|
45
65
|
end
|
46
66
|
|
47
|
-
def
|
48
|
-
|
49
|
-
|
67
|
+
def submit_form(model)
|
68
|
+
intersect = self.class.elements.map(&:keys).flatten & model.keys
|
69
|
+
intersect.each do |val|
|
70
|
+
self.send("#{val}=", model.send(val))
|
71
|
+
end
|
50
72
|
end
|
51
73
|
|
52
74
|
def title
|
53
75
|
browser.title
|
54
76
|
end
|
55
77
|
|
78
|
+
def url
|
79
|
+
browser.url
|
80
|
+
end
|
81
|
+
|
56
82
|
end
|
57
83
|
end
|
data/watir_drops.gemspec
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'watir_drops/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
4
|
spec.name = "watir_drops"
|
8
|
-
spec.version =
|
5
|
+
spec.version = '0.3.0'
|
9
6
|
spec.authors = ["Titus Fortner"]
|
10
7
|
spec.email = ["titusfortner@gmail.com"]
|
11
8
|
|
@@ -23,5 +20,9 @@ application information, allowing it to be decoupled from the tests}
|
|
23
20
|
spec.add_development_dependency "bundler", "~> 1.10"
|
24
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
22
|
spec.add_development_dependency "rspec"
|
26
|
-
spec.add_development_dependency "
|
23
|
+
spec.add_development_dependency "require_all"
|
24
|
+
spec.add_development_dependency "test-model"
|
25
|
+
spec.add_development_dependency "watir-webdriver"
|
26
|
+
spec.add_development_dependency "watir_session"
|
27
|
+
spec.add_development_dependency "activesupport", "~> 3.0"
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir_drops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Titus Fortner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,76 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: require_all
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-model
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: watir-webdriver
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: watir_session
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activesupport
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
58
114
|
requirements:
|
59
115
|
- - "~>"
|
60
116
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
117
|
+
version: '3.0'
|
62
118
|
type: :development
|
63
119
|
prerelease: false
|
64
120
|
version_requirements: !ruby/object:Gem::Requirement
|
65
121
|
requirements:
|
66
122
|
- - "~>"
|
67
123
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
124
|
+
version: '3.0'
|
69
125
|
description: |-
|
70
126
|
This gem leverages the Watir test framework to allow for easy modeling of specific web
|
71
127
|
application information, allowing it to be decoupled from the tests
|
@@ -82,8 +138,6 @@ files:
|
|
82
138
|
- Rakefile
|
83
139
|
- lib/watir_drops.rb
|
84
140
|
- lib/watir_drops/page_object.rb
|
85
|
-
- lib/watir_drops/session.rb
|
86
|
-
- lib/watir_drops/version.rb
|
87
141
|
- watir_drops.gemspec
|
88
142
|
homepage: https://github.com/titusfortner/watir_drops
|
89
143
|
licenses:
|
@@ -105,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
159
|
version: '0'
|
106
160
|
requirements: []
|
107
161
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.4.
|
162
|
+
rubygems_version: 2.4.5.1
|
109
163
|
signing_key:
|
110
164
|
specification_version: 4
|
111
165
|
summary: Page Object Framework for use with Watir
|
data/lib/watir_drops/session.rb
DELETED
data/lib/watir_drops/version.rb
DELETED