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,77 +1,93 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Symbiont::Generators do
|
4
|
-
let(:watir_browser)
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
describe "select list web objects" do
|
8
|
-
context "when declared in a definition" do
|
9
|
-
it "should generate methods for referencing the select list" do
|
10
|
-
watir_definition.should respond_to(:concepts_select_list)
|
11
|
-
watir_definition.should respond_to(:concepts_object)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should generate methods for interacting with the select list" do
|
15
|
-
watir_definition.should respond_to(:concepts)
|
16
|
-
watir_definition.should respond_to(:concepts_option?)
|
17
|
-
watir_definition.should respond_to(:concepts_exists?)
|
18
|
-
watir_definition.should respond_to(:concepts_visible?)
|
19
|
-
watir_definition.should respond_to(:concepts_enabled?)
|
20
|
-
watir_definition.should respond_to(:concepts?)
|
21
|
-
watir_definition.should respond_to(:concepts_?)
|
22
|
-
watir_definition.should respond_to(:concepts!)
|
23
|
-
watir_definition.should respond_to(:concepts=)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "when used by the watir platform" do
|
28
|
-
it "should locate the select list" do
|
29
|
-
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
30
|
-
web_object = watir_definition.concepts_object
|
31
|
-
web_object.should_not be_nil
|
32
|
-
web_object.should be_instance_of Symbiont::WebObjects::SelectList
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should retrieve the current value of a selected option" do
|
36
|
-
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
37
|
-
watir_browser.should_receive(:value).and_return("testing")
|
38
|
-
watir_definition.concepts_option?.should == "testing"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should retrieve the current selection from the select list" do
|
42
|
-
selected = "testing"
|
43
|
-
selected.should_receive(:text).and_return("testing")
|
44
|
-
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
45
|
-
watir_browser.should_receive(:selected_options).and_return([selected])
|
46
|
-
watir_definition.concepts.should == "testing"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should select an item from the select list" do
|
50
|
-
watir_browser.should_receive(:select_list).and_return watir_browser
|
51
|
-
watir_browser.should_receive(:select).with("testing")
|
52
|
-
watir_definition.concepts = "testing"
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Generators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "select list web objects" do
|
8
|
+
context "when declared in a definition" do
|
9
|
+
it "should generate methods for referencing the select list" do
|
10
|
+
watir_definition.should respond_to(:concepts_select_list)
|
11
|
+
watir_definition.should respond_to(:concepts_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the select list" do
|
15
|
+
watir_definition.should respond_to(:concepts)
|
16
|
+
watir_definition.should respond_to(:concepts_option?)
|
17
|
+
watir_definition.should respond_to(:concepts_exists?)
|
18
|
+
watir_definition.should respond_to(:concepts_visible?)
|
19
|
+
watir_definition.should respond_to(:concepts_enabled?)
|
20
|
+
watir_definition.should respond_to(:concepts?)
|
21
|
+
watir_definition.should respond_to(:concepts_?)
|
22
|
+
watir_definition.should respond_to(:concepts!)
|
23
|
+
watir_definition.should respond_to(:concepts=)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when used by the watir platform" do
|
28
|
+
it "should locate the select list" do
|
29
|
+
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
30
|
+
web_object = watir_definition.concepts_object
|
31
|
+
web_object.should_not be_nil
|
32
|
+
web_object.should be_instance_of Symbiont::WebObjects::SelectList
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should retrieve the current value of a selected option" do
|
36
|
+
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
37
|
+
watir_browser.should_receive(:value).and_return("testing")
|
38
|
+
watir_definition.concepts_option?.should == "testing"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should retrieve the current selection from the select list" do
|
42
|
+
selected = "testing"
|
43
|
+
selected.should_receive(:text).and_return("testing")
|
44
|
+
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
45
|
+
watir_browser.should_receive(:selected_options).and_return([selected])
|
46
|
+
watir_definition.concepts.should == "testing"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should select an item from the select list" do
|
50
|
+
watir_browser.should_receive(:select_list).and_return watir_browser
|
51
|
+
watir_browser.should_receive(:select).with("testing")
|
52
|
+
watir_definition.concepts = "testing"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should retrieve a list of selection options" do
|
56
|
+
option1 = double('option')
|
57
|
+
option2 = double('option')
|
58
|
+
option1.should_receive(:text).and_return("concept1")
|
59
|
+
option2.should_receive(:text).and_return("concept2")
|
60
|
+
|
61
|
+
select_element = double("select")
|
62
|
+
select_element.should_receive(:options).twice.and_return([option1, option2])
|
63
|
+
watir_definition.should_receive(:concepts_object).and_return(select_element)
|
64
|
+
watir_definition.concepts_options?.should == ["concept1","concept2"]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should determine if a select list exists" do
|
68
|
+
watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
|
69
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
70
|
+
watir_definition.concepts_exists?.should be_true
|
71
|
+
watir_definition.concepts?.should be_true
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should determine if a select list is visible" do
|
75
|
+
watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
|
76
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
77
|
+
watir_definition.concepts_visible?.should be_true
|
78
|
+
watir_definition.concepts_?.should be_true
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should determine if a select list is enabled" do
|
82
|
+
watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
|
83
|
+
watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
|
84
|
+
watir_definition.concepts_enabled?.should be_true
|
85
|
+
watir_definition.concepts!.should be_true
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should call a block on the select list if specified" do
|
89
|
+
watir_definition.topics_object.should == "topics"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -1,52 +1,56 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Symbiont::Generators do
|
4
|
-
let(:watir_browser)
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
describe "span
|
8
|
-
context "when declared in a definition" do
|
9
|
-
it "should generate methods for referencing the span" do
|
10
|
-
watir_definition.should respond_to(:inline_span)
|
11
|
-
watir_definition.should respond_to(:inline_object)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should generate methods for interacting with the span" do
|
15
|
-
watir_definition.should respond_to(:inline_exists?)
|
16
|
-
watir_definition.should respond_to(:inline_visible?)
|
17
|
-
watir_definition.should respond_to(:inline?)
|
18
|
-
watir_definition.should respond_to(:inline_?)
|
19
|
-
watir_definition.should respond_to(:inline)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when used by the watir platform" do
|
24
|
-
it "should locate the span" do
|
25
|
-
watir_browser.should_receive(:span).and_return(watir_browser)
|
26
|
-
web_object = watir_definition.inline_span
|
27
|
-
web_object.should_not be_nil
|
28
|
-
web_object.should be_instance_of Symbiont::WebObjects::Span
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should determine if a span exists" do
|
32
|
-
watir_browser.should_receive(:span).twice.and_return(watir_browser)
|
33
|
-
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
-
watir_definition.inline_exists?.should be_true
|
35
|
-
watir_definition.inline?.should be_true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should determine if a span is visible" do
|
39
|
-
watir_browser.should_receive(:span).twice.and_return(watir_browser)
|
40
|
-
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
-
watir_definition.inline_visible?.should be_true
|
42
|
-
watir_definition.inline_?.should be_true
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return the text of a span" do
|
46
|
-
watir_browser.should_receive(:span).and_return(watir_browser)
|
47
|
-
watir_browser.should_receive(:text).and_return("testing")
|
48
|
-
watir_definition.inline.should == "testing"
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Generators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "span generators" do
|
8
|
+
context "when declared in a definition" do
|
9
|
+
it "should generate methods for referencing the span" do
|
10
|
+
watir_definition.should respond_to(:inline_span)
|
11
|
+
watir_definition.should respond_to(:inline_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the span" do
|
15
|
+
watir_definition.should respond_to(:inline_exists?)
|
16
|
+
watir_definition.should respond_to(:inline_visible?)
|
17
|
+
watir_definition.should respond_to(:inline?)
|
18
|
+
watir_definition.should respond_to(:inline_?)
|
19
|
+
watir_definition.should respond_to(:inline)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when used by the watir platform" do
|
24
|
+
it "should locate the span" do
|
25
|
+
watir_browser.should_receive(:span).and_return(watir_browser)
|
26
|
+
web_object = watir_definition.inline_span
|
27
|
+
web_object.should_not be_nil
|
28
|
+
web_object.should be_instance_of Symbiont::WebObjects::Span
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should determine if a span exists" do
|
32
|
+
watir_browser.should_receive(:span).twice.and_return(watir_browser)
|
33
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
+
watir_definition.inline_exists?.should be_true
|
35
|
+
watir_definition.inline?.should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should determine if a span is visible" do
|
39
|
+
watir_browser.should_receive(:span).twice.and_return(watir_browser)
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
+
watir_definition.inline_visible?.should be_true
|
42
|
+
watir_definition.inline_?.should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return the text of a span" do
|
46
|
+
watir_browser.should_receive(:span).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:text).and_return("testing")
|
48
|
+
watir_definition.inline.should == "testing"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should call a block on the span if specified" do
|
52
|
+
watir_definition.part_object.should == "part"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,52 +1,56 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Symbiont::Generators do
|
4
|
-
let(:watir_browser)
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
describe "cell
|
8
|
-
context "when declared
|
9
|
-
it "should generate methods for referencing the cell" do
|
10
|
-
watir_definition.should respond_to(:
|
11
|
-
watir_definition.should respond_to(:
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should generate methods for interacting with the cell" do
|
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
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when used by the watir platform" do
|
24
|
-
it "should locate the table cell" do
|
25
|
-
watir_browser.should_receive(:td).and_return(watir_browser)
|
26
|
-
web_object = watir_definition.
|
27
|
-
web_object.should_not be_nil
|
28
|
-
web_object.should be_instance_of Symbiont::WebObjects::TableCell
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should determine if a table cell exists" do
|
32
|
-
watir_browser.should_receive(:td).twice.and_return(watir_browser)
|
33
|
-
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
-
watir_definition.
|
35
|
-
watir_definition.
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should determine if a table cell is visible" do
|
39
|
-
watir_browser.should_receive(:td).twice.and_return(watir_browser)
|
40
|
-
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
-
watir_definition.
|
42
|
-
watir_definition.
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return the text of a table cell" do
|
46
|
-
watir_browser.should_receive(:td).and_return(watir_browser)
|
47
|
-
watir_browser.should_receive(:text).and_return("testing")
|
48
|
-
watir_definition.
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Generators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "table cell generators" do
|
8
|
+
context "when declared on a page definition" do
|
9
|
+
it "should generate methods for referencing the cell" do
|
10
|
+
watir_definition.should respond_to(:total_cell)
|
11
|
+
watir_definition.should respond_to(:total_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the cell" do
|
15
|
+
watir_definition.should respond_to(:total_exists?)
|
16
|
+
watir_definition.should respond_to(:total_visible?)
|
17
|
+
watir_definition.should respond_to(:total?)
|
18
|
+
watir_definition.should respond_to(:total_?)
|
19
|
+
watir_definition.should respond_to(:total)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when used by the watir platform" do
|
24
|
+
it "should locate the table cell" do
|
25
|
+
watir_browser.should_receive(:td).and_return(watir_browser)
|
26
|
+
web_object = watir_definition.total_cell
|
27
|
+
web_object.should_not be_nil
|
28
|
+
web_object.should be_instance_of Symbiont::WebObjects::TableCell
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should determine if a table cell exists" do
|
32
|
+
watir_browser.should_receive(:td).twice.and_return(watir_browser)
|
33
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
+
watir_definition.total_exists?.should be_true
|
35
|
+
watir_definition.total?.should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should determine if a table cell is visible" do
|
39
|
+
watir_browser.should_receive(:td).twice.and_return(watir_browser)
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
+
watir_definition.total_visible?.should be_true
|
42
|
+
watir_definition.total_?.should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return the text of a table cell" do
|
46
|
+
watir_browser.should_receive(:td).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:text).and_return("testing")
|
48
|
+
watir_definition.total.should == "testing"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should call a block on the table cell if specified" do
|
52
|
+
watir_definition.sum_object.should == "sum"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,52 +1,56 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Symbiont::Generators do
|
4
|
-
let(:watir_browser)
|
5
|
-
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
7
|
-
describe "table
|
8
|
-
context "when declared
|
9
|
-
it "should generate methods for referencing the table" do
|
10
|
-
watir_definition.should respond_to(:accounts_table)
|
11
|
-
watir_definition.should respond_to(:accounts_object)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should generate methods for interacting with the table" do
|
15
|
-
watir_definition.should respond_to(:accounts_exists?)
|
16
|
-
watir_definition.should respond_to(:accounts?)
|
17
|
-
watir_definition.should respond_to(:accounts_visible?)
|
18
|
-
watir_definition.should respond_to(:accounts_?)
|
19
|
-
watir_definition.should respond_to(:accounts)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when used by the watir platform" do
|
24
|
-
it "should locate the table" do
|
25
|
-
watir_browser.should_receive(:table).and_return(watir_browser)
|
26
|
-
web_object = watir_definition.accounts_table
|
27
|
-
web_object.should_not be_nil
|
28
|
-
web_object.should be_instance_of Symbiont::WebObjects::Table
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should determine if a table exists" do
|
32
|
-
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
33
|
-
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
-
watir_definition.accounts_exists?.should be_true
|
35
|
-
watir_definition.accounts?.should be_true
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should determine if a table is visible" do
|
39
|
-
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
40
|
-
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
-
watir_definition.accounts_visible?.should be_true
|
42
|
-
watir_definition.accounts_?.should be_true
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return the text of a table" do
|
46
|
-
watir_browser.should_receive(:table).and_return(watir_browser)
|
47
|
-
watir_browser.should_receive(:text).and_return("testing")
|
48
|
-
watir_definition.accounts.should == "testing"
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Generators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "table generators" do
|
8
|
+
context "when declared on a page definition" do
|
9
|
+
it "should generate methods for referencing the table" do
|
10
|
+
watir_definition.should respond_to(:accounts_table)
|
11
|
+
watir_definition.should respond_to(:accounts_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the table" do
|
15
|
+
watir_definition.should respond_to(:accounts_exists?)
|
16
|
+
watir_definition.should respond_to(:accounts?)
|
17
|
+
watir_definition.should respond_to(:accounts_visible?)
|
18
|
+
watir_definition.should respond_to(:accounts_?)
|
19
|
+
watir_definition.should respond_to(:accounts)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when used by the watir platform" do
|
24
|
+
it "should locate the table" do
|
25
|
+
watir_browser.should_receive(:table).and_return(watir_browser)
|
26
|
+
web_object = watir_definition.accounts_table
|
27
|
+
web_object.should_not be_nil
|
28
|
+
web_object.should be_instance_of Symbiont::WebObjects::Table
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should determine if a table exists" do
|
32
|
+
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
33
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
+
watir_definition.accounts_exists?.should be_true
|
35
|
+
watir_definition.accounts?.should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should determine if a table is visible" do
|
39
|
+
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
+
watir_definition.accounts_visible?.should be_true
|
42
|
+
watir_definition.accounts_?.should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return the text of a table" do
|
46
|
+
watir_browser.should_receive(:table).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:text).and_return("testing")
|
48
|
+
watir_definition.accounts.should == "testing"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should call a block on the table if specified" do
|
52
|
+
watir_definition.invoices_object.should == "invoices"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Generators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "text area generators" do
|
8
|
+
context "when declared on a page definition" do
|
9
|
+
it "should generate methods for referencing the text area" do
|
10
|
+
watir_definition.should respond_to(:summary_text_area)
|
11
|
+
watir_definition.should respond_to(:summary_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the text area" do
|
15
|
+
watir_definition.should respond_to(:summary)
|
16
|
+
watir_definition.should respond_to(:summary_exists?)
|
17
|
+
watir_definition.should respond_to(:summary_visible?)
|
18
|
+
watir_definition.should respond_to(:summary_enabled?)
|
19
|
+
watir_definition.should respond_to(:summary?)
|
20
|
+
watir_definition.should respond_to(:summary_?)
|
21
|
+
watir_definition.should respond_to(:summary!)
|
22
|
+
watir_definition.should respond_to(:summary=)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when used by the watir platform" do
|
27
|
+
it "should locate the text area" do
|
28
|
+
watir_browser.should_receive(:text_area).and_return(watir_browser)
|
29
|
+
web_object = watir_definition.summary_object
|
30
|
+
web_object.should_not be_nil
|
31
|
+
web_object.should be_instance_of Symbiont::WebObjects::TextArea
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should retrieve text from the text area" do
|
35
|
+
watir_browser.should_receive(:text_area).and_return(watir_browser)
|
36
|
+
watir_browser.should_receive(:value).and_return("testing")
|
37
|
+
watir_definition.summary.should == "testing"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should enter text into a text area" do
|
41
|
+
watir_browser.should_receive(:text_area).and_return(watir_browser)
|
42
|
+
watir_browser.should_receive(:set).with("testing")
|
43
|
+
watir_definition.summary = "testing"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should determine if a text area exists" do
|
47
|
+
watir_browser.should_receive(:text_area).twice.and_return(watir_browser)
|
48
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
49
|
+
watir_definition.summary_exists?.should be_true
|
50
|
+
watir_definition.summary?.should be_true
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should determine if a text area is visible" do
|
54
|
+
watir_browser.should_receive(:text_area).twice.and_return(watir_browser)
|
55
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
56
|
+
watir_definition.summary_visible?.should be_true
|
57
|
+
watir_definition.summary_?.should be_true
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should determine if a text area is enabled" do
|
61
|
+
watir_browser.should_receive(:text_area).twice.and_return(watir_browser)
|
62
|
+
watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
|
63
|
+
watir_definition.summary_enabled?.should be_true
|
64
|
+
watir_definition.summary!.should be_true
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should call a block on the text area if specified" do
|
68
|
+
watir_definition.description_object.should == "description"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|