symbiont 0.0.4 → 0.1.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.md +6 -0
- data/cucumber.yml +1 -1
- data/lib/symbiont/generators.rb +279 -3
- data/lib/symbiont/platform_watir/platform_object.rb +217 -0
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +22 -1
- data/lib/symbiont/web_objects/checkbox.rb +9 -0
- data/lib/symbiont/web_objects/div.rb +9 -0
- data/lib/symbiont/web_objects/radio.rb +9 -0
- data/lib/symbiont/web_objects/select_list.rb +9 -0
- data/lib/symbiont/web_objects/span.rb +9 -0
- data/lib/symbiont/web_objects/table.rb +38 -0
- data/lib/symbiont/web_objects/table_cell.rb +9 -0
- data/lib/symbiont/web_objects/table_row.rb +26 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/symbiont/generators/cell_generators_spec.rb +52 -0
- data/spec/symbiont/generators/checkbox_generators_spec.rb +75 -0
- data/spec/symbiont/generators/div_generators_spec.rb +52 -0
- data/spec/symbiont/generators/radio_generators_spec.rb +78 -0
- data/spec/symbiont/generators/select_list_generators_spec.rb +77 -0
- data/spec/symbiont/generators/span_generators_spec.rb +52 -0
- data/spec/symbiont/generators/table_generators_spec.rb +45 -0
- data/spec/symbiont/web_object_spec.rb +20 -0
- data/spec/symbiont/web_objects/table_row_spec.rb +24 -0
- data/spec/symbiont/web_objects/table_spec.rb +33 -0
- data/specs/button.feature +22 -22
- data/specs/checkbox.feature +40 -0
- data/specs/definitions/pages.rb +88 -41
- data/specs/div.feature +11 -0
- data/specs/frame.feature +2 -2
- data/specs/link.feature +15 -15
- data/specs/radio.feature +38 -0
- data/specs/select_list.feature +38 -0
- data/specs/span.feature +11 -0
- data/specs/support/env.rb +2 -0
- data/specs/support/test_steps/action_steps_buttons.rb +67 -0
- data/specs/support/test_steps/action_steps_checkboxes.rb +75 -0
- data/specs/support/test_steps/action_steps_divs.rb +18 -0
- data/specs/support/test_steps/action_steps_frames.rb +13 -0
- data/specs/support/test_steps/action_steps_links.rb +41 -0
- data/specs/support/test_steps/action_steps_navigate.rb +15 -0
- data/specs/support/test_steps/action_steps_radios.rb +75 -0
- data/specs/support/test_steps/action_steps_select_lists.rb +72 -0
- data/specs/support/test_steps/action_steps_spans.rb +18 -0
- data/specs/support/test_steps/action_steps_tables.rb +69 -0
- data/specs/support/test_steps/action_steps_text_fields.rb +68 -0
- data/specs/table.feature +27 -0
- data/specs/text_field.feature +18 -18
- metadata +42 -9
- data/specs/support/test_steps/action_steps.rb +0 -207
@@ -0,0 +1,26 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module WebObjects
|
3
|
+
|
4
|
+
class TableRow < WebObject
|
5
|
+
|
6
|
+
# This method is used to return a TableCell object based on the index provided.
|
7
|
+
# @return [Symbiont::WebObjects::TableCell]
|
8
|
+
def [](index)
|
9
|
+
Object::Symbiont::WebObjects::TableCell.new(@web_object[index])
|
10
|
+
end
|
11
|
+
|
12
|
+
# This method returns the number of columns in a table object.
|
13
|
+
def columns
|
14
|
+
@web_object.wd.find_elements(:xpath, cell_xpath).size
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def cell_xpath
|
20
|
+
".//child::td|th"
|
21
|
+
end
|
22
|
+
|
23
|
+
end # class: TableRow
|
24
|
+
|
25
|
+
end # module: WebObjects
|
26
|
+
end # module: Symbiont
|
data/spec/spec_helper.rb
CHANGED
@@ -23,6 +23,13 @@ class DefinitionTest
|
|
23
23
|
link :reset_password, id: "resetPassword"
|
24
24
|
button :submit, id: "btnSubmit"
|
25
25
|
text_field :login_name, id: "loginName"
|
26
|
+
select_list :concepts, id: "concepts"
|
27
|
+
checkbox :apply_tax, id: "applyTax"
|
28
|
+
radio :include_tax, id: "includeTax"
|
29
|
+
table :accounts, id: "accounts"
|
30
|
+
cell :totalValue, id: "totalValue"
|
31
|
+
div :section, id: "section"
|
32
|
+
span :inline, id: "inline"
|
26
33
|
|
27
34
|
within_frame(id: "frame") do |frame|
|
28
35
|
text_field :framedLoginName, id: "framedLoginName", frame: frame
|
@@ -0,0 +1,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 "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(:visible?).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
|
@@ -0,0 +1,75 @@
|
|
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 "checkbox web objects" do
|
8
|
+
context "when declared in a definition" do
|
9
|
+
it "should generate methods for referencing the checkbox" do
|
10
|
+
watir_definition.should respond_to(:apply_tax_checkbox)
|
11
|
+
watir_definition.should respond_to(:apply_tax_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the checkbox" do
|
15
|
+
watir_definition.should respond_to(:apply_tax_exists?)
|
16
|
+
watir_definition.should respond_to(:apply_tax_visible?)
|
17
|
+
watir_definition.should respond_to(:apply_tax_enabled?)
|
18
|
+
watir_definition.should respond_to(:apply_tax?)
|
19
|
+
watir_definition.should respond_to(:apply_tax_?)
|
20
|
+
watir_definition.should respond_to(:apply_tax!)
|
21
|
+
watir_definition.should respond_to(:apply_tax_checked?)
|
22
|
+
watir_definition.should respond_to(:check_apply_tax)
|
23
|
+
watir_definition.should respond_to(:uncheck_apply_tax)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when used by the watir platform" do
|
28
|
+
it "should locate the checkbox" do
|
29
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
30
|
+
web_object = watir_definition.apply_tax_object
|
31
|
+
web_object.should_not be_nil
|
32
|
+
web_object.should be_instance_of Symbiont::WebObjects::CheckBox
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should determine if a checkbox exists" do
|
36
|
+
watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
|
37
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
38
|
+
watir_definition.apply_tax_exists?.should be_true
|
39
|
+
watir_definition.apply_tax?.should be_true
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should determine if a checkbox is visible" do
|
43
|
+
watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
|
44
|
+
watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
|
45
|
+
watir_definition.apply_tax_visible?.should be_true
|
46
|
+
watir_definition.apply_tax_?.should be_true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should determine if a checkbox is enabled" do
|
50
|
+
watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
|
51
|
+
watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
|
52
|
+
watir_definition.apply_tax_enabled?.should be_true
|
53
|
+
watir_definition.apply_tax!.should be_true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should determine if a checkbox is checked" do
|
57
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
58
|
+
watir_browser.should_receive(:set?).and_return(true)
|
59
|
+
watir_definition.apply_tax_checked?.should be_true
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should be able to check a checkbox" do
|
63
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
64
|
+
watir_browser.should_receive(:set)
|
65
|
+
watir_definition.check_apply_tax
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should be able to uncheck a checkbox" do
|
69
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
70
|
+
watir_browser.should_receive(:clear)
|
71
|
+
watir_definition.uncheck_apply_tax
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,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 "div web objects" do
|
8
|
+
context "when declared in a definition" do
|
9
|
+
it "should generate methods for referencing the div" do
|
10
|
+
watir_definition.should respond_to(:section_div)
|
11
|
+
watir_definition.should respond_to(:section_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the div" do
|
15
|
+
watir_definition.should respond_to(:section_exists?)
|
16
|
+
watir_definition.should respond_to(:section_visible?)
|
17
|
+
watir_definition.should respond_to(:section?)
|
18
|
+
watir_definition.should respond_to(:section_?)
|
19
|
+
watir_definition.should respond_to(:section)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when used by the watir platform" do
|
24
|
+
it "should locate the div" do
|
25
|
+
watir_browser.should_receive(:div).and_return(watir_browser)
|
26
|
+
web_object = watir_definition.section_div
|
27
|
+
web_object.should_not be_nil
|
28
|
+
web_object.should be_instance_of Symbiont::WebObjects::Div
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should determine if a div exists" do
|
32
|
+
watir_browser.should_receive(:div).twice.and_return(watir_browser)
|
33
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
+
watir_definition.section_exists?.should be_true
|
35
|
+
watir_definition.section?.should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should determine if a div is visible" do
|
39
|
+
watir_browser.should_receive(:div).twice.and_return(watir_browser)
|
40
|
+
watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
|
41
|
+
watir_definition.section_visible?.should be_true
|
42
|
+
watir_definition.section_?.should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return the text of a span" do
|
46
|
+
watir_browser.should_receive(:div).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:text).and_return("testing")
|
48
|
+
watir_definition.section.should == "testing"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,78 @@
|
|
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 "radio web objects" do
|
8
|
+
context "when declared in a definition" do
|
9
|
+
it "should generate methods for referencing the radio" do
|
10
|
+
watir_definition.should respond_to(:include_tax_radio)
|
11
|
+
watir_definition.should respond_to(:include_tax_radio_button)
|
12
|
+
watir_definition.should respond_to(:include_tax_object)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should generate methods for interacting with the radio" do
|
16
|
+
watir_definition.should respond_to(:include_tax_exists?)
|
17
|
+
watir_definition.should respond_to(:include_tax_visible?)
|
18
|
+
watir_definition.should respond_to(:include_tax_enabled?)
|
19
|
+
watir_definition.should respond_to(:include_tax?)
|
20
|
+
watir_definition.should respond_to(:include_tax_?)
|
21
|
+
watir_definition.should respond_to(:include_tax!)
|
22
|
+
watir_definition.should respond_to(:include_tax_selected?)
|
23
|
+
watir_definition.should respond_to(:include_tax_set?)
|
24
|
+
watir_definition.should respond_to(:set_include_tax)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when used by the watir platform" do
|
29
|
+
it "should locate the radio" do
|
30
|
+
watir_browser.should_receive(:radio).and_return(watir_browser)
|
31
|
+
web_object = watir_definition.include_tax_radio
|
32
|
+
web_object.should_not be_nil
|
33
|
+
web_object.should be_instance_of Symbiont::WebObjects::Radio
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should determine if a radio exists" do
|
37
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
38
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
39
|
+
watir_definition.include_tax_exists?.should be_true
|
40
|
+
watir_definition.include_tax?.should be_true
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should determine if a radio is visible" do
|
44
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
45
|
+
watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
|
46
|
+
watir_definition.include_tax_visible?.should be_true
|
47
|
+
watir_definition.include_tax_?.should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should determine if a radio is enabled" do
|
51
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
52
|
+
watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
|
53
|
+
watir_definition.include_tax_enabled?.should be_true
|
54
|
+
watir_definition.include_tax!.should be_true
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should determine if a radio is set" do
|
58
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
59
|
+
watir_browser.should_receive(:set?).twice.and_return(watir_browser)
|
60
|
+
watir_definition.include_tax_selected?.should be_true
|
61
|
+
watir_definition.include_tax_set?.should be_true
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should set a radio" do
|
65
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
66
|
+
watir_browser.should_receive(:set).twice.and_return(watir_browser)
|
67
|
+
watir_definition.select_include_tax
|
68
|
+
watir_definition.set_include_tax
|
69
|
+
end
|
70
|
+
|
71
|
+
#it "should clear a radio" do
|
72
|
+
# watir_browser.should_receive(:radio).and_return(watir_browser)
|
73
|
+
# watir_browser.should_receive(:clear).and_return(watir_browser)
|
74
|
+
# watir_definition.clear_include_tax
|
75
|
+
#end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,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 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(:visible?).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
|
@@ -0,0 +1,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 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(:visible?).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
|
@@ -0,0 +1,45 @@
|
|
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
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when used by the watir platform" do
|
23
|
+
it "should locate the table" do
|
24
|
+
watir_browser.should_receive(:table).and_return(watir_browser)
|
25
|
+
web_object = watir_definition.accounts_table
|
26
|
+
web_object.should_not be_nil
|
27
|
+
web_object.should be_instance_of Symbiont::WebObjects::Table
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should determine if a table exists" do
|
31
|
+
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
32
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
33
|
+
watir_definition.accounts_exists?.should be_true
|
34
|
+
watir_definition.accounts?.should be_true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should determine if a table is visible" do
|
38
|
+
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
39
|
+
watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
|
40
|
+
watir_definition.accounts_visible?.should be_true
|
41
|
+
watir_definition.accounts_?.should be_true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -4,6 +4,26 @@ describe "Web Objects" do
|
|
4
4
|
let(:watir_browser) { mock_browser_for_watir }
|
5
5
|
let(:watir_definition) { ::Symbiont::WebObjects::WebObject.new(watir_browser) }
|
6
6
|
|
7
|
+
it "should determine if a web object is enabled" do
|
8
|
+
watir_browser.should_receive(:enabled?).and_return(true)
|
9
|
+
watir_definition.enabled?.should == true
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should determine if a web object is disabled" do
|
13
|
+
watir_browser.should_receive(:enabled?).and_return(false)
|
14
|
+
watir_definition.disabled?.should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should determine if a web object exists" do
|
18
|
+
watir_browser.should_receive(:exists?).and_return(true)
|
19
|
+
watir_definition.exists?.should == true
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should determine if a web object is visible" do
|
23
|
+
watir_browser.should_receive(:visible?).and_return(true)
|
24
|
+
watir_definition.visible?.should == true
|
25
|
+
end
|
26
|
+
|
7
27
|
it "should return the text contained by a web object" do
|
8
28
|
watir_browser.should_receive(:text).and_return("testing")
|
9
29
|
watir_definition.text.should == "testing"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::WebObjects::TableRow do
|
4
|
+
describe "implementation" do
|
5
|
+
let(:table_cell) { double('table_cell') }
|
6
|
+
let(:table_row_object) { double('table_row_object') }
|
7
|
+
|
8
|
+
context "on the watir platform" do
|
9
|
+
it "should return a table cell when indexed" do
|
10
|
+
table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
|
11
|
+
table_row_object.should_receive(:[]).with(1).and_return(table_cell)
|
12
|
+
table_row[1].should be_instance_of Symbiont::WebObjects::TableCell
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return the number of columns" do
|
16
|
+
table_row = Symbiont::WebObjects::TableRow.new(table_row_object)
|
17
|
+
table_row_object.stub(:wd).and_return(table_row_object)
|
18
|
+
table_row_object.should_receive(:find_elements).with(:xpath, ".//child::td|th").and_return(table_row_object)
|
19
|
+
table_row_object.should_receive(:size).and_return(3)
|
20
|
+
table_row.columns.should == 3
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::WebObjects::Table do
|
4
|
+
describe "implementation" do
|
5
|
+
let(:table_object) { double('table_object') }
|
6
|
+
|
7
|
+
context "on the watir platform" do
|
8
|
+
let(:watir_table) { Symbiont::WebObjects::Table.new(table_object) }
|
9
|
+
|
10
|
+
it "should return a table row when indexed" do
|
11
|
+
table_object.stub(:[]).with(1).and_return(table_object)
|
12
|
+
watir_table[1].should be_instance_of Symbiont::WebObjects::TableRow
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return the first row" do
|
16
|
+
table_object.stub(:[]).with(0).and_return(table_object)
|
17
|
+
watir_table.first_row.should be_instance_of Symbiont::WebObjects::TableRow
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the last row" do
|
21
|
+
table_object.stub(:[]).with(-1).and_return(table_object)
|
22
|
+
watir_table.last_row.should be_instance_of Symbiont::WebObjects::TableRow
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return the number of rows" do
|
26
|
+
table_object.should_receive(:wd).and_return(table_object)
|
27
|
+
table_object.should_receive(:find_elements).with(:xpath, ".//child::tr").and_return(table_object)
|
28
|
+
table_object.should_receive(:size).and_return(2)
|
29
|
+
watir_table.rows.should == 2
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/specs/button.feature
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
Feature: Ability to Support Button Web Objects
|
2
|
-
|
2
|
+
|
3
3
|
Scenario: Reference a button
|
4
|
-
When on the test page
|
4
|
+
When on the object test page
|
5
5
|
Then the click me button should exist
|
6
6
|
And the click me button should be visible
|
7
7
|
And the click me button should be enabled
|
8
|
-
And the click me button
|
9
|
-
|
8
|
+
And the click me button should be a button object
|
9
|
+
|
10
10
|
Scenario: Get text from a button
|
11
|
-
When on the test page
|
11
|
+
When on the object test page
|
12
12
|
Then the text of the click me button should be "Click Me"
|
13
|
-
|
13
|
+
|
14
14
|
Scenario: Click a button
|
15
|
-
When the click me button on the test page is clicked
|
16
|
-
Then the success page appears
|
17
|
-
|
18
|
-
Scenario:
|
19
|
-
When on the test page
|
15
|
+
When the click me button on the simple object test page is clicked
|
16
|
+
Then the first success page appears
|
17
|
+
|
18
|
+
Scenario: Handling a non-existent button
|
19
|
+
When on the object test page
|
20
20
|
Then the fake button should not exist
|
21
|
-
But the fake button
|
22
|
-
|
23
|
-
Scenario:
|
24
|
-
When on the test page
|
25
|
-
Then the
|
26
|
-
And the
|
27
|
-
And the
|
28
|
-
And the
|
29
|
-
But the
|
21
|
+
But the fake button should be a button object
|
22
|
+
|
23
|
+
Scenario: Handling a disabled button
|
24
|
+
When on the object test page
|
25
|
+
Then the can't click me button should exist
|
26
|
+
And the can't click me button should be visible
|
27
|
+
And the text of the can't click me button should be "Can't Click Me"
|
28
|
+
And the can't click me button should be a button object
|
29
|
+
But the can't click me button should not be enabled
|
30
30
|
|
31
31
|
Scenario Outline: Finding buttons with locators
|
32
|
-
When the click me button on the test page is clicked by "<locator>"
|
33
|
-
Then the success page appears
|
32
|
+
When the click me button on the object test page is clicked by "<locator>"
|
33
|
+
Then the first success page appears
|
34
34
|
|
35
35
|
Scenarios:
|
36
36
|
| locator |
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Ability to Support Checkbox Web Objects
|
2
|
+
|
3
|
+
Scenario: Reference a button
|
4
|
+
When on the object test page
|
5
|
+
Then the organic circuitry checkbox should exist
|
6
|
+
And the organic circuitry checkbox should be visible
|
7
|
+
And the organic circuitry checkbox should be enabled
|
8
|
+
And the organic circuitry checkbox should be a checkbox object
|
9
|
+
|
10
|
+
Scenario: Modify checkbox and check state
|
11
|
+
When organic circuitry is not chosen as the futuristic technology
|
12
|
+
Then the organic circuitry checkbox should be unchecked
|
13
|
+
When organic circuitry is chosen as the futuristic technology
|
14
|
+
Then the organic circuitry checkbox should be checked
|
15
|
+
When organic circuitry is not chosen as the futuristic technology
|
16
|
+
Then the organic circuitry checkbox should be unchecked
|
17
|
+
|
18
|
+
Scenario: Handling a non-existent checkbox
|
19
|
+
When on the object test page
|
20
|
+
Then the fake checkbox should not exist
|
21
|
+
But the fake checkbox should be a checkbox object
|
22
|
+
|
23
|
+
Scenario: Handling a disabled checkbox
|
24
|
+
When on the object test page
|
25
|
+
Then the preferential eigenstate selector checkbox should exist
|
26
|
+
And the preferential eigenstate selector checkbox should be visible
|
27
|
+
And the preferential eigenstate selector checkbox should be a checkbox object
|
28
|
+
But the preferential eigenstate selector checkbox should not be enabled
|
29
|
+
|
30
|
+
Scenario Outline: Finding buttons with locators
|
31
|
+
When the kinetic harpoon checkbox on the object test page is checked by "<locator>"
|
32
|
+
Then the kinetic harpoon checkbox should be checked
|
33
|
+
|
34
|
+
Scenarios:
|
35
|
+
| locator |
|
36
|
+
| id |
|
37
|
+
| name |
|
38
|
+
| class |
|
39
|
+
| xpath |
|
40
|
+
| index |
|