symbiont 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile.lock +22 -7
  2. data/HISTORY.md +6 -0
  3. data/app/public/css/site.css +16 -0
  4. data/app/public/js/site.js +3 -1
  5. data/app/views/comics.erb +23 -1
  6. data/app/views/webobject.erb +1 -1
  7. data/lib/symbiont/data_setter.rb +7 -3
  8. data/lib/symbiont/enclosers.rb +24 -27
  9. data/lib/symbiont/evaluators.rb +52 -23
  10. data/lib/symbiont/factory.rb +19 -75
  11. data/lib/symbiont/generators.rb +172 -44
  12. data/lib/symbiont/platform_watir/platform_object.rb +202 -18
  13. data/lib/symbiont/version.rb +1 -1
  14. data/lib/symbiont/web_objects/button.rb +1 -1
  15. data/lib/symbiont/web_objects/checkbox.rb +1 -1
  16. data/lib/symbiont/web_objects/heading.rb +12 -0
  17. data/lib/symbiont/web_objects/hidden_field.rb +19 -0
  18. data/lib/symbiont/web_objects/label.rb +15 -0
  19. data/lib/symbiont/web_objects/list_item.rb +13 -0
  20. data/lib/symbiont/web_objects/ordered_list.rb +49 -0
  21. data/lib/symbiont/web_objects/radio.rb +1 -1
  22. data/lib/symbiont/web_objects/select_list.rb +1 -1
  23. data/lib/symbiont/web_objects/table.rb +4 -0
  24. data/lib/symbiont/web_objects/table_row.rb +4 -0
  25. data/lib/symbiont/web_objects/text_area.rb +26 -0
  26. data/lib/symbiont/web_objects/unordered_list.rb +49 -0
  27. data/lib/symbiont.rb +7 -0
  28. data/lucid.yml +6 -0
  29. data/spec/spec_helper.rb +70 -16
  30. data/spec/symbiont/data_setter_spec.rb +65 -62
  31. data/spec/symbiont/enclosers_spec.rb +76 -57
  32. data/spec/symbiont/evaluators_spec.rb +95 -75
  33. data/spec/symbiont/factory_spec.rb +174 -122
  34. data/spec/symbiont/generators/button_generators_spec.rb +34 -31
  35. data/spec/symbiont/generators/checkbox_generators_spec.rb +79 -75
  36. data/spec/symbiont/generators/div_generators_spec.rb +56 -52
  37. data/spec/symbiont/generators/hidden_field_generators_spec.rb +65 -0
  38. data/spec/symbiont/generators/link_generators_spec.rb +30 -27
  39. data/spec/symbiont/generators/paragraph_generators_spec.rb +22 -17
  40. data/spec/symbiont/generators/radio_generators_spec.rb +76 -77
  41. data/spec/symbiont/generators/select_list_generators_spec.rb +93 -77
  42. data/spec/symbiont/generators/span_generators_spec.rb +56 -52
  43. data/spec/symbiont/generators/{cell_generators_spec.rb → table_cell_generators_spec.rb} +56 -52
  44. data/spec/symbiont/generators/table_generators_spec.rb +56 -52
  45. data/spec/symbiont/generators/text_area_generators_spec.rb +72 -0
  46. data/spec/symbiont/generators/text_field_generators_spec.rb +30 -27
  47. data/spec/symbiont/generators_spec.rb +38 -28
  48. data/spec/symbiont/locators_spec.rb +68 -68
  49. data/spec/symbiont/platform_object_spec.rb +2 -4
  50. data/spec/symbiont/symbiont_spec.rb +10 -8
  51. data/spec/symbiont/web_object_spec.rb +194 -194
  52. data/spec/symbiont/web_objects/button_spec.rb +38 -30
  53. data/spec/symbiont/web_objects/checkbox_spec.rb +27 -27
  54. data/spec/symbiont/web_objects/div_spec.rb +18 -11
  55. data/spec/symbiont/web_objects/heading_spec.rb +22 -0
  56. data/spec/symbiont/web_objects/hidden_field_spec.rb +18 -0
  57. data/spec/symbiont/web_objects/label_spec.rb +18 -0
  58. data/spec/symbiont/web_objects/link_spec.rb +33 -33
  59. data/spec/symbiont/web_objects/list_item_spec.rb +18 -0
  60. data/spec/symbiont/web_objects/option_spec.rb +9 -9
  61. data/spec/symbiont/web_objects/ordered_list_spec.rb +53 -0
  62. data/spec/symbiont/web_objects/paragraph_spec.rb +9 -2
  63. data/spec/symbiont/web_objects/radio_spec.rb +27 -27
  64. data/spec/symbiont/web_objects/select_list_spec.rb +69 -69
  65. data/spec/symbiont/web_objects/span_spec.rb +18 -11
  66. data/spec/symbiont/web_objects/table_cell_spec.rb +19 -19
  67. data/spec/symbiont/web_objects/table_row_spec.rb +58 -58
  68. data/spec/symbiont/web_objects/table_spec.rb +61 -61
  69. data/spec/symbiont/web_objects/text_area_spec.rb +18 -0
  70. data/spec/symbiont/web_objects/text_field_spec.rb +39 -39
  71. data/spec/symbiont/web_objects/unordered_list_spec.rb +51 -0
  72. data/specs/common/support/browser.rb +25 -0
  73. data/specs/common/support/env.rb +6 -0
  74. data/specs/common/support/events.rb +15 -0
  75. data/specs/enclosers.feature +9 -0
  76. data/specs/evaluators.feature +26 -0
  77. data/specs/pages/characters.rb +22 -0
  78. data/specs/pages/home.rb +9 -0
  79. data/specs/pages/stardate.rb +23 -0
  80. data/specs/pages/web_objects.rb +77 -0
  81. data/specs/select_list.feature +53 -0
  82. data/specs/steps/enclosers_steps.rb +17 -0
  83. data/specs/steps/evaluators_steps.rb +44 -0
  84. data/specs/steps/navigation_steps.rb +14 -0
  85. data/specs/steps/select_list_steps.rb +94 -0
  86. data/specs/steps/table_cell_steps.rb +31 -0
  87. data/specs/steps/table_steps.rb +87 -0
  88. data/specs/table.feature +49 -0
  89. data/specs/table_cell.feature +27 -0
  90. data/symbiont.gemspec +4 -1
  91. metadata +72 -6
  92. data/cucumber.yml +0 -6
@@ -1,77 +1,93 @@
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 determine if a select list exists" do
56
- watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
57
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
58
- watir_definition.concepts_exists?.should be_true
59
- watir_definition.concepts?.should be_true
60
- end
61
-
62
- it "should determine if a select list is visible" do
63
- watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
64
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
65
- watir_definition.concepts_visible?.should be_true
66
- watir_definition.concepts_?.should be_true
67
- end
68
-
69
- it "should determine if a select list is enabled" do
70
- watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
71
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
72
- watir_definition.concepts_enabled?.should be_true
73
- watir_definition.concepts!.should be_true
74
- end
75
- end
76
- end
77
- end
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) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "span web objects" 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
- end
51
- end
52
- end
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) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "cell web objects" do
8
- context "when declared in a definition" do
9
- it "should generate methods for referencing the cell" do
10
- watir_definition.should respond_to(:totalValue_cell)
11
- watir_definition.should respond_to(:totalValue_object)
12
- end
13
-
14
- it "should generate methods for interacting with the cell" do
15
- watir_definition.should respond_to(:totalValue_exists?)
16
- watir_definition.should respond_to(:totalValue_visible?)
17
- watir_definition.should respond_to(:totalValue?)
18
- watir_definition.should respond_to(:totalValue_?)
19
- watir_definition.should respond_to(:totalValue)
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.totalValue_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.totalValue_exists?.should be_true
35
- watir_definition.totalValue?.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.totalValue_visible?.should be_true
42
- watir_definition.totalValue_?.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.totalValue.should == "testing"
49
- end
50
- end
51
- end
52
- end
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) { mock_browser_for_watir }
5
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
7
- describe "table web objects" do
8
- context "when declared in a 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
- end
51
- end
52
- end
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