testcentricity_web 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab40b67743553e06540746f3cc20b3dbef79aaf8f70f1be584dd54150a252e71
4
- data.tar.gz: 638bb4707bb184a59fa6bf5645f8107891e569e8eb7f218ac92ef1259c21b9ec
3
+ metadata.gz: 8fdb6f0dda3633c2c5419bf6477bb60131814db02ece30fba81ca20dc0738a26
4
+ data.tar.gz: 7503ad522b8bcaa9e1befd791ca3d7ef6ca13728963e0a8a1d4ef11b93973c02
5
5
  SHA512:
6
- metadata.gz: 8de993273139d817ea101761ae99fbf5eb3a3737d57b7d3e537e9885dff49dcb842bef51448b88c72993768bb4e4f59f24299ed2ebd104a552d89ecd4f6bc9d7
7
- data.tar.gz: 891917e94e04880a609a32c7a53adc5bfb125a1dd4c570fdf712d4164948b3e3748c0131ed5fc56b95ab6096c0570c0144a5eba974c926b0a7a860a35e1235ae
6
+ metadata.gz: bd7f80d554ff6f37988a9531d3be6a6ca5f9db61c77ba6acb3c49634cb8b0a87bf9952ccd1eb5dbbebfa56ce511193dcbdd462fc90d4b9ac27352d570f0a0cf7
7
+ data.tar.gz: a7c7249a9042a327208d275be92a42465322984afdba99df2ea3dd9e9755a9a6cb311486bf618d2c3fa5306ce38d42e6d79d4d81c0a71d677879c39749910baa
data/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  # CHANGELOG
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [4.1.0] - 28-FEB-2022
5
+
6
+ ### Added
7
+ * TestCentricity now supports and integrates with Selenium-Webdriver version 4.1.
8
+ * Added support for locally hosted Microsoft Edge desktop web browsers, including in `headless` mode.
9
+ * Added `CheckBox.define_custom_elements` and `Radio.define_custom_elements` methods to support abstracted UI implementations
10
+ where the `input type="checkbox"` or `input type="radio"` object is hidden or obscured by a proxy object, typically a `label`.
11
+ * Added support for `shutdownOtherSimulators` and `forceSimulatorSoftwareKeyboardPresence` capabilities for iOS simulators
12
+ when testing with Mobile Safari browser on iOS Simulators.
13
+
14
+ ### Changed
15
+ * `checkbox` and `radio` methods no longer accept an optional `proxy`. Calling the `checkbox` or `radio` methods with a `proxy`
16
+ parameter will result in a `wrong number of arguments (given 3, expected 2) (ArgumentError)` exception. Use the `define_custom_elements`
17
+ method to specify the locator for an associated `proxy` and/or `label` element. The `define_custom_elements` method can be
18
+ called from an `initialize` method for the `PageObject` or `PageSection` where the `checkbox` or `radio` is instantiated.
19
+ * Ruby version 2.7 or greater required.
20
+
21
+
22
+ ## [4.0.3] - 30-DEC-2021
23
+
24
+ ### Changed
25
+ * Primary test data path has been changed from `features/test_data/` to `config/test_data/`.
26
+
27
+ ### Fixed
28
+ * No longer throws a `NoMethodError: undefined method 'World' for main:Object` error when using RSpec.
29
+
30
+
4
31
  ## [4.0.0] - 18-APR-2021
5
32
 
6
33
  ### Changed
@@ -31,17 +58,20 @@ All notable changes to this project will be documented in this file.
31
58
  * `UIElement.invoke_siebel_popup`
32
59
  * `UIElement.get_siebel_object_type`
33
60
 
61
+
34
62
  ## [3.3.0] - 14-MAR-2021
35
63
 
36
64
  ### Fixed
37
65
  * `WebDriverConnect.initialize_web_driver` method now correctly sets local Chrome browser Download directory when running
38
66
  with headless Chrome.
39
67
 
68
+
40
69
  ## [3.2.25] - 11-MAR-2021
41
70
 
42
71
  ### Added
43
72
  * Added `String.titlecase` method.
44
73
 
74
+
45
75
  ## [3.2.23] - 11-FEB-2021
46
76
 
47
77
  ### Changed
@@ -49,35 +79,41 @@ with headless Chrome.
49
79
  `:translate_downcase`, `:translate_capitalize`, and `:translate_titlecase` conversions to fall back to `:en` default
50
80
  locale if translated strings are missing from the current locale specified in `I18n.locale`.
51
81
 
82
+
52
83
  ## [3.2.22] - 09-FEB-2021
53
84
 
54
85
  ### Fixed
55
86
  * Updated `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods to correctly handle `:translate_upcase`,
56
87
  `:translate_downcase`, `:translate_capitalize`, and `:translate_titlecase` conversions for Arrays of `String`.
57
88
 
89
+
58
90
  ## [3.2.21] - 04-FEB-2021
59
91
 
60
92
  ### Changed
61
93
  * `UIElement.hover_at` method now accepts an optional `visible` parameter to allow hovering over UI elements that are not
62
94
  visible.
63
95
 
96
+
64
97
  ## [3.2.20] - 21-JAN-2021
65
98
 
66
99
  ### Changed
67
100
  * `UIElement.hover` method now accepts an optional `visible` parameter to allow hovering over UI elements that are not
68
101
  visible.
69
102
 
103
+
70
104
  ## [3.2.19] - 05-JAN-2021
71
105
 
72
106
  ### Fixed
73
107
  * `SelectList.choose_option` and `SelectList.get_options` methods now wait up to 5 seconds for list drop menu to appear.
74
108
 
109
+
75
110
  ## [3.2.18] - 12-AUG-2020
76
111
 
77
112
  ### Fixed
78
113
  * Updated `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods to correctly handle `:row`, `:column`,
79
114
  `:cell`, `:item`, and `:attribute` properties.
80
115
 
116
+
81
117
  ## [3.2.17] - 19-JUNE-2020
82
118
 
83
119
  ### Changed
@@ -85,28 +121,33 @@ visible.
85
121
  * Updated `Table.get_row_count`, `Table.get_column_count`, and `Table.get_table_cell_locator` methods to support tables
86
122
  with row headers in row #1.
87
123
 
124
+
88
125
  ## [3.2.16] - 13-MAY-2020
89
126
 
90
127
  ### Changed
91
128
  * `WebDriverConnect.initialize_web_driver` method now sets local Chrome and Firefox browser Download directory to separate
92
129
  folders for each parallel test thread when using `parallel_tests` gem to run tests in concurrent threads.
93
130
 
131
+
94
132
  ## [3.2.15] - 06-APR-2020
95
133
 
96
134
  ### Fixed
97
135
  * `PageObject.populate_data_fields` and `PageSection.populate_data_fields` methods accept `String` or `Boolean` values
98
136
  for checkboxes and radio buttons.
99
137
 
138
+
100
139
  ## [3.2.14] - 06-APR-2020
101
140
 
102
141
  ### Added
103
142
  * Added `UIElement.scroll_to` method.
104
143
 
144
+
105
145
  ## [3.2.13] - 24-MAR-2020
106
146
 
107
147
  ### Added
108
148
  * Added `PageObject.send_keys` method.
109
149
 
150
+
110
151
  ## [3.2.12] - 11-MAR-2020
111
152
 
112
153
  ### Added
@@ -114,26 +155,31 @@ for checkboxes and radio buttons.
114
155
  * Updated `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods to support verification of the
115
156
  `focused` property.
116
157
 
158
+
117
159
  ## [3.2.11] - 10-MAR-2020
118
160
 
119
161
  ### Added
120
162
  * Added `PageSection.verify_focus_order` method.
121
163
 
164
+
122
165
  ## [3.2.10] - 09-MAR-2020
123
166
 
124
167
  ### Added
125
168
  * Added `PageObject.verify_focus_order` method.
126
169
 
170
+
127
171
  ## [3.2.9] - 12-FEB-2020
128
172
 
129
173
  ### Fixed
130
174
  * Fixed `UIElement.wait_until_value_is`, `List.wait_until_item_count_is`, and `Table.wait_until_row_count_is`' methods.
131
175
 
176
+
132
177
  ## [3.2.8] - 08-FEB-2020
133
178
 
134
179
  ### Fixed
135
180
  * Fixed `UIElement.visible?` method that was broken in release 3.2.7.
136
181
 
182
+
137
183
  ## [3.2.7] - 05-FEB-2020
138
184
 
139
185
  ### Added
@@ -143,11 +189,13 @@ for checkboxes and radio buttons.
143
189
  * Updated `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods to support verification of the
144
190
  `crossorigin`, `preload`, and `poster` properties.
145
191
 
192
+
146
193
  ## [3.2.6] - 31-JAN-2020
147
194
 
148
195
  ### Changed
149
196
  * `Audio.volume` and `Video.volume` methods now return a `Float`.
150
197
 
198
+
151
199
  ## [3.2.5] - 25-JAN-2020
152
200
 
153
201
  ### Added
@@ -158,11 +206,13 @@ for checkboxes and radio buttons.
158
206
  ### Fixed
159
207
  * Fixed `UIElement.aria_multiselectable?` method.
160
208
 
209
+
161
210
  ## [3.2.4] - 16-JAN-2020
162
211
 
163
212
  ### Added
164
213
  * Added `Range` type `UIElement` to support interaction with and verification of HTML5 Input Range Slider Objects.
165
214
 
215
+
166
216
  ## [3.2.3] - 29-DEC-2019
167
217
 
168
218
  ### Added
@@ -195,6 +245,7 @@ properties:
195
245
  * `aria_multiselectable`
196
246
  * `aria_controls`
197
247
 
248
+
198
249
  ## [3.2.2] - 16-OCT-2019
199
250
 
200
251
  ### Added
@@ -204,6 +255,7 @@ properties:
204
255
  * Updated `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods to support verification of `indeterminate` property.
205
256
  * Updated device profiles for iPad Pro 12.9" 3rd Generation (iOS 13.1) with Mobile Safari browser.
206
257
 
258
+
207
259
  ## [3.2.1] - 03-OCT-2019
208
260
 
209
261
  ### Changed
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2021, Tony Mrozinski
1
+ Copyright (c) 2014-2022, Tony Mrozinski
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -4,14 +4,14 @@
4
4
 
5
5
 
6
6
  The TestCentricity™ Web core generic framework for desktop and mobile web browser-based app testing implements a Page Object and Data
7
- Object Model DSL for use with Cucumber, Capybara (version 3.x), and Selenium-Webdriver (version 3.x).
7
+ Object Model DSL for use with Cucumber, Capybara (version 3.x), and Selenium-Webdriver (version 4.1).
8
8
 
9
9
  **An example project that demonstrates the implementation of a page object model framework using Cucumber and TestCentricity™ can be found [here](https://github.com/TestCentricity/tc_web_sample).**
10
10
 
11
11
  The TestCentricity™ Web gem supports running automated tests against the following web test targets:
12
- * locally hosted desktop browsers (Firefox, Chrome, Safari, or IE)
12
+ * locally hosted desktop browsers (Firefox, Chrome, Edge, Safari, or IE)
13
13
  * locally hosted emulated iOS Mobile Safari, Android, Windows Phone, or Blackberry mobile browsers (running within a local instance of Chrome)
14
- * locally hosted "headless" Chrome or Firefox browsers
14
+ * locally hosted "headless" Chrome, Firefox, or Edge browsers
15
15
  * desktop and emulated mobile web browsers hosted on Selenium Grid and Dockerized Selenium Grid environments
16
16
  * mobile Safari browsers on iOS device simulators or physical iOS devices (using Appium and XCode on OS X)
17
17
  * mobile Chrome or Android browsers on Android Studio virtual device emulators (using Appium and Android Studio on OS X)
@@ -727,11 +727,11 @@ To use these **PageManager** methods, include the step definitions and code belo
727
727
 
728
728
  ## Connecting to a Web Browser
729
729
 
730
- The `TestCentricity::WebDriverConnect.initialize_web_driver` method configures the appropriate Selenium-Webdriver capabilities required to establish a
731
- connection with a target web browser, and sets the base host URL of the web site you are running your tests against.
730
+ The `TestCentricity::WebDriverConnect.initialize_web_driver` method configures the appropriate Selenium-Webdriver capabilities required to
731
+ establish a connection with a target web browser, and sets the base host URL of the web site you are running your tests against.
732
732
 
733
- The `TestCentricity::WebDriverConnect.initialize_web_driver` method accepts a single optional parameter - the base host URL. Cucumber **Environment
734
- Variables** are used to specify the target local or remote web browser, and the various webdriver capability parameters required to configure
733
+ The `TestCentricity::WebDriverConnect.initialize_web_driver` method accepts a single optional parameter - the base host URL. Cucumber
734
+ **Environment Variables** are used to specify the target local or remote web browser, and the various webdriver capability parameters required to configure
735
735
  the connection.
736
736
 
737
737
 
@@ -746,6 +746,8 @@ values from the table below:
746
746
  `chrome_headless` | OS X or Windows (headless - no visible UI)
747
747
  `firefox` | OS X or Windows (Firefox version 55 or greater only)
748
748
  `firefox_headless` | OS X or Windows (headless - no visible UI)
749
+ `edge` | OS X or Windows
750
+ `edge_headless` | OS X or Windows (headless - no visible UI)
749
751
  `safari` | OS X only
750
752
  `ie` | Windows only (IE version 10.x or greater only)
751
753
 
@@ -768,11 +770,11 @@ a `/downloads` folder at the same level as the `/config` and `/features` folders
768
770
 
769
771
  my_automation_project
770
772
  ├── config
773
+ │ └── test_data
771
774
  ├── downloads
772
775
  ├── features
773
776
  │ ├── step_definitions
774
- ├── support
775
- │ └── test_data
777
+ └── support
776
778
  ├── Gemfile
777
779
  └── README.md
778
780
 
@@ -783,6 +785,7 @@ test thread. This is to ensure that files downloaded in each test thread are iso
783
785
 
784
786
  my_automation_project
785
787
  ├── config
788
+ │ └── test_data
786
789
  ├── downloads
787
790
  │ ├── 1
788
791
  │ ├── 2
@@ -790,8 +793,7 @@ test thread. This is to ensure that files downloaded in each test thread are iso
790
793
  │ └── 4
791
794
  ├── features
792
795
  │ ├── step_definitions
793
- ├── support
794
- │ └── test_data
796
+ └── support
795
797
  ├── Gemfile
796
798
  └── README.md
797
799
 
@@ -882,12 +884,12 @@ of the Chrome desktop browser. The user specified device profiles must be locate
882
884
  │ │ └── devices
883
885
  │ │ └── devices.yml
884
886
  │ ├── locales
887
+ │ ├── test_data
885
888
  │ └── cucumber.yml
886
889
  ├── downloads
887
890
  ├── features
888
891
  │ ├── step_definitions
889
- ├── support
890
- │ └── test_data
892
+ └── support
891
893
  ├── Gemfile
892
894
  └── README.md
893
895
 
@@ -947,6 +949,8 @@ Once your test environment is properly configured, the following **Environment V
947
949
  `LANGUAGE` | [Optional] Language to set for the simulator. e.g. `fr`
948
950
  `ORIENTATION` | [Optional] Set to `portrait` or `landscape` (only for iOS simulators)
949
951
  `NEW_COMMAND_TIMEOUT` | [Optional] Time (in Seconds) that Appium will wait for a new command from the client
952
+ `SHOW_SIM_KEYBOARD` | [Optional] Show the simulator keyboard during text entry. Set to `true` or `false`
953
+ `SHUTDOWN_OTHER_SIMS`| [Optional] Close any other running simulators. Set to `true` or `false`
950
954
 
951
955
 
952
956
  ### Mobile Chrome or Android browsers on Android Studio Virtual Device emulators
@@ -989,7 +993,7 @@ Sauce Labs, TestingBot, Gridlastic, or LambdaTest services. If your tests are ru
989
993
  #### Remote desktop browsers on the BrowserStack service
990
994
 
991
995
  For remotely hosted desktop web browsers on the BrowserStack service, the following **Environment Variables** must be set as described in
992
- the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities)
996
+ the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities?tag=selenium-4)
993
997
  for information regarding the specific capabilities.
994
998
 
995
999
  **Environment Variable** | **Description**
@@ -1003,15 +1007,13 @@ for information regarding the specific capabilities.
1003
1007
  `BS_VERSION` | [Optional] Refer to `browser_version` capability in chart. If not specified, latest stable version of browser will be used.
1004
1008
  `TUNNELING` | Must be `true` if you are testing against internal/local servers (`true` or `false`). If `true`, the BrowserStack Local instance will be automatically started.
1005
1009
  `RESOLUTION` | [Optional] Refer to supported screen `resolution` capability in chart
1006
- `BROWSER_SIZE` | [Optional] Specify width, height of browser window
1007
1010
  `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
1008
1011
  `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart
1009
1012
  `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code.
1010
- `SELENIUM_VERSION` | [Optional] Specify Selenium WebDriver version to use
1011
- `CONSOLE_LOGS` | [Optional] Used to capture browser console logs. Refer to `browserstack.console` capability in chart
1012
- `WD_VERSION` | [Optional] Specify browser-specific WebDriver version to use. Refer to `browserstack.geckodriver`, `browserstack.ie.driver`, and `browserstack.safari.driver` capabilities in chart
1013
1013
  `ALLOW_POPUPS` | [Optional] Allow popups (`true` or `false`) - for Safari, IE, and Edge browsers only
1014
1014
  `ALLOW_COOKIES` | [Optional] Allow all cookies (`true` or `false`) - for Safari browsers only
1015
+ `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`)
1016
+ `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`)
1015
1017
 
1016
1018
  If the BrowserStack Local instance is running (`TUNNELING` Environment Variable is `true`), call the`TestCentricity::WebDriverConnect.close_tunnel` method
1017
1019
  upon completion of your test suite to stop the Local instance. Place the code shown below in your `env.rb` or `hooks.rb` file.
@@ -1025,7 +1027,7 @@ upon completion of your test suite to stop the Local instance. Place the code sh
1025
1027
  #### Remote mobile browsers on the BrowserStack service
1026
1028
 
1027
1029
  For remotely hosted mobile web browsers on the BrowserStack service, the following **Environment Variables** must be set as described in
1028
- the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities)
1030
+ the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities?tag=selenium-4)
1029
1031
  for information regarding the specific capabilities.
1030
1032
 
1031
1033
  **Environment Variable** | **Description**
@@ -1034,8 +1036,7 @@ for information regarding the specific capabilities.
1034
1036
  `BS_USERNAME` | Must be set to your BrowserStack account user name
1035
1037
  `BS_AUTHKEY` | Must be set to your BrowserStack account access key
1036
1038
  `BS_OS` | Must be set to `ios` or `android`
1037
- `BS_BROWSER` | Must be set to `iPhone`, `iPad`, or `android`
1038
- `BS_PLATFORM` | Must be set to `MAC` (for iOS) or `ANDROID`
1039
+ `BS_BROWSER` | Must be set to `Safari` (for iOS) or `Chrome` (for Android)
1039
1040
  `BS_DEVICE` | Refer to `device` capability in chart
1040
1041
  `BS_REAL_MOBILE` | Set to `true` if running against a real device
1041
1042
  `DEVICE_TYPE` | Must be set to `phone` or `tablet`
@@ -1044,7 +1045,9 @@ for information regarding the specific capabilities.
1044
1045
  `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
1045
1046
  `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart
1046
1047
  `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code.
1047
- `CONSOLE_LOGS` | [Optional] Used to capture browser console logs. Refer to `browserstack.console` capability in chart
1048
+ `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`)
1049
+ `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`)
1050
+ `APPIUM_LOGS` | [Optional] Generate Appium logs (`true` or `false`)
1048
1051
 
1049
1052
 
1050
1053
 
@@ -1706,7 +1709,7 @@ landscape orientation running on the BrowserStack service:
1706
1709
 
1707
1710
  ## Copyright and License
1708
1711
 
1709
- TestCentricity™ Framework is Copyright (c) 2014-2021, Tony Mrozinski.
1712
+ TestCentricity™ Framework is Copyright (c) 2014-2022, Tony Mrozinski.
1710
1713
  All rights reserved.
1711
1714
 
1712
1715
  Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@ module TestCentricity
26
26
  puts 'Appium Server is starting'
27
27
  end
28
28
  # start new Appium Server
29
- @process = ChildProcess.build(*parameters)
29
+ @process = ChildProcess.build
30
30
  process.start
31
31
  # wait until confirmation that Appium Server is running
32
32
  wait = Selenium::WebDriver::Wait.new(timeout: 30)
@@ -8,7 +8,7 @@ require 'faker'
8
8
 
9
9
  module TestCentricity
10
10
 
11
- PRIMARY_DATA_PATH ||= 'features/test_data/'
11
+ PRIMARY_DATA_PATH ||= 'config/test_data/'
12
12
  PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_PATH}data."
13
13
  XL_PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_FILE}xls"
14
14
  YML_PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_FILE}yml"
@@ -5,6 +5,8 @@ module TestCentricity
5
5
  attr_accessor :environ_specific_data
6
6
 
7
7
  def self.find_environ(environ_name, source_type = :excel)
8
+ raise 'No environment specified' if environ_name.nil?
9
+
8
10
  data = case source_type
9
11
  when :excel
10
12
  ExcelData.read_row_data(XL_PRIMARY_DATA_FILE, 'Environments', environ_name)
@@ -13,11 +15,27 @@ module TestCentricity
13
15
  @generic_data ||= YAML.load_file(YML_PRIMARY_DATA_FILE)
14
16
  # read environment specific test data
15
17
  data_file = "#{PRIMARY_DATA_PATH}#{environ_name}_data.yml"
16
- @environ_specific_data ||= YAML.load_file(data_file)
18
+ @environ_specific_data = if File.exist?(data_file)
19
+ YAML.load_file(data_file)
20
+ else
21
+ {}
22
+ end
17
23
 
18
24
  read('Environments', environ_name)
19
25
  when :json
20
- read_json_node_data('environments.json', environ_name)
26
+ # read generic test data from data.json file
27
+ raw_data = File.read(JSON_PRIMARY_DATA_FILE)
28
+ @generic_data = JSON.parse(raw_data)
29
+ # read environment specific test data
30
+ data_file = "#{PRIMARY_DATA_PATH}#{environ_name}_data.json"
31
+ @environ_specific_data = if File.exist?(data_file)
32
+ raw_data = File.read(data_file)
33
+ JSON.parse(raw_data)
34
+ else
35
+ {}
36
+ end
37
+
38
+ read('Environments', environ_name)
21
39
  end
22
40
  @current = Environ.new(data)
23
41
  Environ.current = @current
@@ -47,6 +65,9 @@ module TestCentricity
47
65
  @session_id = Time.now.strftime('%d%H%M%S%L')
48
66
  @session_time_stamp = Time.now.strftime('%Y%m%d%H%M%S')
49
67
  @test_environment = ENV['TEST_ENVIRONMENT']
68
+ @a11y_standard = ENV['ACCESSIBILITY_STANDARD'] || 'best-practice'
69
+ @locale = ENV['LOCALE'] || 'en'
70
+ @language = ENV['LANGUAGE'] || 'English'
50
71
  @screen_shots = []
51
72
 
52
73
  attr_accessor :test_environment
@@ -111,9 +132,6 @@ module TestCentricity
111
132
  @dns = data['DNS']
112
133
  @db_username = data['DB_USERNAME']
113
134
  @db_password = data['DB_PASSWORD']
114
- @a11y_standard = ENV['ACCESSIBILITY_STANDARD'] || 'best-practice'
115
- @locale = ENV['LOCALE'] || 'en'
116
- @language = ENV['LANGUAGE'] || 'English'
117
135
 
118
136
  super
119
137
  end
@@ -365,13 +383,13 @@ module TestCentricity
365
383
  def self.report_header
366
384
  report_header = "\n<b><u>TEST ENVIRONMENT</u>:</b> #{ENV['TEST_ENVIRONMENT']}\n"\
367
385
  " <b>Browser:</b>\t #{Environ.browser.capitalize}\n"
368
- report_header = "#{report_header} <b>Device:</b>\t\t #{Environ.device_name}\n" if Environ.device_name
386
+ report_header = "#{report_header} <b>Device:</b>\t #{Environ.device_name}\n" if Environ.device_name
369
387
  report_header = "#{report_header} <b>Device OS:</b>\t #{Environ.device_os} #{Environ.device_os_version}\n" if Environ.device_os
370
388
  report_header = "#{report_header} <b>Device type:</b>\t #{Environ.device_type}\n" if Environ.device_type
371
- report_header = "#{report_header} <b>Driver:</b>\t\t #{Environ.driver}\n" if Environ.driver
389
+ report_header = "#{report_header} <b>Driver:</b>\t #{Environ.driver}\n" if Environ.driver
372
390
  report_header = "#{report_header} <b>Grid:</b>\t\t #{Environ.grid}\n" if Environ.grid
373
- report_header = "#{report_header} <b>OS:</b>\t\t\t #{Environ.os}\n" if Environ.os
374
- report_header = "#{report_header} <b>Locale:</b>\t\t #{Environ.locale}\n" if Environ.locale
391
+ report_header = "#{report_header} <b>OS:</b>\t\t #{Environ.os}\n" if Environ.os
392
+ report_header = "#{report_header} <b>Locale:</b>\t #{Environ.locale}\n" if Environ.locale
375
393
  report_header = "#{report_header} <b>Language:</b>\t #{Environ.language}\n" if Environ.language
376
394
  report_header = "#{report_header} <b>Country:</b>\t #{ENV['COUNTRY']}\n" if ENV['COUNTRY']
377
395
  report_header = "#{report_header} <b>WCAG Accessibility Standard:</b>\t #{ENV['ACCESSIBILITY_STANDARD']}\n" if ENV['ACCESSIBILITY_STANDARD']
@@ -116,8 +116,8 @@ module TestCentricity
116
116
  end
117
117
 
118
118
  def self.enqueue_screenshot
119
- timestamp = Time.now.strftime('%Y%m%d%H%M%S')
120
- filename = "Screenshot-#{timestamp}"
119
+ timestamp = Time.now.strftime('%Y%m%d%H%M%S%L')
120
+ filename = "Screenshot-#{timestamp}.png"
121
121
  path = File.join Dir.pwd, 'reports/screenshots/', filename
122
122
  # highlight the active UI element prior to taking a screenshot
123
123
  unless @active_ui_element.nil? || @mru_ui_element == @active_ui_element
@@ -126,14 +126,14 @@ module TestCentricity
126
126
  end
127
127
  # take screenshot
128
128
  if Environ.driver == :appium
129
- AppiumConnect.take_screenshot("#{path}.png")
129
+ AppiumConnect.take_screenshot(path)
130
130
  else
131
- Capybara.save_screenshot "#{path}.png"
131
+ Capybara.save_screenshot path
132
132
  end
133
133
  # unhighlight the active UI element
134
134
  @mru_ui_element.unhighlight unless @mru_ui_element.blank?
135
135
  # add screenshot to queue
136
- puts "Screenshot saved at #{path}.png"
136
+ puts "Screenshot saved at #{path}"
137
137
  screen_shot = {path: path, filename: filename}
138
138
  Environ.save_screen_shot(screen_shot)
139
139
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '4.0.1'
2
+ VERSION = '4.1.0'
3
3
  end
@@ -100,13 +100,12 @@ module TestCentricity
100
100
  #
101
101
  # @param element_name [Symbol] name of checkbox object (as a symbol)
102
102
  # @param locator [String] CSS selector or XPath expression that uniquely identifies object
103
- # @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
104
103
  # @example
105
104
  # checkbox :remember_checkbox, "//input[@id='RememberUser']"
106
- # checkbox :accept_terms_checkbox, 'input#accept_terms_conditions', :accept_terms_label
105
+ # checkbox :accept_terms_checkbox, 'input#accept_terms_conditions'
107
106
  #
108
- def self.checkbox(element_name, locator, proxy = nil)
109
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CheckBox.new("#{element_name}", self, "#{locator}", :page, #{proxy});end))
107
+ def self.checkbox(element_name, locator)
108
+ define_page_element(element_name, TestCentricity::CheckBox, locator)
110
109
  end
111
110
 
112
111
  # Declare and instantiate a collection of checkboxes for this page object.
@@ -126,13 +125,12 @@ module TestCentricity
126
125
  #
127
126
  # @param element_name [Symbol] name of radio object (as a symbol)
128
127
  # @param locator [String] CSS selector or XPath expression that uniquely identifies object
129
- # @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
130
128
  # @example
131
129
  # radio :accept_terms_radio, "//input[@id='Accept_Terms']"
132
- # radio :decline_terms_radio, '#decline_terms_conditions', :decline_terms_label
130
+ # radio :decline_terms_radio, '#decline_terms_conditions'
133
131
  #
134
- def self.radio(element_name, locator, proxy = nil)
135
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Radio.new("#{element_name}", self, "#{locator}", :page, #{proxy});end))
132
+ def self.radio(element_name, locator)
133
+ define_page_element(element_name, TestCentricity::Radio, locator)
136
134
  end
137
135
 
138
136
  # Declare and instantiate a collection of radio buttons for this page object.
@@ -220,13 +220,12 @@ module TestCentricity
220
220
  #
221
221
  # @param element_name [Symbol] name of checkbox object (as a symbol)
222
222
  # @param locator [String] CSS selector or XPath expression that uniquely identifies object
223
- # @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
224
223
  # @example
225
224
  # checkbox :remember_checkbox, "//input[@id='RememberUser']"
226
- # checkbox :accept_terms_checkbox, 'input#accept_terms_conditions', :accept_terms_label
225
+ # checkbox :accept_terms_checkbox, 'input#accept_terms_conditions'
227
226
  #
228
- def self.checkbox(element_name, locator, proxy = nil)
229
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CheckBox.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
227
+ def self.checkbox(element_name, locator)
228
+ define_element(element_name, TestCentricity::CheckBox, locator)
230
229
  end
231
230
 
232
231
  # Declare and instantiate a collection of checkboxes for this page section.
@@ -246,13 +245,12 @@ module TestCentricity
246
245
  #
247
246
  # @param element_name [Symbol] name of radio object (as a symbol)
248
247
  # @param locator [String] CSS selector or XPath expression that uniquely identifies object
249
- # @param proxy [Symbol] Optional name (as a symbol) of proxy object to receive click actions
250
248
  # @example
251
249
  # radio :accept_terms_radio, "//input[@id='Accept_Terms']"
252
- # radio :decline_terms_radio, 'input#decline_terms_conditions', :decline_terms_label
250
+ # radio :decline_terms_radio, 'input#decline_terms_conditions'
253
251
  #
254
252
  def self.radio(element_name, locator, proxy = nil)
255
- class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::Radio.new("#{element_name}", self, "#{locator}", :section, #{proxy});end))
253
+ define_element(element_name, TestCentricity::Radio, locator)
256
254
  end
257
255
 
258
256
  # Declare and instantiate a collection of radio buttons for this page section.