watirsplash 2.1.1 → 2.2.0
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/History.rdoc +7 -0
- data/README.rdoc +5 -5
- data/lib/watirsplash/generators/templates/new_project/.rspec +1 -1
- data/lib/watirsplash/page/base.rb +8 -1
- data/lib/watirsplash/util.rb +2 -2
- data/lib/watirsplash/version.rb +2 -2
- data/spec/page_spec.rb +34 -4
- metadata +6 -6
data/History.rdoc
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== Version 2.2.0 / 2011-09-10
|
2
|
+
|
3
|
+
* watir-webdriver/firefox is now the default framework under Linux and OS X
|
4
|
+
* Page objects will reuse WatirSplash::Browser.current if it exists
|
5
|
+
* added Page#redirect_to for redirecting to another Page object
|
6
|
+
* require spec_helper relatively from working directory
|
7
|
+
|
1
8
|
=== Version 2.1.1 / 2011-08-18
|
2
9
|
|
3
10
|
* bumped Watir dependency to 2.0.1
|
data/README.rdoc
CHANGED
@@ -62,7 +62,7 @@ testing right away!
|
|
62
62
|
def search_button
|
63
63
|
modify button(:name => "go"),
|
64
64
|
# clicking the search button results a page transition to "results" page
|
65
|
-
:click => lambda {Results
|
65
|
+
:click => lambda {redirect_to Results}
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -119,15 +119,15 @@ testing right away!
|
|
119
119
|
== SUPPORTED PLATFORMS & BROWSERS
|
120
120
|
|
121
121
|
WatirSplash supports different frameworks/browsers on different operating systems:
|
122
|
-
* Linux & OS X -
|
123
|
-
* Windows -
|
122
|
+
* Linux & OS X - watir-webdriver/firefox, watir-webdriver/chrome and firewatir
|
123
|
+
* Windows - watir, watir-webdriver/firefox, watir-webdriver/chrome, watir-webdriver/ie and firewatir
|
124
124
|
|
125
125
|
Each framework drives a specific browser:
|
126
|
-
* FireWatir - Firefox
|
127
126
|
* Watir - IE
|
128
127
|
* Watir-WebDriver - Chrome, IE and Firefox
|
128
|
+
* FireWatir - Firefox
|
129
129
|
|
130
|
-
It is possible to specify what framework to use in
|
130
|
+
It is possible to specify what framework to use in spec_helper.rb file:
|
131
131
|
WatirSplash::Util.framework = "watir-webdriver/firefox"
|
132
132
|
|
133
133
|
It is also possible to specify used framework by using environment variable WATIRSPLASH_FRAMEWORK.
|
@@ -9,17 +9,24 @@ module WatirSplash
|
|
9
9
|
def url url
|
10
10
|
@@url = url
|
11
11
|
end
|
12
|
+
|
12
13
|
end
|
13
14
|
|
14
15
|
def initialize(browser=nil)
|
15
16
|
if browser
|
16
17
|
@browser = WatirSplash::Browser.current = browser
|
17
18
|
else
|
18
|
-
@browser = WatirSplash::Browser.
|
19
|
+
@browser = (WatirSplash::Browser.current &&
|
20
|
+
WatirSplash::Browser.current.exists?) ||
|
21
|
+
WatirSplash::Browser.new
|
19
22
|
@browser.goto @@url
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
26
|
+
def redirect_to page, browser=nil
|
27
|
+
page.new browser || WatirSplash::Browser.current
|
28
|
+
end
|
29
|
+
|
23
30
|
def modify element, methodz
|
24
31
|
methodz.each_pair do |meth, return_value|
|
25
32
|
element.instance_eval do
|
data/lib/watirsplash/util.rb
CHANGED
data/lib/watirsplash/version.rb
CHANGED
data/spec/page_spec.rb
CHANGED
@@ -4,10 +4,15 @@ class DummyPage < WatirSplash::Page::Base
|
|
4
4
|
def something
|
5
5
|
modify Hash.new,
|
6
6
|
:store => lambda {|a,b| a + b},
|
7
|
-
:new_method => lambda {[]}
|
7
|
+
:new_method => lambda {[]},
|
8
|
+
:another_page => lambda {redirect_to AnotherDummyPage},
|
9
|
+
:another_page_with_new_browser => lambda {|browser| redirect_to AnotherDummyPage, browser}
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
13
|
+
class AnotherDummyPage < WatirSplash::Page::Base
|
14
|
+
end
|
15
|
+
|
11
16
|
describe WatirSplash::Page::Base do
|
12
17
|
before :all do
|
13
18
|
# close the browser opened in environment.rb
|
@@ -19,7 +24,7 @@ describe WatirSplash::Page::Base do
|
|
19
24
|
page = DummyPage.new
|
20
25
|
browser = page.instance_variable_get(:@browser)
|
21
26
|
browser.should respond_to(:title)
|
22
|
-
browser.url.should =~
|
27
|
+
browser.url.should =~ %r{bing.com}
|
23
28
|
end
|
24
29
|
|
25
30
|
it "allows to reuse existing browser" do
|
@@ -29,7 +34,7 @@ describe WatirSplash::Page::Base do
|
|
29
34
|
page = DummyPage.new(browser)
|
30
35
|
page_browser = page.instance_variable_get(:@browser)
|
31
36
|
page_browser.should == browser
|
32
|
-
page_browser.url.should =~
|
37
|
+
page_browser.url.should =~ %r{google.com}
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
@@ -63,6 +68,31 @@ describe WatirSplash::Page::Base do
|
|
63
68
|
end
|
64
69
|
end
|
65
70
|
|
71
|
+
context "#redirect_to" do
|
72
|
+
it "redirects to the new page reusing the current browser" do
|
73
|
+
page = DummyPage.new
|
74
|
+
another_page = page.something.another_page
|
75
|
+
another_page.should be_kind_of(AnotherDummyPage)
|
76
|
+
another_page.url.should =~ %r{bing.com}
|
77
|
+
end
|
78
|
+
|
79
|
+
it "redirects to the new page using the provided browser" do
|
80
|
+
page = DummyPage.new
|
81
|
+
old_browser = WatirSplash::Browser.current
|
82
|
+
|
83
|
+
browser = WatirSplash::Browser.new
|
84
|
+
browser.goto "http://google.com/ncr"
|
85
|
+
new_page = page.something.another_page_with_new_browser browser
|
86
|
+
new_page_browser = new_page.instance_variable_get(:@browser)
|
87
|
+
new_page_browser.should == browser
|
88
|
+
new_page_browser.url.should =~ %r{google.com}
|
89
|
+
|
90
|
+
page_browser = page.instance_variable_get(:@browser)
|
91
|
+
page_browser.should == old_browser
|
92
|
+
page_browser.url.should =~ %r{bing.com}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
66
96
|
context "#method_missing" do
|
67
97
|
it "gets SpecHelper module included into class" do
|
68
98
|
DummyPage.included_modules.should include(WatirSplash::SpecHelper)
|
@@ -71,7 +101,7 @@ describe WatirSplash::Page::Base do
|
|
71
101
|
it "redirects all missing methods to browser object" do
|
72
102
|
page = DummyPage.new
|
73
103
|
page.should_not respond_to(:text_field)
|
74
|
-
page.text_field(:id => /
|
104
|
+
page.text_field(:id => /something/).should be_kind_of(Watir::TextField)
|
75
105
|
end
|
76
106
|
end
|
77
107
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watirsplash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jarmo Pertman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|
@@ -173,7 +173,7 @@ rubyforge_project:
|
|
173
173
|
rubygems_version: 1.8.4
|
174
174
|
signing_key:
|
175
175
|
specification_version: 3
|
176
|
-
summary: watirsplash 2.
|
176
|
+
summary: watirsplash 2.2.0
|
177
177
|
test_files:
|
178
178
|
- spec/browser_spec.rb
|
179
179
|
- spec/page_spec.rb
|