watir-page-helper 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. data/.gitignore +24 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +2 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +55 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +88 -0
  9. data/Rakefile +6 -0
  10. data/features/README.md +47 -0
  11. data/features/simple_elements/README.md +13 -0
  12. data/features/simple_elements/div.feature +27 -0
  13. data/features/simple_elements/h1.feature +27 -0
  14. data/features/simple_elements/h2.feature +27 -0
  15. data/features/simple_elements/h3.feature +27 -0
  16. data/features/simple_elements/h4.feature +27 -0
  17. data/features/simple_elements/h5.feature +27 -0
  18. data/features/simple_elements/h6.feature +27 -0
  19. data/features/simple_elements/p.feature +27 -0
  20. data/features/simple_elements/span.feature +27 -0
  21. data/features/step_definitions/steps.rb +11 -0
  22. data/features/support/env.rb +32 -0
  23. data/history.md +10 -0
  24. data/lib/watir-page-helper.rb +231 -0
  25. data/lib/watir-page-helper/commands.rb +64 -0
  26. data/lib/watir-page-helper/generated.rb +388 -0
  27. data/script/generate +39 -0
  28. data/script/templates/generated.rb.erb +90 -0
  29. data/script/templates/simple_element.feature.erb +27 -0
  30. data/script/templates/test.html.erb +10 -0
  31. data/spec/example1.rb +19 -0
  32. data/spec/example2.rb +12 -0
  33. data/spec/helper.rb +12 -0
  34. data/spec/iframe.html +9 -0
  35. data/spec/image.png +0 -0
  36. data/spec/pages.rb +118 -0
  37. data/spec/test.html +103 -0
  38. data/spec/test.png +0 -0
  39. data/spec/watir-page-helper/pages/my_page.rb +9 -0
  40. data/spec/watir-page-helper/pages/nested_table_page.rb +8 -0
  41. data/spec/watir-page-helper_spec.rb +235 -0
  42. data/watir-page-helper.gemspec +35 -0
  43. metadata +189 -0
Binary file
@@ -0,0 +1,9 @@
1
+ module WatirPageHelper::MyPage
2
+ extend WatirPageHelper::ClassMethods
3
+
4
+ direct_url "http://www.google.com"
5
+ expected_element :text_field, :name => "q"
6
+ expected_title "Google"
7
+ text_field :search_box, :name => "q"
8
+ button :search, :name => "btnG"
9
+ end
@@ -0,0 +1,8 @@
1
+ module WatirPageHelper::NestedTablePage
2
+ extend WatirPageHelper::ClassMethods
3
+ include CommonPage
4
+
5
+ table :test_table, :id => "mySecondTable"
6
+ row(:test_table_row_1) { |page| page.test_table.tr }
7
+ cell(:test_table_row_1_cell_1) { |page| page.test_table_row_1_row.td }
8
+ end
@@ -0,0 +1,235 @@
1
+ require 'helper'
2
+ require 'pages'
3
+
4
+ describe "Watir Page Helper" do
5
+ include WatirPageHelper::Commands
6
+
7
+ before(:all) { @browser = WatirPageHelper.create }
8
+ after(:all) { @browser.close }
9
+
10
+ it 'should support nesting of table elements' do
11
+ visit :nested_table_page do |page|
12
+ page.test_table.rows.length.should == 1
13
+ page.test_table_row_1.should == "Test Table 2 Col 1 Test Table 2 Col 2"
14
+ page.test_table_row_1_cell_1.should == "Test Table 2 Col 1"
15
+ end
16
+ end
17
+
18
+ it 'should support nesting of div and span elements' do
19
+ visit PageNestedDiv do |page|
20
+ page.my_nice_div.should == "This div is unnamed and inside myNiceDiv.\nThis span is unnamed and inside myNiceDiv."
21
+ page.my_unnamed_div.should == 'This div is unnamed and inside myNiceDiv.'
22
+ page.my_unnamed_span.should == 'This span is unnamed and inside myNiceDiv.'
23
+ end
24
+ end
25
+
26
+ it 'should support nesting without parameters' do
27
+ visit PageNestedNoParams do |page|
28
+ page.my_nice_div.should == "This div is unnamed and inside myNiceDiv.\nThis span is unnamed and inside myNiceDiv."
29
+ page.my_unnamed_div.should == 'This div is unnamed and inside myNiceDiv.'
30
+ page.my_unnamed_span.should == 'This span is unnamed and inside myNiceDiv.'
31
+ end
32
+ end
33
+
34
+ it "should raise an error when the expected literal title doesn't match actual title" do
35
+ lambda { visit PageIncorrectTitle }.should raise_error("Expected title 'not expected' instead of 'HTML Document Title'")
36
+ end
37
+
38
+ it "should raise an error when the expected title pattern doesn't match actual title" do
39
+ lambda { visit PageIncorrectTitleRegExp }.should raise_error("Expected title '(?-mix:.*not expected.*)' instead of 'HTML Document Title'")
40
+ end
41
+
42
+ it "should go to the correct url on initialize if set in page class, and check correct literal title" do
43
+ visit PageCorrectTitle do |page|
44
+ page.url.should == BaseTestPage::TEST_URL
45
+ page.title.should == "HTML Document Title"
46
+ end
47
+ end
48
+
49
+ it "should go to the correct url on initialize if set in page class, and check correct title pattern" do
50
+ visit PageCorrectTitleRegExp do |page|
51
+ page.url.should == BaseTestPage::TEST_URL
52
+ page.title.should =~ /^HTML Document Title$/
53
+ end
54
+ end
55
+
56
+ it "should check the correct literal title of an existing open page" do
57
+ visit PageCorrectTitle
58
+ on PageCorrectTitle do |page|
59
+ page.title.should == "HTML Document Title"
60
+ end
61
+ end
62
+
63
+ it "should go to the correct url on initialize if set in page class, and check correct title pattern" do
64
+ visit PageCorrectTitleRegExp
65
+ on PageCorrectTitleRegExp do |page|
66
+ page.title.should =~ /^HTML Document Title$/
67
+ end
68
+ end
69
+
70
+ it "should check for the presence of an element when initializing a page" do
71
+ visit PageExpectElement
72
+ @browser.text_field(:name => "firstname").exist?.should be_true
73
+ end
74
+
75
+ it "should check for the presence of an element when initializing a page - and raise an error if not present" do
76
+ lambda { on PageExpectNonElement }.should raise_error(/timed out after 1 seconds, waiting for.*doesntexist.*to become present/, Watir::Wait::TimeoutError)
77
+ @browser.text_field(:id => "doesnt exist").exist?.should be_false
78
+ end
79
+
80
+ it "should support adding three methods for text fields" do
81
+ visit PageTextFields do |page|
82
+ page.first_name = "Test Name" #set
83
+ page.first_name.should == "Test Name" #check
84
+ page.first_name_text_field.exists?.should be_true #object
85
+ end
86
+ end
87
+
88
+ it "should support adding four methods for select lists" do
89
+ visit PageSelectList do |page|
90
+ page.cars = "Mazda" #select
91
+ page.cars.should == "Mazda" #check
92
+ page.cars_selected?("Mazda").should be_true #selected?
93
+ page.cars_select_list.exists?.should be_true #object
94
+ end
95
+ end
96
+
97
+ it "should support adding four methods for checkboxes" do
98
+ visit PageCheckbox do |page|
99
+ page.check_agree
100
+ page.agree?.should be_true
101
+ page.uncheck_agree
102
+ page.agree?.should be_false
103
+ page.agree_checkbox.exist?.should be_true
104
+ end
105
+ end
106
+
107
+ it "should support adding three methods for radio buttons" do
108
+ visit PageRadioButton do |page|
109
+ page.medium_set?.should be_false
110
+ page.select_medium
111
+ page.medium_set?.should be_true
112
+ page.medium_radio_button.exist?.should be_true
113
+ end
114
+ end
115
+
116
+ it "should support adding two methods for buttons" do
117
+ visit PageButton do |page|
118
+ page.submit
119
+ page.submit_button.enabled?.should be_true
120
+ end
121
+ end
122
+
123
+ it "should support adding two methods for links" do
124
+ visit PageLink do |page|
125
+ page.info
126
+ page.info_link.exist?.should be_true
127
+ end
128
+ end
129
+
130
+ it "should support adding one method for tables" do
131
+ visit PageTable do |page|
132
+ page.test_table.rows.length.should == 1
133
+ end
134
+ end
135
+
136
+ it "should support adding two methods for table rows" do
137
+ visit PageTable do |page|
138
+ page.test_table_row_1.should == "Test Table Col 1 Test Table Col 2"
139
+ page.test_table_row_1_row.cells.length.should == 2
140
+ end
141
+ end
142
+
143
+ it "should support adding two methods for table cells" do
144
+ visit PageTable do |page|
145
+ page.test_table_row_1_cell_1.should == "Test Table Col 1"
146
+ page.test_table_row_1_cell_1_cell.exist?.should be_true
147
+ end
148
+ end
149
+
150
+ it "should support adding two methods for divs" do
151
+ visit PageDiv do |page|
152
+ page.information.should == "This is a header\nThis is a paragraph."
153
+ page.information_div.exist?.should be_true
154
+ end
155
+ end
156
+
157
+ it "should support adding two methods for spans" do
158
+ visit PageSpan do |page|
159
+ page.background.should == "Some background text in a span."
160
+ page.background_span.should exist
161
+ end
162
+ end
163
+
164
+ it "should support adding two methods for paragraphs" do
165
+ visit PageParagraph do |page|
166
+ page.paragraph.should == "This is a paragraph."
167
+ page.paragraph_p.should exist
168
+ end
169
+ end
170
+
171
+ it "should support adding two methods each for dl, dt, dd" do
172
+ visit PageDlDtDd do |page|
173
+ page.definition_list.should == "Succulents\n- water-retaining plants adapted to arid climates or soil conditions.\nCactus\n- plants who distinctive appearance is a result of adaptations to conserve water in dry and/or hot environments."
174
+ page.definition_list_dl.exist?.should be_true
175
+ page.definition_type.should == "Succulents"
176
+ page.definition_type_dt.exist?.should be_true
177
+ page.definition_data.should == "- water-retaining plants adapted to arid climates or soil conditions."
178
+ page.definition_data_dd.exist?.should be_true
179
+ end
180
+ end
181
+
182
+ it "should support adding two methods for a form" do
183
+ visit PageForm do |page|
184
+ page.main_form.should == "First name:\nLast name:\nCar model:\nHonda\nMazda\nToyota\n\nDo you agree?: I agree\nHigh\nMedium\nLow"
185
+ page.main_form_form.should exist
186
+ end
187
+ end
188
+
189
+ it "should support adding a method for a image" do
190
+ visit PageImage do |page|
191
+ page.succulent_image.exist?.should be_true
192
+ end
193
+ end
194
+
195
+ it "should support adding two methods for a li" do
196
+ visit PageLi do |page|
197
+ page.blue_item.should == "Blue"
198
+ page.blue_item_li.exist?.should be_true
199
+ end
200
+ end
201
+
202
+ it "should support adding two methods for each heading attribute" do
203
+ visit PageHeadings do |page|
204
+ page.heading_one.should == "Heading One"
205
+ page.heading_two.should == "Heading Two"
206
+ page.heading_three.should == "Heading Three"
207
+ page.heading_four.should == "Heading Four"
208
+ page.heading_five.should == "Heading Five"
209
+ page.heading_six.should == "Heading Six"
210
+ page.heading_one_h1.exist?.should be_true
211
+ page.heading_two_h2.exist?.should be_true
212
+ page.heading_three_h3.exist?.should be_true
213
+ page.heading_four_h4.exist?.should be_true
214
+ page.heading_five_h5.exist?.should be_true
215
+ page.heading_six_h6.exist?.should be_true
216
+ end
217
+ end
218
+
219
+ it "should support elements within a iframe" do
220
+ visit PageIFrame do |page|
221
+ page.iframe.exist?.should be_true
222
+ page.ilink_link.exist?.should be_true
223
+ page.ilink
224
+ end
225
+ end
226
+
227
+ it 'should support file upload fields' do
228
+ visit PageFileField do |page|
229
+ image_path = File.dirname(__FILE__) + '/image.png'
230
+ page.upload = image_path #set
231
+ page.upload.should == image_path #check
232
+ page.upload_file_field.exist?.should be_true
233
+ end
234
+ end
235
+ end
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "watir-page-helper"
5
+ s.version = "1.0.3"
6
+ s.authors = ["Alister Scott","Mark Ryall"]
7
+ s.email = ["alister.scott@gmail.com"]
8
+ s.description = %q{DEPRECATED - This is a page helper for Watir-WebDriver that allows use easy access to elements. See watirwebdriver.com}
9
+ s.summary = %q{DEPRECATED - A page helper for Watir-WebDriver that allows use easy access to elements.}
10
+
11
+ s.rubyforge_project = 'watir-page-helper'
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+ s.licenses = ['MIT']
18
+
19
+ s.add_runtime_dependency 'watir-webdriver'
20
+
21
+ s.add_development_dependency 'rake'
22
+ s.add_development_dependency 'rspec'
23
+ s.add_development_dependency 'cucumber'
24
+
25
+ s.post_install_message = %{
26
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
27
+
28
+ Watir-page-helper has now been END-OF_LIFED.
29
+ You should now use the page-object gem.
30
+ Please see this blog post for further details: http://wp.me/p98zF-k0
31
+
32
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
33
+
34
+ }
35
+ end
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: watir-page-helper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alister Scott
9
+ - Mark Ryall
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-09-20 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: watir-webdriver
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: cucumber
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ description: DEPRECATED - This is a page helper for Watir-WebDriver that allows use
80
+ easy access to elements. See watirwebdriver.com
81
+ email:
82
+ - alister.scott@gmail.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - .gitignore
88
+ - .rspec
89
+ - .rvmrc
90
+ - .travis.yml
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - features/README.md
97
+ - features/simple_elements/README.md
98
+ - features/simple_elements/div.feature
99
+ - features/simple_elements/h1.feature
100
+ - features/simple_elements/h2.feature
101
+ - features/simple_elements/h3.feature
102
+ - features/simple_elements/h4.feature
103
+ - features/simple_elements/h5.feature
104
+ - features/simple_elements/h6.feature
105
+ - features/simple_elements/p.feature
106
+ - features/simple_elements/span.feature
107
+ - features/step_definitions/steps.rb
108
+ - features/support/env.rb
109
+ - history.md
110
+ - lib/watir-page-helper.rb
111
+ - lib/watir-page-helper/commands.rb
112
+ - lib/watir-page-helper/generated.rb
113
+ - script/generate
114
+ - script/templates/generated.rb.erb
115
+ - script/templates/simple_element.feature.erb
116
+ - script/templates/test.html.erb
117
+ - spec/example1.rb
118
+ - spec/example2.rb
119
+ - spec/helper.rb
120
+ - spec/iframe.html
121
+ - spec/image.png
122
+ - spec/pages.rb
123
+ - spec/test.html
124
+ - spec/test.png
125
+ - spec/watir-page-helper/pages/my_page.rb
126
+ - spec/watir-page-helper/pages/nested_table_page.rb
127
+ - spec/watir-page-helper_spec.rb
128
+ - watir-page-helper.gemspec
129
+ homepage:
130
+ licenses:
131
+ - MIT
132
+ post_install_message: ! "\n (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
133
+ (::) (::) (::) (::)\n\n Watir-page-helper has now been END-OF_LIFED.\n You
134
+ should now use the page-object gem.\n Please see this blog post for further details:
135
+ http://wp.me/p98zF-k0\n\n (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
136
+ (::) (::) (::) (::)\n\n"
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ segments:
147
+ - 0
148
+ hash: 1632216002128865340
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ segments:
156
+ - 0
157
+ hash: 1632216002128865340
158
+ requirements: []
159
+ rubyforge_project: watir-page-helper
160
+ rubygems_version: 1.8.24
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: DEPRECATED - A page helper for Watir-WebDriver that allows use easy access
164
+ to elements.
165
+ test_files:
166
+ - features/README.md
167
+ - features/simple_elements/README.md
168
+ - features/simple_elements/div.feature
169
+ - features/simple_elements/h1.feature
170
+ - features/simple_elements/h2.feature
171
+ - features/simple_elements/h3.feature
172
+ - features/simple_elements/h4.feature
173
+ - features/simple_elements/h5.feature
174
+ - features/simple_elements/h6.feature
175
+ - features/simple_elements/p.feature
176
+ - features/simple_elements/span.feature
177
+ - features/step_definitions/steps.rb
178
+ - features/support/env.rb
179
+ - spec/example1.rb
180
+ - spec/example2.rb
181
+ - spec/helper.rb
182
+ - spec/iframe.html
183
+ - spec/image.png
184
+ - spec/pages.rb
185
+ - spec/test.html
186
+ - spec/test.png
187
+ - spec/watir-page-helper/pages/my_page.rb
188
+ - spec/watir-page-helper/pages/nested_table_page.rb
189
+ - spec/watir-page-helper_spec.rb