testcentricity 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -0
- data/Rakefile +2 -2
- data/config/test_data/data.yml +67 -0
- data/features/deep_links.feature +12 -0
- data/features/step_definitions/generic_steps.rb +5 -0
- data/features/support/android/screens/product_item_screen.rb +39 -0
- data/features/support/android/screens/products_screen.rb +15 -1
- data/features/support/android/sections/list_items/product_list_item.rb +13 -0
- data/features/support/data/product_data.rb +27 -0
- data/features/support/ios/screens/product_item_screen.rb +39 -0
- data/features/support/ios/screens/products_screen.rb +15 -1
- data/features/support/ios/sections/list_items/product_list_item.rb +13 -0
- data/features/support/world_data.rb +4 -1
- data/features/support/world_pages.rb +1 -0
- data/lib/testcentricity/app_elements/app_element_helper.rb +55 -12
- data/lib/testcentricity/version.rb +1 -1
- data/testcentricity.gemspec +1 -1
- metadata +14 -7
- data/config/test_data/LOCAL_data.yml +0 -15
- data/features/support/ios/sections/list_items/product_cell_item.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c7b4120e8589701d29a850600108df295c1c199fa8c19e9f6f92bd76b49a47
|
4
|
+
data.tar.gz: 956e90ac6395ed32e69c2fd7558977398b8c42c075577d858090ce194da8c668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b389a6ce9b701bb380ae02d34b7dc2880617aa315738a59082dfabf3c00fc2411d4f7ab99b3102f048918c9cc77e2e02b3b475fae3836986bfcc2237d7495112
|
7
|
+
data.tar.gz: b8d6b8ce2cb4cf7f98d66b8fe7ea7a9e4a1db0a07d3410660d5e6c06d962dc0bb48ce761d8998b4ac1475165ae042f8116109f049b8241e6eda7f64eb7147430
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
4
|
|
5
|
+
## [3.0.4] - 02-JUNE-2022
|
6
|
+
|
7
|
+
### Added
|
8
|
+
* Added `AppUIElement.wait_until_enabled` method.
|
9
|
+
|
10
|
+
### Updated
|
11
|
+
* Incorporated all changes from the [TestCentricity™ Web gem](https://rubygems.org/gems/testcentricity_web) version 4.2.4, which is
|
12
|
+
bundled with this gem.
|
13
|
+
|
14
|
+
|
5
15
|
## [3.0.3] - 30-MAY-2022
|
6
16
|
|
7
17
|
### Added
|
data/README.md
CHANGED
@@ -536,6 +536,7 @@ With TestCentricity, all native app UI elements are based on the `AppUIElement`
|
|
536
536
|
element.wait_until_gone(seconds)
|
537
537
|
element.wait_until_visible(seconds)
|
538
538
|
element.wait_until_hidden(seconds)
|
539
|
+
element.wait_until_enabled(seconds)
|
539
540
|
element.wait_until_value_is(value, seconds)
|
540
541
|
element.wait_until_value_changes(seconds)
|
541
542
|
|
data/Rakefile
CHANGED
@@ -35,7 +35,7 @@ desc 'Run required specs and Cucumber features'
|
|
35
35
|
task required: [:required_specs, :android_sim, :ios_sim]
|
36
36
|
|
37
37
|
|
38
|
-
desc 'Run all specs
|
38
|
+
desc 'Run all specs'
|
39
39
|
task all_specs: [:required_specs, :web_specs]
|
40
40
|
|
41
41
|
|
@@ -52,7 +52,7 @@ end
|
|
52
52
|
desc 'Build and release new version'
|
53
53
|
task :release do
|
54
54
|
version = TestCentricity::VERSION
|
55
|
-
puts "Releasing #{version}, y/n?"
|
55
|
+
puts "Releasing version #{version} of TestCentricity gem, y/n?"
|
56
56
|
exit(1) unless $stdin.gets.chomp == 'y'
|
57
57
|
sh 'gem build testcentricity.gemspec && ' \
|
58
58
|
"gem push testcentricity-#{version}.gem"
|
data/config/test_data/data.yml
CHANGED
@@ -7,3 +7,70 @@ Environments:
|
|
7
7
|
IOS_APP_PATH: '/Users/Shared/Test_Apps/iOS/MyRNDemoApp.app'
|
8
8
|
IOS_IPA_PATH: '/Users/Shared/Test_Apps/iOS/iOS-Real-Device-MyRNDemoApp.1.3.0-162.ipa'
|
9
9
|
ANDROID_APK_PATH: '/Users/Shared/Test_Apps/Android/Android-MyDemoAppRN.1.2.0.build-231.apk'
|
10
|
+
|
11
|
+
# This section is populated with user credential data required to test the Login screen features
|
12
|
+
User_creds:
|
13
|
+
valid_data:
|
14
|
+
username: 'bob@example.com'
|
15
|
+
password: '10203040'
|
16
|
+
invalid_user:
|
17
|
+
username: 'iggy.snicklefritz@example.com'
|
18
|
+
password: '10203040'
|
19
|
+
locked_account:
|
20
|
+
username: 'alice@example.com'
|
21
|
+
password: '10203040'
|
22
|
+
no_username:
|
23
|
+
password: '10203040'
|
24
|
+
no_password:
|
25
|
+
username: 'bob@example.com'
|
26
|
+
|
27
|
+
# This section is populated with Product data required for testing the Shopping features
|
28
|
+
Products:
|
29
|
+
1:
|
30
|
+
id: 1
|
31
|
+
name: 'Sauce Labs Backpack'
|
32
|
+
description: 'carry.allTheThings() with the sleek, streamlined Sly Pack that melds uncompromising style with unequaled laptop and tablet protection.'
|
33
|
+
price: '$29.99'
|
34
|
+
review: 4
|
35
|
+
colors: ['BLACK', 'BLUE', 'GRAY', 'RED']
|
36
|
+
defaultColor: 'BLACK'
|
37
|
+
2:
|
38
|
+
id: 2
|
39
|
+
name: 'Sauce Labs Bike Light'
|
40
|
+
description: "A red light isn't the desired state in testing but it sure helps when riding your bike at night. Water-resistant with 3 lighting modes, 1 AAA battery included."
|
41
|
+
price: '$9.99'
|
42
|
+
review: 4
|
43
|
+
colors: ['BLACK']
|
44
|
+
defaultColor: 'BLACK'
|
45
|
+
3:
|
46
|
+
id: 3
|
47
|
+
name: 'Sauce Labs Bolt T-Shirt'
|
48
|
+
description: 'Get your testing superhero on with the Sauce Labs bolt T-shirt. From American Apparel, 100% ringspun combed cotton, heather gray with red bolt.'
|
49
|
+
price: '$15.99'
|
50
|
+
review: 4
|
51
|
+
colors: ['BLACK']
|
52
|
+
defaultColor: 'BLACK'
|
53
|
+
4:
|
54
|
+
id: 4
|
55
|
+
name: 'Sauce Labs Fleece Jacket'
|
56
|
+
description: "It's not every day that you come across a midweight quarter-zip fleece jacket capable of handling everything from a relaxing day outdoors to a busy day at the office."
|
57
|
+
price: '$49.99'
|
58
|
+
review: 4
|
59
|
+
colors: ['GRAY']
|
60
|
+
defaultColor: 'GRAY'
|
61
|
+
5:
|
62
|
+
id: 5
|
63
|
+
name: 'Sauce Labs Onesie'
|
64
|
+
description: "Rib snap infant onesie for the junior automation engineer in development. Reinforced 3-snap bottom closure, two-needle hemmed sleeved and bottom won't unravel."
|
65
|
+
price: '$7.99'
|
66
|
+
review: 4
|
67
|
+
colors: ['BLACK', 'GRAY', 'RED']
|
68
|
+
defaultColor: 'RED'
|
69
|
+
6:
|
70
|
+
id: 6
|
71
|
+
name: 'Test.allTheThings() T-Shirt'
|
72
|
+
description: 'This classic Sauce Labs t-shirt is perfect to wear when cozying up to your keyboard to automate a few tests. Super-soft and comfy ringspun combed cotton.'
|
73
|
+
price: '$15.99'
|
74
|
+
review: 4
|
75
|
+
colors: ['BLACK', 'GRAY', 'RED']
|
76
|
+
defaultColor: 'RED'
|
data/features/deep_links.feature
CHANGED
@@ -24,3 +24,15 @@ Feature: App screen deep links
|
|
24
24
|
|Products |Checkout - Address |
|
25
25
|
|Products |Checkout - Payment |
|
26
26
|
|About |Products |
|
27
|
+
|
28
|
+
|
29
|
+
Scenario Outline: Verify Product Item screen can be directly accessed via deep links
|
30
|
+
Given I am on the Products screen
|
31
|
+
And I access the data for product id <product_id>
|
32
|
+
When I load the Product Item screen
|
33
|
+
Then I expect the Product Item screen to be correctly displayed
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
|product_id |
|
37
|
+
|1 |
|
38
|
+
|5 |
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class ProductItemScreen < BaseAppScreen
|
2
|
+
trait(:page_name) { 'Product Item' }
|
3
|
+
trait(:page_locator) { { accessibility_id: 'product screen' } }
|
4
|
+
trait(:page_url) { "product-details/#{ProductData.current.id.to_s}" }
|
5
|
+
|
6
|
+
# Product Item screen UI elements
|
7
|
+
labels price_value: { accessibility_id: 'product price' },
|
8
|
+
description_value: { accessibility_id: 'product description' },
|
9
|
+
quantity_value: { accessibility_id: 'counter amount' },
|
10
|
+
highlights_label: { xpath: '//android.view.ViewGroup/android.widget.TextView[2]' }
|
11
|
+
image :product_image, { xpath: '//android.view.ViewGroup/android.widget.ImageView' }
|
12
|
+
buttons add_to_cart_button: { accessibility_id: 'Add To Cart button' },
|
13
|
+
minus_qty_button: { accessibility_id: 'counter minus button' },
|
14
|
+
plus_qty_button: { accessibility_id: 'counter plus button' },
|
15
|
+
black_color_button: { accessibility_id: 'black circle' },
|
16
|
+
blue_color_button: { accessibility_id: 'blue circle' },
|
17
|
+
gray_color_button: { accessibility_id: 'gray circle' },
|
18
|
+
red_color_button: { accessibility_id: 'red circle' }
|
19
|
+
|
20
|
+
def verify_page_ui
|
21
|
+
super
|
22
|
+
ui = {
|
23
|
+
header_label => { visible: true, caption: ProductData.current.name },
|
24
|
+
price_value => { visible: true, caption: ProductData.current.price },
|
25
|
+
highlights_label => { visible: true, caption: 'Product Highlights' },
|
26
|
+
description_value => { visible: true, caption: ProductData.current.description },
|
27
|
+
product_image => { visible: true, enabled: true },
|
28
|
+
black_color_button => { visible: ProductData.current.colors.include?('BLACK') },
|
29
|
+
blue_color_button => { visible: ProductData.current.colors.include?('BLUE') },
|
30
|
+
gray_color_button => { visible: ProductData.current.colors.include?('GRAY') },
|
31
|
+
red_color_button => { visible: ProductData.current.colors.include?('RED') },
|
32
|
+
minus_qty_button => { visible: true, enabled: true },
|
33
|
+
quantity_value => { visible: true, enabled: true, caption: '1' },
|
34
|
+
plus_qty_button => { visible: true, enabled: true },
|
35
|
+
add_to_cart_button => { visible: true, enabled: true, caption: 'Add To Cart' }
|
36
|
+
}
|
37
|
+
verify_ui_states(ui)
|
38
|
+
end
|
39
|
+
end
|
@@ -3,10 +3,24 @@ class ProductsScreen < BaseAppScreen
|
|
3
3
|
trait(:page_locator) { { accessibility_id: 'products screen' } }
|
4
4
|
trait(:page_url) { 'store-overview' }
|
5
5
|
|
6
|
+
# Products screen UI elements
|
7
|
+
list :product_list, { xpath: '//android.widget.ScrollView' }
|
8
|
+
section :product_list_item, ProductListItem
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super
|
12
|
+
# define the list item element for the Product list object
|
13
|
+
list_elements = { list_item: { xpath: '//android.view.ViewGroup[@content-desc="store item"]' } }
|
14
|
+
product_list.define_list_elements(list_elements)
|
15
|
+
# associate the Product List Item indexed section object with the Product list object
|
16
|
+
product_list_item.set_list_index(product_list)
|
17
|
+
end
|
18
|
+
|
6
19
|
def verify_page_ui
|
7
20
|
super
|
8
21
|
ui = {
|
9
|
-
header_label => { visible: true, caption: 'Products' }
|
22
|
+
header_label => { visible: true, caption: 'Products' },
|
23
|
+
product_list => { visible: true, itemcount: 6 }
|
10
24
|
}
|
11
25
|
verify_ui_states(ui)
|
12
26
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class ProductListItem < TestCentricity::ScreenSection
|
2
|
+
trait(:section_name) { 'Product List Item' }
|
3
|
+
trait(:section_locator) { { xpath: '//android.view.ViewGroup[@content-desc="store item"]' } }
|
4
|
+
|
5
|
+
# Product Cell Item UI elements
|
6
|
+
labels product_name: { xpath: '//android.widget.TextView[@content-desc="store item text"]' },
|
7
|
+
product_price: { xpath: '//android.widget.TextView[@content-desc="store item price"]' }
|
8
|
+
buttons review_star_1: { xpath: '//android.view.ViewGroup[@content-desc="review star 1"]' },
|
9
|
+
review_star_2: { xpath: '//android.view.ViewGroup[@content-desc="review star 2"]' },
|
10
|
+
review_star_3: { xpath: '//android.view.ViewGroup[@content-desc="review star 3"]' },
|
11
|
+
review_star_4: { xpath: '//android.view.ViewGroup[@content-desc="review star 4"]' },
|
12
|
+
review_star_5: { xpath: '//android.view.ViewGroup[@content-desc="review star 5"]' }
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ProductDataSource < TestCentricity::DataSource
|
2
|
+
def find_product(product_id)
|
3
|
+
ProductData.current = ProductData.new(environs.read('Products', product_id.to_i))
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
class ProductData < TestCentricity::DataPresenter
|
9
|
+
attribute :id, Integer
|
10
|
+
attribute :name, String
|
11
|
+
attribute :description, String
|
12
|
+
attribute :price, String
|
13
|
+
attribute :review, Integer
|
14
|
+
attribute :colors, Array
|
15
|
+
attribute :default_color, String
|
16
|
+
|
17
|
+
def initialize(data)
|
18
|
+
@id = data[:id]
|
19
|
+
@name = data[:name]
|
20
|
+
@description = data[:description]
|
21
|
+
@price = data[:price]
|
22
|
+
@review = data[:review]
|
23
|
+
@colors = data[:colors]
|
24
|
+
@default_color = data[:defaultColor]
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class ProductItemScreen < BaseAppScreen
|
2
|
+
trait(:page_name) { 'Product Item' }
|
3
|
+
trait(:page_locator) { { accessibility_id: 'product screen' } }
|
4
|
+
trait(:page_url) { "product-details/#{ProductData.current.id.to_s}" }
|
5
|
+
|
6
|
+
# Product Item screen UI elements
|
7
|
+
labels price_value: { accessibility_id: 'product price' },
|
8
|
+
description_value: { accessibility_id: 'product description' },
|
9
|
+
quantity_value: { accessibility_id: 'counter amount' },
|
10
|
+
highlights_label: { accessibility_id: 'Product Highlights' }
|
11
|
+
image :product_image, { xpath: '//XCUIElementTypeImage' }
|
12
|
+
buttons add_to_cart_button: { accessibility_id: 'Add To Cart button' },
|
13
|
+
minus_qty_button: { accessibility_id: 'counter minus button' },
|
14
|
+
plus_qty_button: { accessibility_id: 'counter plus button' },
|
15
|
+
black_color_button: { accessibility_id: 'black circle' },
|
16
|
+
blue_color_button: { accessibility_id: 'blue circle' },
|
17
|
+
gray_color_button: { accessibility_id: 'gray circle' },
|
18
|
+
red_color_button: { accessibility_id: 'red circle' }
|
19
|
+
|
20
|
+
def verify_page_ui
|
21
|
+
super
|
22
|
+
ui = {
|
23
|
+
header_label => { visible: true, caption: ProductData.current.name },
|
24
|
+
price_value => { visible: true, caption: ProductData.current.price },
|
25
|
+
highlights_label => { visible: true, caption: 'Product Highlights' },
|
26
|
+
description_value => { visible: true, caption: ProductData.current.description },
|
27
|
+
product_image => { visible: true, enabled: true },
|
28
|
+
black_color_button => { visible: ProductData.current.colors.include?('BLACK') },
|
29
|
+
blue_color_button => { visible: ProductData.current.colors.include?('BLUE') },
|
30
|
+
gray_color_button => { visible: ProductData.current.colors.include?('GRAY') },
|
31
|
+
red_color_button => { visible: ProductData.current.colors.include?('RED') },
|
32
|
+
minus_qty_button => { visible: true, enabled: true },
|
33
|
+
quantity_value => { visible: true, enabled: true, caption: '1' },
|
34
|
+
plus_qty_button => { visible: true, enabled: true },
|
35
|
+
add_to_cart_button => { visible: true, enabled: true, caption: 'Add To Cart' }
|
36
|
+
}
|
37
|
+
verify_ui_states(ui)
|
38
|
+
end
|
39
|
+
end
|
@@ -3,10 +3,24 @@ class ProductsScreen < BaseAppScreen
|
|
3
3
|
trait(:page_locator) { { accessibility_id: 'products screen' } }
|
4
4
|
trait(:page_url) { 'store-overview' }
|
5
5
|
|
6
|
+
# Products screen UI elements
|
7
|
+
list :product_list, { xpath: '//XCUIElementTypeScrollView/XCUIElementTypeOther[1]' }
|
8
|
+
section :product_list_item, ProductListItem
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super
|
12
|
+
# define the list item element for the Product list object
|
13
|
+
list_elements = { list_item: { xpath: '//XCUIElementTypeOther[@name="store item"]' } }
|
14
|
+
product_list.define_list_elements(list_elements)
|
15
|
+
# associate the Product List Item indexed section object with the Product list object
|
16
|
+
product_list_item.set_list_index(product_list)
|
17
|
+
end
|
18
|
+
|
6
19
|
def verify_page_ui
|
7
20
|
super
|
8
21
|
ui = {
|
9
|
-
header_label => { visible: true, caption: 'Products' }
|
22
|
+
header_label => { visible: true, caption: 'Products' },
|
23
|
+
# product_list => { visible: true, itemcount: 6 }
|
10
24
|
}
|
11
25
|
verify_ui_states(ui)
|
12
26
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class ProductListItem < TestCentricity::ScreenSection
|
2
|
+
trait(:section_name) { 'Product List Item' }
|
3
|
+
trait(:section_locator) { { xpath: '//XCUIElementTypeOther[@name="store item"]' } }
|
4
|
+
|
5
|
+
# Product Cell Item UI elements
|
6
|
+
labels product_name: { xpath: '//XCUIElementTypeStaticText[@name="store item text"]' },
|
7
|
+
product_price: { xpath: '//XCUIElementTypeStaticText[@name="store item price"]' }
|
8
|
+
buttons review_star_1: { xpath: '//XCUIElementTypeOther[@name="review star 1"]' },
|
9
|
+
review_star_2: { xpath: '//XCUIElementTypeOther[@name="review star 2"]' },
|
10
|
+
review_star_3: { xpath: '//XCUIElementTypeOther[@name="review star 3"]' },
|
11
|
+
review_star_4: { xpath: '//XCUIElementTypeOther[@name="review star 4"]' },
|
12
|
+
review_star_5: { xpath: '//XCUIElementTypeOther[@name="review star 5"]' }
|
13
|
+
end
|
@@ -4,7 +4,10 @@ module WorldData
|
|
4
4
|
# by the TestCentricity™ DataManager. Data Object class definitions are contained in the features/support/data folder.
|
5
5
|
#
|
6
6
|
def data_objects
|
7
|
-
{
|
7
|
+
{
|
8
|
+
user_data_source: UserDataSource,
|
9
|
+
product_data_source: ProductDataSource
|
10
|
+
}
|
8
11
|
end
|
9
12
|
end
|
10
13
|
|
@@ -15,6 +15,7 @@ module WorldPages
|
|
15
15
|
login_screen: LoginScreen,
|
16
16
|
webview_screen: WebViewScreen,
|
17
17
|
products_screen: ProductsScreen,
|
18
|
+
product_item_screen: ProductItemScreen,
|
18
19
|
checkout_address_screen: CheckoutAddressScreen,
|
19
20
|
checkout_payment_screen: CheckoutPaymentScreen,
|
20
21
|
qr_code_scanner_screen: QRCodeScannerScreen,
|
@@ -174,12 +174,16 @@ module TestCentricity
|
|
174
174
|
# @example
|
175
175
|
# run_button.wait_until_exists(0.5)
|
176
176
|
#
|
177
|
-
def wait_until_exists(seconds = nil)
|
177
|
+
def wait_until_exists(seconds = nil, post_exception = true)
|
178
178
|
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
179
179
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
180
180
|
wait.until { exists? }
|
181
181
|
rescue
|
182
|
-
|
182
|
+
if post_exception
|
183
|
+
raise "Could not find UI #{object_ref_message} after #{timeout} seconds" unless exists?
|
184
|
+
else
|
185
|
+
exists?
|
186
|
+
end
|
183
187
|
end
|
184
188
|
|
185
189
|
# Wait until the object no longer exists, or until the specified wait time has expired. If the wait time is nil, then
|
@@ -189,12 +193,16 @@ module TestCentricity
|
|
189
193
|
# @example
|
190
194
|
# logout_button.wait_until_gone(5)
|
191
195
|
#
|
192
|
-
def wait_until_gone(seconds = nil)
|
196
|
+
def wait_until_gone(seconds = nil, post_exception = true)
|
193
197
|
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
194
198
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
195
199
|
wait.until { !exists? }
|
196
200
|
rescue
|
197
|
-
|
201
|
+
if post_exception
|
202
|
+
raise "UI #{object_ref_message} remained visible after #{timeout} seconds" if exists?
|
203
|
+
else
|
204
|
+
exists?
|
205
|
+
end
|
198
206
|
end
|
199
207
|
|
200
208
|
# Wait until the object is visible, or until the specified wait time has expired. If the wait time is nil, then the
|
@@ -204,12 +212,16 @@ module TestCentricity
|
|
204
212
|
# @example
|
205
213
|
# run_button.wait_until_visible(0.5)
|
206
214
|
#
|
207
|
-
def wait_until_visible(seconds = nil)
|
215
|
+
def wait_until_visible(seconds = nil, post_exception = true)
|
208
216
|
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
209
217
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
210
218
|
wait.until { visible? }
|
211
219
|
rescue
|
212
|
-
|
220
|
+
if post_exception
|
221
|
+
raise "Could not find UI #{object_ref_message} after #{timeout} seconds" unless visible?
|
222
|
+
else
|
223
|
+
visible?
|
224
|
+
end
|
213
225
|
end
|
214
226
|
|
215
227
|
# Wait until the object is hidden, or until the specified wait time has expired. If the wait time is nil, then the
|
@@ -219,12 +231,35 @@ module TestCentricity
|
|
219
231
|
# @example
|
220
232
|
# run_button.wait_until_hidden(10)
|
221
233
|
#
|
222
|
-
def wait_until_hidden(seconds = nil)
|
234
|
+
def wait_until_hidden(seconds = nil, post_exception = true)
|
223
235
|
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
224
236
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
225
237
|
wait.until { hidden? }
|
226
238
|
rescue
|
227
|
-
|
239
|
+
if post_exception
|
240
|
+
raise "UI #{object_ref_message} remained visible after #{timeout} seconds" if visible?
|
241
|
+
else
|
242
|
+
hidden?
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
# Wait until the object is enabled, or until the specified wait time has expired. If the wait time is nil, then the
|
247
|
+
# wait time will be Environ.default_max_wait_time.
|
248
|
+
#
|
249
|
+
# @param seconds [Integer or Float] wait time in seconds
|
250
|
+
# @example
|
251
|
+
# run_button.wait_until_enabled(10)
|
252
|
+
#
|
253
|
+
def wait_until_enabled(seconds = nil, post_exception = true)
|
254
|
+
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
255
|
+
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
256
|
+
wait.until { enabled? }
|
257
|
+
rescue
|
258
|
+
if post_exception
|
259
|
+
raise "UI #{object_ref_message} remained disabled after #{timeout} seconds" unless enabled?
|
260
|
+
else
|
261
|
+
enabled?
|
262
|
+
end
|
228
263
|
end
|
229
264
|
|
230
265
|
# Wait until the object's value equals the specified value, or until the specified wait time has expired. If the wait
|
@@ -237,12 +272,16 @@ module TestCentricity
|
|
237
272
|
# or
|
238
273
|
# total_weight_field.wait_until_value_is({ :greater_than => '250' }, 5)
|
239
274
|
#
|
240
|
-
def wait_until_value_is(value, seconds = nil)
|
275
|
+
def wait_until_value_is(value, seconds = nil, post_exception = true)
|
241
276
|
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
242
277
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
243
278
|
wait.until { compare(value, get_value) }
|
244
279
|
rescue
|
245
|
-
|
280
|
+
if post_exception
|
281
|
+
raise "Value of UI #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
|
282
|
+
else
|
283
|
+
get_value == value
|
284
|
+
end
|
246
285
|
end
|
247
286
|
|
248
287
|
# Wait until the object's value changes to a different value, or until the specified wait time has expired. If the
|
@@ -252,13 +291,17 @@ module TestCentricity
|
|
252
291
|
# @example
|
253
292
|
# basket_grand_total_label.wait_until_value_changes(5)
|
254
293
|
#
|
255
|
-
def wait_until_value_changes(seconds = nil)
|
294
|
+
def wait_until_value_changes(seconds = nil, post_exception = true)
|
256
295
|
value = get_value
|
257
296
|
timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
|
258
297
|
wait = Selenium::WebDriver::Wait.new(timeout: timeout)
|
259
298
|
wait.until { get_value != value }
|
260
299
|
rescue
|
261
|
-
|
300
|
+
if post_exception
|
301
|
+
raise "Value of UI #{object_ref_message} failed to change from '#{value}' after #{timeout} seconds" if get_value == value
|
302
|
+
else
|
303
|
+
get_value == value
|
304
|
+
end
|
262
305
|
end
|
263
306
|
|
264
307
|
def width
|
data/testcentricity.gemspec
CHANGED
@@ -43,6 +43,6 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_runtime_dependency 'appium_lib'
|
44
44
|
spec.add_runtime_dependency 'curb'
|
45
45
|
spec.add_runtime_dependency 'json'
|
46
|
-
spec.add_runtime_dependency 'testcentricity_web', '>= 4.2.
|
46
|
+
spec.add_runtime_dependency 'testcentricity_web', '>= 4.2.4'
|
47
47
|
spec.add_runtime_dependency 'test-unit'
|
48
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testcentricity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
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: 2022-
|
11
|
+
date: 2022-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 4.2.
|
187
|
+
version: 4.2.4
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 4.2.
|
194
|
+
version: 4.2.4
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: test-unit
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,7 +233,6 @@ files:
|
|
233
233
|
- Rakefile
|
234
234
|
- config/cucumber.yml
|
235
235
|
- config/locales/en-US.yml
|
236
|
-
- config/test_data/LOCAL_data.yml
|
237
236
|
- config/test_data/data.yml
|
238
237
|
- features/deep_links.feature
|
239
238
|
- features/login.feature
|
@@ -246,11 +245,14 @@ files:
|
|
246
245
|
- features/support/android/screens/checkout_payment_screen.rb
|
247
246
|
- features/support/android/screens/geo_location_screen.rb
|
248
247
|
- features/support/android/screens/login_screen.rb
|
248
|
+
- features/support/android/screens/product_item_screen.rb
|
249
249
|
- features/support/android/screens/products_screen.rb
|
250
250
|
- features/support/android/screens/qr_code_scanner_screen.rb
|
251
251
|
- features/support/android/screens/saucebot_screen.rb
|
252
252
|
- features/support/android/screens/webview_screen.rb
|
253
|
+
- features/support/android/sections/list_items/product_list_item.rb
|
253
254
|
- features/support/android/sections/nav_widgets/nav_menu.rb
|
255
|
+
- features/support/data/product_data.rb
|
254
256
|
- features/support/data/user_data.rb
|
255
257
|
- features/support/env.rb
|
256
258
|
- features/support/hooks.rb
|
@@ -261,11 +263,12 @@ files:
|
|
261
263
|
- features/support/ios/screens/checkout_payment_screen.rb
|
262
264
|
- features/support/ios/screens/geo_location_screen.rb
|
263
265
|
- features/support/ios/screens/login_screen.rb
|
266
|
+
- features/support/ios/screens/product_item_screen.rb
|
264
267
|
- features/support/ios/screens/products_screen.rb
|
265
268
|
- features/support/ios/screens/qr_code_scanner_screen.rb
|
266
269
|
- features/support/ios/screens/saucebot_screen.rb
|
267
270
|
- features/support/ios/screens/webview_screen.rb
|
268
|
-
- features/support/ios/sections/list_items/
|
271
|
+
- features/support/ios/sections/list_items/product_list_item.rb
|
269
272
|
- features/support/ios/sections/nav_widgets/nav_bar.rb
|
270
273
|
- features/support/ios/sections/nav_widgets/nav_menu.rb
|
271
274
|
- features/support/shared_components/screens/base_app_screen.rb
|
@@ -355,11 +358,14 @@ test_files:
|
|
355
358
|
- features/support/android/screens/checkout_payment_screen.rb
|
356
359
|
- features/support/android/screens/geo_location_screen.rb
|
357
360
|
- features/support/android/screens/login_screen.rb
|
361
|
+
- features/support/android/screens/product_item_screen.rb
|
358
362
|
- features/support/android/screens/products_screen.rb
|
359
363
|
- features/support/android/screens/qr_code_scanner_screen.rb
|
360
364
|
- features/support/android/screens/saucebot_screen.rb
|
361
365
|
- features/support/android/screens/webview_screen.rb
|
366
|
+
- features/support/android/sections/list_items/product_list_item.rb
|
362
367
|
- features/support/android/sections/nav_widgets/nav_menu.rb
|
368
|
+
- features/support/data/product_data.rb
|
363
369
|
- features/support/data/user_data.rb
|
364
370
|
- features/support/env.rb
|
365
371
|
- features/support/hooks.rb
|
@@ -370,11 +376,12 @@ test_files:
|
|
370
376
|
- features/support/ios/screens/checkout_payment_screen.rb
|
371
377
|
- features/support/ios/screens/geo_location_screen.rb
|
372
378
|
- features/support/ios/screens/login_screen.rb
|
379
|
+
- features/support/ios/screens/product_item_screen.rb
|
373
380
|
- features/support/ios/screens/products_screen.rb
|
374
381
|
- features/support/ios/screens/qr_code_scanner_screen.rb
|
375
382
|
- features/support/ios/screens/saucebot_screen.rb
|
376
383
|
- features/support/ios/screens/webview_screen.rb
|
377
|
-
- features/support/ios/sections/list_items/
|
384
|
+
- features/support/ios/sections/list_items/product_list_item.rb
|
378
385
|
- features/support/ios/sections/nav_widgets/nav_bar.rb
|
379
386
|
- features/support/ios/sections/nav_widgets/nav_menu.rb
|
380
387
|
- features/support/shared_components/screens/base_app_screen.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
User_creds:
|
3
|
-
valid_data:
|
4
|
-
username: 'bob@example.com'
|
5
|
-
password: '10203040'
|
6
|
-
invalid_user:
|
7
|
-
username: 'iggy.snicklefritz@example.com'
|
8
|
-
password: '10203040'
|
9
|
-
locked_account:
|
10
|
-
username: 'alice@example.com'
|
11
|
-
password: '10203040'
|
12
|
-
no_username:
|
13
|
-
password: '10203040'
|
14
|
-
no_password:
|
15
|
-
username: 'bob@example.com'
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class ProductCellItem < TestCentricity::ScreenSection
|
2
|
-
trait(:section_name) { 'Product Cell Item' }
|
3
|
-
trait(:section_locator) { { xpath: "//XCUIElementTypeOther[@name='store item']" } }
|
4
|
-
|
5
|
-
# Product Cell Item UI elements
|
6
|
-
labels product_name: { xpath: '(//XCUIElementTypeOther)[1]' },
|
7
|
-
product_price: { xpath: "//XCUIElementTypeStaticText[@name='store item price']" }
|
8
|
-
buttons review_star_1: { xpath: "//XCUIElementTypeOther[@name='review star 1']" },
|
9
|
-
review_star_2: { xpath: "//XCUIElementTypeOther[@name='review star 2']" },
|
10
|
-
review_star_3: { xpath: "//XCUIElementTypeOther[@name='review star 3']" },
|
11
|
-
review_star_4: { xpath: "//XCUIElementTypeOther[@name='review star 4']" },
|
12
|
-
review_star_5: { xpath: "//XCUIElementTypeOther[@name='review star 5']" }
|
13
|
-
end
|