testcentricity_web 1.0.21 → 1.0.22
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 +4 -4
- data/lib/testcentricity_web.rb +4 -1
- data/lib/testcentricity_web/elements/cell_button.rb +8 -0
- data/lib/testcentricity_web/elements/cell_checkbox.rb +38 -0
- data/lib/testcentricity_web/elements/cell_element.rb +36 -0
- data/lib/testcentricity_web/elements/cell_radio.rb +31 -0
- data/lib/testcentricity_web/elements/table.rb +8 -4
- data/lib/testcentricity_web/page_objects_helper.rb +40 -0
- data/lib/testcentricity_web/page_sections_helper.rb +40 -0
- data/lib/testcentricity_web/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b68b85fdae4ff17195153396ec001aeba087248c
|
4
|
+
data.tar.gz: edba7bcd859ddab9b29ee02ccda4f3aea7b0deac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fbd4d428b2b7150477244be54f3267c20a26ad2d7e7f0573d2e34008b94ab0db66603eb741935147af4e2604a584c1267e9a1fd25ce63b53ae6ac54219b0d00
|
7
|
+
data.tar.gz: fcb4f8c48ba0a1c5b37be42263adb908462642eedcbfd73325065aa64b2f2364e0f47b334d04292fa52c0505c390fca476acc7d5a52eb5cc96d2728bbdea442b
|
data/lib/testcentricity_web.rb
CHANGED
@@ -28,7 +28,10 @@ require 'testcentricity_web/elements/select_list'
|
|
28
28
|
require 'testcentricity_web/elements/list'
|
29
29
|
require 'testcentricity_web/elements/table'
|
30
30
|
require 'testcentricity_web/elements/textfield'
|
31
|
-
|
31
|
+
require 'testcentricity_web/elements/cell_element'
|
32
|
+
require 'testcentricity_web/elements/cell_button'
|
33
|
+
require 'testcentricity_web/elements/cell_checkbox'
|
34
|
+
require 'testcentricity_web/elements/cell_radio'
|
32
35
|
|
33
36
|
module TestCentricity
|
34
37
|
class PageManager
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class CellCheckBox < CellElement
|
3
|
+
attr_accessor :proxy
|
4
|
+
|
5
|
+
def initialize(name, parent, locator, context, table, column, proxy)
|
6
|
+
super
|
7
|
+
@type = :cell_checkbox
|
8
|
+
@proxy = proxy
|
9
|
+
end
|
10
|
+
|
11
|
+
def checked?(row)
|
12
|
+
obj, = find_cell_element(row)
|
13
|
+
cell_object_not_found_exception(obj, 'Cell CheckBox', row)
|
14
|
+
obj.checked?
|
15
|
+
end
|
16
|
+
|
17
|
+
def set_checkbox_state(row, state)
|
18
|
+
obj, = find_cell_element(row)
|
19
|
+
cell_object_not_found_exception(obj, 'Cell CheckBox', row)
|
20
|
+
obj.set(state)
|
21
|
+
end
|
22
|
+
|
23
|
+
def check(row)
|
24
|
+
set_checkbox_state(row, true)
|
25
|
+
end
|
26
|
+
|
27
|
+
def uncheck(row)
|
28
|
+
set_checkbox_state(row, false)
|
29
|
+
end
|
30
|
+
|
31
|
+
def verify_check_state(row, state, enqueue = false)
|
32
|
+
actual = checked?(row)
|
33
|
+
enqueue ?
|
34
|
+
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected Row #{row}/Col #{@column} Cell Checkbox #{object_ref_message}") :
|
35
|
+
assert_equal(state, actual, "Expected Row #{row}/Col #{@column} Cell Checkbox #{object_ref_message} to be #{state} but found #{actual} instead")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class CellElement < UIElement
|
3
|
+
attr_accessor :table
|
4
|
+
attr_accessor :column
|
5
|
+
|
6
|
+
def initialize(name, parent, locator, context, table, column)
|
7
|
+
@name = name
|
8
|
+
@parent = parent
|
9
|
+
@context = context
|
10
|
+
@alt_locator = nil
|
11
|
+
@table = table
|
12
|
+
@column = column
|
13
|
+
@locator = "#{@table.get_table_cell_locator('ROW_SPEC', column)}/#{locator}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def exists?(row)
|
17
|
+
obj, = find_cell_element(row)
|
18
|
+
obj != nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def click(row)
|
22
|
+
obj, = find_cell_element(row)
|
23
|
+
cell_object_not_found_exception(obj, @type, row)
|
24
|
+
obj.click
|
25
|
+
end
|
26
|
+
|
27
|
+
def find_cell_element(row)
|
28
|
+
set_alt_locator("#{@locator.gsub('ROW_SPEC', row)}")
|
29
|
+
find_element
|
30
|
+
end
|
31
|
+
|
32
|
+
def cell_object_not_found_exception(obj, obj_type, row)
|
33
|
+
object_not_found_exception(obj, "Row #{row}/Col #{@column} #{obj_type}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class CellRadio < CellElement
|
3
|
+
attr_accessor :proxy
|
4
|
+
|
5
|
+
def initialize(name, parent, locator, context, table, column, proxy)
|
6
|
+
super
|
7
|
+
@type = :cell_radio
|
8
|
+
@proxy = proxy
|
9
|
+
end
|
10
|
+
|
11
|
+
def selected?(row)
|
12
|
+
obj, = find_cell_element(row)
|
13
|
+
cell_object_not_found_exception(obj, 'Cell Radio', row)
|
14
|
+
obj.checked?
|
15
|
+
end
|
16
|
+
|
17
|
+
def set_selected_state(row, state)
|
18
|
+
obj, = find_cell_element(row)
|
19
|
+
cell_object_not_found_exception(obj, 'Cell Radio', row)
|
20
|
+
obj.set(state)
|
21
|
+
end
|
22
|
+
|
23
|
+
def select(row)
|
24
|
+
set_selected_state(row, true)
|
25
|
+
end
|
26
|
+
|
27
|
+
def unselect(row)
|
28
|
+
set_selected_state(row, false)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -440,9 +440,7 @@ module TestCentricity
|
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
443
|
-
|
444
|
-
|
445
|
-
def set_table_cell_locator(row, column)
|
443
|
+
def get_table_cell_locator(row, column)
|
446
444
|
if @table_section.nil?
|
447
445
|
row_spec = "#{@locator}/#{@table_body}/#{@table_row}"
|
448
446
|
row_spec = "#{row_spec}[#{row}]"
|
@@ -451,7 +449,13 @@ module TestCentricity
|
|
451
449
|
row_spec = "#{row_spec}[#{row}]/#{@table_row}[1]"
|
452
450
|
end
|
453
451
|
column_spec = "/#{@table_column}[#{column}]"
|
454
|
-
|
452
|
+
"#{row_spec}#{column_spec}"
|
453
|
+
end
|
454
|
+
|
455
|
+
private
|
456
|
+
|
457
|
+
def set_table_cell_locator(row, column)
|
458
|
+
set_alt_locator(get_table_cell_locator(row, column))
|
455
459
|
end
|
456
460
|
|
457
461
|
def find_table_cell(row, column)
|
@@ -272,6 +272,46 @@ module TestCentricity
|
|
272
272
|
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :page);end))
|
273
273
|
end
|
274
274
|
|
275
|
+
# Declare and instantiate a cell button in a table column on this page object.
|
276
|
+
#
|
277
|
+
# @param element_name [Symbol] name of cell button object (as a symbol)
|
278
|
+
# @param locator [String] XPath expression that uniquely identifies cell button within row and column of parent table object
|
279
|
+
# @param table [Symbol] Name (as a symbol) of parent table object
|
280
|
+
# @param column [Integer] 1-based index of table column that contains the cell button object
|
281
|
+
# @example
|
282
|
+
# cell_button :show_button, "a[@class='show']", :data_table, 5
|
283
|
+
# cell_button :edit_button, "a[@class='edit']", :data_table, 5
|
284
|
+
#
|
285
|
+
def self.cell_button(element_name, locator, table, column)
|
286
|
+
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellButton.new("#{element_name}", self, "#{locator}", :page, #{table}, #{column});end))
|
287
|
+
end
|
288
|
+
|
289
|
+
# Declare and instantiate a cell checkbox in a table column on this page object.
|
290
|
+
#
|
291
|
+
# @param element_name [Symbol] name of cell checkbox object (as a symbol)
|
292
|
+
# @param locator [String] XPath expression that uniquely identifies cell checkbox within row and column of parent table object
|
293
|
+
# @param table [Symbol] Name (as a symbol) of parent table object
|
294
|
+
# @param column [Integer] 1-based index of table column that contains the cell checkbox object
|
295
|
+
# @example
|
296
|
+
# cell_checkbox :is_registered_check, "a[@class='registered']", :data_table, 4
|
297
|
+
#
|
298
|
+
def self.cell_checkbox(element_name, locator, table, column)
|
299
|
+
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellCheckBox.new("#{element_name}", self, "#{locator}", :page, #{table}, #{column});end))
|
300
|
+
end
|
301
|
+
|
302
|
+
# Declare and instantiate a cell radio in a table column on this page object.
|
303
|
+
#
|
304
|
+
# @param element_name [Symbol] name of cell radio object (as a symbol)
|
305
|
+
# @param locator [String] XPath expression that uniquely identifies cell radio within row and column of parent table object
|
306
|
+
# @param table [Symbol] Name (as a symbol) of parent table object
|
307
|
+
# @param column [Integer] 1-based index of table column that contains the cell radio object
|
308
|
+
# @example
|
309
|
+
# cell_radio :track_a_radio, "a[@class='track_a']", :data_table, 8
|
310
|
+
#
|
311
|
+
def self.cell_radio(element_name, locator, table, column)
|
312
|
+
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellRadio.new("#{element_name}", self, "#{locator}", :page, #{table}, #{column});end))
|
313
|
+
end
|
314
|
+
|
275
315
|
# Instantiate a single PageSection object for this page object.
|
276
316
|
#
|
277
317
|
# @param section_name [Symbol] name of PageSection object (as a symbol)
|
@@ -281,6 +281,46 @@ module TestCentricity
|
|
281
281
|
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::FileField.new("#{element_name}", self, "#{locator}", :section);end))
|
282
282
|
end
|
283
283
|
|
284
|
+
# Declare and instantiate a cell button in a table column on this page section.
|
285
|
+
#
|
286
|
+
# @param element_name [Symbol] name of cell button object (as a symbol)
|
287
|
+
# @param locator [String] XPath expression that uniquely identifies cell button within row and column of parent table object
|
288
|
+
# @param table [Symbol] Name (as a symbol) of parent table object
|
289
|
+
# @param column [Integer] 1-based index of table column that contains the cell button object
|
290
|
+
# @example
|
291
|
+
# cell_button :show_button, "a[@class='show']", :data_table, 5
|
292
|
+
# cell_button :edit_button, "a[@class='edit']", :data_table, 5
|
293
|
+
#
|
294
|
+
def self.cell_button(element_name, locator, table, column)
|
295
|
+
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellButton.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column});end))
|
296
|
+
end
|
297
|
+
|
298
|
+
# Declare and instantiate a cell checkbox in a table column on this page section.
|
299
|
+
#
|
300
|
+
# @param element_name [Symbol] name of cell checkbox object (as a symbol)
|
301
|
+
# @param locator [String] XPath expression that uniquely identifies cell checkbox within row and column of parent table object
|
302
|
+
# @param table [Symbol] Name (as a symbol) of parent table object
|
303
|
+
# @param column [Integer] 1-based index of table column that contains the cell checkbox object
|
304
|
+
# @example
|
305
|
+
# cell_checkbox :is_registered_check, "a[@class='registered']", :data_table, 4
|
306
|
+
#
|
307
|
+
def self.cell_checkbox(element_name, locator, table, column)
|
308
|
+
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellCheckBox.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column});end))
|
309
|
+
end
|
310
|
+
|
311
|
+
# Declare and instantiate a cell radio in a table column on this page section.
|
312
|
+
#
|
313
|
+
# @param element_name [Symbol] name of cell radio object (as a symbol)
|
314
|
+
# @param locator [String] XPath expression that uniquely identifies cell radio within row and column of parent table object
|
315
|
+
# @param table [Symbol] Name (as a symbol) of parent table object
|
316
|
+
# @param column [Integer] 1-based index of table column that contains the cell radio object
|
317
|
+
# @example
|
318
|
+
# cell_radio :track_a_radio, "a[@class='track_a']", :data_table, 8
|
319
|
+
#
|
320
|
+
def self.cell_radio(element_name, locator, table, column)
|
321
|
+
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellRadio.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column});end))
|
322
|
+
end
|
323
|
+
|
284
324
|
# Instantiate a single PageSection object within this PageSection object.
|
285
325
|
#
|
286
326
|
# @param section_name [Symbol] name of PageSection object (as a symbol)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testcentricity_web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- A.J. Mrozinski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -194,6 +194,10 @@ files:
|
|
194
194
|
- lib/testcentricity_web/data_objects_helper.rb
|
195
195
|
- lib/testcentricity_web/drag_drop_helper.rb
|
196
196
|
- lib/testcentricity_web/elements/button.rb
|
197
|
+
- lib/testcentricity_web/elements/cell_button.rb
|
198
|
+
- lib/testcentricity_web/elements/cell_checkbox.rb
|
199
|
+
- lib/testcentricity_web/elements/cell_element.rb
|
200
|
+
- lib/testcentricity_web/elements/cell_radio.rb
|
197
201
|
- lib/testcentricity_web/elements/checkbox.rb
|
198
202
|
- lib/testcentricity_web/elements/file_field.rb
|
199
203
|
- lib/testcentricity_web/elements/image.rb
|