page-object 0.8.7 → 0.8.8
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.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -2
- data/ChangeLog +5 -0
- data/features/area.feature +0 -8
- data/features/audio.feature +0 -8
- data/features/canvas.feature +0 -8
- data/features/div.feature +0 -8
- data/features/gxt_table_extension.feature +2 -1
- data/features/headings.feature +0 -48
- data/features/label.feature +0 -8
- data/features/link.feature +0 -9
- data/features/list_item.feature +0 -8
- data/features/paragraph.feature +0 -8
- data/features/span.feature +0 -8
- data/features/step_definitions/gxt_table_steps.rb +24 -16
- data/features/support/env.rb +1 -0
- data/features/table_cell.feature +0 -8
- data/features/video.feature +0 -8
- data/lib/page-object/accessors.rb +16 -16
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +26 -0
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +14 -12
- data/spec/page-object/elements/div_spec.rb +2 -2
- data/spec/page-object/page-object_spec.rb +1 -1
- metadata +23 -44
- data/.rvmrc +0 -2
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dfa172a1868058c6898f6df913eabfd8bfe4ab06
|
4
|
+
data.tar.gz: 5f9ca6f196ecb011fa43529f6b0eb1a5761fc17b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c001a8140a22b48148a72fe2f5e4f3b7a17d3f6f07ce812e1a31b0308cb4551cd83520658e094da7871664786f2fe303f30828e60a5a7b92daa681ac902da34
|
7
|
+
data.tar.gz: 47e1d9561c93be89b88e3c7ac54dde7354c89ddc06eaa05024bbff1c893e26c5190df49eba10ba08a457a68f4fdf582a5f1825add9b41a02c9f9e5160e129273
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
page-object
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p0
|
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== Version 0.8.8 / 2013-4-5
|
2
|
+
* Enhancements
|
3
|
+
* Added callback to widget classes to allow them to define their own accessors
|
4
|
+
* Added more support for using css when locating elements using Watir-webdriver (Neal Lindsay)
|
5
|
+
|
1
6
|
=== Version 0.8.7 / 2013-3-31
|
2
7
|
* Enhancements
|
3
8
|
* Added ability to find elements using any valid attribute
|
data/features/area.feature
CHANGED
@@ -19,14 +19,6 @@ Feature: Area
|
|
19
19
|
| name |
|
20
20
|
| xpath |
|
21
21
|
| index |
|
22
|
-
|
23
|
-
@selenium_only
|
24
|
-
Scenario Outline: Locating areas on the page
|
25
|
-
When I search for the area by "<search_by>"
|
26
|
-
Then I should be able to click the area
|
27
|
-
|
28
|
-
Scenarios:
|
29
|
-
| search_by |
|
30
22
|
| css |
|
31
23
|
|
32
24
|
Scenario: Getting the coordinates for the area
|
data/features/audio.feature
CHANGED
@@ -19,14 +19,6 @@ Feature: Support for the audio element
|
|
19
19
|
| name |
|
20
20
|
| xpath |
|
21
21
|
| index |
|
22
|
-
|
23
|
-
@selenium_only
|
24
|
-
Scenario Outline: Locating an audio element on the page
|
25
|
-
When I search for the audio element by "<search_by>"
|
26
|
-
Then I should know it is visible
|
27
|
-
|
28
|
-
Scenarios:
|
29
|
-
| search_by |
|
30
22
|
| css |
|
31
23
|
|
32
24
|
Scenario Outline: Locating audios using multiple parameters
|
data/features/canvas.feature
CHANGED
@@ -19,14 +19,6 @@ Feature: Support for the canvas element
|
|
19
19
|
| name |
|
20
20
|
| xpath |
|
21
21
|
| index |
|
22
|
-
|
23
|
-
@selenium_only
|
24
|
-
Scenario Outline: Locating a canvas on the page
|
25
|
-
When I search for the canvas by "<search_by>"
|
26
|
-
Then I should know it is visible
|
27
|
-
|
28
|
-
Examples:
|
29
|
-
| search_by |
|
30
22
|
| css |
|
31
23
|
|
32
24
|
Scenario: Determining the width and height of the canvas
|
data/features/div.feature
CHANGED
@@ -28,14 +28,6 @@ Feature: Div
|
|
28
28
|
| name |
|
29
29
|
| text |
|
30
30
|
| title |
|
31
|
-
|
32
|
-
@selenium_only
|
33
|
-
Scenario Outline: Locating divs on the page
|
34
|
-
When I search for the div by "<search_by>"
|
35
|
-
Then the text should be "page-object rocks!"
|
36
|
-
|
37
|
-
Scenarios:
|
38
|
-
| search_by |
|
39
31
|
| css |
|
40
32
|
|
41
33
|
Scenario Outline: Locating divs using multiple parameters
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@focus
|
1
2
|
Feature: Gxt Table Extension
|
2
3
|
As a Quality Engineer working on a Gxt or Gwt project
|
3
4
|
In order to easily create test widgets to interact with application widgets
|
@@ -21,4 +22,4 @@ Feature: Gxt Table Extension
|
|
21
22
|
|
22
23
|
Scenario: Confirm a correct row count from a GxtTable
|
23
24
|
When I retrieve a GxtTable widget
|
24
|
-
|
25
|
+
Then the GxtTable should have "13" rows
|
data/features/headings.feature
CHANGED
@@ -28,14 +28,6 @@ Feature: Headings
|
|
28
28
|
| name |
|
29
29
|
| xpath |
|
30
30
|
| index |
|
31
|
-
|
32
|
-
@selenium_only
|
33
|
-
Scenario Outline: Locating h1s on the Page
|
34
|
-
When I search for the heading1 by "<search_by>"
|
35
|
-
Then I should see "h1's are cool"
|
36
|
-
|
37
|
-
Scenarios:
|
38
|
-
| search_by |
|
39
31
|
| css |
|
40
32
|
|
41
33
|
Scenario Outline: Locating h2s on the Page
|
@@ -49,14 +41,6 @@ Feature: Headings
|
|
49
41
|
| name |
|
50
42
|
| xpath |
|
51
43
|
| index |
|
52
|
-
|
53
|
-
@selenium_only
|
54
|
-
Scenario Outline: Locating h2s on the Page
|
55
|
-
When I search for the heading2 by "<search_by>"
|
56
|
-
Then I should see "h2's are cool"
|
57
|
-
|
58
|
-
Scenarios:
|
59
|
-
| search_by |
|
60
44
|
| css |
|
61
45
|
|
62
46
|
Scenario Outline: Locating h3s on the Page
|
@@ -70,14 +54,6 @@ Feature: Headings
|
|
70
54
|
| name |
|
71
55
|
| xpath |
|
72
56
|
| index |
|
73
|
-
|
74
|
-
@selenium_only
|
75
|
-
Scenario Outline: Locating h3s on the Page
|
76
|
-
When I search for the heading3 by "<search_by>"
|
77
|
-
Then I should see "h3's are cool"
|
78
|
-
|
79
|
-
Scenarios:
|
80
|
-
| search_by |
|
81
57
|
| css |
|
82
58
|
|
83
59
|
Scenario Outline: Locating h4s on the Page
|
@@ -91,14 +67,6 @@ Feature: Headings
|
|
91
67
|
| name |
|
92
68
|
| xpath |
|
93
69
|
| index |
|
94
|
-
|
95
|
-
@selenium_only
|
96
|
-
Scenario Outline: Locating h4s on the Page
|
97
|
-
When I search for the heading4 by "<search_by>"
|
98
|
-
Then I should see "h4's are cool"
|
99
|
-
|
100
|
-
Scenarios:
|
101
|
-
| search_by |
|
102
70
|
| css |
|
103
71
|
|
104
72
|
Scenario Outline: Locating h5s on the Page
|
@@ -112,14 +80,6 @@ Feature: Headings
|
|
112
80
|
| name |
|
113
81
|
| xpath |
|
114
82
|
| index |
|
115
|
-
|
116
|
-
@selenium_only
|
117
|
-
Scenario Outline: Locating h5s on the Page
|
118
|
-
When I search for the heading5 by "<search_by>"
|
119
|
-
Then I should see "h5's are cool"
|
120
|
-
|
121
|
-
Scenarios:
|
122
|
-
| search_by |
|
123
83
|
| css |
|
124
84
|
|
125
85
|
Scenario Outline: Locating h6s on the Page
|
@@ -133,13 +93,5 @@ Feature: Headings
|
|
133
93
|
| name |
|
134
94
|
| xpath |
|
135
95
|
| index |
|
136
|
-
|
137
|
-
@selenium_only
|
138
|
-
Scenario Outline: Locating h6s on the Page
|
139
|
-
When I search for the heading6 by "<search_by>"
|
140
|
-
Then I should see "h6's are cool"
|
141
|
-
|
142
|
-
Scenarios:
|
143
|
-
| search_by |
|
144
96
|
| css |
|
145
97
|
|
data/features/label.feature
CHANGED
@@ -28,14 +28,6 @@ Feature: Handling labels with page object
|
|
28
28
|
| index |
|
29
29
|
| name |
|
30
30
|
| text |
|
31
|
-
|
32
|
-
@selenium_only
|
33
|
-
Scenario Outline: Locating labels on the page
|
34
|
-
When I search for the label by "<search_by>"
|
35
|
-
Then the text should be "page-object is the best!"
|
36
|
-
|
37
|
-
Scenarios:
|
38
|
-
| search_by |
|
39
31
|
| css |
|
40
32
|
|
41
33
|
Scenario Outline: Locating labels using multiple parameters
|
data/features/link.feature
CHANGED
@@ -27,15 +27,6 @@ Feature: Links
|
|
27
27
|
| css |
|
28
28
|
| title |
|
29
29
|
|
30
|
-
@selenium_only
|
31
|
-
Scenario Outline: Locating links on the Page
|
32
|
-
When I search for the link by "<search_by>"
|
33
|
-
Then I should be able to select the link
|
34
|
-
|
35
|
-
Scenarios:
|
36
|
-
| search_by |
|
37
|
-
| css |
|
38
|
-
|
39
30
|
Scenario: Support for multiple parameters
|
40
31
|
When I select a link labeled "Hello" and index "0"
|
41
32
|
Then the page should contain the text "Success"
|
data/features/list_item.feature
CHANGED
@@ -19,14 +19,6 @@ Feature: List item
|
|
19
19
|
| index |
|
20
20
|
| name |
|
21
21
|
| text |
|
22
|
-
|
23
|
-
@selenium_only
|
24
|
-
Scenario Outline: Locating list items on the page
|
25
|
-
When I search for the list item by "<search_by>"
|
26
|
-
Then the text should be "Item One"
|
27
|
-
|
28
|
-
Scenarios:
|
29
|
-
| search_by |
|
30
22
|
| css |
|
31
23
|
|
32
24
|
Scenario Outline: Locating list items using multiple parameters
|
data/features/paragraph.feature
CHANGED
@@ -18,14 +18,6 @@ Feature: Paragraph
|
|
18
18
|
| xpath |
|
19
19
|
| index |
|
20
20
|
| name |
|
21
|
-
|
22
|
-
@selenium_only
|
23
|
-
Scenario Outline: Locating paragraphs on the page
|
24
|
-
When I search for the paragraph by "<search_by>"
|
25
|
-
Then the text should be "Static Elements Page"
|
26
|
-
|
27
|
-
Scenarios:
|
28
|
-
| search_by |
|
29
21
|
| css |
|
30
22
|
|
31
23
|
Scenario Outline: Locating paragraphs using multiple parameters
|
data/features/span.feature
CHANGED
@@ -20,14 +20,6 @@ Feature: Span
|
|
20
20
|
| name |
|
21
21
|
| text |
|
22
22
|
| title |
|
23
|
-
|
24
|
-
@selenium_only
|
25
|
-
Scenario Outline: Locating spans on the page
|
26
|
-
When I search for the span by "<search_by>"
|
27
|
-
Then the text should be "My alert"
|
28
|
-
|
29
|
-
Scenarios:
|
30
|
-
| search_by |
|
31
23
|
| css |
|
32
24
|
|
33
25
|
Scenario Outline: Locating span using multiple parameters
|
@@ -1,19 +1,35 @@
|
|
1
1
|
Given /^I am on the Gxt Examples page$/ do
|
2
|
-
|
3
|
-
@page.navigate_to "http://gxtexamplegallery.appspot.com/"
|
2
|
+
visit GxtSamplePageObject
|
4
3
|
end
|
5
4
|
|
6
5
|
When /^I have the Basic Grid opened$/ do
|
7
|
-
|
6
|
+
on(GxtSamplePageObject).basic_grid_element.click
|
8
7
|
end
|
9
8
|
|
10
9
|
When /^I have defined a GxtTable class extending Table$/ do
|
11
10
|
class GxtTable < PageObject::Elements::Table
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def self.accessor_methods(accessor, name)
|
13
|
+
accessor.send :define_method, "#{name}_rows" do
|
14
|
+
self.send("#{name}_element").rows
|
15
|
+
end
|
16
16
|
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
def child_xpath
|
20
|
+
".//descendant::tr"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
When /^I define a page-object using that widget$/ do
|
26
|
+
class GxtSamplePageObject
|
27
|
+
include PageObject
|
28
|
+
|
29
|
+
page_url "http://gxtexamplegallery.appspot.com/"
|
30
|
+
|
31
|
+
div(:basic_grid, :class => "label_basic_grid")
|
32
|
+
gxt_table(:gxt_table, :class => "x-grid3")
|
17
33
|
end
|
18
34
|
end
|
19
35
|
|
@@ -22,19 +38,11 @@ When /^I have registered the GxtTable with PageObject$/ do
|
|
22
38
|
end
|
23
39
|
|
24
40
|
When /^I retrieve a GxtTable widget$/ do
|
25
|
-
@element =
|
41
|
+
@element = on(GxtSamplePageObject).gxt_table_element
|
26
42
|
end
|
27
43
|
|
28
44
|
|
29
45
|
When /^the GxtTable should have "(\d+)" rows$/ do |rows|
|
30
|
-
|
46
|
+
on(GxtSamplePageObject).gxt_table_rows.should == rows.to_i
|
31
47
|
end
|
32
48
|
|
33
|
-
When /^I define a page-object using that widget$/ do
|
34
|
-
class GxtSamplePageObject
|
35
|
-
include PageObject
|
36
|
-
|
37
|
-
div(:basic_grid, :class => "label_basic_grid")
|
38
|
-
gxt_table(:gxt_table, :class => "x-grid3")
|
39
|
-
end
|
40
|
-
end
|
data/features/support/env.rb
CHANGED
data/features/table_cell.feature
CHANGED
@@ -19,14 +19,6 @@ Feature: Table Cell
|
|
19
19
|
| xpath |
|
20
20
|
| name |
|
21
21
|
| text |
|
22
|
-
|
23
|
-
@selenium_only
|
24
|
-
Scenario Outline: Locating table cells on the Page
|
25
|
-
When I search for the table cell by "<search_by>"
|
26
|
-
Then the cell data should be 'Data4'
|
27
|
-
|
28
|
-
Scenarios:
|
29
|
-
| search_by |
|
30
22
|
| css |
|
31
23
|
|
32
24
|
@watir_only
|
data/features/video.feature
CHANGED
@@ -19,14 +19,6 @@ Feature: Support for video element
|
|
19
19
|
| name |
|
20
20
|
| xpath |
|
21
21
|
| index |
|
22
|
-
|
23
|
-
@selenium_only
|
24
|
-
Scenario Outline: Locating a video element on the page
|
25
|
-
When I search for the video element by "<search_by>"
|
26
|
-
Then I should know it is visible
|
27
|
-
|
28
|
-
Scenarios:
|
29
|
-
| search_by |
|
30
22
|
| css |
|
31
23
|
|
32
24
|
Scenario Outline: Locating videos using multiple parameters
|
@@ -413,7 +413,7 @@ module PageObject
|
|
413
413
|
# @param [Hash] identifier how we find a div. You can use a multiple paramaters
|
414
414
|
# by combining of any of the following except xpath. The valid keys are:
|
415
415
|
# * :class => Watir and Selenium
|
416
|
-
# * :css => Selenium
|
416
|
+
# * :css => Watir and Selenium
|
417
417
|
# * :id => Watir and Selenium
|
418
418
|
# * :index => Watir and Selenium
|
419
419
|
# * :name => Watir and Selenium
|
@@ -442,7 +442,7 @@ module PageObject
|
|
442
442
|
# @param [Hash] identifier how we find a span. You can use a multiple paramaters
|
443
443
|
# by combining of any of the following except xpath. The valid keys are:
|
444
444
|
# * :class => Watir and Selenium
|
445
|
-
# * :css => Selenium
|
445
|
+
# * :css => Watir and Selenium
|
446
446
|
# * :id => Watir and Selenium
|
447
447
|
# * :index => Watir and Selenium
|
448
448
|
# * :name => Watir and Selenium
|
@@ -501,7 +501,7 @@ module PageObject
|
|
501
501
|
# @param [Hash] identifier how we find a cell. You can use a multiple paramaters
|
502
502
|
# by combining of any of the following except xpath. The valid keys are:
|
503
503
|
# * :class => Watir and Selenium
|
504
|
-
# * :css => Selenium
|
504
|
+
# * :css => Watir and Selenium
|
505
505
|
# * :id => Watir and Selenium
|
506
506
|
# * :index => Watir and Selenium
|
507
507
|
# * :name => Watir and Selenium
|
@@ -580,7 +580,7 @@ module PageObject
|
|
580
580
|
# @param [Hash] identifier how we find a list item. You can use a multiple paramaters
|
581
581
|
# by combining of any of the following except xpath. The valid keys are:
|
582
582
|
# * :class => Watir and Selenium
|
583
|
-
# * :css => Selenium
|
583
|
+
# * :css => Watir and Selenium
|
584
584
|
# * :id => Watir and Selenium
|
585
585
|
# * :index => Watir and Selenium
|
586
586
|
# * :name => Watir and Selenium
|
@@ -667,7 +667,7 @@ module PageObject
|
|
667
667
|
# @param [Hash] identifier how we find a H1. You can use a multiple paramaters
|
668
668
|
# by combining of any of the following except xpath. The valid keys are:
|
669
669
|
# * :class => Watir and Selenium
|
670
|
-
# * :css => Selenium
|
670
|
+
# * :css => Watir and Selenium
|
671
671
|
# * :id => Watir and Selenium
|
672
672
|
# * :index => Watir and Selenium
|
673
673
|
# * :name => Watir and Selenium
|
@@ -694,7 +694,7 @@ module PageObject
|
|
694
694
|
# @param [Hash] identifier how we find a H2. You can use a multiple paramaters
|
695
695
|
# by combining of any of the following except xpath. The valid keys are:
|
696
696
|
# * :class => Watir and Selenium
|
697
|
-
# * :css => Selenium
|
697
|
+
# * :css => Watir and Selenium
|
698
698
|
# * :id => Watir and Selenium
|
699
699
|
# * :index => Watir and Selenium
|
700
700
|
# * :name => Watir and Selenium
|
@@ -721,7 +721,7 @@ module PageObject
|
|
721
721
|
# @param [Hash] identifier how we find a H3. You can use a multiple paramaters
|
722
722
|
# by combining of any of the following except xpath. The valid keys are:
|
723
723
|
# * :class => Watir and Selenium
|
724
|
-
# * :css => Selenium
|
724
|
+
# * :css => Watir and Selenium
|
725
725
|
# * :id => Watir and Selenium
|
726
726
|
# * :index => Watir and Selenium
|
727
727
|
# * :name => Watir and Selenium
|
@@ -748,7 +748,7 @@ module PageObject
|
|
748
748
|
# @param [Hash] identifier how we find a H4. You can use a multiple paramaters
|
749
749
|
# by combining of any of the following except xpath. The valid keys are:
|
750
750
|
# * :class => Watir and Selenium
|
751
|
-
# * :css => Selenium
|
751
|
+
# * :css => Watir and Selenium
|
752
752
|
# * :id => Watir and Selenium
|
753
753
|
# * :index => Watir and Selenium
|
754
754
|
# * :name => Watir and Selenium
|
@@ -775,7 +775,7 @@ module PageObject
|
|
775
775
|
# @param [Hash] identifier how we find a H5. You can use a multiple paramaters
|
776
776
|
# by combining of any of the following except xpath. The valid keys are:
|
777
777
|
# * :class => Watir and Selenium
|
778
|
-
# * :css => Selenium
|
778
|
+
# * :css => Watir and Selenium
|
779
779
|
# * :id => Watir and Selenium
|
780
780
|
# * :index => Watir and Selenium
|
781
781
|
# * :name => Watir and Selenium
|
@@ -802,7 +802,7 @@ module PageObject
|
|
802
802
|
# @param [Hash] identifier how we find a H6. You can use a multiple paramaters
|
803
803
|
# by combining of any of the following except xpath. The valid keys are:
|
804
804
|
# * :class => Watir and Selenium
|
805
|
-
# * :css => Selenium
|
805
|
+
# * :css => Watir and Selenium
|
806
806
|
# * :id => Watir and Selenium
|
807
807
|
# * :index => Watir and Selenium
|
808
808
|
# * :name => Watir and Selenium
|
@@ -829,7 +829,7 @@ module PageObject
|
|
829
829
|
# @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters
|
830
830
|
# by combining of any of the following except xpath. The valid keys are:
|
831
831
|
# * :class => Watir and Selenium
|
832
|
-
# * :css => Selenium
|
832
|
+
# * :css => Watir and Selenium
|
833
833
|
# * :id => Watir and Selenium
|
834
834
|
# * :index => Watir and Selenium
|
835
835
|
# * :name => Watir and Selenium
|
@@ -886,7 +886,7 @@ module PageObject
|
|
886
886
|
# @param [Hash] identifier how we find a label. You can use a multiple paramaters
|
887
887
|
# by combining of any of the following except xpath. The valid keys are:
|
888
888
|
# * :class => Watir and Selenium
|
889
|
-
# * :css => Selenium
|
889
|
+
# * :css => Watir and Selenium
|
890
890
|
# * :id => Watir and Selenium
|
891
891
|
# * :index => Watir and Selenium
|
892
892
|
# * :name => Watir and Selenium
|
@@ -914,7 +914,7 @@ module PageObject
|
|
914
914
|
# @param [Hash] identifier how we find an area. You can use a multiple paramaters
|
915
915
|
# by combining of any of the following except xpath. The valid keys are:
|
916
916
|
# * :class => Watir and Selenium
|
917
|
-
# * :css => Selenium
|
917
|
+
# * :css => Watir and Selenium
|
918
918
|
# * :id => Watir and Selenium
|
919
919
|
# * :index => Watir and Selenium
|
920
920
|
# * :name => Watir and Selenium
|
@@ -942,7 +942,7 @@ module PageObject
|
|
942
942
|
# @param [Hash] identifier how we find a canvas. You can use a multiple paramaters
|
943
943
|
# by combining of any of the following except xpath. The valid keys are:
|
944
944
|
# * :class => Watir and Selenium
|
945
|
-
# * :css => Selenium
|
945
|
+
# * :css => Watir and Selenium
|
946
946
|
# * :id => Watir and Selenium
|
947
947
|
# * :index => Watir and Selenium
|
948
948
|
# * :name => Watir and Selenium
|
@@ -965,7 +965,7 @@ module PageObject
|
|
965
965
|
# @param [Hash] identifier how we find an audio element. You can use a multiple paramaters
|
966
966
|
# by combining of any of the following except xpath. The valid keys are:
|
967
967
|
# * :class => Watir and Selenium
|
968
|
-
# * :css => Selenium
|
968
|
+
# * :css => Watir and Selenium
|
969
969
|
# * :id => Watir and Selenium
|
970
970
|
# * :index => Watir and Selenium
|
971
971
|
# * :name => Watir and Selenium
|
@@ -988,7 +988,7 @@ module PageObject
|
|
988
988
|
# @param [Hash] identifier how we find a video element. You can use a multiple paramaters
|
989
989
|
# by combining of any of the following except xpath. The valid keys are:
|
990
990
|
# * :class => Watir and Selenium
|
991
|
-
# * :css => Selenium
|
991
|
+
# * :css => Watir and Selenium
|
992
992
|
# * :id => Watir and Selenium
|
993
993
|
# * :index => Watir and Selenium
|
994
994
|
# * :name => Watir and Selenium
|
@@ -930,9 +930,33 @@ module PageObject
|
|
930
930
|
end
|
931
931
|
|
932
932
|
private
|
933
|
+
|
934
|
+
def move_element_to_css_selector(the_call, identifier)
|
935
|
+
valid_elements = %w(
|
936
|
+
area audio canvas div
|
937
|
+
h1 h2 h3 h4 h5 h6
|
938
|
+
label li p span td video
|
939
|
+
)
|
940
|
+
element = the_call.split('(').first
|
941
|
+
if identifier.keys.include?(:css) and valid_elements.include? element
|
942
|
+
the_call[element] = 'element'
|
943
|
+
selectors = identifier[:css].split(/,\s*/).map { |selector|
|
944
|
+
modified_selector = selector.split /\s+/
|
945
|
+
last = modified_selector.pop
|
946
|
+
if last.index(element) == 0
|
947
|
+
selector
|
948
|
+
else
|
949
|
+
modified_selector.push(element + last)
|
950
|
+
end
|
951
|
+
}
|
952
|
+
identifier[:css] = selectors.join(', ')
|
953
|
+
end
|
954
|
+
[the_call, identifier]
|
955
|
+
end
|
933
956
|
|
934
957
|
def find_watir_elements(the_call, type, identifier, tag_name=nil)
|
935
958
|
identifier, frame_identifiers = parse_identifiers(identifier, type, tag_name)
|
959
|
+
the_call, identifier = move_element_to_css_selector(the_call, identifier)
|
936
960
|
elements = @browser.instance_eval "#{nested_frames(frame_identifiers)}#{the_call}"
|
937
961
|
switch_to_default_content(frame_identifiers)
|
938
962
|
elements.map { |element| type.new(element, :platform => :watir_webdriver) }
|
@@ -940,6 +964,7 @@ module PageObject
|
|
940
964
|
|
941
965
|
def find_watir_element(the_call, type, identifier, tag_name=nil)
|
942
966
|
identifier, frame_identifiers = parse_identifiers(identifier, type, tag_name)
|
967
|
+
the_call, identifier = move_element_to_css_selector(the_call, identifier)
|
943
968
|
element = @browser.instance_eval "#{nested_frames(frame_identifiers)}#{the_call}"
|
944
969
|
switch_to_default_content(frame_identifiers)
|
945
970
|
type.new(element, :platform => :watir_webdriver)
|
@@ -947,6 +972,7 @@ module PageObject
|
|
947
972
|
|
948
973
|
def process_watir_call(the_call, type, identifier, value=nil, tag_name=nil)
|
949
974
|
identifier, frame_identifiers = parse_identifiers(identifier, type, tag_name)
|
975
|
+
the_call, identifier = move_element_to_css_selector(the_call, identifier)
|
950
976
|
value = @browser.instance_eval "#{nested_frames(frame_identifiers)}#{the_call}"
|
951
977
|
switch_to_default_content(frame_identifiers)
|
952
978
|
value
|
data/lib/page-object/version.rb
CHANGED
data/lib/page-object/widgets.rb
CHANGED
@@ -17,7 +17,7 @@ module PageObject
|
|
17
17
|
#
|
18
18
|
def self.register_widget(widget_tag, widget_class, base_element_tag)
|
19
19
|
if widget_class.ancestors.include? Elements::Element
|
20
|
-
define_accessors(Accessors, widget_tag)
|
20
|
+
define_accessors(Accessors, widget_tag, widget_class)
|
21
21
|
define_nested_elements(Elements::Element, widget_tag)
|
22
22
|
define_locators(PageObject, widget_tag)
|
23
23
|
define_selenium_accessors(Platforms::SeleniumWebDriver::PageObject, widget_tag, widget_class, base_element_tag)
|
@@ -25,21 +25,23 @@ module PageObject
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
private
|
29
29
|
|
30
|
-
def self.define_accessors(base, widget_tag)
|
30
|
+
def self.define_accessors(base, widget_tag, widget_class)
|
31
31
|
accessors_module = Module.new do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
platform.#{widget_tag}_for(identifier.clone)
|
32
|
+
define_method widget_tag do |name, identifier={:index => 0}, &block|
|
33
|
+
define_method("#{name}_element") do
|
34
|
+
return call_block(&block) if block
|
35
|
+
platform.send("#{widget_tag}_for", identifier.clone)
|
37
36
|
end
|
38
|
-
define_method(
|
39
|
-
return call_block(&block).exists? if
|
40
|
-
platform
|
37
|
+
define_method("#{name}?") do
|
38
|
+
return call_block(&block).exists? if block
|
39
|
+
platform.send("#{widget_tag}_for", identifier.clone).exists?
|
41
40
|
end
|
42
|
-
|
41
|
+
if widget_class.respond_to? :accessor_methods
|
42
|
+
widget_class.accessor_methods(self, name)
|
43
|
+
end
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
base.send(:include, accessors_module)
|
@@ -6,14 +6,14 @@ describe PageObject::Elements::Div do
|
|
6
6
|
|
7
7
|
describe "when mapping how to find an element" do
|
8
8
|
it "should map watir types to same" do
|
9
|
-
[:class, :id, :text, :index, :xpath, :name, :title].each do |t|
|
9
|
+
[:class, :id, :text, :index, :xpath, :name, :title, :css].each do |t|
|
10
10
|
identifier = div.watir_identifier_for t => 'value'
|
11
11
|
identifier.keys.first.should == t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should map selenium types to same" do
|
16
|
-
[:class, :id, :text, :index, :name, :xpath, :title].each do |t|
|
16
|
+
[:class, :id, :text, :index, :name, :xpath, :title, :css].each do |t|
|
17
17
|
key, value = div.selenium_identifier_for t => 'value'
|
18
18
|
key.should == t
|
19
19
|
end
|
@@ -155,7 +155,7 @@ describe PageObject do
|
|
155
155
|
end
|
156
156
|
|
157
157
|
@page = CallbackPage.new(watir_browser)
|
158
|
-
@page.initialize_accessors.usec.should be
|
158
|
+
@page.initialize_accessors.usec.should be <= @page.initialize_page.usec
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should know which element has focus" do
|
metadata
CHANGED
@@ -1,126 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeff Morgan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: watir-webdriver
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.6.2
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.6.2
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: selenium-webdriver
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.31.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.31.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: page_navigation
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0.7'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0.7'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 2.12.0
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 2.12.0
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: cucumber
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: 1.2.0
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 1.2.0
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: yard
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: 0.7.2
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: 0.7.2
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rack
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '1.0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '1.0'
|
126
111
|
description: Page Object DSL that works with both Watir and Selenium
|
@@ -132,7 +117,8 @@ extra_rdoc_files: []
|
|
132
117
|
files:
|
133
118
|
- .gitignore
|
134
119
|
- .rspec
|
135
|
-
- .
|
120
|
+
- .ruby-gemset
|
121
|
+
- .ruby-version
|
136
122
|
- .travis.yml
|
137
123
|
- ChangeLog
|
138
124
|
- Gemfile
|
@@ -385,33 +371,26 @@ files:
|
|
385
371
|
- spec/spec_helper.rb
|
386
372
|
homepage: http://github.com/cheezy/page-object
|
387
373
|
licenses: []
|
374
|
+
metadata: {}
|
388
375
|
post_install_message:
|
389
376
|
rdoc_options: []
|
390
377
|
require_paths:
|
391
378
|
- lib
|
392
379
|
required_ruby_version: !ruby/object:Gem::Requirement
|
393
|
-
none: false
|
394
380
|
requirements:
|
395
|
-
- -
|
381
|
+
- - '>='
|
396
382
|
- !ruby/object:Gem::Version
|
397
383
|
version: '0'
|
398
|
-
segments:
|
399
|
-
- 0
|
400
|
-
hash: 1736610363844410914
|
401
384
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
402
|
-
none: false
|
403
385
|
requirements:
|
404
|
-
- -
|
386
|
+
- - '>='
|
405
387
|
- !ruby/object:Gem::Version
|
406
388
|
version: '0'
|
407
|
-
segments:
|
408
|
-
- 0
|
409
|
-
hash: 1736610363844410914
|
410
389
|
requirements: []
|
411
390
|
rubyforge_project: page-object
|
412
|
-
rubygems_version:
|
391
|
+
rubygems_version: 2.0.0
|
413
392
|
signing_key:
|
414
|
-
specification_version:
|
393
|
+
specification_version: 4
|
415
394
|
summary: Page Object DSL for browser testing
|
416
395
|
test_files:
|
417
396
|
- features/area.feature
|
data/.rvmrc
DELETED