testcentricity_web 3.2.12 → 3.2.17

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: 45255a5e0001ea076f691aed9284b7c1eb4c9857aaa79dcf0845f82290b3bac7
4
- data.tar.gz: 0ebd75ccb27af3be6f4146cf20897fe9be69cb5cdcaf9a0566d1c35c57e68585
3
+ metadata.gz: 967025c22dced2c769d460dbb4d6a20708293277b43887a82158c64f242686e9
4
+ data.tar.gz: 9db450d8190d44e31012c45fdad5236507bee75638f323e2bd42632758354743
5
5
  SHA512:
6
- metadata.gz: 1336183ee836e42e58c0a971ebcd1e4c8eefe2b7cd11b5c7ddebb460426f4f23088d404f66929b5d5fd2255f312dd3c8b54982be45af5367db475a39756924b2
7
- data.tar.gz: 1b352854c16a52970b1e335b1af43412710e9102a69ab70a01a3ebd39d9a6a7f3a3192caa491d063d65ccb7972854188e8672a3803b2da259838e4d3c2f18fce
6
+ metadata.gz: bdceb150bda3a9cfa267e3658a5332a76042deada8d57b58b5862f6b73b1c0e9a49721a7f7f57e99cae851626d67531290463acbd26eb2981193a4e1354bb18e
7
+ data.tar.gz: cc252a2ec353bc83d91dcd97a8d4c30f89b434107bbbde48d91a9937f5befe1ad9264e62409ac744f8372885f7c67d52bf10260a25c0b45927783a2a8bbf351d
@@ -1,6 +1,35 @@
1
1
  # CHANGELOG
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [3.2.17] - 19-JUNE-2020
5
+
6
+ ### Changed
7
+ * Updated `Table.define_table_elements` method to accept value for `:row_header` element.
8
+ * Updated `Table.get_row_count`, `Table.get_column_count`, and `Table.get_table_cell_locator` methods to support tables
9
+ with row headers in row #1.
10
+
11
+ ## [3.2.16] - 13-MAY-2020
12
+
13
+ ### Changed
14
+ * `WebDriverConnect.initialize_web_driver` method now sets local Chrome and Firefox browser Download directory to separate
15
+ folders for each parallel test thread when using `parallel_tests` gem to run tests in concurrent threads.
16
+
17
+ ## [3.2.15] - 06-APR-2020
18
+
19
+ ### Fixed
20
+ * `PageObject.populate_data_fields` and `PageSection.populate_data_fields` methods accept `String` or `Boolean` values
21
+ for checkboxes and radio buttons.
22
+
23
+ ## [3.2.14] - 06-APR-2020
24
+
25
+ ### Added
26
+ * Added `UIElement.scroll_to` method.
27
+
28
+ ## [3.2.13] - 24-MAR-2020
29
+
30
+ ### Added
31
+ * Added `PageObject.send_keys` method.
32
+
4
33
  ## [3.2.12] - 11-MAR-2020
5
34
 
6
35
  ### Added
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testcentricity_web (3.2.12)
4
+ testcentricity_web (3.2.17)
5
5
  appium_lib
6
6
  browserstack-local
7
7
  capybara (>= 3.1, < 4)
@@ -21,11 +21,11 @@ GEM
21
21
  specs:
22
22
  addressable (2.7.0)
23
23
  public_suffix (>= 2.0.2, < 5.0)
24
- appium_lib (10.5.0)
24
+ appium_lib (10.6.0)
25
25
  appium_lib_core (~> 3.3)
26
26
  nokogiri (~> 1.8, >= 1.8.1)
27
27
  tomlrb (~> 1.1)
28
- appium_lib_core (3.5.0)
28
+ appium_lib_core (3.10.0)
29
29
  faye-websocket (~> 0.10.0)
30
30
  selenium-webdriver (~> 3.14, >= 3.14.1)
31
31
  axiom-types (0.1.1)
@@ -33,7 +33,7 @@ GEM
33
33
  ice_nine (~> 0.11.0)
34
34
  thread_safe (~> 0.3, >= 0.3.1)
35
35
  browserstack-local (1.3.0)
36
- capybara (3.31.0)
36
+ capybara (3.32.2)
37
37
  addressable
38
38
  mini_mime (>= 0.1.3)
39
39
  nokogiri (~> 1.8)
@@ -51,51 +51,51 @@ GEM
51
51
  thread_safe (~> 0.3, >= 0.3.1)
52
52
  equalizer (0.0.11)
53
53
  eventmachine (1.2.7)
54
- faker (2.10.2)
54
+ faker (2.12.0)
55
55
  i18n (>= 1.6, < 2)
56
56
  faye-websocket (0.10.9)
57
57
  eventmachine (>= 0.12.0)
58
58
  websocket-driver (>= 0.5.1)
59
- ffi (1.12.2)
60
- i18n (1.8.2)
59
+ ffi (1.13.1)
60
+ i18n (1.8.3)
61
61
  concurrent-ruby (~> 1.0)
62
62
  ice_nine (0.11.2)
63
63
  mini_mime (1.0.2)
64
64
  mini_portile2 (2.4.0)
65
65
  nokogiri (1.10.9)
66
66
  mini_portile2 (~> 2.4.0)
67
- os (1.0.1)
68
- power_assert (1.1.6)
69
- public_suffix (4.0.3)
70
- rack (2.2.2)
67
+ os (1.1.0)
68
+ power_assert (1.2.0)
69
+ public_suffix (4.0.5)
70
+ rack (2.2.3)
71
71
  rack-test (1.1.0)
72
72
  rack (>= 1.0, < 3)
73
73
  rake (13.0.1)
74
74
  redcarpet (3.5.0)
75
- regexp_parser (1.7.0)
75
+ regexp_parser (1.7.1)
76
76
  ruby-ole (1.2.12.2)
77
- rubyzip (2.2.0)
77
+ rubyzip (2.3.0)
78
78
  selenium-webdriver (3.142.7)
79
79
  childprocess (>= 0.5, < 4.0)
80
80
  rubyzip (>= 1.2.2)
81
81
  spreadsheet (1.1.7)
82
82
  ruby-ole (>= 1.0)
83
- test-unit (3.3.5)
83
+ test-unit (3.3.6)
84
84
  power_assert
85
85
  thread_safe (0.3.6)
86
- tomlrb (1.2.9)
86
+ tomlrb (1.3.0)
87
87
  virtus (1.0.5)
88
88
  axiom-types (~> 0.1)
89
89
  coercible (~> 1.0)
90
90
  descendants_tracker (~> 0.0, >= 0.0.3)
91
91
  equalizer (~> 0.0, >= 0.0.9)
92
- webdrivers (4.2.0)
92
+ webdrivers (4.4.1)
93
93
  nokogiri (~> 1.6)
94
94
  rubyzip (>= 1.3.0)
95
95
  selenium-webdriver (>= 3.0, < 4.0)
96
- websocket-driver (0.7.1)
96
+ websocket-driver (0.7.2)
97
97
  websocket-extensions (>= 0.1.0)
98
- websocket-extensions (0.1.4)
98
+ websocket-extensions (0.1.5)
99
99
  xpath (3.2.0)
100
100
  nokogiri (~> 1.8)
101
101
 
data/README.md CHANGED
@@ -776,6 +776,25 @@ a `/downloads` folder at the same level as the `/config` and `/features` folders
776
776
  └── README.md
777
777
 
778
778
 
779
+ When running tests in multiple concurrent threads using the `parallel_tests` gem, a new folder will be created within the `/downloads` folder for each
780
+ test thread. This is to ensure that files downloaded in each test thread are isolated from tests running in other parallel threads. An example of the
781
+ `/downloads` folder structure for 4 parallel threads is depicted below:
782
+
783
+ my_automation_project
784
+ ├── config
785
+ ├── downloads
786
+ │ ├── 1
787
+ │ ├── 2
788
+ │ ├── 3
789
+ │ └── 4
790
+ ├── features
791
+ │ ├── step_definitions
792
+ │ ├── support
793
+ │ └── test_data
794
+ ├── Gemfile
795
+ └── README.md
796
+
797
+
779
798
  When testing file downloads using a local instance of Firefox, you will need to specify the MIME types of the various file types that your tests will
780
799
  be downloading. This is accomplished by setting the `MIME_TYPES` Environment Variable to a comma-delimited string containing the list of MIME types to
781
800
  be accepted. This list is required as it will prevent Firefox from displaying the File Download modal dialog, which will halt your automated tests. An
@@ -42,6 +42,9 @@ module TestCentricity
42
42
  attr_accessor :grid
43
43
  attr_accessor :tunneling
44
44
 
45
+ attr_accessor :parallel
46
+ attr_accessor :process_num
47
+
45
48
  attr_accessor :signed_in
46
49
  attr_accessor :portal_status
47
50
  attr_accessor :portal_context
@@ -94,6 +97,22 @@ module TestCentricity
94
97
  @session_time_stamp
95
98
  end
96
99
 
100
+ def self.parallel=(state)
101
+ @parallel = state
102
+ end
103
+
104
+ def self.parallel
105
+ @parallel
106
+ end
107
+
108
+ def self.process_num=(num)
109
+ @process_num = num
110
+ end
111
+
112
+ def self.process_num
113
+ @process_num
114
+ end
115
+
97
116
  def self.test_environment
98
117
  if @test_environment.blank?
99
118
  nil
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '3.2.12'
2
+ VERSION = '3.2.17'
3
3
  end
@@ -481,6 +481,17 @@ module TestCentricity
481
481
  page.driver.browser.title
482
482
  end
483
483
 
484
+ # Send keystrokes to the focused element on a Page object
485
+ #
486
+ # @param keys [String] keys
487
+ # @example
488
+ # editor_page.send_keys([:control, 'z'])
489
+ #
490
+ def send_keys(*keys)
491
+ focused_obj = page.driver.browser.switch_to.active_element
492
+ focused_obj.send_keys(*keys)
493
+ end
494
+
484
495
  # Wait until the page object exists, or until the specified wait time has expired. If the wait time is nil, then the wait
485
496
  # time will be Capybara.default_max_wait_time.
486
497
  #
@@ -279,7 +279,8 @@ module TestCentricity
279
279
  else
280
280
  case data_field.get_object_type
281
281
  when :checkbox
282
- data_field.set_checkbox_state(data_param.to_bool)
282
+ check_state = data_param.is_a?(String) ? data_param.to_bool : data_param
283
+ data_field.set_checkbox_state(check_state)
283
284
  when :selectlist
284
285
  if data_field.get_siebel_object_type == 'JComboBox'
285
286
  data_field.set("#{data_param}\t")
@@ -287,7 +288,8 @@ module TestCentricity
287
288
  data_field.choose_option(data_param)
288
289
  end
289
290
  when :radio
290
- data_field.set_selected_state(data_param.to_bool)
291
+ check_state = data_param.is_a?(String) ? data_param.to_bool : data_param
292
+ data_field.set_selected_state(check_state)
291
293
  when :textfield
292
294
  data_field.set("#{data_param}\t")
293
295
  if integrity_check && data_field.get_value != data_param
@@ -2,6 +2,7 @@ require 'selenium-webdriver'
2
2
  require 'os'
3
3
  require 'browserstack/local'
4
4
  require 'webdrivers'
5
+ require 'fileutils'
5
6
 
6
7
 
7
8
  module TestCentricity
@@ -16,6 +17,14 @@ module TestCentricity
16
17
  browser = ENV['WEB_BROWSER']
17
18
  # set downloads folder path
18
19
  @downloads_path = "#{Dir.pwd}/downloads"
20
+ if ENV['PARALLEL']
21
+ Environ.parallel = true
22
+ Environ.process_num = ENV['TEST_ENV_NUMBER']
23
+ @downloads_path = "#{@downloads_path}/#{ENV['TEST_ENV_NUMBER']}"
24
+ Dir.mkdir(@downloads_path) unless Dir.exist?(@downloads_path)
25
+ else
26
+ Environ.parallel = false
27
+ end
19
28
  @downloads_path = @downloads_path.tr('/', "\\") if OS.windows?
20
29
 
21
30
  # assume that we're testing within a local desktop web browser
@@ -26,37 +35,37 @@ module TestCentricity
26
35
  Environ.device = :web
27
36
  Environ.device_name = 'browser'
28
37
 
29
- case browser.downcase.to_sym
30
- when :appium
31
- initialize_appium
32
- context = 'mobile device emulator'
33
- when :browserstack
34
- initialize_browserstack
35
- context = 'Browserstack cloud service'
36
- when :crossbrowser
37
- initialize_crossbrowser
38
- context = 'CrossBrowserTesting cloud service'
39
- when :gridlastic
40
- initialize_gridlastic
41
- context = 'Gridlastic cloud service'
42
- when :lambdatest
43
- initialize_lambdatest
44
- context = 'LambdaTest cloud service'
45
- when :saucelabs
46
- initialize_saucelabs
47
- context = 'Sauce Labs cloud service'
48
- when :testingbot
49
- initialize_testingbot
50
- context = 'TestingBot cloud service'
51
- else
52
- if ENV['SELENIUM'] == 'remote'
53
- initialize_remote
54
- context = 'Selenium Grid'
55
- else
56
- initialize_local_browser
57
- context = 'local browser instance'
58
- end
59
- end
38
+ context = case browser.downcase.to_sym
39
+ when :appium
40
+ initialize_appium
41
+ 'mobile device emulator'
42
+ when :browserstack
43
+ initialize_browserstack
44
+ 'Browserstack cloud service'
45
+ when :crossbrowser
46
+ initialize_crossbrowser
47
+ 'CrossBrowserTesting cloud service'
48
+ when :gridlastic
49
+ initialize_gridlastic
50
+ 'Gridlastic cloud service'
51
+ when :lambdatest
52
+ initialize_lambdatest
53
+ 'LambdaTest cloud service'
54
+ when :saucelabs
55
+ initialize_saucelabs
56
+ 'Sauce Labs cloud service'
57
+ when :testingbot
58
+ initialize_testingbot
59
+ 'TestingBot cloud service'
60
+ else
61
+ if ENV['SELENIUM'] == 'remote'
62
+ initialize_remote
63
+ 'Selenium Grid'
64
+ else
65
+ initialize_local_browser
66
+ 'local browser instance'
67
+ end
68
+ end
60
69
 
61
70
  # set browser window size only if testing with a desktop web browser
62
71
  unless Environ.is_device? || Capybara.current_driver == :appium
@@ -169,11 +178,11 @@ module TestCentricity
169
178
  end
170
179
 
171
180
  def self.initialize_local_browser
172
- if OS.osx?
173
- Environ.os = 'OS X'
174
- elsif OS.windows?
175
- Environ.os = 'Windows'
176
- end
181
+ Environ.os = if OS.osx?
182
+ 'OS X'
183
+ elsif OS.windows?
184
+ 'Windows'
185
+ end
177
186
 
178
187
  browser = ENV['WEB_BROWSER'].downcase.to_sym
179
188
 
@@ -7,6 +7,7 @@ module TestCentricity
7
7
  attr_accessor :table_header
8
8
  attr_accessor :header_row
9
9
  attr_accessor :header_column
10
+ attr_accessor :row_header
10
11
  attr_accessor :tree_expand
11
12
  attr_accessor :tree_collapse
12
13
 
@@ -21,7 +22,8 @@ module TestCentricity
21
22
  table_column: 'td',
22
23
  table_header: 'thead',
23
24
  header_row: 'tr',
24
- header_column: 'th'
25
+ header_column: 'th',
26
+ row_header: nil
25
27
  }
26
28
 
27
29
  case @locator_type
@@ -52,6 +54,8 @@ module TestCentricity
52
54
  @header_row = value
53
55
  when :header_column
54
56
  @header_column = value
57
+ when :row_header
58
+ @row_header = value
55
59
  when :tree_expand
56
60
  @tree_expand = value
57
61
  when :tree_collapse
@@ -70,20 +74,18 @@ module TestCentricity
70
74
  #
71
75
  def get_row_count
72
76
  wait_until_exists(5)
73
- case @locator_type
74
- when :xpath
75
- if @table_section.nil?
76
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}", visible: :all).count
77
- else
78
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}", visible: :all).count
79
- end
80
- when :css
81
- if @table_section.nil?
82
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}", visible: :all).count
83
- else
84
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}", visible: :all).count
85
- end
86
- end
77
+ delimiter = case @locator_type
78
+ when :xpath
79
+ "/"
80
+ when :css
81
+ " > "
82
+ end
83
+ path = if @table_section.nil?
84
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_row}"
85
+ else
86
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_section}"
87
+ end
88
+ page.all(@locator_type, path, visible: :all).count
87
89
  end
88
90
 
89
91
  # Wait until the table's row count equals the specified value, or until the specified wait time has expired. If the wait
@@ -138,33 +140,48 @@ module TestCentricity
138
140
  row_count = get_row_count
139
141
  case @locator_type
140
142
  when :xpath
141
- if row_count.zero?
142
- page.all(:xpath, "#{@locator}/#{@table_header}/#{@header_row}/#{@header_column}", visible: :all).count
143
- else
144
- if @table_section.nil?
145
- row_count == 1 ?
146
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}/#{@table_column}", visible: :all).count :
147
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}[2]/#{@table_column}", visible: :all).count
148
- else
149
- row_count == 1 ?
150
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}/#{@table_row}/#{@table_column}", visible: :all).count :
151
- page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}[2]/#{@table_row}/#{@table_column}", visible: :all).count
152
- end
153
- end
143
+ delimiter = "/"
144
+ index = "[2]"
154
145
  when :css
155
- if row_count.zero?
156
- page.all(:css, "#{@locator} > #{@table_header} > #{@header_row} > #{@header_column}", visible: :all).count
157
- else
158
- if @table_section.nil?
159
- row_count == 1 ?
160
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_row} > #{@table_column}", visible: :all).count :
161
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_row}:nth-of-type(2) > #{@table_column}", visible: :all).count
162
- else
163
- row_count == 1 ?
164
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_section} > #{@table_row} > #{@table_column}", visible: :all).count :
165
- page.all(:css, "#{@locator} > #{@table_body} > #{@table_section}:nth-of-type(2) > #{@table_row} > #{@table_column}", visible: :all).count
166
- end
167
- end
146
+ delimiter = " > "
147
+ index = ":nth-of-type(2)"
148
+ end
149
+ path = if row_count.zero?
150
+ "#{@locator}#{delimiter}#{@table_header}#{delimiter}#{@header_row}#{delimiter}#{@header_column}"
151
+ else
152
+ if @table_section.nil?
153
+ if row_count == 1
154
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_row}#{delimiter}#{@table_column}"
155
+ else
156
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_row}#{index}#{delimiter}#{@table_column}"
157
+ end
158
+ else
159
+ if row_count == 1
160
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_section}#{delimiter}#{@table_row}#{delimiter}#{@table_column}"
161
+ else
162
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_section}#{index}#{delimiter}#{@table_row}#{delimiter}#{@table_column}"
163
+ end
164
+ end
165
+ end
166
+ if @row_header.nil?
167
+ page.all(@locator_type, path, visible: :all).count
168
+ else
169
+ cols = page.all(@locator_type, path, visible: :all).count
170
+
171
+ path = if @table_section.nil?
172
+ if row_count == 1
173
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_row}#{delimiter}#{@row_header}"
174
+ else
175
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_row}#{index}#{delimiter}#{@row_header}"
176
+ end
177
+ else
178
+ if row_count == 1
179
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_section}#{delimiter}#{@table_row}#{delimiter}#{@row_header}"
180
+ else
181
+ "#{@locator}#{delimiter}#{@table_body}#{delimiter}#{@table_section}#{index}#{delimiter}#{@table_row}#{delimiter}#{@row_header}"
182
+ end
183
+ end
184
+ cols + page.all(@locator_type, path, visible: :all).count
168
185
  end
169
186
  end
170
187
 
@@ -615,7 +632,15 @@ module TestCentricity
615
632
  row_spec = "#{@locator}/#{@table_body}/#{@table_section}"
616
633
  row_spec = "#{row_spec}[#{row}]/#{@table_row}[1]"
617
634
  end
618
- column_spec = "/#{@table_column}[#{column}]"
635
+ column_spec = if @row_header.nil?
636
+ "/#{@table_column}[#{column}]"
637
+ else
638
+ if column == 1
639
+ "/#{@row_header}"
640
+ else
641
+ "/#{@table_column}[#{column - 1}]"
642
+ end
643
+ end
619
644
  when :css
620
645
  if @table_section.nil?
621
646
  row_spec = "#{@locator} > #{@table_body} > #{@table_row}"
@@ -624,7 +649,16 @@ module TestCentricity
624
649
  row_spec = "#{@locator} > #{@table_body} > #{@table_section}"
625
650
  row_spec = "#{row_spec}:nth-of-type(#{row}) > #{@table_row}:nth-of-type(1)"
626
651
  end
627
- column_spec = " > #{@table_column}:nth-of-type(#{column})"
652
+
653
+ column_spec = if @row_header.nil?
654
+ " > #{@table_column}:nth-of-type(#{column})"
655
+ else
656
+ if column == 1
657
+ " > #{@row_header}"
658
+ else
659
+ " > #{@table_column}:nth-of-type(#{column - 1})"
660
+ end
661
+ end
628
662
  end
629
663
  "#{row_spec}#{column_spec}"
630
664
  end
@@ -158,6 +158,18 @@ module TestCentricity
158
158
  obj.click_at(x, y)
159
159
  end
160
160
 
161
+ # Scroll the object to its top, middle, or bottom
162
+ #
163
+ # @param position [Symbol] :top, :bottom, :center
164
+ # @example
165
+ # cue_list.scroll_to(:bottom)
166
+ #
167
+ def scroll_to(position)
168
+ obj, type = find_element
169
+ object_not_found_exception(obj, type)
170
+ obj.scroll_to(position)
171
+ end
172
+
161
173
  def set(value)
162
174
  obj, type = find_element
163
175
  object_not_found_exception(obj, type)
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.2.12
4
+ version: 3.2.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: 2020-03-11 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler