symbiont 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +22 -7
- data/HISTORY.md +6 -0
- data/app/public/css/site.css +16 -0
- data/app/public/js/site.js +3 -1
- data/app/views/comics.erb +23 -1
- data/app/views/webobject.erb +1 -1
- data/lib/symbiont/data_setter.rb +7 -3
- data/lib/symbiont/enclosers.rb +24 -27
- data/lib/symbiont/evaluators.rb +52 -23
- data/lib/symbiont/factory.rb +19 -75
- data/lib/symbiont/generators.rb +172 -44
- data/lib/symbiont/platform_watir/platform_object.rb +202 -18
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/button.rb +1 -1
- data/lib/symbiont/web_objects/checkbox.rb +1 -1
- data/lib/symbiont/web_objects/heading.rb +12 -0
- data/lib/symbiont/web_objects/hidden_field.rb +19 -0
- data/lib/symbiont/web_objects/label.rb +15 -0
- data/lib/symbiont/web_objects/list_item.rb +13 -0
- data/lib/symbiont/web_objects/ordered_list.rb +49 -0
- data/lib/symbiont/web_objects/radio.rb +1 -1
- data/lib/symbiont/web_objects/select_list.rb +1 -1
- data/lib/symbiont/web_objects/table.rb +4 -0
- data/lib/symbiont/web_objects/table_row.rb +4 -0
- data/lib/symbiont/web_objects/text_area.rb +26 -0
- data/lib/symbiont/web_objects/unordered_list.rb +49 -0
- data/lib/symbiont.rb +7 -0
- data/lucid.yml +6 -0
- data/spec/spec_helper.rb +70 -16
- data/spec/symbiont/data_setter_spec.rb +65 -62
- data/spec/symbiont/enclosers_spec.rb +76 -57
- data/spec/symbiont/evaluators_spec.rb +95 -75
- data/spec/symbiont/factory_spec.rb +174 -122
- data/spec/symbiont/generators/button_generators_spec.rb +34 -31
- data/spec/symbiont/generators/checkbox_generators_spec.rb +79 -75
- data/spec/symbiont/generators/div_generators_spec.rb +56 -52
- data/spec/symbiont/generators/hidden_field_generators_spec.rb +65 -0
- data/spec/symbiont/generators/link_generators_spec.rb +30 -27
- data/spec/symbiont/generators/paragraph_generators_spec.rb +22 -17
- data/spec/symbiont/generators/radio_generators_spec.rb +76 -77
- data/spec/symbiont/generators/select_list_generators_spec.rb +93 -77
- data/spec/symbiont/generators/span_generators_spec.rb +56 -52
- data/spec/symbiont/generators/{cell_generators_spec.rb → table_cell_generators_spec.rb} +56 -52
- data/spec/symbiont/generators/table_generators_spec.rb +56 -52
- data/spec/symbiont/generators/text_area_generators_spec.rb +72 -0
- data/spec/symbiont/generators/text_field_generators_spec.rb +30 -27
- data/spec/symbiont/generators_spec.rb +38 -28
- data/spec/symbiont/locators_spec.rb +68 -68
- data/spec/symbiont/platform_object_spec.rb +2 -4
- data/spec/symbiont/symbiont_spec.rb +10 -8
- data/spec/symbiont/web_object_spec.rb +194 -194
- data/spec/symbiont/web_objects/button_spec.rb +38 -30
- data/spec/symbiont/web_objects/checkbox_spec.rb +27 -27
- data/spec/symbiont/web_objects/div_spec.rb +18 -11
- data/spec/symbiont/web_objects/heading_spec.rb +22 -0
- data/spec/symbiont/web_objects/hidden_field_spec.rb +18 -0
- data/spec/symbiont/web_objects/label_spec.rb +18 -0
- data/spec/symbiont/web_objects/link_spec.rb +33 -33
- data/spec/symbiont/web_objects/list_item_spec.rb +18 -0
- data/spec/symbiont/web_objects/option_spec.rb +9 -9
- data/spec/symbiont/web_objects/ordered_list_spec.rb +53 -0
- data/spec/symbiont/web_objects/paragraph_spec.rb +9 -2
- data/spec/symbiont/web_objects/radio_spec.rb +27 -27
- data/spec/symbiont/web_objects/select_list_spec.rb +69 -69
- data/spec/symbiont/web_objects/span_spec.rb +18 -11
- data/spec/symbiont/web_objects/table_cell_spec.rb +19 -19
- data/spec/symbiont/web_objects/table_row_spec.rb +58 -58
- data/spec/symbiont/web_objects/table_spec.rb +61 -61
- data/spec/symbiont/web_objects/text_area_spec.rb +18 -0
- data/spec/symbiont/web_objects/text_field_spec.rb +39 -39
- data/spec/symbiont/web_objects/unordered_list_spec.rb +51 -0
- data/specs/common/support/browser.rb +25 -0
- data/specs/common/support/env.rb +6 -0
- data/specs/common/support/events.rb +15 -0
- data/specs/enclosers.feature +9 -0
- data/specs/evaluators.feature +26 -0
- data/specs/pages/characters.rb +22 -0
- data/specs/pages/home.rb +9 -0
- data/specs/pages/stardate.rb +23 -0
- data/specs/pages/web_objects.rb +77 -0
- data/specs/select_list.feature +53 -0
- data/specs/steps/enclosers_steps.rb +17 -0
- data/specs/steps/evaluators_steps.rb +44 -0
- data/specs/steps/navigation_steps.rb +14 -0
- data/specs/steps/select_list_steps.rb +94 -0
- data/specs/steps/table_cell_steps.rb +31 -0
- data/specs/steps/table_steps.rb +87 -0
- data/specs/table.feature +49 -0
- data/specs/table_cell.feature +27 -0
- data/symbiont.gemspec +4 -1
- metadata +72 -6
- data/cucumber.yml +0 -6
@@ -1,75 +1,95 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe Symbiont::
|
4
|
-
let(:watir_browser)
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
describe "browser-level actions" do
|
8
|
-
context "a definition using watir-webdriver" do
|
9
|
-
it "should visit a page" do
|
10
|
-
watir_browser.should_receive(:goto).with("http://localhost:
|
11
|
-
watir_definition.visit("http://localhost:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Symbiont::Evaluators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "browser-level actions" do
|
8
|
+
context "a definition using watir-webdriver" do
|
9
|
+
it "should visit a page" do
|
10
|
+
watir_browser.should_receive(:goto).twice.with("http://localhost:9292")
|
11
|
+
watir_definition.visit("http://localhost:9292")
|
12
|
+
watir_definition.navigate_to("http://localhost:9292")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should get the active url" do
|
16
|
+
watir_browser.should_receive(:url).twice.and_return("http://localhost:9292")
|
17
|
+
watir_definition.url.should == "http://localhost:9292"
|
18
|
+
watir_definition.current_url.should == "http://localhost:9292"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should get a screenshot" do
|
22
|
+
watir_browser.should_receive(:wd).twice.and_return(watir_browser)
|
23
|
+
watir_browser.should_receive(:save_screenshot).twice
|
24
|
+
watir_definition.screenshot("testing.png")
|
25
|
+
watir_definition.save_screenshot("testing.png")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should run a script against the browser" do
|
29
|
+
watir_browser.should_receive(:execute_script).twice.and_return("input")
|
30
|
+
watir_definition.run_script("return document.activeElement").should == "input"
|
31
|
+
watir_definition.execute_script("return document.activeElement").should == "input"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to go back to a previous page" do
|
35
|
+
watir_browser.should_receive(:back)
|
36
|
+
watir_definition.back
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to go forward to an already visited page" do
|
40
|
+
watir_browser.should_receive(:forward)
|
41
|
+
watir_definition.forward
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should be able to refresh the page contents" do
|
45
|
+
watir_browser.should_receive(:refresh)
|
46
|
+
watir_definition.refresh
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should be able to clear all of the cookies from the browser" do
|
50
|
+
watir_browser.should_receive(:cookies).twice.and_return(watir_browser)
|
51
|
+
watir_browser.should_receive(:clear).twice
|
52
|
+
watir_definition.remove_cookies
|
53
|
+
watir_definition.clear_cookies
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "page-level actions" do
|
59
|
+
context "a definition using watir-webdriver" do
|
60
|
+
it "should return all the text on a page" do
|
61
|
+
watir_browser.should_receive(:text).and_return("page text")
|
62
|
+
watir_definition.text.should == "page text"
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return all the markup on a page" do
|
66
|
+
watir_browser.should_receive(:html).twice.and_return("<h1>Page Title</h1>")
|
67
|
+
watir_definition.markup.should == "<h1>Page Title</h1>"
|
68
|
+
watir_definition.html.should == "<h1>Page Title</h1>"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should return the title of a page" do
|
72
|
+
watir_browser.should_receive(:title).and_return("Page Title")
|
73
|
+
watir_definition.title.should == "Page Title"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should return the web object that has focus" do
|
77
|
+
watir_browser.should_receive(:execute_script).and_return(watir_browser)
|
78
|
+
watir_browser.should_receive(:tag_name).twice.and_return(:input)
|
79
|
+
watir_browser.should_receive(:type).and_return(:submit)
|
80
|
+
watir_definition.focus.class.should == Symbiont::WebObjects::Button
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should wait for jquery pending requests to finish" do
|
84
|
+
watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(0)
|
85
|
+
watir_definition.wait_for_pending_requests
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should return an exception if pending requests did not finish" do
|
89
|
+
watir_browser.should_receive(:execute_script).with('return jQuery.active')
|
90
|
+
watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(1)
|
91
|
+
expect { watir_definition.wait_for_pending_requests(1) }.to raise_error
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -1,122 +1,174 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'symbiont/factory'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
class
|
12
|
-
include Symbiont
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
@factory.browser
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
@factory.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
@factory.
|
70
|
-
page.
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
@factory.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'symbiont/factory'
|
3
|
+
|
4
|
+
module AppModule
|
5
|
+
class TestDefinitionInModule
|
6
|
+
include Symbiont
|
7
|
+
url_is "http://localhost:9292"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class TestFactory
|
12
|
+
include Symbiont::Factory
|
13
|
+
|
14
|
+
attr_accessor :browser
|
15
|
+
attr_accessor :active
|
16
|
+
end
|
17
|
+
|
18
|
+
class TestFactoryPage
|
19
|
+
include Symbiont
|
20
|
+
|
21
|
+
url_is "http://localhost:9292"
|
22
|
+
end
|
23
|
+
|
24
|
+
class TestFactoryWithURL
|
25
|
+
include Symbiont
|
26
|
+
|
27
|
+
url_is "http://localhost:9292"
|
28
|
+
end
|
29
|
+
|
30
|
+
class TestFactorySecond
|
31
|
+
include Symbiont
|
32
|
+
end
|
33
|
+
|
34
|
+
class TestFactoryThird
|
35
|
+
include Symbiont
|
36
|
+
end
|
37
|
+
|
38
|
+
describe Symbiont::Factory do
|
39
|
+
before(:each) do
|
40
|
+
@factory = TestFactory.new
|
41
|
+
@factory.browser = mock_browser_for_watir
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should create a new definition object, using on" do
|
45
|
+
@factory.browser.should_not_receive(:goto)
|
46
|
+
@factory.on DefinitionTest do |page|
|
47
|
+
page.should be_instance_of DefinitionTest
|
48
|
+
end
|
49
|
+
|
50
|
+
@factory.on "DefinitionTest" do |page|
|
51
|
+
page.should be_instance_of DefinitionTest
|
52
|
+
end
|
53
|
+
|
54
|
+
@factory.on "AppModule::TestDefinitionInModule" do |page|
|
55
|
+
page.should be_instance_of AppModule::TestDefinitionInModule
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should create a new definition object, using during" do
|
60
|
+
@factory.browser.should_not_receive(:goto)
|
61
|
+
@factory.during DefinitionTest do |page|
|
62
|
+
page.should be_instance_of DefinitionTest
|
63
|
+
end
|
64
|
+
|
65
|
+
@factory.during "DefinitionTest" do |page|
|
66
|
+
page.should be_instance_of DefinitionTest
|
67
|
+
end
|
68
|
+
|
69
|
+
@factory.during "AppModule::TestDefinitionInModule" do |page|
|
70
|
+
page.should be_instance_of AppModule::TestDefinitionInModule
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should create a new definition object and view it, using on_view" do
|
75
|
+
@factory.browser.should_receive(:goto).exactly(5).times
|
76
|
+
@factory.on_view DefinitionTest do |page|
|
77
|
+
page.should be_instance_of DefinitionTest
|
78
|
+
end
|
79
|
+
|
80
|
+
@factory.on_view "DefinitionTest" do |page|
|
81
|
+
page.should be_instance_of DefinitionTest
|
82
|
+
end
|
83
|
+
|
84
|
+
@factory.on_view "AppModule::TestDefinitionInModule" do |page|
|
85
|
+
page.should be_instance_of AppModule::TestDefinitionInModule
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should create a new definition object and view it, using start_activity" do
|
90
|
+
@factory.browser.should_receive(:goto).exactly(5).times
|
91
|
+
@factory.start_activity DefinitionTest do |page|
|
92
|
+
page.should be_instance_of DefinitionTest
|
93
|
+
end
|
94
|
+
|
95
|
+
@factory.start_activity "DefinitionTest" do |page|
|
96
|
+
page.should be_instance_of DefinitionTest
|
97
|
+
end
|
98
|
+
|
99
|
+
@factory.start_activity "AppModule::TestDefinitionInModule" do |page|
|
100
|
+
page.should be_instance_of AppModule::TestDefinitionInModule
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should create a new definition object and view it, using start_on" do
|
105
|
+
@factory.browser.should_receive(:goto).exactly(5).times
|
106
|
+
@factory.start_on DefinitionTest do |page|
|
107
|
+
page.should be_instance_of DefinitionTest
|
108
|
+
end
|
109
|
+
|
110
|
+
@factory.start_on "DefinitionTest" do |page|
|
111
|
+
page.should be_instance_of DefinitionTest
|
112
|
+
end
|
113
|
+
|
114
|
+
@factory.start_on "AppModule::TestDefinitionInModule" do |page|
|
115
|
+
page.should be_instance_of AppModule::TestDefinitionInModule
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should set a reference to be used outside the factory" do
|
120
|
+
active = @factory.on DefinitionTest
|
121
|
+
current = @factory.instance_variable_get "@active"
|
122
|
+
current.should === active
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should use an existing definition when that definition is already active" do
|
126
|
+
@factory.instance_variable_set "@active", TestFactorySecond.new(@factory.browser)
|
127
|
+
|
128
|
+
used = false
|
129
|
+
@factory.if_on(TestFactorySecond) do |page|
|
130
|
+
page.should be_instance_of TestFactorySecond
|
131
|
+
used = true
|
132
|
+
end
|
133
|
+
used.should be true
|
134
|
+
|
135
|
+
used = false
|
136
|
+
@factory.if_on("TestFactorySecond") do |page|
|
137
|
+
page.should be_instance_of TestFactorySecond
|
138
|
+
used = true
|
139
|
+
end
|
140
|
+
used.should be true
|
141
|
+
|
142
|
+
used = false
|
143
|
+
@factory.instance_variable_set "@active", AppModule::TestDefinitionInModule.new(@factory.browser)
|
144
|
+
@factory.if_on("AppModule::TestDefinitionInModule") do |page|
|
145
|
+
page.should be_instance_of AppModule::TestDefinitionInModule
|
146
|
+
used = true
|
147
|
+
end
|
148
|
+
used.should be true
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should not execute block if definition is not the active definition" do
|
152
|
+
@factory.instance_variable_set "@active", TestFactorySecond.new(@factory.browser)
|
153
|
+
@factory.if_on(TestFactoryThird) do |page|
|
154
|
+
fail
|
155
|
+
end
|
156
|
+
|
157
|
+
@factory.if_on("TestFactoryThird") do |page|
|
158
|
+
fail
|
159
|
+
end
|
160
|
+
|
161
|
+
@factory.if_on("AppModule::TestDefinitionInModule") do |page|
|
162
|
+
fail
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should return the @active instance if asking for another page" do
|
167
|
+
expected = TestFactoryWithURL.new(@factory.browser)
|
168
|
+
@factory.instance_variable_set "@active", expected
|
169
|
+
@factory.if_on(TestFactoryPage).should == expected
|
170
|
+
@factory.if_on("TestFactoryPage").should == expected
|
171
|
+
@factory.if_on("AppModule::TestDefinitionInModule").should == expected
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
@@ -1,69 +1,72 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Symbiont::Generators do
|
4
|
-
let(:watir_browser)
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
5
|
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
6
|
|
7
|
-
describe "button
|
8
|
-
context "when declared
|
7
|
+
describe "button generators" do
|
8
|
+
context "when declared on a page definition" do
|
9
9
|
it "should generate methods for referencing the button" do
|
10
|
-
watir_definition.should respond_to(:
|
11
|
-
watir_definition.should respond_to(:
|
10
|
+
watir_definition.should respond_to(:login_object)
|
11
|
+
watir_definition.should respond_to(:login_button)
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should generate methods for interacting with the
|
15
|
-
watir_definition.should respond_to(:
|
16
|
-
watir_definition.should respond_to(:
|
17
|
-
watir_definition.should respond_to(:
|
18
|
-
watir_definition.should respond_to(:
|
19
|
-
watir_definition.should respond_to(:
|
20
|
-
watir_definition.should respond_to(:
|
21
|
-
watir_definition.should respond_to(:
|
22
|
-
watir_definition.should respond_to(:
|
14
|
+
it "should generate methods for interacting with the button" do
|
15
|
+
watir_definition.should respond_to(:login)
|
16
|
+
watir_definition.should respond_to(:login_text)
|
17
|
+
watir_definition.should respond_to(:login_exists?)
|
18
|
+
watir_definition.should respond_to(:login_visible?)
|
19
|
+
watir_definition.should respond_to(:login_enabled?)
|
20
|
+
watir_definition.should respond_to(:login?)
|
21
|
+
watir_definition.should respond_to(:login_?)
|
22
|
+
watir_definition.should respond_to(:login!)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
context "used by the watir platform" do
|
26
|
+
context "when used by the watir platform" do
|
27
27
|
it "should locate the button" do
|
28
28
|
watir_browser.should_receive(:button).and_return(watir_browser)
|
29
|
-
web_object = watir_definition.
|
29
|
+
web_object = watir_definition.login_object
|
30
30
|
web_object.should_not be_nil
|
31
31
|
web_object.should be_instance_of Symbiont::WebObjects::Button
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it "should return the text of the button" do
|
35
35
|
watir_browser.should_receive(:button).and_return(watir_browser)
|
36
|
-
watir_browser.should_receive(:text).and_return('
|
37
|
-
watir_definition.
|
36
|
+
watir_browser.should_receive(:text).and_return('Login')
|
37
|
+
watir_definition.login_text.should == "Login"
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should click the button" do
|
41
41
|
watir_browser.should_receive(:button).and_return(watir_browser)
|
42
42
|
watir_browser.should_receive(:click)
|
43
|
-
watir_definition.
|
43
|
+
watir_definition.login
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should determine if a button exists" do
|
47
47
|
watir_browser.should_receive(:button).twice.and_return(watir_browser)
|
48
48
|
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
49
|
-
watir_definition.
|
50
|
-
watir_definition.
|
49
|
+
watir_definition.login?.should be_true
|
50
|
+
watir_definition.login_exists?.should be_true
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "should determine if a button is visible" do
|
54
54
|
watir_browser.should_receive(:button).twice.and_return(watir_browser)
|
55
55
|
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
56
|
-
watir_definition.
|
57
|
-
watir_definition.
|
56
|
+
watir_definition.login_?.should be_true
|
57
|
+
watir_definition.login_visible?.should be_true
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
it "should determine if a button is enabled" do
|
61
61
|
watir_browser.should_receive(:button).twice.and_return(watir_browser)
|
62
62
|
watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
|
63
|
-
watir_definition.
|
64
|
-
watir_definition.
|
63
|
+
watir_definition.login_enabled?.should be_true
|
64
|
+
watir_definition.login!.should be_true
|
65
65
|
end
|
66
|
-
end
|
67
66
|
|
67
|
+
it "should call a block on the button if specified" do
|
68
|
+
watir_definition.logout_object.should == "logout"
|
69
|
+
end
|
70
|
+
end
|
68
71
|
end
|
69
|
-
end
|
72
|
+
end
|