Module: Checks

Included in:
HTMLGeneric
Defined in:
lib/html_check_modules.rb

Instance Method Summary collapse

Instance Method Details

#verify_element_checkedObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/html_check_modules.rb', line 77

def verify_element_checked
  execute(this_method){
    expected_value{
      true
    }
    actual_value{
      @element.getAttribute('CHECKED')
    }
    result{
      @expected_value == @actual_value
    }
    @reporter.record_results(:verifyElementChecked, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_inner_htmlObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/html_check_modules.rb', line 52

def verify_element_inner_html
  execute(this_method){  
    expected_value{
      @parameter.value
    }
    actual_value{
      if @element.tagName == 'INPUT' or @element.tagName == 'SELECT' or @element.tagName == 'TEXTAREA'
        @element.value
      else
        @element.innerHTML
      end
    }
    result{
      if @parameter.regex
        !@actual_value.match("#{@expected_value}").nil?
      else
        @actual_value == @expected_value
      end
    }
    @reporter.record_results(:verifyElementHtml, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_inner_textObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/html_check_modules.rb', line 4

def verify_element_inner_text
  execute(this_method){  
    expected_value{
      @parameter.value
    }
    actual_value{
      if @element.tagName == 'INPUT' or @element.tagName == 'SELECT' or @element.tagName == 'TEXTAREA'
        @element.value
      else
        @element.innerText
      end
    }
    result{
      if @parameter.regex
        !@actual_value.match("#{@expected_value}").nil?
      else
        @actual_value == @expected_value
      end
    }
    @reporter.record_results(:verifyElementText, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_not_checkedObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/html_check_modules.rb', line 93

def verify_element_not_checked
  execute(this_method){
    expected_value{
      false
    }
    actual_value{
      @element.getAttribute('CHECKED')
    }
    result{
      @expected_value == @actual_value
    }
    @reporter.record_results(:verifyElementNotChecked, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_not_presentObject



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/html_check_modules.rb', line 145

def verify_element_not_present
  execute(this_method){
    expected_value{
      true
    }
    actual_value{
      @element.nil?
    }
    result{
      @actual_value == @expected_value
    }
    @reporter.record_results(:verifyElementNotPresent, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_presentObject



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/html_check_modules.rb', line 129

def verify_element_present
  execute(this_method){
    expected_value{
      false
    }
    actual_value{
      @element.nil?
    }
    result{
      @actual_value == @expected_value
    }
    @reporter.record_results(:verifyElementPresent, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_sourceObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/html_check_modules.rb', line 109

def verify_element_source
  execute(this_method){
    expected_value{
      @value
    }
    actual_value{
      @element.src
    }            
    result{
      if @parameter.regex
        !@actual_value.match("#{@expected_value}").nil?
      else
        @actual_value == @expected_value
      end
    }
    @reporter.record_results(:verifyElementSource, @expected_value, @actual_value, @result)
    @result
  }
end

#verify_element_valueObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/html_check_modules.rb', line 28

def verify_element_value
  execute(this_method){  
    expected_value{
      @parameter.value
    }
    actual_value{
      if @element.tagName == 'INPUT' or @element.tagName == 'SELECT' or @element.tagName == 'TEXTAREA'
        @element.value
      else
        @element.innerText
      end
    }
    result{
      if @parameter.regex
        !@actual_value.match("#{@expected_value}").nil?
      else
        @actual_value == @expected_value
      end
    }
    @reporter.record_results(:verifyElementValue, @expected_value, @actual_value, @result)
    @result
  }
end