page-object 2.2.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.coveralls.yml +1 -1
- data/.gitignore +8 -8
- data/.rspec +2 -2
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +17 -17
- data/ChangeLog +923 -888
- data/Gemfile +13 -13
- data/Guardfile +20 -20
- data/LICENSE +20 -20
- data/README.md +114 -114
- data/Rakefile +29 -29
- data/cucumber.yml +8 -8
- data/lib/page-object.rb +431 -420
- data/lib/page-object/accessors.rb +1201 -1175
- data/lib/page-object/element_locators.rb +21 -21
- data/lib/page-object/elements.rb +62 -61
- data/lib/page-object/elements/area.rb +9 -9
- data/lib/page-object/elements/audio.rb +9 -9
- data/lib/page-object/elements/bold.rb +9 -9
- data/lib/page-object/elements/button.rb +12 -12
- data/lib/page-object/elements/canvas.rb +10 -10
- data/lib/page-object/elements/check_box.rb +9 -9
- data/lib/page-object/elements/date_field.rb +10 -0
- data/lib/page-object/elements/div.rb +9 -9
- data/lib/page-object/elements/element.rb +212 -159
- data/lib/page-object/elements/file_field.rb +9 -9
- data/lib/page-object/elements/form.rb +9 -9
- data/lib/page-object/elements/heading.rb +14 -14
- data/lib/page-object/elements/hidden_field.rb +9 -9
- data/lib/page-object/elements/image.rb +10 -10
- data/lib/page-object/elements/italic.rb +9 -9
- data/lib/page-object/elements/label.rb +9 -9
- data/lib/page-object/elements/link.rb +9 -9
- data/lib/page-object/elements/list_item.rb +9 -9
- data/lib/page-object/elements/media.rb +11 -11
- data/lib/page-object/elements/option.rb +9 -9
- data/lib/page-object/elements/ordered_list.rb +43 -45
- data/lib/page-object/elements/paragraph.rb +9 -9
- data/lib/page-object/elements/radio_button.rb +9 -9
- data/lib/page-object/elements/select_list.rb +42 -42
- data/lib/page-object/elements/span.rb +9 -9
- data/lib/page-object/elements/table.rb +85 -68
- data/lib/page-object/elements/table_cell.rb +10 -10
- data/lib/page-object/elements/table_row.rb +52 -52
- data/lib/page-object/elements/text_area.rb +9 -9
- data/lib/page-object/elements/text_field.rb +10 -10
- data/lib/page-object/elements/unordered_list.rb +42 -44
- data/lib/page-object/elements/video.rb +9 -9
- data/lib/page-object/indexed_properties.rb +41 -41
- data/lib/page-object/javascript/angularjs.rb +14 -14
- data/lib/page-object/javascript/jquery.rb +14 -14
- data/lib/page-object/javascript/prototype.rb +14 -14
- data/lib/page-object/javascript/yui.rb +18 -18
- data/lib/page-object/javascript_framework_facade.rb +80 -80
- data/lib/page-object/locator_generator.rb +183 -182
- data/lib/page-object/nested_elements.rb +17 -17
- data/lib/page-object/page_factory.rb +108 -108
- data/lib/page-object/page_populator.rb +105 -95
- data/lib/page-object/platforms/watir.rb +50 -50
- data/lib/page-object/platforms/watir/page_object.rb +1155 -1124
- data/lib/page-object/section_collection.rb +16 -16
- data/lib/page-object/version.rb +4 -4
- data/lib/page-object/widgets.rb +98 -98
- data/page-object.gemspec +32 -32
- metadata +12 -12
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class FileField < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.type_to_class[:file] = ::PageObject::Elements::FileField
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class FileField < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.type_to_class[:file] = ::PageObject::Elements::FileField
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Form < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:form] = ::PageObject::Elements::Form
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Form < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:form] = ::PageObject::Elements::Form
|
8
|
+
end
|
9
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Heading < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:h1] = ::PageObject::Elements::Heading
|
8
|
-
::PageObject::Elements.tag_to_class[:h2] = ::PageObject::Elements::Heading
|
9
|
-
::PageObject::Elements.tag_to_class[:h3] = ::PageObject::Elements::Heading
|
10
|
-
::PageObject::Elements.tag_to_class[:h4] = ::PageObject::Elements::Heading
|
11
|
-
::PageObject::Elements.tag_to_class[:h5] = ::PageObject::Elements::Heading
|
12
|
-
::PageObject::Elements.tag_to_class[:h6] = ::PageObject::Elements::Heading
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Heading < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:h1] = ::PageObject::Elements::Heading
|
8
|
+
::PageObject::Elements.tag_to_class[:h2] = ::PageObject::Elements::Heading
|
9
|
+
::PageObject::Elements.tag_to_class[:h3] = ::PageObject::Elements::Heading
|
10
|
+
::PageObject::Elements.tag_to_class[:h4] = ::PageObject::Elements::Heading
|
11
|
+
::PageObject::Elements.tag_to_class[:h5] = ::PageObject::Elements::Heading
|
12
|
+
::PageObject::Elements.tag_to_class[:h6] = ::PageObject::Elements::Heading
|
13
|
+
end
|
14
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class HiddenField < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.type_to_class[:hidden] = ::PageObject::Elements::HiddenField
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class HiddenField < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.type_to_class[:hidden] = ::PageObject::Elements::HiddenField
|
8
|
+
end
|
9
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Image < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:img] = ::PageObject::Elements::Image
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Image < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:img] = ::PageObject::Elements::Image
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Italic < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:i] = ::PageObject::Elements::Italic
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Italic < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:i] = ::PageObject::Elements::Italic
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Label < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:label] = ::PageObject::Elements::Label
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Label < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:label] = ::PageObject::Elements::Label
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Link < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:a] = ::PageObject::Elements::Link
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Link < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:a] = ::PageObject::Elements::Link
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class ListItem < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:li] = ::PageObject::Elements::ListItem
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class ListItem < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:li] = ::PageObject::Elements::ListItem
|
8
|
+
end
|
9
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Media < Element
|
4
|
-
|
5
|
-
def has_controls?
|
6
|
-
attribute(:controls)
|
7
|
-
end
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Media < Element
|
4
|
+
|
5
|
+
def has_controls?
|
6
|
+
attribute(:controls)
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Option < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:option] = ::PageObject::Elements::Option
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Option < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:option] = ::PageObject::Elements::Option
|
8
|
+
end
|
9
|
+
end
|
@@ -1,45 +1,43 @@
|
|
1
|
-
|
2
|
-
module PageObject
|
3
|
-
module Elements
|
4
|
-
class OrderedList < Element
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
#
|
8
|
-
# iterator that yields with a PageObject::Elements::ListItem
|
9
|
-
#
|
10
|
-
# @return [PageObject::Elements::ListItem]
|
11
|
-
#
|
12
|
-
def each(&block)
|
13
|
-
list_items.each(&block)
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# Return the PageObject::Elements::ListItem for the index provided. Index
|
18
|
-
# is zero based.
|
19
|
-
#
|
20
|
-
# @return [PageObject::Elements::ListItem]
|
21
|
-
#
|
22
|
-
def [](idx)
|
23
|
-
list_items[idx]
|
24
|
-
end
|
25
|
-
|
26
|
-
#
|
27
|
-
# Return the number of items contained in the ordered list
|
28
|
-
#
|
29
|
-
def items
|
30
|
-
list_items.size
|
31
|
-
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# Return Array of ListItem objects that are children of the OrderedList
|
35
|
-
#
|
36
|
-
def list_items
|
37
|
-
@list_items ||= children(tag_name: 'li')
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
1
|
+
|
2
|
+
module PageObject
|
3
|
+
module Elements
|
4
|
+
class OrderedList < Element
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
#
|
8
|
+
# iterator that yields with a PageObject::Elements::ListItem
|
9
|
+
#
|
10
|
+
# @return [PageObject::Elements::ListItem]
|
11
|
+
#
|
12
|
+
def each(&block)
|
13
|
+
list_items.each(&block)
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# Return the PageObject::Elements::ListItem for the index provided. Index
|
18
|
+
# is zero based.
|
19
|
+
#
|
20
|
+
# @return [PageObject::Elements::ListItem]
|
21
|
+
#
|
22
|
+
def [](idx)
|
23
|
+
list_items[idx]
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Return the number of items contained in the ordered list
|
28
|
+
#
|
29
|
+
def items
|
30
|
+
list_items.size
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Return Array of ListItem objects that are children of the OrderedList
|
35
|
+
#
|
36
|
+
def list_items
|
37
|
+
@list_items ||= children(tag_name: 'li')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
::PageObject::Elements.tag_to_class[:ol] = ::PageObject::Elements::OrderedList
|
42
|
+
end
|
43
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class Paragraph < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.tag_to_class[:p] = ::PageObject::Elements::Paragraph
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class Paragraph < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.tag_to_class[:p] = ::PageObject::Elements::Paragraph
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class RadioButton < Element
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
::PageObject::Elements.type_to_class[:radio] = ::PageObject::Elements::RadioButton
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class RadioButton < Element
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
::PageObject::Elements.type_to_class[:radio] = ::PageObject::Elements::RadioButton
|
8
|
+
end
|
9
|
+
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
module PageObject
|
2
|
-
module Elements
|
3
|
-
class SelectList < Element
|
4
|
-
|
5
|
-
#
|
6
|
-
# Return the PageObject::Elements::Option for the index provided. Index
|
7
|
-
# is zero based.
|
8
|
-
#
|
9
|
-
# @return [PageObject::Elements::Option]
|
10
|
-
#
|
11
|
-
def [](idx)
|
12
|
-
options[idx]
|
13
|
-
end
|
14
|
-
|
15
|
-
#
|
16
|
-
# Return an array of Options contained in the select list.
|
17
|
-
#
|
18
|
-
# @return [array of PageObject::Elements::Option]
|
19
|
-
#
|
20
|
-
def options
|
21
|
-
element.options.map { |e| PageObject::Elements::Option.new(e) }
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# @return [Array<String>] An array of strings representing the text of the currently selected options.
|
26
|
-
#
|
27
|
-
def selected_options
|
28
|
-
element.selected_options.map(&:text).compact
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# @return [Array<String>] An array of strings representing the value of the currently selected options.
|
33
|
-
#
|
34
|
-
def selected_values
|
35
|
-
element.selected_options.map(&:value).compact
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
::PageObject::Elements.tag_to_class[:select] = ::PageObject::Elements::SelectList
|
41
|
-
end
|
42
|
-
end
|
1
|
+
module PageObject
|
2
|
+
module Elements
|
3
|
+
class SelectList < Element
|
4
|
+
|
5
|
+
#
|
6
|
+
# Return the PageObject::Elements::Option for the index provided. Index
|
7
|
+
# is zero based.
|
8
|
+
#
|
9
|
+
# @return [PageObject::Elements::Option]
|
10
|
+
#
|
11
|
+
def [](idx)
|
12
|
+
options[idx]
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# Return an array of Options contained in the select list.
|
17
|
+
#
|
18
|
+
# @return [array of PageObject::Elements::Option]
|
19
|
+
#
|
20
|
+
def options
|
21
|
+
element.options.map { |e| PageObject::Elements::Option.new(e) }
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# @return [Array<String>] An array of strings representing the text of the currently selected options.
|
26
|
+
#
|
27
|
+
def selected_options
|
28
|
+
element.selected_options.map(&:text).compact
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# @return [Array<String>] An array of strings representing the value of the currently selected options.
|
33
|
+
#
|
34
|
+
def selected_values
|
35
|
+
element.selected_options.map(&:value).compact
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
::PageObject::Elements.tag_to_class[:select] = ::PageObject::Elements::SelectList
|
41
|
+
end
|
42
|
+
end
|