testcentricity_web 2.3.16 → 2.3.17
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/README.md +5 -0
- data/lib/testcentricity_web/appium_server.rb +0 -0
- data/lib/testcentricity_web/exception_queue_helper.rb +49 -1
- data/lib/testcentricity_web/page_objects_helper.rb +2 -43
- data/lib/testcentricity_web/page_sections_helper.rb +2 -43
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_elements/list.rb +35 -8
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df906d46604b41bddf152f1b278b37dbd52bf288
|
4
|
+
data.tar.gz: 88f6d0090a3779394e948fc1a6c598e639e70a9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 604568dc130aa338f194b430bf0ca5e39474175171b701ae54f2fd16cd7fc272d9801a1f94cf043f02a1da510a4e23b7c99ce86f07adeead452dc862db16fc51
|
7
|
+
data.tar.gz: 701cac1a5faefcb72aeff3e5e3c3bee639be52e4a0800224acedcb4cce67f5fea7859dbb00aa2d2eaf1be04a56296f0c08fac8ce1bf5130f96425c76389a4aef
|
data/README.md
CHANGED
@@ -28,6 +28,11 @@ hosted instances of Chrome, Firefox, Safari, and IE web browsers.
|
|
28
28
|
|
29
29
|
|
30
30
|
## What's New
|
31
|
+
###Version 2.3.17
|
32
|
+
|
33
|
+
* Added `List.wait_until_item_count_is` and `List.wait_until_item_count_changes` methods.
|
34
|
+
* `UIElement.wait_until_value_is` and `List.wait_until_item_count_is` methods now accept comparison hash.
|
35
|
+
|
31
36
|
###Version 2.3.16
|
32
37
|
|
33
38
|
* Added `PageSection.double_click`, `PageObject.right_click`, and `PageObject.send_keys` methods.
|
File without changes
|
@@ -28,6 +28,50 @@ module TestCentricity
|
|
28
28
|
@error_queue = nil
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.enqueue_comparison(state, actual, error_msg)
|
32
|
+
if state.is_a?(Hash) && state.length == 1
|
33
|
+
state.each do |key, value|
|
34
|
+
case key
|
35
|
+
when :lt, :less_than
|
36
|
+
enqueue_exception("#{error_msg} be less than #{value} but found '#{actual}'") unless actual < value
|
37
|
+
when :lt_eq, :less_than_or_equal
|
38
|
+
enqueue_exception("#{error_msg} be less than or equal to #{value} but found '#{actual}'") unless actual <= value
|
39
|
+
when :gt, :greater_than
|
40
|
+
enqueue_exception("#{error_msg} be greater than #{value} but found '#{actual}'") unless actual > value
|
41
|
+
when :gt_eq, :greater_than_or_equal
|
42
|
+
enqueue_exception("#{error_msg} be greater than or equal to #{value} but found '#{actual}'") unless actual >= value
|
43
|
+
when :starts_with
|
44
|
+
enqueue_exception("#{error_msg} start with '#{value}' but found '#{actual}'") unless actual.start_with?(value)
|
45
|
+
when :ends_with
|
46
|
+
enqueue_exception("#{error_msg} end with '#{value}' but found '#{actual}'") unless actual.end_with?(value)
|
47
|
+
when :contains
|
48
|
+
enqueue_exception("#{error_msg} contain '#{value}' but found '#{actual}'") unless actual.include?(value)
|
49
|
+
when :not_contains, :does_not_contain
|
50
|
+
enqueue_exception("#{error_msg} not contain '#{value}' but found '#{actual}'") if actual.include?(value)
|
51
|
+
when :not_equal
|
52
|
+
enqueue_exception("#{error_msg} not equal '#{value}' but found '#{actual}'") if actual == value
|
53
|
+
when :like, :is_like
|
54
|
+
actual_like = actual.delete("\n")
|
55
|
+
actual_like = actual_like.delete("\r")
|
56
|
+
actual_like = actual_like.delete("\t")
|
57
|
+
actual_like = actual_like.delete(' ')
|
58
|
+
actual_like = actual_like.downcase
|
59
|
+
expected = value.delete("\n")
|
60
|
+
expected = expected.delete("\r")
|
61
|
+
expected = expected.delete("\t")
|
62
|
+
expected = expected.delete(' ')
|
63
|
+
expected = expected.downcase
|
64
|
+
enqueue_exception("#{error_msg} be like '#{value}' but found '#{actual}'") unless actual_like.include?(expected)
|
65
|
+
when :translate
|
66
|
+
expected = I18n.t(value)
|
67
|
+
enqueue_assert_equal(expected, actual, error_msg)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
else
|
71
|
+
enqueue_assert_equal(state, actual, error_msg)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
31
75
|
private
|
32
76
|
|
33
77
|
def self.enqueue(message)
|
@@ -38,7 +82,11 @@ module TestCentricity
|
|
38
82
|
timestamp = Time.now.strftime('%Y%m%d%H%M%S')
|
39
83
|
filename = "Screenshot-#{timestamp}"
|
40
84
|
path = File.join Dir.pwd, 'reports/screenshots/', filename
|
41
|
-
|
85
|
+
if Environ.driver == :appium
|
86
|
+
AppiumConnect.take_screenshot("#{path}.png")
|
87
|
+
else
|
88
|
+
Capybara.save_screenshot "#{path}.png"
|
89
|
+
end
|
42
90
|
puts "Screenshot saved at #{path}.png"
|
43
91
|
screen_shot = { :path => path, :filename => filename }
|
44
92
|
Environ.save_screen_shot(screen_shot)
|
@@ -595,49 +595,8 @@ module TestCentricity
|
|
595
595
|
end
|
596
596
|
end
|
597
597
|
end
|
598
|
-
|
599
|
-
|
600
|
-
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
|
601
|
-
state.each do |key, value|
|
602
|
-
case key
|
603
|
-
when :lt, :less_than
|
604
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be less than #{value} but found '#{actual}'") unless actual < value
|
605
|
-
when :lt_eq, :less_than_or_equal
|
606
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be less than or equal to #{value} but found '#{actual}'") unless actual <= value
|
607
|
-
when :gt, :greater_than
|
608
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be greater than #{value} but found '#{actual}'") unless actual > value
|
609
|
-
when :gt_eq, :greater_than_or_equal
|
610
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be greater than or equal to #{value} but found '#{actual}'") unless actual >= value
|
611
|
-
when :starts_with
|
612
|
-
ExceptionQueue.enqueue_exception("#{error_msg} start with '#{value}' but found '#{actual}'") unless actual.start_with?(value)
|
613
|
-
when :ends_with
|
614
|
-
ExceptionQueue.enqueue_exception("#{error_msg} end with '#{value}' but found '#{actual}'") unless actual.end_with?(value)
|
615
|
-
when :contains
|
616
|
-
ExceptionQueue.enqueue_exception("#{error_msg} contain '#{value}' but found '#{actual}'") unless actual.include?(value)
|
617
|
-
when :not_contains, :does_not_contain
|
618
|
-
ExceptionQueue.enqueue_exception("#{error_msg} not contain '#{value}' but found '#{actual}'") if actual.include?(value)
|
619
|
-
when :not_equal
|
620
|
-
ExceptionQueue.enqueue_exception("#{error_msg} not equal '#{value}' but found '#{actual}'") if actual == value
|
621
|
-
when :like, :is_like
|
622
|
-
actual_like = actual.delete("\n")
|
623
|
-
actual_like = actual_like.delete("\r")
|
624
|
-
actual_like = actual_like.delete("\t")
|
625
|
-
actual_like = actual_like.delete(' ')
|
626
|
-
actual_like = actual_like.downcase
|
627
|
-
expected = value.delete("\n")
|
628
|
-
expected = expected.delete("\r")
|
629
|
-
expected = expected.delete("\t")
|
630
|
-
expected = expected.delete(' ')
|
631
|
-
expected = expected.downcase
|
632
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be like '#{value}' but found '#{actual}'") unless actual_like.include?(expected)
|
633
|
-
when :translate
|
634
|
-
expected = I18n.t(value)
|
635
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) translated #{property} property")
|
636
|
-
end
|
637
|
-
end
|
638
|
-
else
|
639
|
-
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property")
|
640
|
-
end
|
598
|
+
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
|
599
|
+
ExceptionQueue.enqueue_comparison(state, actual, error_msg)
|
641
600
|
end
|
642
601
|
end
|
643
602
|
rescue ObjectNotFoundError => e
|
@@ -787,49 +787,8 @@ module TestCentricity
|
|
787
787
|
end
|
788
788
|
end
|
789
789
|
end
|
790
|
-
|
791
|
-
|
792
|
-
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
|
793
|
-
state.each do |key, value|
|
794
|
-
case key
|
795
|
-
when :lt, :less_than
|
796
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be less than #{value} but found '#{actual}'") unless actual < value
|
797
|
-
when :lt_eq, :less_than_or_equal
|
798
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be less than or equal to #{value} but found '#{actual}'") unless actual <= value
|
799
|
-
when :gt, :greater_than
|
800
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be greater than #{value} but found '#{actual}'") unless actual > value
|
801
|
-
when :gt_eq, :greater_than_or_equal
|
802
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be greater than or equal to #{value} but found '#{actual}'") unless actual >= value
|
803
|
-
when :starts_with
|
804
|
-
ExceptionQueue.enqueue_exception("#{error_msg} start with '#{value}' but found '#{actual}'") unless actual.start_with?(value)
|
805
|
-
when :ends_with
|
806
|
-
ExceptionQueue.enqueue_exception("#{error_msg} end with '#{value}' but found '#{actual}'") unless actual.end_with?(value)
|
807
|
-
when :contains
|
808
|
-
ExceptionQueue.enqueue_exception("#{error_msg} contain '#{value}' but found '#{actual}'") unless actual.include?(value)
|
809
|
-
when :not_contains, :does_not_contain
|
810
|
-
ExceptionQueue.enqueue_exception("#{error_msg} not contain '#{value}' but found '#{actual}'") if actual.include?(value)
|
811
|
-
when :not_equal
|
812
|
-
ExceptionQueue.enqueue_exception("#{error_msg} not equal '#{value}' but found '#{actual}'") if actual == value
|
813
|
-
when :like, :is_like
|
814
|
-
actual_like = actual.delete("\n")
|
815
|
-
actual_like = actual_like.delete("\r")
|
816
|
-
actual_like = actual_like.delete("\t")
|
817
|
-
actual_like = actual_like.delete(' ')
|
818
|
-
actual_like = actual_like.downcase
|
819
|
-
expected = value.delete("\n")
|
820
|
-
expected = expected.delete("\r")
|
821
|
-
expected = expected.delete("\t")
|
822
|
-
expected = expected.delete(' ')
|
823
|
-
expected = expected.downcase
|
824
|
-
ExceptionQueue.enqueue_exception("#{error_msg} be like '#{value}' but found '#{actual}'") unless actual_like.include?(expected)
|
825
|
-
when :translate
|
826
|
-
expected = I18n.t(value)
|
827
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) translated #{property} property")
|
828
|
-
end
|
829
|
-
end
|
830
|
-
else
|
831
|
-
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property")
|
832
|
-
end
|
790
|
+
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
|
791
|
+
ExceptionQueue.enqueue_comparison(state, actual, error_msg)
|
833
792
|
end
|
834
793
|
end
|
835
794
|
rescue ObjectNotFoundError => e
|
@@ -11,10 +11,10 @@ module TestCentricity
|
|
11
11
|
def define_list_elements(element_spec)
|
12
12
|
element_spec.each do |element, value|
|
13
13
|
case element
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
when :list_item
|
15
|
+
@list_item = value
|
16
|
+
else
|
17
|
+
raise "#{element} is not a recognized list element"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -63,11 +63,38 @@ module TestCentricity
|
|
63
63
|
|
64
64
|
def get_list_row_locator(row)
|
65
65
|
case @locator_type
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
when :xpath
|
67
|
+
"#{@locator}/#{@list_item}[#{row}]"
|
68
|
+
when :css
|
69
|
+
"#{@locator} > #{@list_item}:nth-of-type(#{row})"
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
# Wait until the list's item_count equals the specified value, or until the specified wait time has expired. If the wait
|
74
|
+
# time is nil, then the wait time will be Capybara.default_max_wait_time.
|
75
|
+
#
|
76
|
+
# @param value [Integer or Hash] value expected or comparison hash
|
77
|
+
# @param seconds [Integer or Float] wait time in seconds
|
78
|
+
# @example
|
79
|
+
# search_results_list.wait_until_item_count_is(10, 15)
|
80
|
+
# or
|
81
|
+
# search_results_list.wait_until_item_count_is({ :greater_than_or_equal => 1 }, 5)
|
82
|
+
#
|
83
|
+
def wait_until_item_count_is(value, seconds = nil)
|
84
|
+
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
85
|
+
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
86
|
+
wait.until { compare(value, get_item_count) }
|
87
|
+
rescue
|
88
|
+
raise "Value of List #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_item_count == value
|
89
|
+
end
|
90
|
+
|
91
|
+
def wait_until_item_count_changes(seconds = nil)
|
92
|
+
value = get_item_count
|
93
|
+
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
94
|
+
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
95
|
+
wait.until { get_item_count != value }
|
96
|
+
rescue
|
97
|
+
raise "Value of List #{object_ref_message} failed to change from '#{value}' after #{timeout} seconds" if get_item_count == value
|
98
|
+
end
|
72
99
|
end
|
73
100
|
end
|
@@ -301,14 +301,17 @@ module TestCentricity
|
|
301
301
|
# Wait until the object's value equals the specified value, or until the specified wait time has expired. If the wait
|
302
302
|
# time is nil, then the wait time will be Capybara.default_max_wait_time.
|
303
303
|
#
|
304
|
+
# @param value [String or Hash] value expected or comparison hash
|
304
305
|
# @param seconds [Integer or Float] wait time in seconds
|
305
306
|
# @example
|
306
|
-
# card_authorized_label.wait_until_value_is(
|
307
|
+
# card_authorized_label.wait_until_value_is('Card authorized', 5)
|
308
|
+
# or
|
309
|
+
# total_weight_field.wait_until_value_is({ :greater_than => '250' }, 5)
|
307
310
|
#
|
308
311
|
def wait_until_value_is(value, seconds = nil)
|
309
312
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
310
313
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
311
|
-
wait.until { get_value
|
314
|
+
wait.until { compare(value, get_value) }
|
312
315
|
rescue
|
313
316
|
raise "Value of UI #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
|
314
317
|
end
|
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: 2.3.
|
4
|
+
version: 2.3.17
|
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: 2018-03-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|