testcentricity 2.4.2 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +29 -0
  3. data/.rspec +2 -1
  4. data/.rubocop.yml +38 -0
  5. data/.ruby-version +1 -1
  6. data/.simplecov +9 -0
  7. data/.yardopts +3 -0
  8. data/CHANGELOG.md +275 -0
  9. data/CODE_OF_CONDUCT.md +13 -0
  10. data/{LICENSE.txt → LICENSE.md} +3 -4
  11. data/README.md +938 -1380
  12. data/Rakefile +63 -1
  13. data/config/cucumber.yml +145 -0
  14. data/config/locales/en-US.yml +56 -0
  15. data/config/test_data/LOCAL_data.yml +11 -0
  16. data/config/test_data/data.yml +10 -0
  17. data/features/deep_links.feature +26 -0
  18. data/features/login.feature +30 -0
  19. data/features/navigation.feature +31 -0
  20. data/features/step_definitions/generic_steps.rb +72 -0
  21. data/features/support/android/screens/about_screen.rb +11 -0
  22. data/features/support/android/screens/base_app_screen.rb +29 -0
  23. data/features/support/android/screens/checkout_address_screen.rb +17 -0
  24. data/features/support/android/screens/checkout_payment_screen.rb +22 -0
  25. data/features/support/android/screens/login_screen.rb +18 -0
  26. data/features/support/android/screens/products_screen.rb +13 -0
  27. data/features/support/android/screens/saucebot_screen.rb +16 -0
  28. data/features/support/android/screens/webview_screen.rb +13 -0
  29. data/features/support/android/sections/nav_widgets/nav_menu.rb +39 -0
  30. data/features/support/env.rb +61 -0
  31. data/features/support/hooks.rb +135 -0
  32. data/features/support/ios/screens/about_screen.rb +11 -0
  33. data/features/support/ios/screens/base_app_screen.rb +19 -0
  34. data/features/support/ios/screens/checkout_address_screen.rb +17 -0
  35. data/features/support/ios/screens/checkout_payment_screen.rb +22 -0
  36. data/features/support/ios/screens/login_screen.rb +18 -0
  37. data/features/support/ios/screens/products_screen.rb +13 -0
  38. data/features/support/ios/screens/saucebot_screen.rb +16 -0
  39. data/features/support/ios/screens/webview_screen.rb +13 -0
  40. data/features/support/ios/sections/list_items/product_cell_item.rb +13 -0
  41. data/features/support/ios/sections/modals/base_modal.rb +23 -0
  42. data/features/support/ios/sections/modals/logout_modal.rb +6 -0
  43. data/features/support/ios/sections/modals/reset_app_state_modal.rb +6 -0
  44. data/features/support/ios/sections/nav_widgets/nav_bar.rb +31 -0
  45. data/features/support/ios/sections/nav_widgets/nav_menu.rb +41 -0
  46. data/features/support/shared_components/screens/base_app_screen.rb +31 -0
  47. data/features/support/shared_components/screens/checkout_address_screen.rb +17 -0
  48. data/features/support/shared_components/screens/checkout_payment_screen.rb +22 -0
  49. data/features/support/shared_components/screens/login_screen.rb +39 -0
  50. data/features/support/shared_components/screens/saucebot_screen.rb +17 -0
  51. data/features/support/shared_components/screens/webview_screen.rb +12 -0
  52. data/features/support/shared_components/sections/nav_menu.rb +58 -0
  53. data/features/support/world_data.rb +12 -0
  54. data/features/support/world_pages.rb +26 -0
  55. data/lib/testcentricity/app_core/appium_connect_helper.rb +343 -111
  56. data/lib/testcentricity/app_core/screen_object.rb +252 -0
  57. data/lib/testcentricity/app_core/screen_objects_helper.rb +29 -201
  58. data/lib/testcentricity/app_core/{screen_sections_helper.rb → screen_section.rb} +40 -105
  59. data/lib/testcentricity/app_elements/app_element_helper.rb +17 -8
  60. data/lib/testcentricity/app_elements/checkbox.rb +3 -3
  61. data/lib/testcentricity/data_objects/environment.rb +133 -39
  62. data/lib/testcentricity/version.rb +1 -1
  63. data/lib/testcentricity.rb +4 -129
  64. data/reports/.keep +1 -0
  65. data/spec/fixtures/page_object.rb +22 -0
  66. data/spec/fixtures/page_section_object.rb +21 -0
  67. data/spec/fixtures/screen_object.rb +16 -0
  68. data/spec/fixtures/screen_section_object.rb +16 -0
  69. data/spec/spec_helper.rb +28 -9
  70. data/spec/testcentricity/elements/button_spec.rb +18 -0
  71. data/spec/testcentricity/elements/checkbox_spec.rb +28 -0
  72. data/spec/testcentricity/elements/image_spec.rb +13 -0
  73. data/spec/testcentricity/elements/label_spec.rb +18 -0
  74. data/spec/testcentricity/elements/list_spec.rb +13 -0
  75. data/spec/testcentricity/elements/ui_element_spec.rb +72 -0
  76. data/spec/testcentricity/mobile/appium_connect_spec.rb +117 -0
  77. data/spec/testcentricity/mobile/screen_object_spec.rb +63 -0
  78. data/spec/testcentricity/mobile/screen_section_object_spec.rb +56 -0
  79. data/spec/testcentricity/version_spec.rb +7 -0
  80. data/spec/testcentricity/web/browser_spec.rb +41 -0
  81. data/spec/testcentricity/web/local_webdriver_spec.rb +86 -0
  82. data/spec/testcentricity/web/mobile_webdriver_spec.rb +123 -0
  83. data/spec/testcentricity/web/page_object_spec.rb +85 -0
  84. data/spec/testcentricity/web/page_section_object_spec.rb +72 -0
  85. data/testcentricity.gemspec +28 -27
  86. metadata +196 -127
  87. data/.ruby-gemset +0 -1
  88. data/Gemfile.lock +0 -93
  89. data/bin/console +0 -14
  90. data/bin/setup +0 -8
  91. data/lib/devices/devices.yml +0 -352
  92. data/lib/testcentricity/app_core/appium_server.rb +0 -69
  93. data/lib/testcentricity/browser_helper.rb +0 -174
  94. data/lib/testcentricity/data_objects/data_objects_helper.rb +0 -78
  95. data/lib/testcentricity/data_objects/excel_helper.rb +0 -242
  96. data/lib/testcentricity/exception_queue_helper.rb +0 -111
  97. data/lib/testcentricity/utility_helpers.rb +0 -28
  98. data/lib/testcentricity/web_core/drag_drop_helper.rb +0 -15
  99. data/lib/testcentricity/web_core/page_objects_helper.rb +0 -677
  100. data/lib/testcentricity/web_core/page_sections_helper.rb +0 -895
  101. data/lib/testcentricity/web_core/webdriver_helper.rb +0 -588
  102. data/lib/testcentricity/web_elements/button.rb +0 -8
  103. data/lib/testcentricity/web_elements/cell_button.rb +0 -8
  104. data/lib/testcentricity/web_elements/cell_checkbox.rb +0 -38
  105. data/lib/testcentricity/web_elements/cell_element.rb +0 -69
  106. data/lib/testcentricity/web_elements/cell_image.rb +0 -8
  107. data/lib/testcentricity/web_elements/cell_radio.rb +0 -31
  108. data/lib/testcentricity/web_elements/checkbox.rb +0 -100
  109. data/lib/testcentricity/web_elements/file_field.rb +0 -45
  110. data/lib/testcentricity/web_elements/image.rb +0 -34
  111. data/lib/testcentricity/web_elements/label.rb +0 -8
  112. data/lib/testcentricity/web_elements/link.rb +0 -8
  113. data/lib/testcentricity/web_elements/list.rb +0 -100
  114. data/lib/testcentricity/web_elements/list_button.rb +0 -8
  115. data/lib/testcentricity/web_elements/list_checkbox.rb +0 -38
  116. data/lib/testcentricity/web_elements/list_element.rb +0 -61
  117. data/lib/testcentricity/web_elements/list_radio.rb +0 -31
  118. data/lib/testcentricity/web_elements/radio.rb +0 -74
  119. data/lib/testcentricity/web_elements/select_list.rb +0 -208
  120. data/lib/testcentricity/web_elements/siebel_open_ui_helper.rb +0 -15
  121. data/lib/testcentricity/web_elements/table.rb +0 -612
  122. data/lib/testcentricity/web_elements/textfield.rb +0 -114
  123. data/lib/testcentricity/web_elements/ui_elements_helper.rb +0 -532
  124. data/lib/testcentricity/world_extensions.rb +0 -26
  125. data/my_templates/default/method_details/setup.rb +0 -3
  126. data/spec/testcentricity_spec.rb +0 -9
@@ -0,0 +1,252 @@
1
+ require 'test/unit'
2
+
3
+ module TestCentricity
4
+ class ScreenObject < BaseScreenSectionObject
5
+ include Test::Unit::Assertions
6
+
7
+ attr_reader :locator
8
+
9
+ def initialize
10
+ raise "Screen object #{self.class.name} does not have a page_name trait defined" unless defined?(page_name)
11
+ @locator = page_locator if defined?(page_locator)
12
+ end
13
+
14
+ def self.trait(trait_name, &block)
15
+ define_method(trait_name.to_s, &block)
16
+ end
17
+
18
+ def self.element(element_name, locator)
19
+ define_screen_element(element_name, TestCentricity::AppUIElement, locator)
20
+ end
21
+
22
+ def self.elements(element_hash)
23
+ element_hash.each do |element_name, locator|
24
+ element(element_name, locator)
25
+ end
26
+ end
27
+
28
+ def self.button(element_name, locator)
29
+ define_screen_element(element_name, TestCentricity::AppButton, locator)
30
+ end
31
+
32
+ def self.buttons(element_hash)
33
+ element_hash.each do |element_name, locator|
34
+ button(element_name, locator)
35
+ end
36
+ end
37
+
38
+ def self.textfield(element_name, locator)
39
+ define_screen_element(element_name, TestCentricity::AppTextField, locator)
40
+ end
41
+
42
+ def self.textfields(element_hash)
43
+ element_hash.each do |element_name, locator|
44
+ textfield(element_name, locator)
45
+ end
46
+ end
47
+
48
+ def self.switch(element_name, locator)
49
+ define_screen_element(element_name, TestCentricity::AppSwitch, locator)
50
+ end
51
+
52
+ def self.switches(element_hash)
53
+ element_hash.each do |element_name, locator|
54
+ switch(element_name, locator)
55
+ end
56
+ end
57
+
58
+ def self.checkbox(element_name, locator)
59
+ define_screen_element(element_name, TestCentricity::AppCheckBox, locator)
60
+ end
61
+
62
+ def self.checkboxes(element_hash)
63
+ element_hash.each do |element_name, locator|
64
+ checkbox(element_name, locator)
65
+ end
66
+ end
67
+
68
+ def self.label(element_name, locator)
69
+ define_screen_element(element_name, TestCentricity::AppLabel, locator)
70
+ end
71
+
72
+ def self.labels(element_hash)
73
+ element_hash.each do |element_name, locator|
74
+ label(element_name, locator)
75
+ end
76
+ end
77
+
78
+ def self.list(element_name, locator)
79
+ define_screen_element(element_name, TestCentricity::AppList, locator)
80
+ end
81
+
82
+ def self.lists(element_hash)
83
+ element_hash.each do |element_name, locator|
84
+ list(element_name, locator)
85
+ end
86
+ end
87
+
88
+ def self.selectlist(element_name, locator)
89
+ define_screen_element(element_name, TestCentricity::AppSelectList, locator)
90
+ end
91
+
92
+ def self.selectlists(element_hash)
93
+ element_hash.each do |element_name, locator|
94
+ selectlist(element_name, locator)
95
+ end
96
+ end
97
+
98
+ def self.image(element_name, locator)
99
+ define_screen_element(element_name, TestCentricity::AppImage, locator)
100
+ end
101
+
102
+ def self.images(element_hash)
103
+ element_hash.each do |element_name, locator|
104
+ image(element_name, locator)
105
+ end
106
+ end
107
+
108
+ def self.alert(element_name, locator)
109
+ define_screen_element(element_name, TestCentricity::AppAlert, locator)
110
+ end
111
+
112
+ def self.alerts(element_hash)
113
+ element_hash.each do |element_name, locator|
114
+ alert(element_name, locator)
115
+ end
116
+ end
117
+
118
+ def self.section(section_name, obj, locator = 0)
119
+ define_screen_element(section_name, obj, locator)
120
+ end
121
+
122
+ def self.sections(section_hash)
123
+ section_hash.each do |section_name, class_name|
124
+ section(section_name, class_name)
125
+ end
126
+ end
127
+
128
+ def open_portal
129
+ environment = Environ.current
130
+
131
+ Environ.portal_state = :open
132
+ end
133
+
134
+ def verify_page_exists
135
+ wait = Selenium::WebDriver::Wait.new(timeout: Environ.default_max_wait_time)
136
+ wait.until { exists? }
137
+ PageManager.current_page = self
138
+ rescue
139
+ raise "Could not find page_locator for screen object '#{self.class.name}' (#{@locator}) after #{Environ.default_max_wait_time} seconds"
140
+ end
141
+
142
+ def exists?
143
+ @locator.is_a?(Array) ? tries ||= 2 : tries ||= 1
144
+ if @locator.is_a?(Array)
145
+ loc = @locator[tries - 1]
146
+ find_element(loc.keys[0], loc.values[0])
147
+ else
148
+ find_element(@locator.keys[0], @locator.values[0])
149
+ end
150
+ true
151
+ rescue
152
+ retry if (tries -= 1) > 0
153
+ false
154
+ end
155
+
156
+ def wait_until_exists(seconds = nil, post_exception = true)
157
+ timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
158
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
159
+ wait.until { exists? }
160
+ rescue
161
+ if post_exception
162
+ raise "Screen object #{self.class.name} not found after #{timeout} seconds" unless exists?
163
+ else
164
+ exists?
165
+ end
166
+ end
167
+
168
+ def wait_until_gone(seconds = nil, post_exception = true)
169
+ timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
170
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
171
+ wait.until { !exists? }
172
+ rescue
173
+ if post_exception
174
+ raise "Screen object #{self.class.name} remained visible after #{timeout} seconds" if exists?
175
+ else
176
+ exists?
177
+ end
178
+ end
179
+
180
+ def navigate_to; end
181
+
182
+ def verify_page_ui; end
183
+
184
+ def load_page
185
+ if exists?
186
+ verify_page_exists
187
+ return
188
+ end
189
+
190
+ url = if page_url.include?("://")
191
+ page_url
192
+ elsif !Environ.current.deep_link_prefix.blank?
193
+ link_url = "#{Environ.current.deep_link_prefix}://#{page_url}"
194
+ if Environ.is_android?
195
+ $driver.execute_script(
196
+ 'mobile:deepLink',
197
+ {
198
+ url: link_url,
199
+ package: Environ.current.android_app_id
200
+ }
201
+ )
202
+ verify_page_exists
203
+ return
204
+ else
205
+ link_url
206
+ end
207
+ end
208
+
209
+ if Environ.is_ios? && Environ.is_device?
210
+ # launch Safari browser on iOS real device
211
+ $driver.execute_script('mobile: launchApp', { bundleId: 'com.apple.mobilesafari' })
212
+ unless $driver.is_keyboard_shown
213
+ begin
214
+ # attempt to find and click URL button on iOS 15 Safari browser
215
+ find_element(:accessibility_id, 'TabBarItemTitle').click
216
+ rescue
217
+ # fall back to URL button on iOS 14 Safari browser
218
+ find_element(:xpath, '//XCUIElementTypeButton[@name="URL"]').click
219
+ end
220
+ end
221
+ # enter deep-link URL
222
+ wait_for_object(:xpath, '//XCUIElementTypeTextField[@name="URL"]', 5).send_keys("#{url}\uE007")
223
+ # wait for and accept the popup modal
224
+ wait_for_object(:xpath, '//XCUIElementTypeButton[@name="Open"]', 10).click
225
+ else
226
+ $driver.get(url)
227
+ end
228
+ verify_page_exists
229
+ end
230
+
231
+ private
232
+
233
+ def self.define_screen_element(element_name, obj, locator)
234
+ define_method(element_name) do
235
+ ivar_name = "@#{element_name}"
236
+ ivar = instance_variable_get(ivar_name)
237
+ return ivar if ivar
238
+ instance_variable_set(ivar_name, obj.new(element_name, self, locator, :page))
239
+ end
240
+ end
241
+
242
+ def wait_for_object(find_method, locator, seconds)
243
+ wait = Selenium::WebDriver::Wait.new(timeout: seconds)
244
+ obj = nil
245
+ wait.until do
246
+ obj = find_element(find_method, locator)
247
+ obj.displayed?
248
+ end
249
+ obj
250
+ end
251
+ end
252
+ end
@@ -1,181 +1,41 @@
1
1
  require 'test/unit'
2
2
 
3
3
  module TestCentricity
4
- class ScreenObject
5
- include Test::Unit::Assertions
6
-
7
- attr_reader :locator
8
-
9
- def initialize
10
- raise "Screen object #{self.class.name} does not have a page_name trait defined" unless defined?(page_name)
11
- @locator = page_locator if defined?(page_locator)
12
- end
13
-
4
+ class BaseScreenSectionObject
5
+ # Define a trait for this screen or section object.
6
+ #
7
+ # @param trait_name [Symbol] name of trait (as a symbol)
8
+ # @param block [&block] trait value
9
+ # @example
10
+ # trait(:page_name) { 'Shopping Basket' }
11
+ # trait(:page_locator) { { accessibility_id: 'My Contacts View' } }
12
+ # trait(:section_locator) { { id: 'activity_feed_tabs' } }
13
+ #
14
14
  def self.trait(trait_name, &block)
15
15
  define_method(trait_name.to_s, &block)
16
16
  end
17
17
 
18
- def self.element(element_name, locator)
19
- define_page_element(element_name, TestCentricity::AppUIElement, locator)
20
- end
21
-
22
- def self.elements(element_hash)
23
- element_hash.each do |element_name, locator|
24
- element(element_name, locator)
25
- end
26
- end
27
-
28
- def self.button(element_name, locator)
29
- define_page_element(element_name, TestCentricity::AppButton, locator)
30
- end
31
-
32
- def self.buttons(element_hash)
33
- element_hash.each do |element_name, locator|
34
- button(element_name, locator)
35
- end
36
- end
37
-
38
- def self.textfield(element_name, locator)
39
- define_page_element(element_name, TestCentricity::AppTextField, locator)
40
- end
41
-
42
- def self.textfields(element_hash)
43
- element_hash.each do |element_name, locator|
44
- textfield(element_name, locator)
45
- end
46
- end
47
-
48
- def self.switch(element_name, locator)
49
- define_page_element(element_name, TestCentricity::AppSwitch, locator)
50
- end
51
-
52
- def self.switches(element_hash)
53
- element_hash.each do |element_name, locator|
54
- switch(element_name, locator)
55
- end
56
- end
57
-
58
- def self.checkbox(element_name, locator)
59
- define_page_element(element_name, TestCentricity::AppCheckBox, locator)
60
- end
61
-
62
- def self.checkboxes(element_hash)
63
- element_hash.each do |element_name, locator|
64
- checkbox(element_name, locator)
65
- end
66
- end
67
-
68
- def self.label(element_name, locator)
69
- define_page_element(element_name, TestCentricity::AppLabel, locator)
70
- end
71
-
72
- def self.labels(element_hash)
73
- element_hash.each do |element_name, locator|
74
- label(element_name, locator)
75
- end
76
- end
77
-
78
- def self.list(element_name, locator)
79
- define_page_element(element_name, TestCentricity::AppList, locator)
80
- end
81
-
82
- def self.lists(element_hash)
83
- element_hash.each do |element_name, locator|
84
- list(element_name, locator)
85
- end
86
- end
87
-
88
- def self.selectlist(element_name, locator)
89
- define_page_element(element_name, TestCentricity::AppSelectList, locator)
90
- end
91
-
92
- def self.selectlists(element_hash)
93
- element_hash.each do |element_name, locator|
94
- selectlist(element_name, locator)
95
- end
96
- end
97
-
98
- def self.image(element_name, locator)
99
- define_page_element(element_name, TestCentricity::AppImage, locator)
100
- end
101
-
102
- def self.images(element_hash)
103
- element_hash.each do |element_name, locator|
104
- image(element_name, locator)
105
- end
106
- end
107
-
108
- def self.alert(element_name, locator)
109
- define_page_element(element_name, TestCentricity::AppAlert, locator)
110
- end
111
-
112
- def self.section(section_name, obj, locator = 0)
113
- define_page_element(section_name, obj, locator)
114
- end
115
-
116
- def self.sections(section_hash)
117
- section_hash.each do |section_name, class_name|
118
- section(section_name, class_name)
119
- end
120
- end
121
-
122
-
123
- def open_portal
124
- environment = Environ.current
125
-
126
- Environ.portal_state = :open
127
- end
128
-
129
- def verify_page_exists
130
- wait = Selenium::WebDriver::Wait.new(timeout: Environ.default_max_wait_time)
131
- wait.until { exists? }
132
- PageManager.current_page = self
133
- rescue
134
- raise "Could not find page_locator for screen object '#{self.class.name}' (#{@locator}) after #{Environ.default_max_wait_time} seconds"
135
- end
136
-
137
- def exists?
138
- @locator.is_a?(Array) ? tries ||= 2 : tries ||= 1
139
- if @locator.is_a?(Array)
140
- loc = @locator[tries - 1]
141
- find_element(loc.keys[0], loc.values[0])
142
- else
143
- find_element(@locator.keys[0], @locator.values[0])
18
+ def populate_data_fields(data, wait_time = nil)
19
+ timeout = wait_time.nil? ? 5 : wait_time
20
+ data.each do |data_field, data_param|
21
+ unless data_param.blank?
22
+ # make sure the intended UI target element is visible before trying to set its value
23
+ data_field.wait_until_visible(timeout)
24
+ if data_param == '!DELETE'
25
+ data_field.clear
26
+ else
27
+ case data_field.get_object_type
28
+ when :checkbox
29
+ data_field.set_checkbox_state(data_param.to_bool)
30
+ when :textfield
31
+ data_field.clear
32
+ data_field.set(data_param)
33
+ end
34
+ end
35
+ end
144
36
  end
145
- true
146
- rescue
147
- retry if (tries -= 1) > 0
148
- false
149
- end
150
-
151
- def wait_until_exists(seconds = nil)
152
- timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
153
- wait = Selenium::WebDriver::Wait.new(timeout: timeout)
154
- wait.until { exists? }
155
- rescue
156
- raise "Screen object #{self.class.name} not found after #{timeout} seconds" unless exists?
157
- end
158
-
159
- def wait_until_gone(seconds = nil)
160
- timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
161
- wait = Selenium::WebDriver::Wait.new(timeout: timeout)
162
- wait.until { !exists? }
163
- rescue
164
- raise "Screen object #{self.class.name} remained visible after #{timeout} seconds" if exists?
165
- end
166
-
167
- def navigate_to; end
168
-
169
- def verify_page_ui; end
170
-
171
- def load_page
172
- navigate_to unless exists?
173
- verify_page_exists
174
- PageManager.current_page = self
175
37
  end
176
38
 
177
-
178
-
179
39
  def verify_ui_states(ui_states)
180
40
  ui_states.each do |ui_object, object_states|
181
41
  object_states.each do |property, state|
@@ -225,7 +85,7 @@ module TestCentricity
225
85
  actual = ui_object.y_loc
226
86
  end
227
87
  error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
228
- ExceptionQueue.enqueue_comparison(state, actual, error_msg)
88
+ ExceptionQueue.enqueue_comparison(ui_object, state, actual, error_msg)
229
89
  end
230
90
  end
231
91
  rescue ObjectNotFoundError => e
@@ -233,37 +93,5 @@ module TestCentricity
233
93
  ensure
234
94
  ExceptionQueue.post_exceptions
235
95
  end
236
-
237
- def populate_data_fields(data, wait_time = nil)
238
- timeout = wait_time.nil? ? 5 : wait_time
239
- data.each do |data_field, data_param|
240
- unless data_param.blank?
241
- # make sure the intended UI target element is visible before trying to set its value
242
- data_field.wait_until_visible(timeout)
243
- if data_param == '!DELETE'
244
- data_field.clear
245
- else
246
- case data_field.get_object_type
247
- when :checkbox
248
- data_field.set_checkbox_state(data_param.to_bool)
249
- when :textfield
250
- data_field.clear
251
- data_field.set("#{data_param}\t")
252
- end
253
- end
254
- end
255
- end
256
- end
257
-
258
- private
259
-
260
- def self.define_page_element(element_name, obj, locator)
261
- define_method(element_name) do
262
- ivar_name = "@#{element_name}"
263
- ivar = instance_variable_get(ivar_name)
264
- return ivar if ivar
265
- instance_variable_set(ivar_name, obj.new(element_name, self, locator, :page))
266
- end
267
- end
268
96
  end
269
97
  end