page_object_wrapper 1.4.2 → 1.4.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.
- data/good_pages/some_test_page.rb +4 -0
- data/lib/page_object_wrapper/Action.rb +8 -7
- data/lib/page_object_wrapper/Alias.rb +8 -8
- data/lib/page_object_wrapper/Dsl.rb +18 -16
- data/lib/page_object_wrapper/Element.rb +28 -26
- data/lib/page_object_wrapper/ElementsSet.rb +15 -14
- data/lib/page_object_wrapper/PageObject.rb +496 -494
- data/lib/page_object_wrapper/Pagination.rb +18 -17
- data/lib/page_object_wrapper/Table.rb +13 -11
- data/lib/page_object_wrapper/Validator.rb +7 -7
- data/lib/page_object_wrapper/known_elements.rb +33 -31
- data/lib/page_object_wrapper/version.rb +1 -1
- metadata +12 -12
@@ -108,6 +108,10 @@ PageObjectWrapper.define_page(:some_test_page) do
|
|
108
108
|
textarea(:id => 'f2').value == expected
|
109
109
|
end
|
110
110
|
|
111
|
+
validator :tekst_pervoi_ssylki do
|
112
|
+
text = textarea(:id => 'f2').when_present.value
|
113
|
+
end
|
114
|
+
|
111
115
|
pagination :some_pagination do
|
112
116
|
locator "link(:text => 2)", 2
|
113
117
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'Dsl'
|
2
|
-
|
3
|
-
|
2
|
+
module PageObjectWrapper
|
3
|
+
class Action < DslElement
|
4
|
+
attr_reader :fire_block_value, :next_page_value
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def initialize(label, next_page=nil, &block)
|
7
|
+
super label
|
8
|
+
@next_page_value = next_page
|
9
|
+
@fire_block_value = block
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
11
|
-
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'Dsl'
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
module PageObjectWrapper
|
3
|
+
class Alias < DslElement
|
4
|
+
attr_reader :next_page_value
|
5
|
+
dsl_attr_accessor :action
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
def initialize(label, next_page)
|
8
|
+
super label
|
9
|
+
@next_page_value = next_page
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
11
|
-
|
12
|
-
|
@@ -9,27 +9,29 @@ class Class
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
13
|
-
|
12
|
+
module PageObjectWrapper
|
13
|
+
class DslElement
|
14
|
+
dsl_attr_accessor :label
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
protected
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
def initialize label
|
17
|
+
@label = label
|
18
|
+
end
|
19
|
+
protected
|
20
|
+
def to_tree(*args)
|
21
|
+
args.collect(&:label_value).join(" -> ")
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
+
def validate_label
|
24
25
|
|
26
|
+
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
class DslElementWithLocator < DslElement
|
29
|
-
|
29
|
+
class DslElementWithLocator < DslElement
|
30
|
+
dsl_attr_accessor :locator
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def initialize label
|
33
|
+
super label
|
34
|
+
@locator = nil
|
35
|
+
end
|
34
36
|
end
|
35
37
|
end
|
@@ -1,36 +1,38 @@
|
|
1
1
|
require 'Dsl'
|
2
|
-
|
3
|
-
|
2
|
+
module PageObjectWrapper
|
3
|
+
class Element < DslElementWithLocator
|
4
|
+
attr_reader :type
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
def initialize(label, type)
|
7
|
+
super label
|
8
|
+
@type = type
|
9
|
+
@menu = Hash.new
|
10
|
+
@press_action = :click
|
11
|
+
@required = false
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def menu food_type, value
|
15
|
+
@menu[food_type] = value
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def menu_value
|
19
|
+
@menu
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def press_action action
|
23
|
+
@press_action = action
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
def press_action_value
|
27
|
+
@press_action
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def required flag
|
31
|
+
@required = flag
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
def required_value
|
35
|
+
@required
|
36
|
+
end
|
35
37
|
end
|
36
38
|
end
|
@@ -1,22 +1,23 @@
|
|
1
1
|
require 'Dsl'
|
2
2
|
require 'known_elements'
|
3
|
+
module PageObjectWrapper
|
4
|
+
class ElementsSet < DslElement
|
3
5
|
|
4
|
-
|
6
|
+
def initialize(label)
|
7
|
+
super label
|
8
|
+
@elements = []
|
9
|
+
end
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
KNOWN_ELEMENTS.each{|m|
|
12
|
+
ElementsSet.send :define_method, m do |label, &block|
|
13
|
+
e = Element.new(label, m.to_sym)
|
14
|
+
e.instance_eval(&block)
|
15
|
+
@elements << e
|
16
|
+
end
|
17
|
+
}
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
e = Element.new(label, m.to_sym)
|
14
|
-
e.instance_eval(&block)
|
15
|
-
@elements << e
|
19
|
+
def elements
|
20
|
+
@elements
|
16
21
|
end
|
17
|
-
}
|
18
|
-
|
19
|
-
def elements
|
20
|
-
@elements
|
21
22
|
end
|
22
23
|
end
|