fluent 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +14 -0
  4. data/Gemfile +5 -0
  5. data/HISTORY.md +19 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +40 -0
  8. data/Rakefile +13 -0
  9. data/fluent.gemspec +32 -0
  10. data/lib/fluent.rb +82 -0
  11. data/lib/fluent/errors.rb +8 -0
  12. data/lib/fluent/generators.rb +155 -0
  13. data/lib/fluent/logger.rb +5 -0
  14. data/lib/fluent/platform_watir.rb +18 -0
  15. data/lib/fluent/platform_watir/platform_object.rb +112 -0
  16. data/lib/fluent/platform_watir/platform_web_elements/select_list.rb +30 -0
  17. data/lib/fluent/platform_watir/platform_web_elements/web_element.rb +21 -0
  18. data/lib/fluent/platforms.rb +31 -0
  19. data/lib/fluent/version.rb +3 -0
  20. data/lib/fluent/web_elements/button.rb +16 -0
  21. data/lib/fluent/web_elements/checkbox.rb +16 -0
  22. data/lib/fluent/web_elements/link.rb +16 -0
  23. data/lib/fluent/web_elements/option.rb +16 -0
  24. data/lib/fluent/web_elements/paragraph.rb +16 -0
  25. data/lib/fluent/web_elements/radio.rb +16 -0
  26. data/lib/fluent/web_elements/select_list.rb +20 -0
  27. data/lib/fluent/web_elements/text_field.rb +16 -0
  28. data/lib/fluent/web_elements/web_element.rb +33 -0
  29. data/spec/fluent_spec.rb +9 -0
  30. data/spec/generators/button_generators_spec.rb +77 -0
  31. data/spec/generators/checkbox_generators_spec.rb +88 -0
  32. data/spec/generators/link_generators_spec.rb +64 -0
  33. data/spec/generators/paragraph_generators_spec.rb +65 -0
  34. data/spec/generators/radio_generators_spec.rb +85 -0
  35. data/spec/generators/select_list_generators_spec.rb +120 -0
  36. data/spec/generators/text_field_generators_spec.rb +81 -0
  37. data/spec/generators_spec.rb +42 -0
  38. data/spec/mock_app.rb +14 -0
  39. data/spec/platform_object_spec.rb +23 -0
  40. data/spec/spec_helper.rb +17 -0
  41. data/spec/web_element_spec.rb +23 -0
  42. data/spec/web_element_watir_spec.rb +32 -0
  43. metadata +183 -0
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+ require 'mock_app'
3
+
4
+ describe Fluent::Generators do
5
+ let(:watir_browser) { mock_browser_for_watir }
6
+ let(:watir_definition) { TestDefinition.new(watir_browser) }
7
+
8
+ context 'any page definition' do
9
+ context 'providing a page title to be verified' do
10
+ it 'should specify and verify the page title' do
11
+ watir_browser.should_receive(:title).twice.and_return('Test App')
12
+ watir_definition.check_title
13
+ end
14
+
15
+ it 'should raise an error if the page title is not verified' do
16
+ msg = "Expected title: 'Test App'; Actual title: 'Testing'"
17
+ watir_browser.should_receive(:title).twice.and_return('Testing')
18
+ expect { watir_definition.check_title }.to raise_error(Fluent::Errors::TitleNotMatched, msg)
19
+ end
20
+
21
+ it 'should validate the title if provided a regular expression' do
22
+ class QuickDefinition
23
+ include Fluent
24
+ title_is (/\w+/)
25
+ end
26
+
27
+ watir_browser.should_receive(:title).twice.and_return('Symbiote')
28
+ QuickDefinition.new(watir_browser).check_title
29
+ end
30
+ end
31
+
32
+ context 'a definition using watir-webdriver' do
33
+ context 'providing a url' do
34
+ it 'should navigate to the page when viewed' do
35
+ watir_browser.should_receive(:goto)
36
+ watir_definition.view
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,14 @@
1
+ require 'watir-webdriver'
2
+
3
+ def mock_browser_for_watir
4
+ watir_browser = double('watir')
5
+ watir_browser.stub(:is_a?).with(Watir::Browser).and_return(true)
6
+ watir_browser
7
+ end
8
+
9
+ class TestDefinition
10
+ include Fluent
11
+
12
+ url_is 'http://localhost:4567'
13
+ title_is 'Test App'
14
+ end
@@ -0,0 +1,23 @@
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(:watir_definition) { PageDefinition.new(watir_browser) }
10
+
11
+ context 'a definition using watir-webdriver' do
12
+ it 'should return a watir platform object' do
13
+ watir_definition.platform.should be_kind_of Fluent::Platforms::WatirWebDriver::PlatformObject
14
+ end
15
+ end
16
+
17
+ context 'a definition using an unrecognized driver' do
18
+ it 'should raise an exception' do
19
+ msg = 'Unable to create a platform object for unknown_browser.'
20
+ expect { PageDefinition.new(:unknown_browser) }.to raise_error(Fluent::Errors::UnableToCreatePlatform, msg)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ Coveralls.wear!
5
+
6
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7
+ SimpleCov::Formatter::HTMLFormatter,
8
+ Coveralls::SimpleCov::Formatter
9
+ ]
10
+
11
+ SimpleCov.at_exit do
12
+ SimpleCov.result.format!
13
+ SimpleCov.minimum_coverage 90
14
+ SimpleCov.maximum_coverage_drop 5
15
+ end
16
+
17
+ require 'fluent'
@@ -0,0 +1,23 @@
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 perform a click event on a web element' do
8
+ watir_browser.should_receive(:click)
9
+ watir_definition.click
10
+ end
11
+
12
+ it 'should determine if a web element is enabled' do
13
+ watir_browser.should_receive(:enabled?).twice.and_return(true)
14
+ watir_definition.enabled?.should == true
15
+ watir_definition.should be_enabled
16
+ end
17
+
18
+ it 'should determine if a web element is disabled' do
19
+ watir_browser.should_receive(:enabled?).twice.and_return(false)
20
+ watir_definition.disabled?.should == true
21
+ watir_definition.should be_disabled
22
+ end
23
+ end
@@ -0,0 +1,32 @@
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 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 determine if a web element exists' do
13
+ watir_browser.should_receive(:exists?).and_return(true)
14
+ watir_definition.exists?.should == true
15
+ end
16
+
17
+ it 'should determine if a web element does not exist' do
18
+ watir_browser.should_receive(:exists?).and_return(false)
19
+ watir_definition.exists?.should == false
20
+ end
21
+
22
+ it 'should determine if a web element is visible' do
23
+ watir_browser.should_receive(:present?).twice.and_return(true)
24
+ watir_definition.visible?.should == true
25
+ watir_definition.should be_visible
26
+ end
27
+
28
+ it 'should determine if a web element is not visible' do
29
+ watir_browser.should_receive(:present?).and_return(false)
30
+ watir_definition.visible?.should == false
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Nyman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: watir-webdriver
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.6.4
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.6.4
83
+ - !ruby/object:Gem::Dependency
84
+ name: selenium-webdriver
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 2.37.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.37.0
97
+ description: Provides a semantic DSL to construct a fluent interface for test execution
98
+ libraries.
99
+ email: jeffnyman@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .travis.yml
106
+ - Gemfile
107
+ - HISTORY.md
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - fluent.gemspec
112
+ - lib/fluent.rb
113
+ - lib/fluent/errors.rb
114
+ - lib/fluent/generators.rb
115
+ - lib/fluent/logger.rb
116
+ - lib/fluent/platform_watir.rb
117
+ - lib/fluent/platform_watir/platform_object.rb
118
+ - lib/fluent/platform_watir/platform_web_elements/select_list.rb
119
+ - lib/fluent/platform_watir/platform_web_elements/web_element.rb
120
+ - lib/fluent/platforms.rb
121
+ - lib/fluent/version.rb
122
+ - lib/fluent/web_elements/button.rb
123
+ - lib/fluent/web_elements/checkbox.rb
124
+ - lib/fluent/web_elements/link.rb
125
+ - lib/fluent/web_elements/option.rb
126
+ - lib/fluent/web_elements/paragraph.rb
127
+ - lib/fluent/web_elements/radio.rb
128
+ - lib/fluent/web_elements/select_list.rb
129
+ - lib/fluent/web_elements/text_field.rb
130
+ - lib/fluent/web_elements/web_element.rb
131
+ - spec/fluent_spec.rb
132
+ - spec/generators/button_generators_spec.rb
133
+ - spec/generators/checkbox_generators_spec.rb
134
+ - spec/generators/link_generators_spec.rb
135
+ - spec/generators/paragraph_generators_spec.rb
136
+ - spec/generators/radio_generators_spec.rb
137
+ - spec/generators/select_list_generators_spec.rb
138
+ - spec/generators/text_field_generators_spec.rb
139
+ - spec/generators_spec.rb
140
+ - spec/mock_app.rb
141
+ - spec/platform_object_spec.rb
142
+ - spec/spec_helper.rb
143
+ - spec/web_element_spec.rb
144
+ - spec/web_element_watir_spec.rb
145
+ homepage: https://github.com/jnyman/fluent
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - '>='
156
+ - !ruby/object:Gem::Version
157
+ version: 1.9.3
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubyforge_project:
165
+ rubygems_version: 2.0.3
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: A Semantically Clean Fluent Interface Test Framework
169
+ test_files:
170
+ - spec/fluent_spec.rb
171
+ - spec/generators/button_generators_spec.rb
172
+ - spec/generators/checkbox_generators_spec.rb
173
+ - spec/generators/link_generators_spec.rb
174
+ - spec/generators/paragraph_generators_spec.rb
175
+ - spec/generators/radio_generators_spec.rb
176
+ - spec/generators/select_list_generators_spec.rb
177
+ - spec/generators/text_field_generators_spec.rb
178
+ - spec/generators_spec.rb
179
+ - spec/mock_app.rb
180
+ - spec/platform_object_spec.rb
181
+ - spec/spec_helper.rb
182
+ - spec/web_element_spec.rb
183
+ - spec/web_element_watir_spec.rb