fluent 0.4.0 → 0.5.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 +11 -0
- data/lib/fluent.rb +4 -0
- data/lib/fluent/factory.rb +20 -1
- data/lib/fluent/version.rb +1 -1
- metadata +62 -129
- data/.gitignore +0 -19
- data/.travis.yml +0 -14
- data/Gemfile +0 -5
- data/Rakefile +0 -13
- data/fluent.gemspec +0 -33
- data/spec/enclosers_spec.rb +0 -38
- data/spec/evaluators_spec.rb +0 -88
- data/spec/factory_spec.rb +0 -49
- data/spec/fluent_spec.rb +0 -40
- data/spec/generators/button_generators_spec.rb +0 -77
- data/spec/generators/cell_generators_spec.rb +0 -50
- data/spec/generators/checkbox_generators_spec.rb +0 -88
- data/spec/generators/div_generators_spec.rb +0 -49
- data/spec/generators/form_generators_spec.rb +0 -42
- data/spec/generators/heading_generators_spec.rb +0 -87
- data/spec/generators/hidden_generators_spec.rb +0 -49
- data/spec/generators/image_generators_spec.rb +0 -42
- data/spec/generators/label_generators_spec.rb +0 -49
- data/spec/generators/link_generators_spec.rb +0 -64
- data/spec/generators/list_item_generators_spec.rb +0 -53
- data/spec/generators/ordered_list_generators_spec.rb +0 -53
- data/spec/generators/paragraph_generators_spec.rb +0 -65
- data/spec/generators/radio_generators_spec.rb +0 -85
- data/spec/generators/select_list_generators_spec.rb +0 -120
- data/spec/generators/span_generators_spec.rb +0 -49
- data/spec/generators/table_generators_spec.rb +0 -49
- data/spec/generators/text_area_generators_spec.rb +0 -55
- data/spec/generators/text_field_generators_spec.rb +0 -81
- data/spec/generators/unordered_list_generators_spec.rb +0 -53
- data/spec/generators_spec.rb +0 -87
- data/spec/mock_app.rb +0 -31
- data/spec/platform_object_spec.rb +0 -32
- data/spec/spec_helper.rb +0 -19
- data/spec/web_element_spec.rb +0 -38
- data/spec/web_element_watir_spec.rb +0 -156
- data/spec/web_elements/button_spec.rb +0 -21
- data/spec/web_elements/cell_spec.rb +0 -13
- data/spec/web_elements/checkbox_spec.rb +0 -25
- data/spec/web_elements/div_spec.rb +0 -9
- data/spec/web_elements/form_spec.rb +0 -9
- data/spec/web_elements/heading_spec.rb +0 -28
- data/spec/web_elements/hidden_spec.rb +0 -9
- data/spec/web_elements/image_spec.rb +0 -9
- data/spec/web_elements/label_spec.rb +0 -9
- data/spec/web_elements/link_spec.rb +0 -9
- data/spec/web_elements/list_item_spec.rb +0 -9
- data/spec/web_elements/option_spec.rb +0 -9
- data/spec/web_elements/ordered_list_spec.rb +0 -42
- data/spec/web_elements/paragraph_spec.rb +0 -9
- data/spec/web_elements/radio_spec.rb +0 -25
- data/spec/web_elements/select_list_spec.rb +0 -45
- data/spec/web_elements/span_spec.rb +0 -9
- data/spec/web_elements/table_row_spec.rb +0 -47
- data/spec/web_elements/table_spec.rb +0 -54
- data/spec/web_elements/text_area_spec.rb +0 -27
- data/spec/web_elements/text_field_spec.rb +0 -29
- data/spec/web_elements/unordered_list_spec.rb +0 -42
data/spec/enclosers_spec.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class EnclosersTest
|
4
|
-
include Fluent
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
describe Fluent::Enclosers do
|
9
|
-
let(:watir_browser) { mock_browser_for_watir }
|
10
|
-
let(:watir_definition) { EnclosersTest.new(watir_browser) }
|
11
|
-
|
12
|
-
context 'a definition using watir-webdriver' do
|
13
|
-
it 'should handle alert message boxes' do
|
14
|
-
watir_browser.should_receive(:alert).exactly(3).times.and_return(watir_browser)
|
15
|
-
watir_browser.should_receive(:exists?).and_return(true)
|
16
|
-
watir_browser.should_receive(:text)
|
17
|
-
watir_browser.should_receive(:ok)
|
18
|
-
watir_definition.will_alert do
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should handle confirmation message boxes' do
|
23
|
-
watir_browser.should_receive(:alert).exactly(3).times.and_return(watir_browser)
|
24
|
-
watir_browser.should_receive(:exists?).and_return(true)
|
25
|
-
watir_browser.should_receive(:text)
|
26
|
-
watir_browser.should_receive(:ok)
|
27
|
-
watir_definition.will_confirm(true) do
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should handle prompt message boxes' do
|
32
|
-
watir_browser.should_receive(:wd).twice.and_return(watir_browser)
|
33
|
-
watir_browser.should_receive(:execute_script).twice
|
34
|
-
watir_definition.will_prompt('Testing') do
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/spec/evaluators_spec.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'mock_app'
|
3
|
-
|
4
|
-
describe Fluent::Evaluators do
|
5
|
-
let(:watir_browser) { mock_browser_for_watir }
|
6
|
-
let(:watir_definition) { TestDefinition.new(watir_browser) }
|
7
|
-
|
8
|
-
describe 'browser-level actions' do
|
9
|
-
context 'a definition using watir-webdriver' do
|
10
|
-
it 'should get the active url' do
|
11
|
-
watir_browser.should_receive(:url).twice.and_return('http://localhost:9292')
|
12
|
-
watir_definition.url.should == 'http://localhost:9292'
|
13
|
-
watir_definition.current_url.should == 'http://localhost:9292'
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should be able to clear all of the cookies from the browser' do
|
17
|
-
watir_browser.should_receive(:cookies).twice.and_return(watir_browser)
|
18
|
-
watir_browser.should_receive(:clear).twice
|
19
|
-
watir_definition.remove_cookies
|
20
|
-
watir_definition.clear_cookies
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should be able to refresh the page contents' do
|
24
|
-
watir_browser.should_receive(:refresh).twice.and_return(watir_browser)
|
25
|
-
watir_definition.refresh_page
|
26
|
-
watir_definition.refresh
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should run a script against the browser' do
|
30
|
-
watir_browser.should_receive(:execute_script).twice.and_return('input')
|
31
|
-
watir_definition.run_script('return document.activeElement').should == 'input'
|
32
|
-
watir_definition.execute_script('return document.activeElement').should == 'input'
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should get a screenshot' do
|
36
|
-
watir_browser.should_receive(:wd).twice.and_return(watir_browser)
|
37
|
-
watir_browser.should_receive(:save_screenshot).twice
|
38
|
-
watir_definition.screenshot('testing.png')
|
39
|
-
watir_definition.save_screenshot('testing.png')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'page-level actions' do
|
45
|
-
context 'a definition using watir-webdriver' do
|
46
|
-
it 'should return all the markup on a page' do
|
47
|
-
watir_browser.should_receive(:html).twice.and_return('<h1>Page Title</h1>')
|
48
|
-
watir_definition.markup.should == '<h1>Page Title</h1>'
|
49
|
-
watir_definition.html.should == '<h1>Page Title</h1>'
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should return the title of a page' do
|
53
|
-
watir_browser.should_receive(:title).twice.and_return('Page Title')
|
54
|
-
watir_definition.page_title.should == 'Page Title'
|
55
|
-
watir_definition.title.should == 'Page Title'
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'should return all the text on a page' do
|
59
|
-
watir_browser.should_receive(:text).twice.and_return('page text')
|
60
|
-
watir_definition.page_text.should == 'page text'
|
61
|
-
watir_definition.text.should == 'page text'
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should wait for jquery pending requests to finish' do
|
65
|
-
watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(0)
|
66
|
-
watir_definition.wait_for_pending_requests
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'should return an exception if pending requests did not finish' do
|
70
|
-
watir_browser.should_receive(:execute_script).at_least(1).times.with('return jQuery.active').and_return(1)
|
71
|
-
expect { watir_definition.wait_for_pending_requests(0.1) }.to raise_error
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should wait for a condition to be true' do
|
75
|
-
watir_browser.should_receive(:wait_until).with(5, 'some condition')
|
76
|
-
watir_definition.wait_until(5, 'some condition')
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should wait for a condition to be true with any page level timeout' do
|
80
|
-
Fluent.page_level_wait = 30
|
81
|
-
watir_browser.should_receive(:wait_until).with(30, nil)
|
82
|
-
watir_definition.wait_until
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
data/spec/factory_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'mock_app'
|
3
|
-
|
4
|
-
class TestFactory
|
5
|
-
include Fluent::Factory
|
6
|
-
|
7
|
-
attr_accessor :driver
|
8
|
-
end
|
9
|
-
|
10
|
-
class DefinitionTest
|
11
|
-
include Fluent
|
12
|
-
|
13
|
-
url_is 'http://localhost:9292'
|
14
|
-
end
|
15
|
-
|
16
|
-
describe Fluent::Factory do
|
17
|
-
before(:each) do
|
18
|
-
@factory = TestFactory.new
|
19
|
-
@factory.driver = mock_browser_for_watir
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should create a new definition object and view it, using on_view' do
|
23
|
-
@factory.driver.should_receive(:goto)
|
24
|
-
@factory.on_view DefinitionTest do |page|
|
25
|
-
page.should be_instance_of DefinitionTest
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should create a new definition object, using on' do
|
30
|
-
@factory.driver.should_not_receive(:goto)
|
31
|
-
@factory.on DefinitionTest do |page|
|
32
|
-
page.should be_instance_of DefinitionTest
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should set a reference to be used outside the factory' do
|
37
|
-
active = @factory.on DefinitionTest
|
38
|
-
current = @factory.instance_variable_get '@active'
|
39
|
-
current.should === active
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should create a new definition based on a string' do
|
43
|
-
@factory.driver.should_receive(:goto)
|
44
|
-
@factory.on_view "DefinitionTest" do |page|
|
45
|
-
page.should be_instance_of DefinitionTest
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/spec/fluent_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Fluent do
|
4
|
-
|
5
|
-
it 'should return version information' do
|
6
|
-
Fluent.version.should == "Fluent v#{Fluent::VERSION}"
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should set the element level wait default to 5' do
|
10
|
-
Fluent.instance_variable_set('@element_wait', nil)
|
11
|
-
Fluent.element_level_wait.should == 5
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should allow the element level wait to be set' do
|
15
|
-
Fluent.instance_variable_set('@element_wait', 10)
|
16
|
-
Fluent.element_level_wait.should == 10
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should be able to set an element level wait value' do
|
20
|
-
Fluent.element_level_wait = 10
|
21
|
-
value = Fluent.instance_variable_get('@element_wait')
|
22
|
-
value.should == 10
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should set the page level wait default to 15' do
|
26
|
-
Fluent.instance_variable_set('@page_wait', nil)
|
27
|
-
Fluent.page_level_wait.should == 15
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should allow the page level wait to be set' do
|
31
|
-
Fluent.instance_variable_set('@page_wait', 10)
|
32
|
-
Fluent.page_level_wait.should == 10
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should be able to set a page level wait value' do
|
36
|
-
Fluent.page_level_wait = 30
|
37
|
-
value = Fluent.instance_variable_get('@page_wait')
|
38
|
-
value.should == 30
|
39
|
-
end
|
40
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
class ButtonGenerators
|
4
|
-
include Fluent
|
5
|
-
|
6
|
-
button :submit, id: 'submit'
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Fluent::Generators do
|
10
|
-
let(:watir_browser) { mock_browser_for_watir }
|
11
|
-
let(:watir_definition) { ButtonGenerators.new(watir_browser) }
|
12
|
-
|
13
|
-
describe 'button generators' do
|
14
|
-
context 'when declared on a page definition' do
|
15
|
-
it 'should generate methods for referencing the button' do
|
16
|
-
watir_definition.should respond_to(:submit_object)
|
17
|
-
watir_definition.should respond_to(:submit_element)
|
18
|
-
watir_definition.should respond_to(:submit_button)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should generate methods for interacting with the button' do
|
22
|
-
watir_definition.should respond_to(:submit)
|
23
|
-
watir_definition.should respond_to(:submit_exists?)
|
24
|
-
watir_definition.should respond_to(:submit_visible?)
|
25
|
-
watir_definition.should respond_to(:submit_enabled?)
|
26
|
-
watir_definition.should respond_to(:submit?)
|
27
|
-
watir_definition.should respond_to(:submit_?)
|
28
|
-
watir_definition.should respond_to(:submit!)
|
29
|
-
watir_definition.should respond_to(:submit_button_exists?)
|
30
|
-
watir_definition.should respond_to(:submit_button_visible?)
|
31
|
-
watir_definition.should respond_to(:submit_button_enabled?)
|
32
|
-
watir_definition.should respond_to(:submit_button?)
|
33
|
-
watir_definition.should respond_to(:submit_button_?)
|
34
|
-
watir_definition.should respond_to(:submit_button!)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'when used by the watir platform' do
|
39
|
-
it 'should locate the button' do
|
40
|
-
watir_browser.should_receive(:button).and_return(watir_browser)
|
41
|
-
web_element = watir_definition.submit_object
|
42
|
-
web_element.should_not be_nil
|
43
|
-
web_element.should be_instance_of Fluent::WebElements::Button
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should click the button' do
|
47
|
-
watir_browser.should_receive(:button).and_return(watir_browser)
|
48
|
-
watir_browser.should_receive(:click)
|
49
|
-
watir_definition.submit
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should determine if a button exists' do
|
53
|
-
watir_browser.should_receive(:button).exactly(3).times.and_return(watir_browser)
|
54
|
-
watir_browser.should_receive(:exists?).exactly(3).times.and_return(watir_browser)
|
55
|
-
watir_definition.submit?.should be_true
|
56
|
-
watir_definition.submit_exists?.should be_true
|
57
|
-
watir_definition.submit_button_exists?.should be_true
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should determine if a button is visible' do
|
61
|
-
watir_browser.should_receive(:button).exactly(3).times.and_return(watir_browser)
|
62
|
-
watir_browser.should_receive(:present?).exactly(3).times.and_return(watir_browser)
|
63
|
-
watir_definition.submit_?.should be_true
|
64
|
-
watir_definition.submit_visible?.should be_true
|
65
|
-
watir_definition.submit_button_visible?.should be_true
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should determine if a button is enabled' do
|
69
|
-
watir_browser.should_receive(:button).exactly(3).times.and_return(watir_browser)
|
70
|
-
watir_browser.should_receive(:enabled?).exactly(3).times.and_return(watir_browser)
|
71
|
-
watir_definition.submit!.should be_true
|
72
|
-
watir_definition.submit_enabled?.should be_true
|
73
|
-
watir_definition.submit_button_enabled?.should be_true
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
class CellGenerators
|
4
|
-
include Fluent
|
5
|
-
|
6
|
-
cell :total, id: 'total'
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Fluent::Generators do
|
10
|
-
let(:watir_browser) { mock_browser_for_watir }
|
11
|
-
let(:watir_definition) { CellGenerators.new(watir_browser) }
|
12
|
-
|
13
|
-
describe 'cell generators' do
|
14
|
-
context 'when declared on a page definition' do
|
15
|
-
it 'should generate methods for referencing the cell' do
|
16
|
-
watir_definition.should respond_to(:total_object)
|
17
|
-
watir_definition.should respond_to(:total_element)
|
18
|
-
watir_definition.should respond_to(:total_cell)
|
19
|
-
watir_definition.should respond_to(:total_td)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should generate methods for interacting with the cell' do
|
23
|
-
watir_definition.should respond_to(:total)
|
24
|
-
watir_definition.should respond_to(:total_exists?)
|
25
|
-
watir_definition.should respond_to(:total_visible?)
|
26
|
-
watir_definition.should respond_to(:total?)
|
27
|
-
watir_definition.should respond_to(:total_?)
|
28
|
-
watir_definition.should respond_to(:total_td_exists?)
|
29
|
-
watir_definition.should respond_to(:total_td_visible?)
|
30
|
-
watir_definition.should respond_to(:total_td?)
|
31
|
-
watir_definition.should respond_to(:total_td_?)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'when used by the watir platform' do
|
36
|
-
it 'should locate the cell' do
|
37
|
-
watir_browser.should_receive(:td).and_return(watir_browser)
|
38
|
-
web_element = watir_definition.total_cell
|
39
|
-
web_element.should_not be_nil
|
40
|
-
web_element.should be_instance_of Fluent::WebElements::Cell
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should return the text of a table' do
|
44
|
-
watir_browser.should_receive(:td).and_return(watir_browser)
|
45
|
-
watir_browser.should_receive(:text).and_return('testing')
|
46
|
-
watir_definition.total.should == 'testing'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,88 +0,0 @@
|
|
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
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
class DivGenerators
|
4
|
-
include Fluent
|
5
|
-
|
6
|
-
div :section, id: 'section'
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Fluent::Generators do
|
10
|
-
let(:watir_browser) { mock_browser_for_watir }
|
11
|
-
let(:watir_definition) { DivGenerators.new(watir_browser) }
|
12
|
-
|
13
|
-
describe 'div generators' do
|
14
|
-
context 'when declared on a page definition' do
|
15
|
-
it 'should generate methods for referencing the div' do
|
16
|
-
watir_definition.should respond_to(:section_object)
|
17
|
-
watir_definition.should respond_to(:section_element)
|
18
|
-
watir_definition.should respond_to(:section_div)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should generate methods for interacting with the div' do
|
22
|
-
watir_definition.should respond_to(:section)
|
23
|
-
watir_definition.should respond_to(:section_exists?)
|
24
|
-
watir_definition.should respond_to(:section_visible?)
|
25
|
-
watir_definition.should respond_to(:section?)
|
26
|
-
watir_definition.should respond_to(:section_?)
|
27
|
-
watir_definition.should respond_to(:section_div_exists?)
|
28
|
-
watir_definition.should respond_to(:section_div_visible?)
|
29
|
-
watir_definition.should respond_to(:section_div?)
|
30
|
-
watir_definition.should respond_to(:section_div_?)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when used by the watir platform' do
|
35
|
-
it 'should locate the div' do
|
36
|
-
watir_browser.should_receive(:div).and_return(watir_browser)
|
37
|
-
web_element = watir_definition.section_div
|
38
|
-
web_element.should_not be_nil
|
39
|
-
web_element.should be_instance_of Fluent::WebElements::Div
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should return the text of a div' do
|
43
|
-
watir_browser.should_receive(:div).and_return(watir_browser)
|
44
|
-
watir_browser.should_receive(:text).and_return('testing')
|
45
|
-
watir_definition.section.should == 'testing'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|