watir-webdriver-page-object 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjljOTViZGQxMGNlZTU2N2Y5ZmIyMGJhOGNiOWZjYTM0MjExOTQzZA==
5
+ data.tar.gz: !binary |-
6
+ ZmE4NThlZTMwNDIzNDBlZGYxMDY2NjUxOGNkZjBjMzJjYmI1NmQ5OA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDM4MGM0NWViZGMwMjM5ZDAzOTc5NjY1YmI3NjBjMWY5ZjY4ZTk5MmI1ZTgy
10
+ NTQ3YmRkODRmZGIxZWY3NDAzNDU2OTFiODdhODEzZDAxNjM2ZDAzMjg2Yjg3
11
+ ZjA0NTk1NDM2ZGE3MjI5NGE4ZjBiOTNmYTgwOTA5YmUzYmY3ZDU=
12
+ data.tar.gz: !binary |-
13
+ ZWFlY2MwN2ZmMWZkOWU1OWQzMmFlMjNmMGNlNTUyOGNjM2QzZTUwNzFmOTg1
14
+ MDc2ZjY1YjgwY2UxYWI1NjNjZGQ2ZjFlZGU3MmUyMGIwYTc5MTUxMmU5ODky
15
+ MjJhNTg5NjlkNDZhZWIxMDQzMDBiMDhhYzlmYTY1NTY1NTEwYzc=
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in watir_webdriver_page_object.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Aaron Humerickhouse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # WatirWebdriverPageObject
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/watir_webdriver_page_object`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'watir_webdriver_page_object'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install watir_webdriver_page_object
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/TIMBERings/watir_webdriver_page_object. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "watir_webdriver_page_object"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,730 @@
1
+ require 'watir-webdriver'
2
+
3
+ module WatirWebdriverPageObject
4
+ # Initializes a page, verifies title, url, and expected element exist prior to continuing.
5
+ def initialize(browser)
6
+ @browser = browser
7
+ expected_element if respond_to? :expected_element
8
+ at? if respond_to? :at?
9
+ has_expected_title? if respond_to? :has_expected_title?
10
+ end
11
+
12
+ # Called when a method is not defined by GenericBasePage. Sends the call up to Selenium
13
+ def method_missing sym, *args, &block
14
+ @browser.send sym, *args, &block
15
+ end
16
+
17
+ # Creates the at? method. The dynamic method checks if the page url matches the page object url.
18
+ # @param url [String, Regexp] The expected URL of the page
19
+ def self.page_url(url)
20
+ define_method 'at?' do
21
+ @browser.wait_until(nil, "Expected URL = #{url}, actual URL = #{@browser.url}") { url.kind_of?(Regexp) ? url =~ @browser.url : url == @browser.url }
22
+ end
23
+ end
24
+
25
+ # Creates the expected_element? method to each page object. Waits until the the element from the the page object
26
+ # is present. If it doesn't, raise an exception.
27
+ # @param type [String] The expected element type.
28
+ # @param identifier [Hash] Information to find the expected element.
29
+ # @param timeout [Integer] The length of time to wait before timeout.
30
+ # @example
31
+ # expected_element('link', {css: 'a.button.save', index: 0}, 15)
32
+ def self.expected_element(type, identifier, timeout=Watir.default_timeout)
33
+ define_method 'expected_element' do
34
+ @browser.send("#{type.to_s}", identifier).wait_until_present timeout
35
+ end
36
+ end
37
+
38
+ # Creates the has_expected_title? method to each page object. Verifies the title matches the given title from the
39
+ # page object. If it doesn't, raise an exception.
40
+ # @param title [String] The head title of page
41
+ def self.title(title)
42
+ define_method 'has_expected_title?' do
43
+ @browser.wait_until(nil, "Expected title = '#{title}', actual title = '#{@browser.title}'") { title.kind_of?(Regexp) ? title =~ @browser.title : title == @browser.title }
44
+ end
45
+ end
46
+
47
+
48
+ ################################## DYNAMIC METHOD CREATION FOR BASE WATIR ELEMENTS ##################################
49
+
50
+ # For each element() defined in the page object these methods are added:
51
+ # * <name> - Returns the element
52
+ # @param element_name [String] The desired name for the new element.
53
+ # @param selector [Hash] The selector for the new element.
54
+ def self.element(element_name, selector)
55
+ define_method element_name.to_s do
56
+ @browser.element(selector)
57
+ end
58
+ end
59
+
60
+ # For each area() defined in the page object these methods are added:
61
+ # * <name> - Returns the area
62
+ # @param element_name [String] The desired name for the new area.
63
+ # @param selector [Hash] The selector for the new area.
64
+ def self.area(element_name, selector)
65
+ define_method element_name.to_s do
66
+ @browser.area(selector)
67
+ end
68
+ end
69
+
70
+ # For each button() defined in the page object these methods are added:
71
+ # * <name> - Returns the button
72
+ # @param element_name [String] The desired name for the new button.
73
+ # @param selector [Hash] The selector for the new button.
74
+ def self.button(element_name, selector)
75
+ define_method element_name.to_s do
76
+ @browser.button(selector)
77
+ end
78
+ end
79
+
80
+ # For each checkbox() defined in the page object these methods are added:
81
+ # * <name> - Returns the checkbox
82
+ # @param element_name [String] The desired name for the new checkbox.
83
+ # @param selector [Hash] The selector for the new checkbox.
84
+ def self.checkbox(element_name, selector)
85
+ define_method element_name.to_s do
86
+ @browser.checkbox(selector)
87
+ end
88
+ end
89
+
90
+ # For each dlist() defined in the page object these methods are added:
91
+ # * <name> - Returns the dlist
92
+ # @param element_name [String] The desired name for the new dlist.
93
+ # @param selector [Hash] The selector for the new dlist.
94
+ def self.dlist(element_name, selector)
95
+ define_method element_name.to_s do
96
+ @browser.dlist(selector)
97
+ end
98
+ end
99
+
100
+ # For each file_field() defined in the page object these methods are added:
101
+ # * <name> - Returns the file_field
102
+ # @param element_name [String] The desired name for the new file_field.
103
+ # @param selector [Hash] The selector for the new file_field.
104
+ def self.file_field(element_name, selector)
105
+ define_method element_name.to_s do
106
+ @browser.file_field(selector)
107
+ end
108
+ end
109
+
110
+ # For each font() defined in the page object these methods are added:
111
+ # * <name> - Returns the font
112
+ # @param element_name [String] The desired name for the new font.
113
+ # @param selector [Hash] The selector for the new font.
114
+ def self.font(element_name, selector)
115
+ define_method element_name.to_s do
116
+ @browser.font(selector)
117
+ end
118
+ end
119
+
120
+ # For each form() defined in the page object these methods are added:
121
+ # * <name> - Returns the form
122
+ # @param element_name [String] The desired name for the new form.
123
+ # @param selector [Hash] The selector for the new form.
124
+ def self.form(element_name, selector)
125
+ define_method element_name.to_s do
126
+ @browser.form(selector)
127
+ end
128
+ end
129
+
130
+ # For each hidden() defined in the page object these methods are added:
131
+ # * <name> - Returns the hidden
132
+ # @param element_name [String] The desired name for the new hidden.
133
+ # @param selector [Hash] The selector for the new hidden.
134
+ def self.hidden(element_name, selector)
135
+ define_method element_name.to_s do
136
+ @browser.hidden(selector)
137
+ end
138
+ end
139
+
140
+ # For each iframe() defined in the page object these methods are added:
141
+ # * <name> - Returns the iframe
142
+ # @param element_name [String] The desired name for the new iframe.
143
+ # @param selector [Hash] The selector for the new iframe.
144
+ def self.iframe(element_name, selector)
145
+ define_method element_name.to_s do
146
+ @browser.iframe(selector)
147
+ end
148
+ end
149
+
150
+ # For each image() defined in the page object these methods are added:
151
+ # * <name> - Returns the image
152
+ # @param element_name [String] The desired name for the new image.
153
+ # @param selector [Hash] The selector for the new image.
154
+ def self.image(element_name, selector)
155
+ define_method element_name.to_s do
156
+ @browser.image(selector)
157
+ end
158
+ end
159
+
160
+ # For each input() defined in the page object these methods are added:
161
+ # * <name> - Returns the input
162
+ # @param element_name [String] The desired name for the new input.
163
+ # @param selector [Hash] The selector for the new input.
164
+ def self.input(element_name, selector)
165
+ define_method element_name.to_s do
166
+ @browser.input(selector)
167
+ end
168
+ end
169
+
170
+ # For each link() defined in the page object these methods are added:
171
+ # * <name> - Returns the link
172
+ # @param element_name [String] The desired name for the new link.
173
+ # @param selector [Hash] The selector for the new link.
174
+ def self.link(element_name, selector)
175
+ define_method element_name.to_s do
176
+ @browser.link(selector)
177
+ end
178
+ end
179
+
180
+ # For each option() defined in the page object these methods are added:
181
+ # * <name> - Returns the option
182
+ # @param element_name [String] The desired name for the new option.
183
+ # @param selector [Hash] The selector for the new option.
184
+ def self.option(element_name, selector)
185
+ define_method element_name.to_s do
186
+ @browser.option(selector)
187
+ end
188
+ end
189
+
190
+ # For each radio() defined in the page object these methods are added:
191
+ # * <name> - Returns the radio
192
+ # @param element_name [String] The desired name for the new radio.
193
+ # @param selector [Hash] The selector for the new radio.
194
+ def self.radio(element_name, selector)
195
+ define_method element_name.to_s do
196
+ @browser.radio(selector)
197
+ end
198
+ end
199
+
200
+ # For each select() defined in the page object these methods are added:
201
+ # * <name> - Returns the select
202
+ # @param element_name [String] The desired name for the new select.
203
+ # @param selector [Hash] The selector for the new select.
204
+ def self.select(element_name, selector)
205
+ define_method element_name.to_s do
206
+ @browser.select(selector)
207
+ end
208
+ end
209
+
210
+ # For each table() defined in the page object these methods are added:
211
+ # * <name> - Returns the table
212
+ # @param element_name [String] The desired name for the new table.
213
+ # @param selector [Hash] The selector for the new table.
214
+ def self.table(element_name, selector)
215
+ define_method element_name.to_s do
216
+ @browser.table(selector)
217
+ end
218
+ end
219
+
220
+ # For each table_cell() defined in the page object these methods are added:
221
+ # * <name> - Returns the table_cell
222
+ # @param element_name [String] The desired name for the new table_cell.
223
+ # @param selector [Hash] The selector for the new table_cell.
224
+ def self.table_cell(element_name, selector)
225
+ define_method element_name.to_s do
226
+ @browser.table_cell(selector)
227
+ end
228
+ end
229
+
230
+ # For each td() defined in the page object these methods are added:
231
+ # * <name> - Returns the td
232
+ # @param element_name [String] The desired name for the new td.
233
+ def self.td(element_name, selector)
234
+ define_method element_name.to_s do
235
+ @browser.td(selector)
236
+ end
237
+ end
238
+
239
+ # For each table_row() defined in the page object these methods are added:
240
+ # * <name> - Returns the table_row
241
+ # @param element_name [String] The desired name for the new table_row.
242
+ # @param selector [Hash] The selector for the new table_row.
243
+ def self.tr(element_name, selector)
244
+ define_method element_name.to_s do
245
+ @browser.tr(selector)
246
+ end
247
+ end
248
+
249
+
250
+ # For each table_section() defined in the page object these methods are added:
251
+ # * <name> - Returns the table_section
252
+ # @param element_name [String] The desired name for the new table_section.
253
+ # @param selector [Hash] The selector for the new table_section.
254
+ def self.table_section(element_name, selector)
255
+ define_method element_name.to_s do
256
+ @browser.table_section(selector)
257
+ end
258
+ end
259
+
260
+ # For each text_area() defined in the page object these methods are added:
261
+ # * <name> - Returns the text_area
262
+ # @param element_name [String] The desired name for the new text_area.
263
+ # @param selector [Hash] The selector for the new text_area.
264
+ def self.text_area(element_name, selector)
265
+ define_method element_name.to_s do
266
+ @browser.textarea(selector)
267
+ end
268
+ end
269
+
270
+ # For each text_field() defined in the page object these methods are added:
271
+ # * <name> - Returns the text_field
272
+ # @param element_name [String] The desired name for the new text_field.
273
+ # @param selector [Hash] The selector for the new text_field.
274
+ def self.text_field(element_name, selector)
275
+ define_method element_name.to_s do
276
+ @browser.text_field(selector)
277
+ end
278
+ end
279
+
280
+
281
+ # For each elements() defined in the page object these methods are added:
282
+ # * <name> - Returns an array of matching elements
283
+ # @param element_name [String] The desired name for the new element.
284
+ # @param selector [Hash] The selector for the new element.
285
+ def self.elements(element_name, selector)
286
+ define_method element_name.to_s do
287
+ @browser.elements(selector)
288
+ end
289
+ end
290
+
291
+ # For each areas() defined in the page object these methods are added:
292
+ # * <name> - Returns an array of matching areas
293
+ # @param element_name [String] The desired name for the new area.
294
+ # @param selector [Hash] The selector for the new area.
295
+ def self.areas(element_name, selector)
296
+ define_method element_name.to_s do
297
+ @browser.areas(selector)
298
+ end
299
+ end
300
+
301
+ # For each buttons() defined in the page object these methods are added:
302
+ # * <name> - Returns an array of matching buttons
303
+ # @param element_name [String] The desired name for the new button.
304
+ # @param selector [Hash] The selector for the new button.
305
+ def self.buttons(element_name, selector)
306
+ define_method element_name.to_s do
307
+ @browser.buttons(selector)
308
+ end
309
+ end
310
+
311
+ # For each checkboxes() defined in the page object these methods are added:
312
+ # * <name> - Returns an array of matching checkboxes
313
+ # @param element_name [String] The desired name for the new checkbox.
314
+ # @param selector [Hash] The selector for the new checkbox.
315
+ def self.checkboxes(element_name, selector)
316
+ define_method element_name.to_s do
317
+ @browser.checkboxes(selector)
318
+ end
319
+ end
320
+
321
+ # For each dlists() defined in the page object these methods are added:
322
+ # * <name> - Returns an array of matching dlists
323
+ # @param element_name [String] The desired name for the new dlist.
324
+ # @param selector [Hash] The selector for the new dlist.
325
+ def self.dlists(element_name, selector)
326
+ define_method element_name.to_s do
327
+ @browser.dlists(selector)
328
+ end
329
+ end
330
+
331
+ # For each file_fields() defined in the page object these methods are added:
332
+ # * <name> - Returns an array of matching file_fields
333
+ # @param element_name [String] The desired name for the new file_field.
334
+ # @param selector [Hash] The selector for the new file_field.
335
+ def self.file_fields(element_name, selector)
336
+ define_method element_name.to_s do
337
+ @browser.file_fields(selector)
338
+ end
339
+ end
340
+
341
+ # For each fonts() defined in the page object these methods are added:
342
+ # * <name> - Returns an array of matching fonts
343
+ # @param element_name [String] The desired name for the new font.
344
+ # @param selector [Hash] The selector for the new font.
345
+ def self.fonts(element_name, selector)
346
+ define_method element_name.to_s do
347
+ @browser.fonts(selector)
348
+ end
349
+ end
350
+
351
+ # For each forms() defined in the page object these methods are added:
352
+ # * <name> - Returns an array of matching forms
353
+ # @param element_name [String] The desired name for the new form.
354
+ # @param selector [Hash] The selector for the new form.
355
+ def self.forms(element_name, selector)
356
+ define_method element_name.to_s do
357
+ @browser.forms(selector)
358
+ end
359
+ end
360
+
361
+ # For each hiddens() defined in the page object these methods are added:
362
+ # * <name> - Returns an array of matching hiddens
363
+ # @param element_name [String] The desired name for the new hidden.
364
+ # @param selector [Hash] The selector for the new hidden.
365
+ def self.hiddens(element_name, selector)
366
+ define_method element_name.to_s do
367
+ @browser.hiddens(selector)
368
+ end
369
+ end
370
+
371
+ # For each iframes() defined in the page object these methods are added:
372
+ # * <name> - Returns an array of matching iframes
373
+ # @param element_name [String] The desired name for the new iframe.
374
+ # @param selector [Hash] The selector for the new iframe.
375
+ def self.iframes(element_name, selector)
376
+ define_method element_name.to_s do
377
+ @browser.iframes(selector)
378
+ end
379
+ end
380
+
381
+ # For each images() defined in the page object these methods are added:
382
+ # * <name> - Returns an array of matching images
383
+ # @param element_name [String] The desired name for the new image.
384
+ # @param selector [Hash] The selector for the new image.
385
+ def self.images(element_name, selector)
386
+ define_method element_name.to_s do
387
+ @browser.images(selector)
388
+ end
389
+ end
390
+
391
+ # For each inputs() defined in the page object these methods are added:
392
+ # * <name> - Returns an array of matching inputs
393
+ # @param element_name [String] The desired name for the new input.
394
+ # @param selector [Hash] The selector for the new input.
395
+ def self.inputs(element_name, selector)
396
+ define_method element_name.to_s do
397
+ @browser.inputs(selector)
398
+ end
399
+ end
400
+
401
+ # For each links() defined in the page object these methods are added:
402
+ # * <name> - Returns an array of matching links
403
+ # @param element_name [String] The desired name for the new link.
404
+ # @param selector [Hash] The selector for the new link.
405
+ def self.links(element_name, selector)
406
+ define_method element_name.to_s do
407
+ @browser.links(selector)
408
+ end
409
+ end
410
+
411
+ # For each options() defined in the page object these methods are added:
412
+ # * <name> - Returns an array of matching options
413
+ # @param element_name [String] The desired name for the new option.
414
+ # @param selector [Hash] The selector for the new option.
415
+ def self.options(element_name, selector)
416
+ define_method element_name.to_s do
417
+ @browser.options(selector)
418
+ end
419
+ end
420
+
421
+ # For each radios() defined in the page object these methods are added:
422
+ # * <name> - Returns an array of matching radios
423
+ # @param element_name [String] The desired name for the new radio.
424
+ # @param selector [Hash] The selector for the new radio.
425
+ def self.radios(element_name, selector)
426
+ define_method element_name.to_s do
427
+ @browser.radios(selector)
428
+ end
429
+ end
430
+
431
+ # For each selects() defined in the page object these methods are added:
432
+ # * <name> - Returns an array of matching selects
433
+ # @param element_name [String] The desired name for the new select.
434
+ # @param selector [Hash] The selector for the new select.
435
+ def self.selects(element_name, selector)
436
+ define_method element_name.to_s do
437
+ @browser.selects(selector)
438
+ end
439
+ end
440
+
441
+ # For each tables() defined in the page object these methods are added:
442
+ # * <name> - Returns an array of matching tables
443
+ # @param element_name [String] The desired name for the new table.
444
+ # @param selector [Hash] The selector for the new table.
445
+ def self.tables(element_name, selector)
446
+ define_method element_name.to_s do
447
+ @browser.tables(selector)
448
+ end
449
+ end
450
+
451
+ # For each table_cells() defined in the page object these methods are added:
452
+ # * <name> - Returns an array of matching table_cells
453
+ # @param element_name [String] The desired name for the new table_cell.
454
+ # @param selector [Hash] The selector for the new table_cell.
455
+ def self.table_cells(element_name, selector)
456
+ define_method element_name.to_s do
457
+ @browser.table_cells(selector)
458
+ end
459
+ end
460
+
461
+ # For each tds() defined in the page object these methods are added:
462
+ # * <name> - Returns an array of matching tds
463
+ # @param element_name [String] The desired name for the new td.
464
+ # @param selector [Hash] The selector for the new td.
465
+ def self.tds(element_name, selector)
466
+ define_method element_name.to_s do
467
+ @browser.tds(selector)
468
+ end
469
+ end
470
+
471
+ # For each table_rows() defined in the page object these methods are added:
472
+ # * <name> - Returns an array of matching table_rows
473
+ # @param element_name [String] The desired name for the new table_row.
474
+ # @param selector [Hash] The selector for the new table_row.
475
+ def self.trs(element_name, selector)
476
+ define_method element_name.to_s do
477
+ @browser.trs(selector)
478
+ end
479
+ end
480
+
481
+ # For each table_sections() defined in the page object these methods are added:
482
+ # * <name> - Returns an array of matching table_sections
483
+ # @param element_name [String] The desired name for the new table_section.
484
+ # @param selector [Hash] The selector for the new table_section.
485
+ def self.table_sections(element_name, selector)
486
+ define_method element_name.to_s do
487
+ @browser.table_sections(selector)
488
+ end
489
+ end
490
+
491
+ # For each text_areas() defined in the page object these methods are added:
492
+ # * <name> - Returns an array of matching text_areas
493
+ # @param element_name [String] The desired name for the new text_area.
494
+ # @param selector [Hash] The selector for the new text_area.
495
+ def self.text_areas(element_name, selector)
496
+ define_method element_name.to_s do
497
+ @browser.text_areas(selector)
498
+ end
499
+ end
500
+
501
+ # For each text_fields() defined in the page object these methods are added:
502
+ # * <name> - Returns an array of matching text_fields
503
+ # @param element_name [String] The desired name for the new text_field.
504
+ # @param selector [Hash] The selector for the new text_field.
505
+ def self.text_fields(element_name, selector)
506
+ define_method element_name.to_s do
507
+ @browser.text_fields(selector)
508
+ end
509
+ end
510
+
511
+ # For each h1() defined in the page object these methods are added:
512
+ # * <name> - Returns the first matching h1
513
+ # @param element_name [String] The desired name for the new h1.
514
+ # @param selector [Hash] The selector for the new h1.
515
+ def self.h1(element_name, selector)
516
+ define_method element_name.to_s do
517
+ @browser.h1(selector)
518
+ end
519
+ end
520
+
521
+ # For each h1s() defined in the page object these methods are added:
522
+ # * <name> - Returns an array of matching h1s
523
+ # @param element_name [String] The desired name for the new h1s.
524
+ # @param selector [Hash] The selector for the new h1s.
525
+ def self.h1s(element_name, selector)
526
+ define_method element_name.to_s do
527
+ @browser.h1s(selector)
528
+ end
529
+ end
530
+
531
+ # For each h1() defined in the page object these methods are added:
532
+ # * <name> - Returns the first matching h2
533
+ # @param element_name [String] The desired name for the new h2.
534
+ # @param selector [Hash] The selector for the new h2.
535
+ def self.h2(element_name, selector)
536
+ define_method element_name.to_s do
537
+ @browser.h2(selector)
538
+ end
539
+ end
540
+
541
+ # For each h2s() defined in the page object these methods are added:
542
+ # * <name> - Returns an array of matching h2s
543
+ # @param element_name [String] The desired name for the new h2s.
544
+ # @param selector [Hash] The selector for the new h2s.
545
+ def self.h2s(element_name, selector)
546
+ define_method element_name.to_s do
547
+ @browser.h2s(selector)
548
+ end
549
+ end
550
+
551
+ # For each h3() defined in the page object these methods are added:
552
+ # * <name> - Returns the first matching h3
553
+ # @param element_name [String] The desired name for the new h3.
554
+ # @param selector [Hash] The selector for the new h3.
555
+ def self.h3(element_name, selector)
556
+ define_method element_name.to_s do
557
+ @browser.h3(selector)
558
+ end
559
+ end
560
+
561
+ # For each h3s() defined in the page object these methods are added:
562
+ # * <name> - Returns an array of matching h3s
563
+ # @param element_name [String] The desired name for the new h3s.
564
+ # @param selector [Hash] The selector for the new h3s.
565
+ def self.h3s(element_name, selector)
566
+ define_method element_name.to_s do
567
+ @browser.h3s(selector)
568
+ end
569
+ end
570
+
571
+ # For each h4() defined in the page object these methods are added:
572
+ # * <name> - Returns the first matching h4
573
+ # @param element_name [String] The desired name for the new h4.
574
+ # @param selector [Hash] The selector for the new h4.
575
+ def self.h4(element_name, selector)
576
+ define_method element_name.to_s do
577
+ @browser.h4(selector)
578
+ end
579
+ end
580
+
581
+ # For each h4s() defined in the page object these methods are added:
582
+ # * <name> - Returns an array of matching h4s
583
+ # @param element_name [String] The desired name for the new h4s.
584
+ # @param selector [Hash] The selector for the new h4s.
585
+ def self.h4s(element_name, selector)
586
+ define_method element_name.to_s do
587
+ @browser.h4s(selector)
588
+ end
589
+ end
590
+
591
+ # For each h5() defined in the page object these methods are added:
592
+ # * <name> - Returns the first matching h5
593
+ # @param element_name [String] The desired name for the new h5.
594
+ # @param selector [Hash] The selector for the new h5.
595
+ def self.h5(element_name, selector)
596
+ define_method element_name.to_s do
597
+ @browser.h5(selector)
598
+ end
599
+ end
600
+
601
+ # For each h5s() defined in the page object these methods are added:
602
+ # * <name> - Returns an array of matching h5s
603
+ # @param element_name [String] The desired name for the new h5s.
604
+ # @param selector [Hash] The selector for the new h5s.
605
+ def self.h5s(element_name, selector)
606
+ define_method element_name.to_s do
607
+ @browser.h5s(selector)
608
+ end
609
+ end
610
+
611
+ # For each h7() defined in the page object these methods are added:
612
+ # * <name> - Returns the first matching h7
613
+ # @param element_name [String] The desired name for the new h7.
614
+ # @param selector [Hash] The selector for the new h7.
615
+ def self.h7(element_name, selector)
616
+ define_method element_name.to_s do
617
+ @browser.h7(selector)
618
+ end
619
+ end
620
+
621
+ # For each h7s() defined in the page object these methods are added:
622
+ # * <name> - Returns an array of matching h7s
623
+ # @param element_name [String] The desired name for the new h7s.
624
+ # @param selector [Hash] The selector for the new h7s.
625
+ def self.h7s(element_name, selector)
626
+ define_method element_name.to_s do
627
+ @browser.h7s(selector)
628
+ end
629
+ end
630
+
631
+ # For each div() defined in the page object these methods are added:
632
+ # * <name> - Returns the first matching div
633
+ # @param element_name [String] The desired name for the new div.
634
+ # @param selector [Hash] The selector for the new div.
635
+ def self.div(element_name, selector)
636
+ define_method element_name.to_s do
637
+ @browser.div(selector)
638
+ end
639
+ end
640
+
641
+ # For each divs() defined in the page object these methods are added:
642
+ # * <name> - Returns an array of matching divs
643
+ # @param element_name [String] The desired name for the new divs.
644
+ # @param selector [Hash] The selector for the new divs.
645
+ def self.divs(element_name, selector)
646
+ define_method element_name.to_s do
647
+ @browser.divs(selector)
648
+ end
649
+ end
650
+
651
+ # For each ul() defined in the page object these methods are added:
652
+ # * <name> - Returns the first matching ul
653
+ # @param element_name [String] The desired name for the new ul.
654
+ # @param selector [Hash] The selector for the new ul.
655
+ def self.ul(element_name, selector)
656
+ define_method element_name.to_s do
657
+ @browser.ul(selector)
658
+ end
659
+ end
660
+
661
+ # For each uls() defined in the page object these methods are added:
662
+ # * <name> - Returns an array of matching uls
663
+ # @param element_name [String] The desired name for the new uls.
664
+ # @param selector [Hash] The selector for the new uls.
665
+ def self.uls(element_name, selector)
666
+ define_method element_name.to_s do
667
+ @browser.uls(selector)
668
+ end
669
+ end
670
+
671
+ # For each li() defined in the page object these methods are added:
672
+ # * <name> - Returns the first matching li
673
+ # @param element_name [String] The desired name for the new li.
674
+ # @param selector [Hash] The selector for the new li.
675
+ def self.li(element_name, selector)
676
+ define_method element_name.to_s do
677
+ @browser.li(selector)
678
+ end
679
+ end
680
+
681
+ # For each lis() defined in the page object these methods are added:
682
+ # * <name> - Returns an array of matching lis
683
+ # @param element_name [String] The desired name for the new lis.
684
+ # @param selector [Hash] The selector for the new lis.
685
+ def self.lis(element_name, selector)
686
+ define_method element_name.to_s do
687
+ @browser.lis(selector)
688
+ end
689
+ end
690
+
691
+ # For each dropdown() defined in the page object these methods are added:
692
+ # * <name> - Returns the first matching dropdown
693
+ # @param element_name [String] The desired name for the new dropdown.
694
+ # @param selector [Hash] The selector for the new dropdown.
695
+ def self.dropdown(element_name, selector)
696
+ define_method element_name.to_s do
697
+ @browser.select(selector)
698
+ end
699
+ end
700
+
701
+ # For each dropdowns() defined in the page object these methods are added:
702
+ # * <name> - Returns an array of matching dropdowns
703
+ # @param element_name [String] The desired name for the new dropdowns.
704
+ # @param selector [Hash] The selector for the new dropdowns.
705
+ def self.dropdowns(element_name, selector)
706
+ define_method element_name.to_s do
707
+ @browser.selects(selector)
708
+ end
709
+ end
710
+
711
+ # For each span() defined in the page object these methods are added:
712
+ # * <name> - Returns the first matching span
713
+ # @param element_name [String] The desired name for the new span.
714
+ # @param selector [Hash] The selector for the new span.
715
+ def self.span(element_name, selector)
716
+ define_method element_name.to_s do
717
+ @browser.span(selector)
718
+ end
719
+ end
720
+
721
+ # For each spans() defined in the page object these methods are added:
722
+ # * <name> - Returns an array of matching spans
723
+ # @param element_name [String] The desired name for the new spans.
724
+ # @param selector [Hash] The selector for the new spans.
725
+ def self.spans(element_name, selector)
726
+ define_method element_name.to_s do
727
+ @browser.spans(selector)
728
+ end
729
+ end
730
+ end
@@ -0,0 +1,3 @@
1
+ module WatirWebdriverPageObject
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'watir_webdriver_page_object/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'watir-webdriver-page-object'
8
+ spec.version = WatirWebdriverPageObject::VERSION
9
+ spec.authors = ['Aaron Humerickhouse']
10
+ spec.email = ['aaron.humerickhouse@sportngin.com']
11
+
12
+ spec.summary = 'Adds basic page object functionality to watir-webdriver'
13
+ spec.homepage = 'http://github.com/TIMBERings/watir_webdriver_page_object'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.10'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'watir-webdriver'
24
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: watir-webdriver-page-object
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aaron Humerickhouse
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-20 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: watir-webdriver
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - aaron.humerickhouse@sportngin.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - CODE_OF_CONDUCT.md
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/watir_webdriver_page_object.rb
71
+ - lib/watir_webdriver_page_object/version.rb
72
+ - watir_webdriver_page_object.gemspec
73
+ homepage: http://github.com/TIMBERings/watir_webdriver_page_object
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.4.8
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Adds basic page object functionality to watir-webdriver
97
+ test_files: []