page_object_wrapper 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- class Action < DslElement
3
- attr_reader :fire_block_value, :next_page_value
2
+ module PageObjectWrapper
3
+ class Action < DslElement
4
+ attr_reader :fire_block_value, :next_page_value
4
5
 
5
- def initialize(label, next_page=nil, &block)
6
- super label
7
- @next_page_value = next_page
8
- @fire_block_value = block
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
- class Alias < DslElement
3
- attr_reader :next_page_value
4
- dsl_attr_accessor :action
2
+ module PageObjectWrapper
3
+ class Alias < DslElement
4
+ attr_reader :next_page_value
5
+ dsl_attr_accessor :action
5
6
 
6
- def initialize(label, next_page)
7
- super label
8
- @next_page_value = next_page
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
- class DslElement
13
- dsl_attr_accessor :label
12
+ module PageObjectWrapper
13
+ class DslElement
14
+ dsl_attr_accessor :label
14
15
 
15
- def initialize label
16
- @label = label
17
- end
18
- protected
19
- def to_tree(*args)
20
- args.collect(&:label_value).join(" -> ")
21
- end
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
- def validate_label
24
+ def validate_label
24
25
 
26
+ end
25
27
  end
26
- end
27
28
 
28
- class DslElementWithLocator < DslElement
29
- dsl_attr_accessor :locator
29
+ class DslElementWithLocator < DslElement
30
+ dsl_attr_accessor :locator
30
31
 
31
- def initialize label
32
- super label
33
- @locator = nil
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
- class Element < DslElementWithLocator
3
- attr_reader :type
2
+ module PageObjectWrapper
3
+ class Element < DslElementWithLocator
4
+ attr_reader :type
4
5
 
5
- def initialize(label, type)
6
- super label
7
- @type = type
8
- @menu = Hash.new
9
- @press_action = :click
10
- @required = false
11
- end
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
- def menu food_type, value
14
- @menu[food_type] = value
15
- end
14
+ def menu food_type, value
15
+ @menu[food_type] = value
16
+ end
16
17
 
17
- def menu_value
18
- @menu
19
- end
18
+ def menu_value
19
+ @menu
20
+ end
20
21
 
21
- def press_action action
22
- @press_action = action
23
- end
22
+ def press_action action
23
+ @press_action = action
24
+ end
24
25
 
25
- def press_action_value
26
- @press_action
27
- end
26
+ def press_action_value
27
+ @press_action
28
+ end
28
29
 
29
- def required flag
30
- @required = flag
31
- end
30
+ def required flag
31
+ @required = flag
32
+ end
32
33
 
33
- def required_value
34
- @required
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
- class ElementsSet < DslElement
6
+ def initialize(label)
7
+ super label
8
+ @elements = []
9
+ end
5
10
 
6
- def initialize(label)
7
- super label
8
- @elements = []
9
- end
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
- 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
19
+ def elements
20
+ @elements
16
21
  end
17
- }
18
-
19
- def elements
20
- @elements
21
22
  end
22
23
  end