ripl-watir 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -7
- data/bin/ripl-watir +1 -0
- data/lib/ripl_watir.rb +17 -13
- data/ripl-watir.gemspec +4 -1
- metadata +10 -5
data/README.rdoc
CHANGED
@@ -19,10 +19,6 @@ Hopefully this serves as some kind of demonstration:
|
|
19
19
|
... opens a browser session (firefox by default) and enters a
|
20
20
|
ripl console shell.
|
21
21
|
|
22
|
-
$: << 'lib'
|
23
|
-
|
24
|
-
... add the 'lib' directory to the load path
|
25
|
-
|
26
22
|
Now create a file 'lib/pages/github.rb' containing the following:
|
27
23
|
|
28
24
|
module Pages::Github
|
@@ -35,7 +31,7 @@ Now create a file 'lib/pages/github.rb' containing the following:
|
|
35
31
|
|
36
32
|
>> visit_page :github
|
37
33
|
|
38
|
-
... this creates an instance of the
|
34
|
+
... this creates an instance of the RiplWatir::Page class, loads 'pages/github' (from whereever it happens to be on the load
|
39
35
|
path), mixes Pages::Github into the page class and calls the
|
40
36
|
goto method (which tells the browser to goto github.com). Amazing?
|
41
37
|
|
@@ -67,7 +63,7 @@ Now create a file 'lib/pages/github/login.rb' containing the following:
|
|
67
63
|
|
68
64
|
>> on_page(:github, :login).login 'me@my.mail.com', 'password'
|
69
65
|
|
70
|
-
... creates another instance of the
|
66
|
+
... creates another instance of the RiplWatir::Page class, reloads
|
71
67
|
'pages/github/login.rb' (from whereever it happens to be on the load
|
72
68
|
path) and mixes Pages::Github::Login into it.
|
73
69
|
|
@@ -84,7 +80,7 @@ available as 'browser' without needing a page object.
|
|
84
80
|
|
85
81
|
== Page Objects
|
86
82
|
|
87
|
-
The page objects are always a
|
83
|
+
The page objects are always a RiplWatir::Page instance
|
88
84
|
(which is a delegate of Watir::Browser) with a specified mixin.
|
89
85
|
|
90
86
|
This mixins add methods specifically for interacting with that particular page.
|
data/bin/ripl-watir
CHANGED
data/lib/ripl_watir.rb
CHANGED
@@ -1,18 +1,7 @@
|
|
1
1
|
require 'watir-webdriver'
|
2
|
-
require 'watir-webdriver'
|
3
2
|
require 'forwardable'
|
4
3
|
|
5
4
|
module Pages
|
6
|
-
class Page
|
7
|
-
attr_reader :browser
|
8
|
-
extend Forwardable
|
9
|
-
|
10
|
-
def_delegators :@browser, :title, :url, :html, :status, :refresh, :back
|
11
|
-
|
12
|
-
def initialize browser
|
13
|
-
@browser = browser
|
14
|
-
end
|
15
|
-
end
|
16
5
|
end
|
17
6
|
|
18
7
|
module RiplWatir
|
@@ -24,14 +13,29 @@ module RiplWatir
|
|
24
13
|
end
|
25
14
|
end
|
26
15
|
|
16
|
+
class Page
|
17
|
+
attr_reader :browser
|
18
|
+
extend Forwardable
|
19
|
+
|
20
|
+
def_delegators :@browser, :title, :url, :html, :status, :refresh, :back
|
21
|
+
|
22
|
+
def initialize browser
|
23
|
+
@browser = browser
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
27
|
module Commands
|
28
28
|
def classify s
|
29
29
|
s.to_s.split('_').map(&:capitalize).join
|
30
30
|
end
|
31
31
|
|
32
32
|
def page_class *args
|
33
|
-
page =
|
34
|
-
|
33
|
+
page = RiplWatir::Page.new RiplWatir.browser
|
34
|
+
if ENV['RIPL_WATIR_RELOAD']
|
35
|
+
load "pages/#{args.join '/'}.rb"
|
36
|
+
else
|
37
|
+
require "pages/#{args.join '/'}"
|
38
|
+
end
|
35
39
|
mod = Pages
|
36
40
|
args.each do |name|
|
37
41
|
mod = mod.const_get classify name
|
data/ripl-watir.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ripl-watir"
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.4'
|
7
7
|
s.authors = ["Mark Ryall"]
|
8
8
|
s.email = ["mark@ryall.name"]
|
9
9
|
s.homepage = "https://github.com/markryall/ripl_watir"
|
@@ -11,6 +11,9 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = <<EOF
|
12
12
|
A ripl plugin to provide an interactive shell for creating page objects
|
13
13
|
to build an automated testing infrastructure for a site.
|
14
|
+
|
15
|
+
Set environment variable RIPL_WATIR_RELOAD to force reloading of pages each
|
16
|
+
time they are used (this is only useful during development).
|
14
17
|
EOF
|
15
18
|
|
16
19
|
s.rubyforge_project = "ripl-watir"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripl-watir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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: 2012-
|
12
|
+
date: 2012-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ripl
|
@@ -63,6 +63,11 @@ description: ! 'A ripl plugin to provide an interactive shell for creating page
|
|
63
63
|
|
64
64
|
to build an automated testing infrastructure for a site.
|
65
65
|
|
66
|
+
|
67
|
+
Set environment variable RIPL_WATIR_RELOAD to force reloading of pages each
|
68
|
+
|
69
|
+
time they are used (this is only useful during development).
|
70
|
+
|
66
71
|
'
|
67
72
|
email:
|
68
73
|
- mark@ryall.name
|
@@ -92,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
97
|
version: '0'
|
93
98
|
segments:
|
94
99
|
- 0
|
95
|
-
hash:
|
100
|
+
hash: 2747320712360673650
|
96
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
102
|
none: false
|
98
103
|
requirements:
|
@@ -101,10 +106,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
106
|
version: '0'
|
102
107
|
segments:
|
103
108
|
- 0
|
104
|
-
hash:
|
109
|
+
hash: 2747320712360673650
|
105
110
|
requirements: []
|
106
111
|
rubyforge_project: ripl-watir
|
107
|
-
rubygems_version: 1.8.
|
112
|
+
rubygems_version: 1.8.23
|
108
113
|
signing_key:
|
109
114
|
specification_version: 3
|
110
115
|
summary: watir repl for efficiently creating page objects
|