fluent 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +11 -0
  3. data/lib/fluent.rb +4 -0
  4. data/lib/fluent/factory.rb +20 -1
  5. data/lib/fluent/version.rb +1 -1
  6. metadata +62 -129
  7. data/.gitignore +0 -19
  8. data/.travis.yml +0 -14
  9. data/Gemfile +0 -5
  10. data/Rakefile +0 -13
  11. data/fluent.gemspec +0 -33
  12. data/spec/enclosers_spec.rb +0 -38
  13. data/spec/evaluators_spec.rb +0 -88
  14. data/spec/factory_spec.rb +0 -49
  15. data/spec/fluent_spec.rb +0 -40
  16. data/spec/generators/button_generators_spec.rb +0 -77
  17. data/spec/generators/cell_generators_spec.rb +0 -50
  18. data/spec/generators/checkbox_generators_spec.rb +0 -88
  19. data/spec/generators/div_generators_spec.rb +0 -49
  20. data/spec/generators/form_generators_spec.rb +0 -42
  21. data/spec/generators/heading_generators_spec.rb +0 -87
  22. data/spec/generators/hidden_generators_spec.rb +0 -49
  23. data/spec/generators/image_generators_spec.rb +0 -42
  24. data/spec/generators/label_generators_spec.rb +0 -49
  25. data/spec/generators/link_generators_spec.rb +0 -64
  26. data/spec/generators/list_item_generators_spec.rb +0 -53
  27. data/spec/generators/ordered_list_generators_spec.rb +0 -53
  28. data/spec/generators/paragraph_generators_spec.rb +0 -65
  29. data/spec/generators/radio_generators_spec.rb +0 -85
  30. data/spec/generators/select_list_generators_spec.rb +0 -120
  31. data/spec/generators/span_generators_spec.rb +0 -49
  32. data/spec/generators/table_generators_spec.rb +0 -49
  33. data/spec/generators/text_area_generators_spec.rb +0 -55
  34. data/spec/generators/text_field_generators_spec.rb +0 -81
  35. data/spec/generators/unordered_list_generators_spec.rb +0 -53
  36. data/spec/generators_spec.rb +0 -87
  37. data/spec/mock_app.rb +0 -31
  38. data/spec/platform_object_spec.rb +0 -32
  39. data/spec/spec_helper.rb +0 -19
  40. data/spec/web_element_spec.rb +0 -38
  41. data/spec/web_element_watir_spec.rb +0 -156
  42. data/spec/web_elements/button_spec.rb +0 -21
  43. data/spec/web_elements/cell_spec.rb +0 -13
  44. data/spec/web_elements/checkbox_spec.rb +0 -25
  45. data/spec/web_elements/div_spec.rb +0 -9
  46. data/spec/web_elements/form_spec.rb +0 -9
  47. data/spec/web_elements/heading_spec.rb +0 -28
  48. data/spec/web_elements/hidden_spec.rb +0 -9
  49. data/spec/web_elements/image_spec.rb +0 -9
  50. data/spec/web_elements/label_spec.rb +0 -9
  51. data/spec/web_elements/link_spec.rb +0 -9
  52. data/spec/web_elements/list_item_spec.rb +0 -9
  53. data/spec/web_elements/option_spec.rb +0 -9
  54. data/spec/web_elements/ordered_list_spec.rb +0 -42
  55. data/spec/web_elements/paragraph_spec.rb +0 -9
  56. data/spec/web_elements/radio_spec.rb +0 -25
  57. data/spec/web_elements/select_list_spec.rb +0 -45
  58. data/spec/web_elements/span_spec.rb +0 -9
  59. data/spec/web_elements/table_row_spec.rb +0 -47
  60. data/spec/web_elements/table_spec.rb +0 -54
  61. data/spec/web_elements/text_area_spec.rb +0 -27
  62. data/spec/web_elements/text_field_spec.rb +0 -29
  63. data/spec/web_elements/unordered_list_spec.rb +0 -42
@@ -1,53 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- class UnorderedListGenerators
4
- include Fluent
5
-
6
- ul :list_short, id: 'list1'
7
- unordered_list :list, id: 'list2'
8
- end
9
-
10
- describe Fluent::Generators do
11
- let(:watir_browser) { mock_browser_for_watir }
12
- let(:watir_definition) { UnorderedListGenerators.new(watir_browser) }
13
-
14
- describe 'unordered list generators' do
15
- context 'when declared on a page definition' do
16
- it 'should generate methods for referencing the unordered list' do
17
- watir_definition.should respond_to(:list_object)
18
- watir_definition.should respond_to(:list_element)
19
- watir_definition.should respond_to(:list_unordered_list)
20
- watir_definition.should respond_to(:list_short_ul)
21
- end
22
-
23
- it 'should generate methods for interacting with the unordered list' do
24
- watir_definition.should respond_to(:list)
25
- watir_definition.should respond_to(:list_exists?)
26
- watir_definition.should respond_to(:list_visible?)
27
- watir_definition.should respond_to(:list?)
28
- watir_definition.should respond_to(:list_?)
29
- watir_definition.should respond_to(:list_ul_exists?)
30
- watir_definition.should respond_to(:list_ul_visible?)
31
- watir_definition.should respond_to(:list_ul?)
32
- watir_definition.should respond_to(:list_ul_?)
33
- end
34
- end
35
-
36
- context 'when used by the watir platform' do
37
- it 'should locate the unordered list' do
38
- watir_browser.should_receive(:ul).and_return(watir_browser)
39
- web_element = watir_definition.list_unordered_list
40
- web_element.should_not be_nil
41
- web_element.should be_instance_of Fluent::WebElements::UnorderedList
42
- end
43
-
44
- it 'should return the text of a unordered list' do
45
- watir_browser.should_receive(:ul).twice.and_return(watir_browser)
46
- watir_browser.should_receive(:text).twice.and_return('testing')
47
- watir_definition.list.should == 'testing'
48
- watir_definition.list_short.should == 'testing'
49
- end
50
- end
51
- end
52
-
53
- end
@@ -1,87 +0,0 @@
1
- require 'spec_helper'
2
- require 'mock_app'
3
-
4
- describe Fluent::Generators do
5
- let(:watir_browser) { mock_browser_for_watir }
6
- let(:selenium_browser) { mock_browser_for_selenium }
7
-
8
- let(:watir_definition) { TestDefinition.new(watir_browser) }
9
- let(:selenium_definition) { TestDefinition.new(selenium_browser) }
10
-
11
- context 'any page definition' do
12
- context 'providing a page title to be verified' do
13
- it 'should specify and verify the page title' do
14
- watir_browser.should_receive(:title).twice.and_return('Test App')
15
- watir_definition.check_title
16
-
17
- selenium_browser.should_receive(:title).twice.and_return('Test App')
18
- selenium_definition.check_title
19
- end
20
-
21
- it 'should raise an error if the page title is not verified' do
22
- msg = "Expected title: 'Test App'; Actual title: 'Testing'"
23
- watir_browser.should_receive(:title).twice.and_return('Testing')
24
- expect { watir_definition.check_title }.to raise_error(Fluent::Errors::TitleNotMatched, msg)
25
- end
26
-
27
- it 'should validate the title if provided a regular expression' do
28
- class QuickDefinition
29
- include Fluent
30
- title_is (/\w+/)
31
- end
32
-
33
- watir_browser.should_receive(:title).twice.and_return('Symbiote')
34
- QuickDefinition.new(watir_browser).check_title
35
- end
36
- end
37
-
38
- it 'should specify and verify the page url' do
39
- watir_browser.should_receive(:url).twice.and_return('http://localhost:4567')
40
- watir_definition.check_url
41
- end
42
-
43
- it 'should allow frames to act as a context' do
44
- watir_browser.should_receive(:frame).with(id: 'frame').and_return(watir_browser)
45
- watir_browser.should_receive(:text_field).and_return(watir_browser)
46
- web_element = watir_definition.framedName_text_field
47
- web_element.should_not be_nil
48
- web_element.should be_instance_of Fluent::WebElements::TextField
49
- end
50
-
51
- context 'automatically looking for an element' do
52
- it 'should specify and verify an expected elements' do
53
- watir_definition.should_receive(:name_object).and_return(watir_browser)
54
- watir_browser.should_receive(:when_present).with(5).and_return(watir_browser)
55
- watir_definition.check_objects
56
- end
57
-
58
- it 'should raise an error if an expected elements are not verified' do
59
- class QuickDefinition
60
- include Fluent
61
- look_for :fakeLink
62
- end
63
- expect { QuickDefinition.new(watir_browser).check_objects }.to raise_error
64
- end
65
- end
66
-
67
- context 'a definition using watir-webdriver' do
68
- context 'providing a url' do
69
- it 'should navigate to the page when viewed' do
70
- watir_browser.should_receive(:goto)
71
- watir_definition.view
72
- end
73
- end
74
- end
75
-
76
- context 'a definition using selenium-webdriver' do
77
- context 'providing a url' do
78
- it 'should navigate to the page when viewed' do
79
- selenium_browser.should_receive(:navigate).and_return(selenium_browser)
80
- selenium_browser.should_receive(:to)
81
- selenium_definition.view
82
- end
83
- end
84
- end
85
-
86
- end
87
- end
data/spec/mock_app.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'watir-webdriver'
2
- require 'selenium-webdriver'
3
-
4
- def mock_browser_for_watir
5
- watir_browser = double('watir')
6
- watir_browser.stub(:is_a?).with(Watir::Browser).and_return(true)
7
- watir_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(false)
8
- watir_browser
9
- end
10
-
11
- def mock_browser_for_selenium
12
- selenium_browser = double('selenium')
13
- selenium_browser.stub(:is_a?).with(Watir::Browser).and_return(false)
14
- selenium_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
15
- selenium_browser
16
- end
17
-
18
- class TestDefinition
19
- include Fluent
20
-
21
- url_is 'http://localhost:4567'
22
- title_is 'Test App'
23
-
24
- look_for :name
25
-
26
- text_field :name, id: 'name'
27
-
28
- within_frame(id: 'frame') do |frame|
29
- text_field :framedName, id: 'framedName', frame: frame
30
- end
31
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class PageDefinition
4
- include Fluent
5
- end
6
-
7
- describe Fluent do
8
- let(:watir_browser) { mock_browser_for_watir }
9
- let(:selenium_browser) { mock_browser_for_selenium }
10
-
11
- let(:watir_definition) { PageDefinition.new(watir_browser) }
12
- let(:selenium_definition) { PageDefinition.new(selenium_browser) }
13
-
14
- context 'a definition using watir-webdriver' do
15
- it 'should return a watir platform object' do
16
- watir_definition.platform.should be_kind_of Fluent::Platforms::WatirWebDriver::PlatformObject
17
- end
18
- end
19
-
20
- context 'a definition using selenium-webdriver' do
21
- it 'should return a selenium platform object' do
22
- selenium_definition.platform.should be_kind_of Fluent::Platforms::SeleniumWebDriver::PlatformObject
23
- end
24
- end
25
-
26
- context 'a definition using an unrecognized driver' do
27
- it 'should raise an exception' do
28
- msg = 'Unable to create a platform object for unknown_browser.'
29
- expect { PageDefinition.new(:unknown_browser) }.to raise_error(Fluent::Errors::UnableToCreatePlatform, msg)
30
- end
31
- end
32
- end
data/spec/spec_helper.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
-
4
- Coveralls.wear!
5
-
6
- SimpleCov.add_filter '/spec'
7
-
8
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
9
- SimpleCov::Formatter::HTMLFormatter,
10
- Coveralls::SimpleCov::Formatter
11
- ]
12
-
13
- SimpleCov.at_exit do
14
- SimpleCov.result.format!
15
- SimpleCov.minimum_coverage 90
16
- SimpleCov.maximum_coverage_drop 5
17
- end
18
-
19
- require 'fluent'
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Web Elements' do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { ::Fluent::WebElements::WebElement.new(watir_browser, :platform => :watir_webdriver) }
6
-
7
- it 'should return the text contained by a web element' do
8
- watir_browser.should_receive(:text).and_return('testing')
9
- watir_definition.text.should == 'testing'
10
- end
11
-
12
- it 'should perform a click event on a web element' do
13
- watir_browser.should_receive(:click)
14
- watir_definition.click
15
- end
16
-
17
- it 'should determine if a web element is enabled' do
18
- watir_browser.should_receive(:enabled?).twice.and_return(true)
19
- watir_definition.enabled?.should == true
20
- watir_definition.should be_enabled
21
- end
22
-
23
- it 'should determine if a web element is disabled' do
24
- watir_browser.should_receive(:enabled?).twice.and_return(false)
25
- watir_definition.disabled?.should == true
26
- watir_definition.should be_disabled
27
- end
28
-
29
- it 'should retrieve the style of a web element' do
30
- watir_browser.should_receive(:style).with('display').and_return('none')
31
- watir_definition.style('display').should == 'none'
32
- end
33
-
34
- it 'should retrieve the class name of a web element' do
35
- watir_browser.should_receive(:attribute_value).and_return('class')
36
- watir_definition.class_name
37
- end
38
- end
@@ -1,156 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Web Elements for Watir' do
4
- let(:watir_browser) { mock_browser_for_watir }
5
- let(:watir_definition) { ::Fluent::WebElements::WebElement.new(watir_browser, :platform => :watir_webdriver) }
6
-
7
- it 'should determine if a web element exists' do
8
- watir_browser.should_receive(:exists?).and_return(true)
9
- watir_definition.exists?.should == true
10
- end
11
-
12
- it 'should determine if a web element does not exist' do
13
- watir_browser.should_receive(:exists?).and_return(false)
14
- watir_definition.exists?.should == false
15
- end
16
-
17
- it 'should determine if a web element is visible' do
18
- watir_browser.should_receive(:present?).twice.and_return(true)
19
- watir_definition.visible?.should == true
20
- watir_definition.should be_visible
21
- end
22
-
23
- it 'should determine if a web element is not visible' do
24
- watir_browser.should_receive(:present?).and_return(false)
25
- watir_definition.visible?.should == false
26
- end
27
-
28
- it 'should simulate a double-click event on a web element' do
29
- watir_browser.should_receive(:double_click)
30
- watir_definition.double_click
31
- end
32
-
33
- it 'should allow a clear event on a web element' do
34
- watir_browser.should_receive(:clear)
35
- watir_definition.clear
36
- end
37
-
38
- it 'should be able to flash a web element' do
39
- watir_browser.should_receive(:flash).exactly(5).times.and_return(watir_definition)
40
- watir_browser.should_receive(:exists?).and_return(watir_definition)
41
- watir_definition.flash.should be_instance_of Fluent::WebElements::WebElement
42
- end
43
-
44
- it 'should be able to flash a web element a specified number of times' do
45
- watir_browser.should_receive(:flash).exactly(1).times.and_return(watir_definition)
46
- watir_browser.should_receive(:exists?).and_return(watir_definition)
47
- watir_definition.flash(1).should be_instance_of Fluent::WebElements::WebElement
48
- end
49
-
50
- it 'should retrieve the tag of a web element' do
51
- watir_browser.should_receive(:tag_name).and_return('div')
52
- watir_definition.tag_name.should == 'div'
53
- end
54
-
55
- it 'should retrieve the html of a web element' do
56
- watir_browser.should_receive(:html).and_return('<p>Testing</p>')
57
- watir_definition.html.should == '<p>Testing</p>'
58
- end
59
-
60
- it 'should retrieve the value of an attribute' do
61
- watir_browser.should_receive(:attribute_value).and_return(true)
62
- watir_definition.attribute('readonly').should be_true
63
- end
64
-
65
- it 'should be able to fire an event on a web element' do
66
- watir_browser.should_receive(:fire_event).and_return('onclick')
67
- watir_definition.fire_event('onclick')
68
- end
69
-
70
- it 'should retrieve the value of a web element' do
71
- watir_browser.should_receive(:value).and_return("value")
72
- watir_definition.value.should == 'value'
73
- end
74
-
75
- it 'should retrieve the id of a web element' do
76
- watir_browser.should_receive(:id).and_return('id')
77
- watir_definition.id.should == 'id'
78
- end
79
-
80
- it 'should send key presses to a web element' do
81
- watir_browser.should_receive(:send_keys).with([:control, 'a'])
82
- watir_definition.send_keys([:control, 'a'])
83
- end
84
-
85
- it 'should scroll elements into view' do
86
- watir_browser.should_receive(:wd).and_return(watir_browser)
87
- watir_browser.should_receive(:location_once_scrolled_into_view)
88
- watir_definition.scroll_into_view
89
- end
90
-
91
- it 'should be able to focus on a web element' do
92
- watir_browser.should_receive(:focus).and_return(watir_definition)
93
- watir_definition.focus
94
- end
95
-
96
- it 'should be able to hover over a web element' do
97
- watir_browser.should_receive(:hover).and_return(watir_definition)
98
- watir_definition.hover
99
- end
100
-
101
- it 'should wait for a web element to be present' do
102
- watir_browser.should_receive(:wait_until_present).twice.with(5)
103
- watir_definition.when_actionable(5)
104
- watir_definition.when_present(5)
105
- end
106
-
107
- it 'should use the provided element wait time for presence checks' do
108
- Fluent.element_level_wait = 30
109
- watir_browser.should_receive(:wait_until_present).with(30)
110
- watir_definition.when_present
111
- end
112
-
113
- it 'should reference a web element when it is present' do
114
- watir_browser.should_receive(:wait_until_present).with(5)
115
- web_element = watir_definition.when_actionable(5)
116
- web_element.should === watir_definition
117
- end
118
-
119
- it 'should wait for a web element to become non-present' do
120
- watir_browser.should_receive(:wait_while_present).and_return(false)
121
- watir_definition.when_not_present(5)
122
- end
123
-
124
- it 'should wait for a web element to become visible' do
125
- watir_browser.should_receive(:present?).and_return(true)
126
- watir_definition.when_visible(5)
127
- end
128
-
129
- it 'should reference a web element when it is visible' do
130
- watir_browser.should_receive(:present?).and_return(true)
131
- web_element = watir_definition.when_visible(5)
132
- web_element.should === watir_definition
133
- end
134
-
135
- it 'should wait for a web element to become invisible' do
136
- watir_browser.should_receive(:present?).and_return(false)
137
- watir_definition.when_not_visible(5)
138
- end
139
-
140
- it 'should reference a web element when it is not visible' do
141
- watir_browser.stub(:present?).and_return(false)
142
- web_element = watir_definition.when_not_visible(5)
143
- web_element.should === watir_definition
144
- end
145
-
146
- it 'should wait until a specific condition occurs' do
147
- Object::Watir::Wait.stub(:until).with(5, 'Condition occurred.')
148
- watir_definition.wait_until(5, 'Condition occurred.') { true }
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
156
- end
@@ -1,21 +0,0 @@
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