testcentricity_web 3.0.10 → 3.0.11
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +9 -9
- data/README.md +0 -67
- data/lib/testcentricity_web/data_objects/environment.rb +12 -12
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +12 -4
- data/lib/testcentricity_web/web_core/page_sections_helper.rb +43 -21
- data/lib/testcentricity_web/web_elements/image.rb +6 -2
- data/lib/testcentricity_web/web_elements/list.rb +14 -4
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +60 -17
- 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: 78fa4be1eae12b37a5e50cdad2d62a549e7cde9f
|
|
4
|
+
data.tar.gz: bd21610b06681a8d87ab09bc9e85df4d58e75ef5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87168ed26a747b735c3c31c0786f00f783eb480b868fe92dd4db27029dcc9a0c50ae28cc8696914a28a64923213748838d59b245fe09b229c0d5b85825eea10c
|
|
7
|
+
data.tar.gz: 48ba110d952f1e153374d9a2369e7bf43996cf95276c16dead90394c1ad8b032508f37941af08649087344da0a086d83ac81beeda334b2bf8a527efd8985b302
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
testcentricity_web (3.0.
|
|
4
|
+
testcentricity_web (3.0.11)
|
|
5
5
|
appium_lib
|
|
6
6
|
browserstack-local
|
|
7
7
|
capybara (>= 3.1, < 4)
|
|
@@ -20,15 +20,15 @@ GEM
|
|
|
20
20
|
specs:
|
|
21
21
|
addressable (2.5.2)
|
|
22
22
|
public_suffix (>= 2.0.2, < 4.0)
|
|
23
|
-
appium_lib (9.14.
|
|
24
|
-
appium_lib_core (~> 1.
|
|
23
|
+
appium_lib (9.14.3)
|
|
24
|
+
appium_lib_core (~> 1.8.0)
|
|
25
25
|
nokogiri (~> 1.8, >= 1.8.1)
|
|
26
26
|
tomlrb (~> 1.1)
|
|
27
|
-
appium_lib_core (1.
|
|
27
|
+
appium_lib_core (1.8.4)
|
|
28
28
|
faye-websocket (~> 0.10.0)
|
|
29
|
-
selenium-webdriver (~> 3.5)
|
|
29
|
+
selenium-webdriver (~> 3.5, < 3.14)
|
|
30
30
|
browserstack-local (1.3.0)
|
|
31
|
-
capybara (3.
|
|
31
|
+
capybara (3.5.0)
|
|
32
32
|
addressable
|
|
33
33
|
mini_mime (>= 0.1.3)
|
|
34
34
|
nokogiri (~> 1.8)
|
|
@@ -50,19 +50,19 @@ GEM
|
|
|
50
50
|
concurrent-ruby (~> 1.0)
|
|
51
51
|
mini_mime (1.0.0)
|
|
52
52
|
mini_portile2 (2.3.0)
|
|
53
|
-
nokogiri (1.8.
|
|
53
|
+
nokogiri (1.8.4)
|
|
54
54
|
mini_portile2 (~> 2.3.0)
|
|
55
55
|
os (1.0.0)
|
|
56
56
|
power_assert (1.1.3)
|
|
57
57
|
public_suffix (3.0.2)
|
|
58
58
|
rack (2.0.5)
|
|
59
|
-
rack-test (1.
|
|
59
|
+
rack-test (1.1.0)
|
|
60
60
|
rack (>= 1.0, < 3)
|
|
61
61
|
rake (11.1.2)
|
|
62
62
|
redcarpet (3.3.4)
|
|
63
63
|
ruby-ole (1.2.12.1)
|
|
64
64
|
rubyzip (1.2.1)
|
|
65
|
-
selenium-webdriver (3.
|
|
65
|
+
selenium-webdriver (3.13.1)
|
|
66
66
|
childprocess (~> 0.5)
|
|
67
67
|
rubyzip (~> 1.2)
|
|
68
68
|
spreadsheet (1.1.7)
|
data/README.md
CHANGED
|
@@ -26,73 +26,6 @@ The TestCentricity™ Web gem supports running automated tests against the follo
|
|
|
26
26
|
|
|
27
27
|
A complete history of bug fixes and new features can be found in the {file:CHANGELOG.md CHANGELOG} file.
|
|
28
28
|
|
|
29
|
-
###Version 3.0.10
|
|
30
|
-
|
|
31
|
-
* Added `Image.broken?` method.
|
|
32
|
-
* Added `UIElement.highlight` and `UIElement.unhighlight` methods.
|
|
33
|
-
* `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods now takes screenshots that display a red dashed rectangular highlight around
|
|
34
|
-
any UI element with property states that do not match expected results.
|
|
35
|
-
* Removed deprecated `DataObject.set_current` method.
|
|
36
|
-
|
|
37
|
-
###Version 3.0.9
|
|
38
|
-
|
|
39
|
-
* Added `List.choose_item` and `List.get_selected_item` methods.
|
|
40
|
-
* Added `SelectList.set` method.
|
|
41
|
-
|
|
42
|
-
###Version 3.0.8
|
|
43
|
-
|
|
44
|
-
* Added `PageObject.wait_for_ajax` method.
|
|
45
|
-
* `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods now accept optional `fail_message` string parameter to add context to error
|
|
46
|
-
messages when UI verifications raise an exception.
|
|
47
|
-
|
|
48
|
-
###Version 3.0.7
|
|
49
|
-
|
|
50
|
-
* Added support for connecting to and running your tests in desktop and emulated mobile web browsers hosted on Selenium Grid and Dockerized Selenium
|
|
51
|
-
Grid environments.
|
|
52
|
-
* Added `Environ.report_header` method that can be used to provide formatted test environment information in HTML test results.
|
|
53
|
-
* Deprecated `TestCentricity::WebDriverConnect.set_webdriver_path` method because the correct WebDriver is now automatically set.
|
|
54
|
-
|
|
55
|
-
###Version 3.0.6
|
|
56
|
-
|
|
57
|
-
* Added support for connecting to and running your tests on cloud hosted browsers on the Gridlastic cloud platform.
|
|
58
|
-
* Added support for specifying Selenium WebDriver version, browser-specific WebDriver version (for Firefox, IE, and Safari), and browser console
|
|
59
|
-
logs when running tests on BrowserStack hosted browsers. Refer to **section 8.5.1 (Remote desktop browsers on the BrowserStack service)** below.
|
|
60
|
-
* Updated device profiles for iPhone 7 (iOS 11) with Mobile Firefox browser and iPad (iOS 11) with Mobile Firefox browser.
|
|
61
|
-
* Updated device profiles for iPhone 7 (iOS 11) with Mobile Edge browser and iPad (iOS 11) with Mobile Edge browser.
|
|
62
|
-
* Updated device profiles for iPhone 7 (iOS 11) with Mobile Chrome browser and iPad (iOS 11) with Mobile Chrome browser.
|
|
63
|
-
|
|
64
|
-
###Version 3.0.5
|
|
65
|
-
|
|
66
|
-
* Added `Environ.headless` method. Will return `true` if testing against a *headless* instance of Chrome or Firefox.
|
|
67
|
-
|
|
68
|
-
###Version 3.0.4
|
|
69
|
-
|
|
70
|
-
* Refactored `SelectList` methods to work with Capybara version 3.x.
|
|
71
|
-
|
|
72
|
-
###Version 3.0.3
|
|
73
|
-
|
|
74
|
-
* Pinning to Capybara version 2.18.0 because Capybara 3.x breaks several `SelectList` methods.
|
|
75
|
-
|
|
76
|
-
###Version 3.0.2
|
|
77
|
-
|
|
78
|
-
* `PageManager.find_page` method now raises an exception if the requested page object has not been defined and instantiated.
|
|
79
|
-
|
|
80
|
-
###Version 3.0.1
|
|
81
|
-
|
|
82
|
-
* Updated device profiles for iPhone 7 (iOS 11) with Mobile Firefox browser and iPad (iOS 10) with Mobile Firefox browser.
|
|
83
|
-
* Updated device profiles for iPhone 7 (iOS 11) with Mobile Edge browser and iPad (iOS 10) with Mobile Edge browser.
|
|
84
|
-
* Updated device profiles for iPhone 7 (iOS 11) with Mobile Chrome browser and iPad (iOS 10) with Mobile Chrome browser.
|
|
85
|
-
|
|
86
|
-
###Version 3.0.0
|
|
87
|
-
|
|
88
|
-
* The TestCentricity™ Web gem now works with Selenium-WebDriver version 3.11 and **geckodriver** version 0.20.1 (or later) to support testing of the latest
|
|
89
|
-
versions of Firefox web browsers.
|
|
90
|
-
* Support for testing on locally hosted "headless" Chrome or Firefox browsers has been added.
|
|
91
|
-
* Support for headless browser testing using Poltergeist and PhantomJS has been removed.
|
|
92
|
-
* Support for Legacy FirefoxDriver (used in Firefox versions < 48) has been added.
|
|
93
|
-
* `TestCentricity::WebDriverConnect.set_webdriver_path` method now sets the path to the appropriate **geckodriver** file for OS X or Windows when testing on
|
|
94
|
-
locally hosted Firefox browsers.
|
|
95
|
-
|
|
96
29
|
|
|
97
30
|
## Installation
|
|
98
31
|
|
|
@@ -22,7 +22,6 @@ module TestCentricity
|
|
|
22
22
|
class Environ < TestCentricity::DataObject
|
|
23
23
|
@session_id = Time.now.strftime('%d%H%M%S%L')
|
|
24
24
|
@session_time_stamp = Time.now.strftime('%Y%m%d%H%M%S')
|
|
25
|
-
@session_code
|
|
26
25
|
@test_environment = ENV['TEST_ENVIRONMENT']
|
|
27
26
|
@screen_shots = []
|
|
28
27
|
|
|
@@ -31,6 +30,7 @@ module TestCentricity
|
|
|
31
30
|
attr_accessor :browser_size
|
|
32
31
|
attr_accessor :headless
|
|
33
32
|
attr_accessor :session_state
|
|
33
|
+
attr_accessor :session_code
|
|
34
34
|
attr_accessor :os
|
|
35
35
|
attr_accessor :device
|
|
36
36
|
attr_accessor :device_name
|
|
@@ -60,17 +60,17 @@ module TestCentricity
|
|
|
60
60
|
attr_accessor :db_password
|
|
61
61
|
|
|
62
62
|
def initialize(data)
|
|
63
|
-
@protocol
|
|
64
|
-
@hostname
|
|
65
|
-
@base_url
|
|
66
|
-
@user_id
|
|
67
|
-
@password
|
|
68
|
-
@append
|
|
69
|
-
@option1
|
|
70
|
-
@option2
|
|
71
|
-
@dns
|
|
72
|
-
@db_username
|
|
73
|
-
@db_password
|
|
63
|
+
@protocol = data['PROTOCOL']
|
|
64
|
+
@hostname = data['HOST_NAME']
|
|
65
|
+
@base_url = data['BASE_URL']
|
|
66
|
+
@user_id = data['USER_ID']
|
|
67
|
+
@password = data['PASSWORD']
|
|
68
|
+
@append = data['APPEND']
|
|
69
|
+
@option1 = data['OPTIONAL_1']
|
|
70
|
+
@option2 = data['OPTIONAL_2']
|
|
71
|
+
@dns = data['DNS']
|
|
72
|
+
@db_username = data['DB_USERNAME']
|
|
73
|
+
@db_password = data['DB_PASSWORD']
|
|
74
74
|
super
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -470,12 +470,16 @@ module TestCentricity
|
|
|
470
470
|
# @example
|
|
471
471
|
# home_page.wait_until_exists(15)
|
|
472
472
|
#
|
|
473
|
-
def wait_until_exists(seconds = nil)
|
|
473
|
+
def wait_until_exists(seconds = nil, post_exception = true)
|
|
474
474
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
475
475
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
476
476
|
wait.until { exists? }
|
|
477
477
|
rescue
|
|
478
|
-
|
|
478
|
+
if post_exception
|
|
479
|
+
raise "Page object #{self.class.name} not found after #{timeout} seconds" unless exists?
|
|
480
|
+
else
|
|
481
|
+
exists?
|
|
482
|
+
end
|
|
479
483
|
end
|
|
480
484
|
|
|
481
485
|
# Wait until the page object no longer exists, or until the specified wait time has expired. If the wait time is nil, then
|
|
@@ -485,12 +489,16 @@ module TestCentricity
|
|
|
485
489
|
# @example
|
|
486
490
|
# payment_processing_page.wait_until_gone(15)
|
|
487
491
|
#
|
|
488
|
-
def wait_until_gone(seconds = nil)
|
|
492
|
+
def wait_until_gone(seconds = nil, post_exception = true)
|
|
489
493
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
490
494
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
491
495
|
wait.until { !exists? }
|
|
492
496
|
rescue
|
|
493
|
-
|
|
497
|
+
if post_exception
|
|
498
|
+
raise "Page object #{self.class.name} remained visible after #{timeout} seconds" if exists?
|
|
499
|
+
else
|
|
500
|
+
exists?
|
|
501
|
+
end
|
|
494
502
|
end
|
|
495
503
|
|
|
496
504
|
# Wait until all AJAX requests have completed, or until the specified wait time has expired. If the wait time is nil, then
|
|
@@ -38,21 +38,23 @@ module TestCentricity
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def get_locator
|
|
41
|
-
if @locator.empty? && defined?(section_locator)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
locator = if @locator.empty? && defined?(section_locator)
|
|
42
|
+
section_locator
|
|
43
|
+
else
|
|
44
|
+
@locator
|
|
45
|
+
end
|
|
47
46
|
unless @parent_list.nil?
|
|
48
|
-
locator =
|
|
47
|
+
locator = if @locator_type == @parent_list.get_locator_type
|
|
48
|
+
"#{@parent_list.get_locator} #{locator}"
|
|
49
|
+
else
|
|
50
|
+
"#{@parent_list.get_locator}|#{locator}"
|
|
51
|
+
end
|
|
49
52
|
unless @list_index.nil?
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
53
|
+
locator = if @locator_type == :xpath
|
|
54
|
+
"#{locator}[#{@list_index}]"
|
|
55
|
+
else
|
|
56
|
+
"#{locator}:nth-of-type(#{@list_index})"
|
|
57
|
+
end
|
|
56
58
|
end
|
|
57
59
|
end
|
|
58
60
|
|
|
@@ -67,6 +69,10 @@ module TestCentricity
|
|
|
67
69
|
@locator_type
|
|
68
70
|
end
|
|
69
71
|
|
|
72
|
+
def get_parent_list
|
|
73
|
+
@parent_list
|
|
74
|
+
end
|
|
75
|
+
|
|
70
76
|
def set_list_index(list, index = 1)
|
|
71
77
|
@parent_list = list unless list.nil?
|
|
72
78
|
@list_index = index
|
|
@@ -580,12 +586,16 @@ module TestCentricity
|
|
|
580
586
|
# @example
|
|
581
587
|
# navigation_toolbar.wait_until_exists(0.5)
|
|
582
588
|
#
|
|
583
|
-
def wait_until_exists(seconds = nil)
|
|
589
|
+
def wait_until_exists(seconds = nil, post_exception = true)
|
|
584
590
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
585
591
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
586
592
|
wait.until { exists? }
|
|
587
593
|
rescue
|
|
588
|
-
|
|
594
|
+
if post_exception
|
|
595
|
+
raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless exists?
|
|
596
|
+
else
|
|
597
|
+
exists?
|
|
598
|
+
end
|
|
589
599
|
end
|
|
590
600
|
|
|
591
601
|
# Wait until the Section object no longer exists, or until the specified wait time has expired. If the wait time is
|
|
@@ -595,12 +605,16 @@ module TestCentricity
|
|
|
595
605
|
# @example
|
|
596
606
|
# navigation_toolbar.wait_until_gone(5)
|
|
597
607
|
#
|
|
598
|
-
def wait_until_gone(seconds = nil)
|
|
608
|
+
def wait_until_gone(seconds = nil, post_exception = true)
|
|
599
609
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
600
610
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
601
611
|
wait.until { !exists? }
|
|
602
612
|
rescue
|
|
603
|
-
|
|
613
|
+
if post_exception
|
|
614
|
+
raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if exists?
|
|
615
|
+
else
|
|
616
|
+
exists?
|
|
617
|
+
end
|
|
604
618
|
end
|
|
605
619
|
|
|
606
620
|
# Wait until the Section object is visible, or until the specified wait time has expired. If the wait time is nil,
|
|
@@ -610,12 +624,16 @@ module TestCentricity
|
|
|
610
624
|
# @example
|
|
611
625
|
# bar_chart_section.wait_until_visible(0.5)
|
|
612
626
|
#
|
|
613
|
-
def wait_until_visible(seconds = nil)
|
|
627
|
+
def wait_until_visible(seconds = nil, post_exception = true)
|
|
614
628
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
615
629
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
616
630
|
wait.until { visible? }
|
|
617
631
|
rescue
|
|
618
|
-
|
|
632
|
+
if post_exception
|
|
633
|
+
raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless visible?
|
|
634
|
+
else
|
|
635
|
+
visible?
|
|
636
|
+
end
|
|
619
637
|
end
|
|
620
638
|
|
|
621
639
|
# Wait until the Section object is hidden, or until the specified wait time has expired. If the wait time is nil,
|
|
@@ -625,12 +643,16 @@ module TestCentricity
|
|
|
625
643
|
# @example
|
|
626
644
|
# bar_chart_section.wait_until_hidden(10)
|
|
627
645
|
#
|
|
628
|
-
def wait_until_hidden(seconds = nil)
|
|
646
|
+
def wait_until_hidden(seconds = nil, post_exception = true)
|
|
629
647
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
630
648
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
631
649
|
wait.until { hidden? }
|
|
632
650
|
rescue
|
|
633
|
-
|
|
651
|
+
if post_exception
|
|
652
|
+
raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if visible?
|
|
653
|
+
else
|
|
654
|
+
visible?
|
|
655
|
+
end
|
|
634
656
|
end
|
|
635
657
|
|
|
636
658
|
# Click on a Section object
|
|
@@ -41,12 +41,16 @@ module TestCentricity
|
|
|
41
41
|
# @example
|
|
42
42
|
# company_logo_image.wait_until_loaded(5)
|
|
43
43
|
#
|
|
44
|
-
def wait_until_loaded(seconds = nil)
|
|
44
|
+
def wait_until_loaded(seconds = nil, post_exception = true)
|
|
45
45
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
46
46
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
47
47
|
wait.until { is_loaded? }
|
|
48
48
|
rescue
|
|
49
|
-
|
|
49
|
+
if post_exception
|
|
50
|
+
raise "Image #{object_ref_message} failed to load within #{timeout} seconds" unless loaded?
|
|
51
|
+
else
|
|
52
|
+
loaded?
|
|
53
|
+
end
|
|
50
54
|
end
|
|
51
55
|
end
|
|
52
56
|
end
|
|
@@ -68,6 +68,8 @@ module TestCentricity
|
|
|
68
68
|
obj.all(@list_item).count
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
alias item_count get_item_count
|
|
72
|
+
|
|
71
73
|
def get_all_list_items(element_spec = nil)
|
|
72
74
|
define_list_elements(element_spec) unless element_spec.nil?
|
|
73
75
|
obj, = find_element
|
|
@@ -123,12 +125,16 @@ module TestCentricity
|
|
|
123
125
|
# or
|
|
124
126
|
# search_results_list.wait_until_item_count_is({ greater_than_or_equal: 1 }, 5)
|
|
125
127
|
#
|
|
126
|
-
def wait_until_item_count_is(value, seconds = nil)
|
|
128
|
+
def wait_until_item_count_is(value, seconds = nil, post_exception = true)
|
|
127
129
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
128
130
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
129
131
|
wait.until { compare(value, get_item_count) }
|
|
130
132
|
rescue
|
|
131
|
-
|
|
133
|
+
if post_exception
|
|
134
|
+
raise "Value of List #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_item_count == value
|
|
135
|
+
else
|
|
136
|
+
get_item_count == value
|
|
137
|
+
end
|
|
132
138
|
end
|
|
133
139
|
|
|
134
140
|
# Wait until the list's item count changes to a different value, or until the specified wait time has expired. If the
|
|
@@ -138,13 +144,17 @@ module TestCentricity
|
|
|
138
144
|
# @example
|
|
139
145
|
# search_results_list.wait_until_value_changes(5)
|
|
140
146
|
#
|
|
141
|
-
def wait_until_item_count_changes(seconds = nil)
|
|
147
|
+
def wait_until_item_count_changes(seconds = nil, post_exception = true)
|
|
142
148
|
value = get_item_count
|
|
143
149
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
144
150
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
145
151
|
wait.until { get_item_count != value }
|
|
146
152
|
rescue
|
|
147
|
-
|
|
153
|
+
if post_exception
|
|
154
|
+
raise "Value of List #{object_ref_message} failed to change from '#{value}' after #{timeout} seconds" if get_item_count == value
|
|
155
|
+
else
|
|
156
|
+
get_item_count == value
|
|
157
|
+
end
|
|
148
158
|
end
|
|
149
159
|
end
|
|
150
160
|
end
|
|
@@ -68,6 +68,10 @@ module TestCentricity
|
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
def get_locator_type
|
|
72
|
+
@locator_type
|
|
73
|
+
end
|
|
74
|
+
|
|
71
75
|
def get_object_type
|
|
72
76
|
if @type
|
|
73
77
|
@type
|
|
@@ -248,12 +252,16 @@ module TestCentricity
|
|
|
248
252
|
# @example
|
|
249
253
|
# run_button.wait_until_exists(0.5)
|
|
250
254
|
#
|
|
251
|
-
def wait_until_exists(seconds = nil)
|
|
255
|
+
def wait_until_exists(seconds = nil, post_exception = true)
|
|
252
256
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
253
257
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
254
258
|
wait.until { exists? }
|
|
255
259
|
rescue StandardError
|
|
256
|
-
|
|
260
|
+
if post_exception
|
|
261
|
+
raise "Could not find UI #{object_ref_message} after #{timeout} seconds" unless exists?
|
|
262
|
+
else
|
|
263
|
+
exists?
|
|
264
|
+
end
|
|
257
265
|
end
|
|
258
266
|
|
|
259
267
|
# Wait until the object no longer exists, or until the specified wait time has expired. If the wait time is nil, then
|
|
@@ -263,12 +271,16 @@ module TestCentricity
|
|
|
263
271
|
# @example
|
|
264
272
|
# logout_button.wait_until_gone(5)
|
|
265
273
|
#
|
|
266
|
-
def wait_until_gone(seconds = nil)
|
|
274
|
+
def wait_until_gone(seconds = nil, post_exception = true)
|
|
267
275
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
268
276
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
269
277
|
wait.until { !exists? }
|
|
270
278
|
rescue StandardError
|
|
271
|
-
|
|
279
|
+
if post_exception
|
|
280
|
+
raise "UI #{object_ref_message} remained visible after #{timeout} seconds" if exists?
|
|
281
|
+
else
|
|
282
|
+
exists?
|
|
283
|
+
end
|
|
272
284
|
end
|
|
273
285
|
|
|
274
286
|
# Wait until the object is visible, or until the specified wait time has expired. If the wait time is nil, then the
|
|
@@ -278,12 +290,16 @@ module TestCentricity
|
|
|
278
290
|
# @example
|
|
279
291
|
# run_button.wait_until_visible(0.5)
|
|
280
292
|
#
|
|
281
|
-
def wait_until_visible(seconds = nil)
|
|
293
|
+
def wait_until_visible(seconds = nil, post_exception = true)
|
|
282
294
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
283
295
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
284
296
|
wait.until { visible? }
|
|
285
297
|
rescue StandardError
|
|
286
|
-
|
|
298
|
+
if post_exception
|
|
299
|
+
raise "Could not find UI #{object_ref_message} after #{timeout} seconds" unless visible?
|
|
300
|
+
else
|
|
301
|
+
visible?
|
|
302
|
+
end
|
|
287
303
|
end
|
|
288
304
|
|
|
289
305
|
# Wait until the object is hidden, or until the specified wait time has expired. If the wait time is nil, then the
|
|
@@ -293,12 +309,16 @@ module TestCentricity
|
|
|
293
309
|
# @example
|
|
294
310
|
# run_button.wait_until_hidden(10)
|
|
295
311
|
#
|
|
296
|
-
def wait_until_hidden(seconds = nil)
|
|
312
|
+
def wait_until_hidden(seconds = nil, post_exception = true)
|
|
297
313
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
298
314
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
299
315
|
wait.until { hidden? }
|
|
300
316
|
rescue StandardError
|
|
301
|
-
|
|
317
|
+
if post_exception
|
|
318
|
+
raise "UI #{object_ref_message} remained visible after #{timeout} seconds" if visible?
|
|
319
|
+
else
|
|
320
|
+
visible?
|
|
321
|
+
end
|
|
302
322
|
end
|
|
303
323
|
|
|
304
324
|
# Wait until the object's value equals the specified value, or until the specified wait time has expired. If the wait
|
|
@@ -311,12 +331,16 @@ module TestCentricity
|
|
|
311
331
|
# or
|
|
312
332
|
# total_weight_field.wait_until_value_is({ greater_than: '250' }, 5)
|
|
313
333
|
#
|
|
314
|
-
def wait_until_value_is(value, seconds = nil)
|
|
334
|
+
def wait_until_value_is(value, seconds = nil, post_exception = true)
|
|
315
335
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
316
336
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
317
337
|
wait.until { compare(value, get_value) }
|
|
318
338
|
rescue StandardError
|
|
319
|
-
|
|
339
|
+
if post_exception
|
|
340
|
+
raise "Value of UI #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
|
|
341
|
+
else
|
|
342
|
+
get_value == value
|
|
343
|
+
end
|
|
320
344
|
end
|
|
321
345
|
|
|
322
346
|
# Wait until the object's value changes to a different value, or until the specified wait time has expired. If the
|
|
@@ -326,13 +350,33 @@ module TestCentricity
|
|
|
326
350
|
# @example
|
|
327
351
|
# basket_grand_total_label.wait_until_value_changes(5)
|
|
328
352
|
#
|
|
329
|
-
def wait_until_value_changes(seconds = nil)
|
|
353
|
+
def wait_until_value_changes(seconds = nil, post_exception = true)
|
|
330
354
|
value = get_value
|
|
331
355
|
timeout = seconds.nil? ? Capybara.default_max_wait_time : seconds
|
|
332
356
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
|
333
357
|
wait.until { get_value != value }
|
|
334
358
|
rescue StandardError
|
|
335
|
-
|
|
359
|
+
if post_exception
|
|
360
|
+
raise "Value of UI #{object_ref_message} failed to change from '#{value}' after #{timeout} seconds" if get_value == value
|
|
361
|
+
else
|
|
362
|
+
get_value == value
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
# Return the number of occurrences of an object with an ambiguous locator that evaluates to multiple UI elements.
|
|
367
|
+
#
|
|
368
|
+
# @param visible [Boolean, Symbol] Only find elements with the specified visibility:
|
|
369
|
+
# * true - only finds visible elements.
|
|
370
|
+
# * false - finds invisible _and_ visible elements.
|
|
371
|
+
# * :all - same as false; finds visible and invisible elements.
|
|
372
|
+
# * :hidden - only finds invisible elements.
|
|
373
|
+
# * :visible - same as true; only finds visible elements.
|
|
374
|
+
# @example
|
|
375
|
+
# num_uploads = upload_progress_bars.count(:all)
|
|
376
|
+
#
|
|
377
|
+
def count(visible = true)
|
|
378
|
+
obj_locator = @alt_locator.nil? ? @locator : @alt_locator
|
|
379
|
+
page.all(@locator_type, obj_locator, wait: 0.01, visible: visible, minimum: 0).count
|
|
336
380
|
end
|
|
337
381
|
|
|
338
382
|
# Return width of object.
|
|
@@ -448,7 +492,7 @@ module TestCentricity
|
|
|
448
492
|
# Highlight an object with a 3 pixel wide, red dashed border for the specified wait time.
|
|
449
493
|
# If wait time is zero, then the highlight will remain until the page is refreshed
|
|
450
494
|
#
|
|
451
|
-
# @param
|
|
495
|
+
# @param duration [Integer or Float] wait time in seconds
|
|
452
496
|
# @example
|
|
453
497
|
# error_message.highlight(3)
|
|
454
498
|
#
|
|
@@ -516,18 +560,17 @@ module TestCentricity
|
|
|
516
560
|
obj_locator = @alt_locator.nil? ? @locator : @alt_locator
|
|
517
561
|
parent_section = @context == :section && !@parent.get_locator.nil?
|
|
518
562
|
tries ||= parent_section ? 2 : 1
|
|
519
|
-
|
|
520
|
-
if parent_section && tries > 1
|
|
563
|
+
if parent_section && tries == 2
|
|
521
564
|
parent_locator = @parent.get_locator
|
|
522
565
|
parent_locator = parent_locator.tr('|', ' ')
|
|
523
566
|
parent_locator_type = @parent.get_locator_type
|
|
524
|
-
obj = page.find(parent_locator_type, parent_locator, wait: 0.01).find(@locator_type, obj_locator, wait: 0.01, visible: visible)
|
|
567
|
+
obj = page.find(parent_locator_type, parent_locator, visible: :all, wait: 0.01).find(@locator_type, obj_locator, wait: 0.01, visible: visible)
|
|
525
568
|
else
|
|
526
569
|
obj = page.find(@locator_type, obj_locator, wait: 0.01, visible: visible)
|
|
527
570
|
end
|
|
528
571
|
[obj, @locator_type]
|
|
529
572
|
rescue StandardError
|
|
530
|
-
retry if (tries -= 1)
|
|
573
|
+
retry if (tries -= 1).positive?
|
|
531
574
|
[nil, nil]
|
|
532
575
|
end
|
|
533
576
|
|
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: 3.0.
|
|
4
|
+
version: 3.0.11
|
|
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-
|
|
11
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|