fluent 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +9 -0
- data/lib/fluent/errors.rb +1 -0
- data/lib/fluent/factory.rb +9 -0
- data/lib/fluent/generators.rb +65 -4
- data/lib/fluent/platform_watir/platform_object.rb +92 -3
- data/lib/fluent/platform_watir/platform_web_elements/ordered_list.rb +26 -0
- data/lib/fluent/platform_watir/platform_web_elements/table.rb +25 -0
- data/lib/fluent/platform_watir/platform_web_elements/table_row.rb +27 -0
- data/lib/fluent/platform_watir/platform_web_elements/text_area.rb +21 -0
- data/lib/fluent/platform_watir/platform_web_elements/text_field.rb +4 -0
- data/lib/fluent/platform_watir/platform_web_elements/unordered_list.rb +26 -0
- data/lib/fluent/platform_watir/platform_web_elements/web_element.rb +7 -0
- data/lib/fluent/version.rb +1 -1
- data/lib/fluent/web_elements.rb +20 -0
- data/lib/fluent/web_elements/button.rb +6 -1
- data/lib/fluent/web_elements/cell.rb +3 -0
- data/lib/fluent/web_elements/checkbox.rb +3 -1
- data/lib/fluent/web_elements/div.rb +2 -0
- data/lib/fluent/web_elements/form.rb +18 -0
- data/lib/fluent/web_elements/heading.rb +23 -0
- data/lib/fluent/web_elements/hidden.rb +18 -0
- data/lib/fluent/web_elements/image.rb +18 -0
- data/lib/fluent/web_elements/label.rb +18 -0
- data/lib/fluent/web_elements/link.rb +2 -0
- data/lib/fluent/web_elements/list_item.rb +2 -0
- data/lib/fluent/web_elements/option.rb +2 -0
- data/lib/fluent/web_elements/ordered_list.rb +19 -1
- data/lib/fluent/web_elements/paragraph.rb +2 -0
- data/lib/fluent/web_elements/radio.rb +3 -1
- data/lib/fluent/web_elements/select_list.rb +2 -0
- data/lib/fluent/web_elements/span.rb +3 -0
- data/lib/fluent/web_elements/table.rb +32 -0
- data/lib/fluent/web_elements/table_row.rb +38 -0
- data/lib/fluent/web_elements/text_area.rb +6 -0
- data/lib/fluent/web_elements/text_field.rb +3 -0
- data/lib/fluent/web_elements/unordered_list.rb +20 -1
- data/spec/factory_spec.rb +7 -0
- data/spec/generators/form_generators_spec.rb +42 -0
- data/spec/generators/heading_generators_spec.rb +87 -0
- data/spec/generators/hidden_generators_spec.rb +49 -0
- data/spec/generators/image_generators_spec.rb +42 -0
- data/spec/generators/label_generators_spec.rb +49 -0
- data/spec/generators/text_area_generators_spec.rb +3 -3
- data/spec/generators_spec.rb +5 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/web_element_watir_spec.rb +6 -0
- data/spec/web_elements/button_spec.rb +21 -0
- data/spec/web_elements/cell_spec.rb +13 -0
- data/spec/web_elements/checkbox_spec.rb +4 -0
- data/spec/web_elements/div_spec.rb +9 -0
- data/spec/web_elements/form_spec.rb +9 -0
- data/spec/web_elements/heading_spec.rb +28 -0
- data/spec/web_elements/hidden_spec.rb +9 -0
- data/spec/web_elements/image_spec.rb +9 -0
- data/spec/web_elements/label_spec.rb +9 -0
- data/spec/web_elements/link_spec.rb +9 -0
- data/spec/web_elements/list_item_spec.rb +9 -0
- data/spec/web_elements/option_spec.rb +9 -0
- data/spec/web_elements/ordered_list_spec.rb +42 -0
- data/spec/web_elements/paragraph_spec.rb +9 -0
- data/spec/web_elements/radio_spec.rb +4 -0
- data/spec/web_elements/select_list_spec.rb +4 -0
- data/spec/web_elements/span_spec.rb +9 -0
- data/spec/web_elements/table_row_spec.rb +47 -0
- data/spec/web_elements/table_spec.rb +54 -0
- data/spec/web_elements/text_area_spec.rb +27 -0
- data/spec/web_elements/text_field_spec.rb +13 -0
- data/spec/web_elements/unordered_list_spec.rb +42 -0
- metadata +61 -2
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class FormGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
form :group, id: 'group'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { FormGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'form generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the form' do
|
16
|
+
watir_definition.should respond_to(:group_object)
|
17
|
+
watir_definition.should respond_to(:group_element)
|
18
|
+
watir_definition.should respond_to(:group_form)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the form' do
|
22
|
+
watir_definition.should respond_to(:group_exists?)
|
23
|
+
watir_definition.should respond_to(:group_visible?)
|
24
|
+
watir_definition.should respond_to(:group?)
|
25
|
+
watir_definition.should respond_to(:group_?)
|
26
|
+
watir_definition.should respond_to(:group_form_exists?)
|
27
|
+
watir_definition.should respond_to(:group_form_visible?)
|
28
|
+
watir_definition.should respond_to(:group_form?)
|
29
|
+
watir_definition.should respond_to(:group_form_?)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when used by the watir platform' do
|
34
|
+
it 'should locate the form' do
|
35
|
+
watir_browser.should_receive(:form).and_return(watir_browser)
|
36
|
+
web_element = watir_definition.group_object
|
37
|
+
web_element.should_not be_nil
|
38
|
+
web_element.should be_instance_of Fluent::WebElements::Form
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class HeadingGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
h1 :headingOne, id: 'headingOne'
|
7
|
+
h2 :headingTwo, id: 'headingTwo'
|
8
|
+
h3 :headingThree, id: 'headingThree'
|
9
|
+
h4 :headingFour, id: 'headingFour'
|
10
|
+
h5 :headingFive, id: 'headingFive'
|
11
|
+
h6 :headingSix, id: 'headingSix'
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Fluent::Generators do
|
15
|
+
let(:watir_browser) { mock_browser_for_watir }
|
16
|
+
let(:watir_definition) { HeadingGenerators.new(watir_browser) }
|
17
|
+
|
18
|
+
describe 'heading generators' do
|
19
|
+
context 'when declared on a page definition' do
|
20
|
+
it 'should generate methods for referencing the heading' do
|
21
|
+
watir_definition.should respond_to(:headingOne_object)
|
22
|
+
watir_definition.should respond_to(:headingTwo_object)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should generate methods for interacting with the heading' do
|
26
|
+
watir_definition.should respond_to(:headingOne)
|
27
|
+
watir_definition.should respond_to(:headingTwo)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when used by the watir platform' do
|
32
|
+
it 'should locate the heading' do
|
33
|
+
watir_browser.should_receive(:h1).and_return(watir_browser)
|
34
|
+
web_element = watir_definition.headingOne_h1
|
35
|
+
web_element.should_not be_nil
|
36
|
+
web_element.should be_instance_of Fluent::WebElements::Heading
|
37
|
+
|
38
|
+
watir_browser.should_receive(:h2).and_return(watir_browser)
|
39
|
+
web_element = watir_definition.headingTwo_h2
|
40
|
+
web_element.should be_instance_of Fluent::WebElements::Heading
|
41
|
+
|
42
|
+
watir_browser.should_receive(:h3).and_return(watir_browser)
|
43
|
+
web_element = watir_definition.headingThree_h3
|
44
|
+
web_element.should be_instance_of Fluent::WebElements::Heading
|
45
|
+
|
46
|
+
watir_browser.should_receive(:h4).and_return(watir_browser)
|
47
|
+
web_element = watir_definition.headingFour_h4
|
48
|
+
web_element.should be_instance_of Fluent::WebElements::Heading
|
49
|
+
|
50
|
+
watir_browser.should_receive(:h5).and_return(watir_browser)
|
51
|
+
web_element = watir_definition.headingFive_h5
|
52
|
+
web_element.should be_instance_of Fluent::WebElements::Heading
|
53
|
+
|
54
|
+
watir_browser.should_receive(:h6).and_return(watir_browser)
|
55
|
+
web_element = watir_definition.headingSix_h6
|
56
|
+
web_element.should be_instance_of Fluent::WebElements::Heading
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should return the text of a heading' do
|
60
|
+
watir_browser.should_receive(:h1).and_return(watir_browser)
|
61
|
+
watir_browser.should_receive(:text).and_return('testing')
|
62
|
+
watir_definition.headingOne.should == 'testing'
|
63
|
+
|
64
|
+
watir_browser.should_receive(:h2).and_return(watir_browser)
|
65
|
+
watir_browser.should_receive(:text).and_return('testing')
|
66
|
+
watir_definition.headingTwo.should == 'testing'
|
67
|
+
|
68
|
+
watir_browser.should_receive(:h3).and_return(watir_browser)
|
69
|
+
watir_browser.should_receive(:text).and_return('testing')
|
70
|
+
watir_definition.headingThree.should == 'testing'
|
71
|
+
|
72
|
+
watir_browser.should_receive(:h4).and_return(watir_browser)
|
73
|
+
watir_browser.should_receive(:text).and_return('testing')
|
74
|
+
watir_definition.headingFour.should == 'testing'
|
75
|
+
|
76
|
+
watir_browser.should_receive(:h5).and_return(watir_browser)
|
77
|
+
watir_browser.should_receive(:text).and_return('testing')
|
78
|
+
watir_definition.headingFive.should == 'testing'
|
79
|
+
|
80
|
+
watir_browser.should_receive(:h6).and_return(watir_browser)
|
81
|
+
watir_browser.should_receive(:text).and_return('testing')
|
82
|
+
watir_definition.headingSix.should == 'testing'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class HiddenGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
hidden :ssn, id: 'ssn'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { HiddenGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'hidden generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the hidden' do
|
16
|
+
watir_definition.should respond_to(:ssn_object)
|
17
|
+
watir_definition.should respond_to(:ssn_element)
|
18
|
+
watir_definition.should respond_to(:ssn_hidden)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the text area' do
|
22
|
+
watir_definition.should respond_to(:ssn)
|
23
|
+
watir_definition.should respond_to(:ssn_exists?)
|
24
|
+
watir_definition.should respond_to(:ssn_visible?)
|
25
|
+
watir_definition.should respond_to(:ssn?)
|
26
|
+
watir_definition.should respond_to(:ssn_?)
|
27
|
+
watir_definition.should respond_to(:ssn_hidden_exists?)
|
28
|
+
watir_definition.should respond_to(:ssn_hidden_visible?)
|
29
|
+
watir_definition.should respond_to(:ssn_hidden?)
|
30
|
+
watir_definition.should respond_to(:ssn_hidden_?)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when used by the watir platform' do
|
35
|
+
it 'should locate the hidden' do
|
36
|
+
watir_browser.should_receive(:hidden).and_return(watir_browser)
|
37
|
+
web_element = watir_definition.ssn_object
|
38
|
+
web_element.should_not be_nil
|
39
|
+
web_element.should be_instance_of Fluent::WebElements::Hidden
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should retrieve text from the hidden' do
|
43
|
+
watir_browser.should_receive(:hidden).and_return(watir_browser)
|
44
|
+
watir_browser.should_receive(:value).and_return('testing')
|
45
|
+
watir_definition.ssn.should == 'testing'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class ImageGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
image :logo, id: 'logo'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { ImageGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'image generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the image' do
|
16
|
+
watir_definition.should respond_to(:logo_object)
|
17
|
+
watir_definition.should respond_to(:logo_element)
|
18
|
+
watir_definition.should respond_to(:logo_image)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the image' do
|
22
|
+
watir_definition.should respond_to(:logo_exists?)
|
23
|
+
watir_definition.should respond_to(:logo_visible?)
|
24
|
+
watir_definition.should respond_to(:logo?)
|
25
|
+
watir_definition.should respond_to(:logo_?)
|
26
|
+
watir_definition.should respond_to(:logo_image_exists?)
|
27
|
+
watir_definition.should respond_to(:logo_image_visible?)
|
28
|
+
watir_definition.should respond_to(:logo_image?)
|
29
|
+
watir_definition.should respond_to(:logo_image_?)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when used by the watir platform' do
|
34
|
+
it 'should locate the image' do
|
35
|
+
watir_browser.should_receive(:image).and_return(watir_browser)
|
36
|
+
web_element = watir_definition.logo_object
|
37
|
+
web_element.should_not be_nil
|
38
|
+
web_element.should be_instance_of Fluent::WebElements::Image
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class LabelGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
label :topic, id: 'topic'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { LabelGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'label generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the label' do
|
16
|
+
watir_definition.should respond_to(:topic_object)
|
17
|
+
watir_definition.should respond_to(:topic_element)
|
18
|
+
watir_definition.should respond_to(:topic_label)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the label' do
|
22
|
+
watir_definition.should respond_to(:topic)
|
23
|
+
watir_definition.should respond_to(:topic_exists?)
|
24
|
+
watir_definition.should respond_to(:topic_visible?)
|
25
|
+
watir_definition.should respond_to(:topic?)
|
26
|
+
watir_definition.should respond_to(:topic_?)
|
27
|
+
watir_definition.should respond_to(:topic_label_exists?)
|
28
|
+
watir_definition.should respond_to(:topic_label_visible?)
|
29
|
+
watir_definition.should respond_to(:topic_label?)
|
30
|
+
watir_definition.should respond_to(:topic_label_?)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when used by the watir platform' do
|
35
|
+
it 'should locate the label' do
|
36
|
+
watir_browser.should_receive(:label).and_return(watir_browser)
|
37
|
+
web_element = watir_definition.topic_object
|
38
|
+
web_element.should_not be_nil
|
39
|
+
web_element.should be_instance_of Fluent::WebElements::Label
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should retrieve text from the label' do
|
43
|
+
watir_browser.should_receive(:label).and_return(watir_browser)
|
44
|
+
watir_browser.should_receive(:text).and_return('testing')
|
45
|
+
watir_definition.topic.should == 'testing'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -33,20 +33,20 @@ describe Fluent::Generators do
|
|
33
33
|
|
34
34
|
context 'when used by the watir platform' do
|
35
35
|
it 'should locate the text area' do
|
36
|
-
watir_browser.should_receive(:
|
36
|
+
watir_browser.should_receive(:textarea).and_return(watir_browser)
|
37
37
|
web_element = watir_definition.summary_object
|
38
38
|
web_element.should_not be_nil
|
39
39
|
web_element.should be_instance_of Fluent::WebElements::TextArea
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should retrieve text from the text area' do
|
43
|
-
watir_browser.should_receive(:
|
43
|
+
watir_browser.should_receive(:textarea).and_return(watir_browser)
|
44
44
|
watir_browser.should_receive(:value).and_return('testing')
|
45
45
|
watir_definition.summary.should == 'testing'
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should enter text into a text area' do
|
49
|
-
watir_browser.should_receive(:
|
49
|
+
watir_browser.should_receive(:textarea).and_return(watir_browser)
|
50
50
|
watir_browser.should_receive(:set).with('testing')
|
51
51
|
watir_definition.summary = 'testing'
|
52
52
|
end
|
data/spec/generators_spec.rb
CHANGED
@@ -18,6 +18,11 @@ describe Fluent::Generators do
|
|
18
18
|
selenium_definition.check_title
|
19
19
|
end
|
20
20
|
|
21
|
+
it 'should specify and verify the page url' do
|
22
|
+
watir_browser.should_receive(:url).twice.and_return('http://localhost:4567')
|
23
|
+
watir_definition.check_url
|
24
|
+
end
|
25
|
+
|
21
26
|
it 'should raise an error if the page title is not verified' do
|
22
27
|
msg = "Expected title: 'Test App'; Actual title: 'Testing'"
|
23
28
|
watir_browser.should_receive(:title).twice.and_return('Testing')
|
data/spec/spec_helper.rb
CHANGED
@@ -147,4 +147,10 @@ describe 'Web Elements for Watir' do
|
|
147
147
|
Object::Watir::Wait.stub(:until).with(5, 'Condition occurred.')
|
148
148
|
watir_definition.wait_until(5, 'Condition occurred.') { true }
|
149
149
|
end
|
150
|
+
|
151
|
+
it 'should find the parent for a web element' do
|
152
|
+
watir_browser.should_receive(:tag_name).twice.and_return(:p)
|
153
|
+
watir_browser.should_receive(:parent).and_return(watir_definition)
|
154
|
+
watir_definition.parent
|
155
|
+
end
|
150
156
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe 'Fluent::WebElements::Button' do
|
4
|
+
|
5
|
+
it 'should register with a submit tag' do
|
6
|
+
::Fluent::WebElements.get_class_for(:input, :submit).should == ::Fluent::WebElements::Button
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should register with a button tag' do
|
10
|
+
::Fluent::WebElements.get_class_for(:input, :button).should == ::Fluent::WebElements::Button
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should register with a image tag' do
|
14
|
+
::Fluent::WebElements.get_class_for(:input, :image).should == ::Fluent::WebElements::Button
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should register with a reset tag' do
|
18
|
+
::Fluent::WebElements.get_class_for(:input, :reset).should == ::Fluent::WebElements::Button
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe 'Fluent::WebElements::Cell' do
|
4
|
+
|
5
|
+
it 'should register with a table definition tag' do
|
6
|
+
::Fluent::WebElements.get_class_for(:td).should == ::Fluent::WebElements::Cell
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should register with a table header tag' do
|
10
|
+
::Fluent::WebElements.get_class_for(:th).should == ::Fluent::WebElements::Cell
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -18,4 +18,8 @@ describe 'WebElements::CheckBox' do
|
|
18
18
|
checkbox_object.should_receive(:clear)
|
19
19
|
checkbox_definition.uncheck
|
20
20
|
end
|
21
|
+
|
22
|
+
it 'should register with a checkbox tag' do
|
23
|
+
::Fluent::WebElements.get_class_for(:input, :checkbox).should == ::Fluent::WebElements::CheckBox
|
24
|
+
end
|
21
25
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe 'Fluent::WebElements::Heading' do
|
4
|
+
|
5
|
+
it 'should register with a h1 tag' do
|
6
|
+
::Fluent::WebElements.get_class_for(:h1).should == ::Fluent::WebElements::Heading
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should register with a h2 tag' do
|
10
|
+
::Fluent::WebElements.get_class_for(:h2).should == ::Fluent::WebElements::Heading
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should register with a h3 tag' do
|
14
|
+
::Fluent::WebElements.get_class_for(:h3).should == ::Fluent::WebElements::Heading
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should register with a h4 tag' do
|
18
|
+
::Fluent::WebElements.get_class_for(:h4).should == ::Fluent::WebElements::Heading
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should register with a h5 tag' do
|
22
|
+
::Fluent::WebElements.get_class_for(:h5).should == ::Fluent::WebElements::Heading
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should register with a h6 tag' do
|
26
|
+
::Fluent::WebElements.get_class_for(:h6).should == ::Fluent::WebElements::Heading
|
27
|
+
end
|
28
|
+
end
|