fluent 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +14 -0
- data/Gemfile +5 -0
- data/HISTORY.md +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +13 -0
- data/fluent.gemspec +32 -0
- data/lib/fluent.rb +82 -0
- data/lib/fluent/errors.rb +8 -0
- data/lib/fluent/generators.rb +155 -0
- data/lib/fluent/logger.rb +5 -0
- data/lib/fluent/platform_watir.rb +18 -0
- data/lib/fluent/platform_watir/platform_object.rb +112 -0
- data/lib/fluent/platform_watir/platform_web_elements/select_list.rb +30 -0
- data/lib/fluent/platform_watir/platform_web_elements/web_element.rb +21 -0
- data/lib/fluent/platforms.rb +31 -0
- data/lib/fluent/version.rb +3 -0
- data/lib/fluent/web_elements/button.rb +16 -0
- data/lib/fluent/web_elements/checkbox.rb +16 -0
- data/lib/fluent/web_elements/link.rb +16 -0
- data/lib/fluent/web_elements/option.rb +16 -0
- data/lib/fluent/web_elements/paragraph.rb +16 -0
- data/lib/fluent/web_elements/radio.rb +16 -0
- data/lib/fluent/web_elements/select_list.rb +20 -0
- data/lib/fluent/web_elements/text_field.rb +16 -0
- data/lib/fluent/web_elements/web_element.rb +33 -0
- data/spec/fluent_spec.rb +9 -0
- data/spec/generators/button_generators_spec.rb +77 -0
- data/spec/generators/checkbox_generators_spec.rb +88 -0
- data/spec/generators/link_generators_spec.rb +64 -0
- data/spec/generators/paragraph_generators_spec.rb +65 -0
- data/spec/generators/radio_generators_spec.rb +85 -0
- data/spec/generators/select_list_generators_spec.rb +120 -0
- data/spec/generators/text_field_generators_spec.rb +81 -0
- data/spec/generators_spec.rb +42 -0
- data/spec/mock_app.rb +14 -0
- data/spec/platform_object_spec.rb +23 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/web_element_spec.rb +23 -0
- data/spec/web_element_watir_spec.rb +32 -0
- metadata +183 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class CheckboxGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
checkbox :toggle, id: 'toggle'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { CheckboxGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'checkbox generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the checkbox' do
|
16
|
+
watir_definition.should respond_to(:toggle_object)
|
17
|
+
watir_definition.should respond_to(:toggle_element)
|
18
|
+
watir_definition.should respond_to(:toggle_checkbox)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the text checkbox' do
|
22
|
+
watir_definition.should respond_to(:toggle_checked?)
|
23
|
+
watir_definition.should respond_to(:check_toggle)
|
24
|
+
watir_definition.should respond_to(:uncheck_toggle)
|
25
|
+
watir_definition.should respond_to(:toggle_exists?)
|
26
|
+
watir_definition.should respond_to(:toggle_visible?)
|
27
|
+
watir_definition.should respond_to(:toggle_enabled?)
|
28
|
+
watir_definition.should respond_to(:toggle?)
|
29
|
+
watir_definition.should respond_to(:toggle_?)
|
30
|
+
watir_definition.should respond_to(:toggle!)
|
31
|
+
watir_definition.should respond_to(:toggle_checkbox?)
|
32
|
+
watir_definition.should respond_to(:toggle_checkbox_?)
|
33
|
+
watir_definition.should respond_to(:toggle_checkbox!)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when used by the watir platform' do
|
38
|
+
it 'should locate the checkbox' do
|
39
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
40
|
+
web_element = watir_definition.toggle_object
|
41
|
+
web_element.should_not be_nil
|
42
|
+
web_element.should be_instance_of Fluent::WebElements::CheckBox
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should determine if a checkbox is checked' do
|
46
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:set?).and_return(true)
|
48
|
+
watir_definition.toggle_checked?.should be_true
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should be able to check a checkbox' do
|
52
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
53
|
+
watir_browser.should_receive(:set)
|
54
|
+
watir_definition.check_toggle
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should be able to uncheck a checkbox' do
|
58
|
+
watir_browser.should_receive(:checkbox).and_return(watir_browser)
|
59
|
+
watir_browser.should_receive(:clear)
|
60
|
+
watir_definition.uncheck_toggle
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should determine if a checkbox exists' do
|
64
|
+
watir_browser.should_receive(:checkbox).exactly(3).times.and_return(watir_browser)
|
65
|
+
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
66
|
+
watir_definition.toggle_checkbox_exists?.should be_true
|
67
|
+
watir_definition.toggle_exists?.should be_true
|
68
|
+
watir_definition.toggle?.should be_true
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should determine if a checkbox is visible' do
|
72
|
+
watir_browser.should_receive(:checkbox).exactly(3).times.and_return(watir_browser)
|
73
|
+
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
74
|
+
watir_definition.toggle_checkbox_visible?.should be_true
|
75
|
+
watir_definition.toggle_visible?.should be_true
|
76
|
+
watir_definition.toggle_?.should be_true
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should determine if a checkbox is enabled' do
|
80
|
+
watir_browser.should_receive(:checkbox).exactly(3).times.and_return(watir_browser)
|
81
|
+
watir_browser.should_receive(:enabled?).exactly(3).times.and_return(watir_browser)
|
82
|
+
watir_definition.toggle_checkbox_enabled?.should be_true
|
83
|
+
watir_definition.toggle_enabled?.should be_true
|
84
|
+
watir_definition.toggle!.should be_true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class LinkGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
link :contact, id: 'contact'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { LinkGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'link generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the link' do
|
16
|
+
watir_definition.should respond_to(:contact_object)
|
17
|
+
watir_definition.should respond_to(:contact_element)
|
18
|
+
watir_definition.should respond_to(:contact_link)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the link' do
|
22
|
+
watir_definition.should respond_to(:contact)
|
23
|
+
watir_definition.should respond_to(:contact_exists?)
|
24
|
+
watir_definition.should respond_to(:contact_visible?)
|
25
|
+
watir_definition.should respond_to(:contact?)
|
26
|
+
watir_definition.should respond_to(:contact_?)
|
27
|
+
watir_definition.should respond_to(:contact_link_exists?)
|
28
|
+
watir_definition.should respond_to(:contact_link_visible?)
|
29
|
+
watir_definition.should respond_to(:contact_link?)
|
30
|
+
watir_definition.should respond_to(:contact_link_?)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when used by the watir platform' do
|
35
|
+
it 'should locate the link' do
|
36
|
+
watir_browser.should_receive(:link).and_return(watir_browser)
|
37
|
+
web_element = watir_definition.contact_object
|
38
|
+
web_element.should_not be_nil
|
39
|
+
web_element.should be_instance_of Fluent::WebElements::Link
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should click the link' do
|
43
|
+
watir_browser.stub_chain(:link, :click)
|
44
|
+
watir_definition.contact
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should determine if a link exists' do
|
48
|
+
watir_browser.should_receive(:link).exactly(3).times.and_return(watir_browser)
|
49
|
+
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
50
|
+
watir_definition.contact_link_exists?.should be_true
|
51
|
+
watir_definition.contact_exists?.should be_true
|
52
|
+
watir_definition.contact?.should be_true
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should determine if a link is visible' do
|
56
|
+
watir_browser.should_receive(:link).exactly(3).times.and_return(watir_browser)
|
57
|
+
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
58
|
+
watir_definition.contact_link_visible?.should be_true
|
59
|
+
watir_definition.contact_visible?.should be_true
|
60
|
+
watir_definition.contact_?.should be_true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class ParagraphGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
paragraph :purpose, id: 'purpose'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { ParagraphGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'paragraph generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the paragraph' do
|
16
|
+
watir_definition.should respond_to(:purpose_object)
|
17
|
+
watir_definition.should respond_to(:purpose_element)
|
18
|
+
watir_definition.should respond_to(:purpose_paragraph)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the paragraph' do
|
22
|
+
watir_definition.should respond_to(:purpose)
|
23
|
+
watir_definition.should respond_to(:purpose_exists?)
|
24
|
+
watir_definition.should respond_to(:purpose_visible?)
|
25
|
+
watir_definition.should respond_to(:purpose?)
|
26
|
+
watir_definition.should respond_to(:purpose_?)
|
27
|
+
watir_definition.should respond_to(:purpose_paragraph_exists?)
|
28
|
+
watir_definition.should respond_to(:purpose_paragraph_visible?)
|
29
|
+
watir_definition.should respond_to(:purpose_paragraph?)
|
30
|
+
watir_definition.should respond_to(:purpose_paragraph_?)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when used by the watir platform' do
|
35
|
+
it 'should locate the paragraph' do
|
36
|
+
watir_browser.should_receive(:p).and_return(watir_browser)
|
37
|
+
web_element = watir_definition.purpose_object
|
38
|
+
web_element.should_not be_nil
|
39
|
+
web_element.should be_instance_of Fluent::WebElements::Paragraph
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should return the text of a paragraph' do
|
43
|
+
watir_browser.should_receive(:p).and_return(watir_browser)
|
44
|
+
watir_browser.should_receive(:text).and_return('testing')
|
45
|
+
watir_definition.purpose.should == 'testing'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should determine if a paragraph exists' do
|
49
|
+
watir_browser.should_receive(:p).exactly(3).times.and_return(watir_browser)
|
50
|
+
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
51
|
+
watir_definition.purpose_paragraph_exists?.should be_true
|
52
|
+
watir_definition.purpose_exists?.should be_true
|
53
|
+
watir_definition.purpose?.should be_true
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should determine if a paragraph is visible' do
|
57
|
+
watir_browser.should_receive(:p).exactly(3).times.and_return(watir_browser)
|
58
|
+
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
59
|
+
watir_definition.purpose_paragraph_visible?.should be_true
|
60
|
+
watir_definition.purpose_visible?.should be_true
|
61
|
+
watir_definition.purpose_?.should be_true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class RadioGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
radio :female, name: 'gender'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { RadioGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'radio generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the radio' do
|
16
|
+
watir_definition.should respond_to(:female_object)
|
17
|
+
watir_definition.should respond_to(:female_element)
|
18
|
+
watir_definition.should respond_to(:female_radio)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the radio' do
|
22
|
+
watir_definition.should respond_to(:select_female)
|
23
|
+
watir_definition.should respond_to(:set_female)
|
24
|
+
watir_definition.should respond_to(:female_set?)
|
25
|
+
watir_definition.should respond_to(:female_selected?)
|
26
|
+
watir_definition.should respond_to(:female_exists?)
|
27
|
+
watir_definition.should respond_to(:female_visible?)
|
28
|
+
watir_definition.should respond_to(:female_enabled?)
|
29
|
+
watir_definition.should respond_to(:female?)
|
30
|
+
watir_definition.should respond_to(:female_?)
|
31
|
+
watir_definition.should respond_to(:female!)
|
32
|
+
watir_definition.should respond_to(:female_radio?)
|
33
|
+
watir_definition.should respond_to(:female_radio_?)
|
34
|
+
watir_definition.should respond_to(:female_radio!)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when used by the watir platform' do
|
39
|
+
it 'should locate the radio' do
|
40
|
+
watir_browser.should_receive(:radio).and_return(watir_browser)
|
41
|
+
web_element = watir_definition.female_radio
|
42
|
+
web_element.should_not be_nil
|
43
|
+
web_element.should be_instance_of Fluent::WebElements::Radio
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should determine if a radio is set' do
|
47
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
48
|
+
watir_browser.should_receive(:set?).twice.and_return(watir_browser)
|
49
|
+
watir_definition.female_selected?.should be_true
|
50
|
+
watir_definition.female_set?.should be_true
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should set a radio' do
|
54
|
+
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
55
|
+
watir_browser.should_receive(:set).twice.and_return(watir_browser)
|
56
|
+
watir_definition.select_female
|
57
|
+
watir_definition.set_female
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should determine if a radio exists' do
|
61
|
+
watir_browser.should_receive(:radio).exactly(3).times.and_return(watir_browser)
|
62
|
+
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
63
|
+
watir_definition.female_radio_exists?.should be_true
|
64
|
+
watir_definition.female_exists?.should be_true
|
65
|
+
watir_definition.female?.should be_true
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should determine if a radio is visible' do
|
69
|
+
watir_browser.should_receive(:radio).exactly(3).times.and_return(watir_browser)
|
70
|
+
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
71
|
+
watir_definition.female_radio_visible?.should be_true
|
72
|
+
watir_definition.female_visible?.should be_true
|
73
|
+
watir_definition.female_?.should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should determine if a radio is enabled' do
|
77
|
+
watir_browser.should_receive(:radio).exactly(3).times.and_return(watir_browser)
|
78
|
+
watir_browser.should_receive(:enabled?).exactly(3).times.and_return(watir_browser)
|
79
|
+
watir_definition.female_radio_enabled?.should be_true
|
80
|
+
watir_definition.female_enabled?.should be_true
|
81
|
+
watir_definition.female!.should be_true
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class SelectListGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
select_list :list, id: 'list'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { SelectListGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'select list generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the select list' do
|
16
|
+
watir_definition.should respond_to(:list_object)
|
17
|
+
watir_definition.should respond_to(:list_element)
|
18
|
+
watir_definition.should respond_to(:list_select_list)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the select list' do
|
22
|
+
watir_definition.should respond_to(:list)
|
23
|
+
watir_definition.should respond_to(:list=)
|
24
|
+
watir_definition.should respond_to(:list_value?)
|
25
|
+
watir_definition.should respond_to(:list_options?)
|
26
|
+
watir_definition.should respond_to(:list_exists?)
|
27
|
+
watir_definition.should respond_to(:list_visible?)
|
28
|
+
watir_definition.should respond_to(:list_enabled?)
|
29
|
+
watir_definition.should respond_to(:list?)
|
30
|
+
watir_definition.should respond_to(:list_?)
|
31
|
+
watir_definition.should respond_to(:list!)
|
32
|
+
watir_definition.should respond_to(:list_select_list?)
|
33
|
+
watir_definition.should respond_to(:list_select_list_?)
|
34
|
+
watir_definition.should respond_to(:list_select_list!)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when used by the watir platform' do
|
39
|
+
it 'should locate the select list' do
|
40
|
+
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
41
|
+
web_element = watir_definition.list_object
|
42
|
+
web_element.should_not be_nil
|
43
|
+
web_element.should be_instance_of Fluent::WebElements::SelectList
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should select an option from the select list' do
|
47
|
+
watir_browser.should_receive(:select_list).and_return watir_browser
|
48
|
+
watir_browser.should_receive(:select).with('testing')
|
49
|
+
watir_definition.list = 'testing'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should retrieve the current selected option from the select list' do
|
53
|
+
selected = 'testing'
|
54
|
+
selected.should_receive(:text).and_return('testing')
|
55
|
+
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
56
|
+
watir_browser.should_receive(:selected_options).and_return([selected])
|
57
|
+
watir_definition.list.should == 'testing'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should retrieve the current value of a selected option' do
|
61
|
+
watir_browser.should_receive(:select_list).and_return(watir_browser)
|
62
|
+
watir_browser.should_receive(:value).and_return('testing')
|
63
|
+
watir_definition.list_value?.should == 'testing'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should retrieve a list of of selection options' do
|
67
|
+
option1 = double('option')
|
68
|
+
option2 = double('option')
|
69
|
+
option1.should_receive(:text).and_return('list_item_1')
|
70
|
+
option2.should_receive(:text).and_return('list_item_2')
|
71
|
+
select_element = double('select')
|
72
|
+
select_element.should_receive(:options).twice.and_return([option1, option2])
|
73
|
+
watir_definition.should_receive(:list_object).and_return(select_element)
|
74
|
+
watir_definition.list_options?.should == ['list_item_1','list_item_2']
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should return an option when indexed' do
|
78
|
+
list_element = double('select_list')
|
79
|
+
options = [list_element, list_element]
|
80
|
+
web_element = Fluent::WebElements::SelectList.new(list_element, :platform => :watir_webdriver)
|
81
|
+
list_element.should_receive(:wd).and_return(list_element)
|
82
|
+
list_element.should_receive(:find_elements).with(:xpath, './/child::option').and_return(options)
|
83
|
+
web_element[0].should be_instance_of Fluent::WebElements::Option
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should return an array of options when indexed' do
|
87
|
+
list_element = double('select_list')
|
88
|
+
options = [list_element, list_element]
|
89
|
+
web_element = Fluent::WebElements::SelectList.new(list_element, :platform => :watir_webdriver)
|
90
|
+
list_element.should_receive(:wd).and_return(list_element)
|
91
|
+
list_element.should_receive(:find_elements).with(:xpath, './/child::option').and_return(options)
|
92
|
+
web_element.options.size.should == 2
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should determine if a select list exists' do
|
96
|
+
watir_browser.should_receive(:select_list).exactly(3).times.and_return(watir_browser)
|
97
|
+
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
98
|
+
watir_definition.list_select_list_exists?.should be_true
|
99
|
+
watir_definition.list_exists?.should be_true
|
100
|
+
watir_definition.list?.should be_true
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should determine if a select list is visible' do
|
104
|
+
watir_browser.should_receive(:select_list).exactly(3).times.and_return(watir_browser)
|
105
|
+
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
106
|
+
watir_definition.list_select_list_visible?.should be_true
|
107
|
+
watir_definition.list_visible?.should be_true
|
108
|
+
watir_definition.list_?.should be_true
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'should determine if a select list is enabled' do
|
112
|
+
watir_browser.should_receive(:select_list).exactly(3).times.and_return(watir_browser)
|
113
|
+
watir_browser.should_receive(:enabled?).exactly(3).times.and_return(watir_browser)
|
114
|
+
watir_definition.list_select_list_enabled?.should be_true
|
115
|
+
watir_definition.list_enabled?.should be_true
|
116
|
+
watir_definition.list!.should be_true
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class TextFieldGenerators
|
4
|
+
include Fluent
|
5
|
+
|
6
|
+
text_field :name, id: 'name'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Fluent::Generators do
|
10
|
+
let(:watir_browser) { mock_browser_for_watir }
|
11
|
+
let(:watir_definition) { TextFieldGenerators.new(watir_browser) }
|
12
|
+
|
13
|
+
describe 'text field generators' do
|
14
|
+
context 'when declared on a page definition' do
|
15
|
+
it 'should generate methods for referencing the text field' do
|
16
|
+
watir_definition.should respond_to(:name_object)
|
17
|
+
watir_definition.should respond_to(:name_element)
|
18
|
+
watir_definition.should respond_to(:name_text_field)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate methods for interacting with the text field' do
|
22
|
+
watir_definition.should respond_to(:name)
|
23
|
+
watir_definition.should respond_to(:name=)
|
24
|
+
watir_definition.should respond_to(:name_exists?)
|
25
|
+
watir_definition.should respond_to(:name_visible?)
|
26
|
+
watir_definition.should respond_to(:name_enabled?)
|
27
|
+
watir_definition.should respond_to(:name?)
|
28
|
+
watir_definition.should respond_to(:name_?)
|
29
|
+
watir_definition.should respond_to(:name!)
|
30
|
+
watir_definition.should respond_to(:name_text_field?)
|
31
|
+
watir_definition.should respond_to(:name_text_field_?)
|
32
|
+
watir_definition.should respond_to(:name_text_field!)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when used by the watir platform' do
|
37
|
+
it 'should locate the text field' do
|
38
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
39
|
+
web_element = watir_definition.name_object
|
40
|
+
web_element.should_not be_nil
|
41
|
+
web_element.should be_instance_of Fluent::WebElements::TextField
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should enter text into a text field' do
|
45
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
46
|
+
watir_browser.should_receive(:set).with('testing')
|
47
|
+
watir_definition.name = 'testing'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should retrieve text from the text field' do
|
51
|
+
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
52
|
+
watir_browser.should_receive(:value).and_return('testing')
|
53
|
+
watir_definition.name.should == 'testing'
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should determine if a text field exists' do
|
57
|
+
watir_browser.should_receive(:text_field).exactly(3).times.and_return(watir_browser)
|
58
|
+
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
59
|
+
watir_definition.name_text_field_exists?.should be_true
|
60
|
+
watir_definition.name_exists?.should be_true
|
61
|
+
watir_definition.name?.should be_true
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should determine if a text field is visible' do
|
65
|
+
watir_browser.should_receive(:text_field).exactly(3).times.and_return(watir_browser)
|
66
|
+
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
67
|
+
watir_definition.name_text_field_visible?.should be_true
|
68
|
+
watir_definition.name_visible?.should be_true
|
69
|
+
watir_definition.name_?.should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should determine if a text field is enabled' do
|
73
|
+
watir_browser.should_receive(:text_field).exactly(3).times.and_return(watir_browser)
|
74
|
+
watir_browser.should_receive(:enabled?).exactly(3).times.and_return(watir_browser)
|
75
|
+
watir_definition.name_text_field_enabled?.should be_true
|
76
|
+
watir_definition.name_enabled?.should be_true
|
77
|
+
watir_definition.name!.should be_true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|