watir 7.2.0 → 7.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/chrome.yml +1 -1
  3. data/.github/workflows/edge.yml +1 -1
  4. data/.github/workflows/firefox.yml +1 -1
  5. data/.github/workflows/ie.yml +1 -1
  6. data/.github/workflows/safari.yml +1 -1
  7. data/.github/workflows/unit.yml +1 -1
  8. data/.rubocop.yml +25 -12
  9. data/.rubocop_todo.yml +8 -1
  10. data/CHANGES.md +6 -1
  11. data/LICENSE +2 -2
  12. data/lib/watir/capabilities.rb +1 -1
  13. data/lib/watir/locators/anchor/selector_builder.rb +3 -0
  14. data/lib/watir/locators/element/matcher.rb +2 -1
  15. data/lib/watir/locators/element/selector_builder/regexp_disassembler.rb +2 -1
  16. data/lib/watir/locators/text_field/matcher.rb +0 -4
  17. data/lib/watir/version.rb +1 -1
  18. data/spec/locator_spec_helper.rb +0 -8
  19. data/spec/unit/capabilities_spec.rb +553 -561
  20. data/spec/unit/element_locator_spec.rb +89 -78
  21. data/spec/unit/match_elements/button_spec.rb +69 -62
  22. data/spec/unit/match_elements/element_spec.rb +303 -309
  23. data/spec/unit/match_elements/text_field_spec.rb +76 -73
  24. data/spec/unit/selector_builder/anchor_spec.rb +39 -33
  25. data/spec/unit/selector_builder/button_spec.rb +209 -202
  26. data/spec/unit/selector_builder/cell_spec.rb +48 -42
  27. data/spec/unit/selector_builder/element_spec.rb +634 -627
  28. data/spec/unit/selector_builder/row_spec.rb +119 -113
  29. data/spec/unit/selector_builder/text_field_spec.rb +195 -188
  30. data/spec/unit/selector_builder/textarea_spec.rb +22 -14
  31. data/spec/unit/wait_spec.rb +85 -81
  32. data/spec/watirspec/adjacent_spec.rb +249 -247
  33. data/spec/watirspec/after_hooks_spec.rb +161 -159
  34. data/spec/watirspec/alert_spec.rb +61 -58
  35. data/spec/watirspec/browser_spec.rb +409 -409
  36. data/spec/watirspec/capabilities_spec.rb +89 -99
  37. data/spec/watirspec/cookies_spec.rb +120 -118
  38. data/spec/watirspec/drag_and_drop_spec.rb +26 -24
  39. data/spec/watirspec/element_hidden_spec.rb +66 -60
  40. data/spec/watirspec/elements/area_spec.rb +49 -47
  41. data/spec/watirspec/elements/areas_spec.rb +27 -25
  42. data/spec/watirspec/elements/button_spec.rb +253 -251
  43. data/spec/watirspec/elements/buttons_spec.rb +36 -34
  44. data/spec/watirspec/elements/checkbox_spec.rb +48 -36
  45. data/spec/watirspec/elements/checkboxes_spec.rb +29 -27
  46. data/spec/watirspec/elements/collections_spec.rb +126 -119
  47. data/spec/watirspec/elements/date_field_spec.rb +185 -183
  48. data/spec/watirspec/elements/date_fields_spec.rb +29 -27
  49. data/spec/watirspec/elements/date_time_field_spec.rb +197 -195
  50. data/spec/watirspec/elements/date_time_fields_spec.rb +30 -28
  51. data/spec/watirspec/elements/dd_spec.rb +87 -85
  52. data/spec/watirspec/elements/dds_spec.rb +27 -25
  53. data/spec/watirspec/elements/del_spec.rb +106 -104
  54. data/spec/watirspec/elements/dels_spec.rb +26 -24
  55. data/spec/watirspec/elements/div_spec.rb +225 -221
  56. data/spec/watirspec/elements/divs_spec.rb +37 -35
  57. data/spec/watirspec/elements/dl_spec.rb +110 -108
  58. data/spec/watirspec/elements/dls_spec.rb +28 -26
  59. data/spec/watirspec/elements/dt_spec.rb +86 -84
  60. data/spec/watirspec/elements/dts_spec.rb +27 -25
  61. data/spec/watirspec/elements/element_spec.rb +794 -775
  62. data/spec/watirspec/elements/elements_spec.rb +40 -38
  63. data/spec/watirspec/elements/em_spec.rb +62 -60
  64. data/spec/watirspec/elements/ems_spec.rb +28 -26
  65. data/spec/watirspec/elements/filefield_spec.rb +116 -114
  66. data/spec/watirspec/elements/filefields_spec.rb +28 -26
  67. data/spec/watirspec/elements/font_spec.rb +20 -18
  68. data/spec/watirspec/elements/form_spec.rb +51 -49
  69. data/spec/watirspec/elements/forms_spec.rb +29 -27
  70. data/spec/watirspec/elements/frame_spec.rb +89 -87
  71. data/spec/watirspec/elements/frames_spec.rb +27 -25
  72. data/spec/watirspec/elements/hidden_spec.rb +81 -79
  73. data/spec/watirspec/elements/hiddens_spec.rb +28 -26
  74. data/spec/watirspec/elements/hn_spec.rb +59 -57
  75. data/spec/watirspec/elements/hns_spec.rb +26 -24
  76. data/spec/watirspec/elements/iframe_spec.rb +195 -191
  77. data/spec/watirspec/elements/iframes_spec.rb +31 -29
  78. data/spec/watirspec/elements/image_spec.rb +148 -146
  79. data/spec/watirspec/elements/images_spec.rb +26 -24
  80. data/spec/watirspec/elements/input_spec.rb +9 -7
  81. data/spec/watirspec/elements/ins_spec.rb +106 -104
  82. data/spec/watirspec/elements/inses_spec.rb +26 -24
  83. data/spec/watirspec/elements/label_spec.rb +56 -54
  84. data/spec/watirspec/elements/labels_spec.rb +26 -24
  85. data/spec/watirspec/elements/li_spec.rb +76 -74
  86. data/spec/watirspec/elements/link_spec.rb +173 -177
  87. data/spec/watirspec/elements/links_spec.rb +45 -43
  88. data/spec/watirspec/elements/lis_spec.rb +27 -25
  89. data/spec/watirspec/elements/list_spec.rb +44 -42
  90. data/spec/watirspec/elements/map_spec.rb +57 -55
  91. data/spec/watirspec/elements/maps_spec.rb +27 -25
  92. data/spec/watirspec/elements/meta_spec.rb +16 -14
  93. data/spec/watirspec/elements/metas_spec.rb +26 -24
  94. data/spec/watirspec/elements/ol_spec.rb +56 -65
  95. data/spec/watirspec/elements/ols_spec.rb +26 -24
  96. data/spec/watirspec/elements/option_spec.rb +91 -89
  97. data/spec/watirspec/elements/p_spec.rb +81 -79
  98. data/spec/watirspec/elements/pre_spec.rb +77 -75
  99. data/spec/watirspec/elements/pres_spec.rb +26 -24
  100. data/spec/watirspec/elements/ps_spec.rb +26 -24
  101. data/spec/watirspec/elements/radio_spec.rb +251 -249
  102. data/spec/watirspec/elements/radios_spec.rb +28 -26
  103. data/spec/watirspec/elements/select_list_spec.rb +537 -526
  104. data/spec/watirspec/elements/select_lists_spec.rb +32 -30
  105. data/spec/watirspec/elements/span_spec.rb +112 -110
  106. data/spec/watirspec/elements/spans_spec.rb +26 -24
  107. data/spec/watirspec/elements/strong_spec.rb +58 -58
  108. data/spec/watirspec/elements/strongs_spec.rb +28 -26
  109. data/spec/watirspec/elements/table_spec.rb +192 -139
  110. data/spec/watirspec/elements/tables_spec.rb +28 -26
  111. data/spec/watirspec/elements/tbody_spec.rb +74 -72
  112. data/spec/watirspec/elements/tbodys_spec.rb +40 -38
  113. data/spec/watirspec/elements/td_spec.rb +66 -64
  114. data/spec/watirspec/elements/tds_spec.rb +41 -39
  115. data/spec/watirspec/elements/text_field_spec.rb +206 -204
  116. data/spec/watirspec/elements/text_fields_spec.rb +30 -28
  117. data/spec/watirspec/elements/textarea_spec.rb +20 -18
  118. data/spec/watirspec/elements/textareas_spec.rb +18 -16
  119. data/spec/watirspec/elements/tfoot_spec.rb +65 -63
  120. data/spec/watirspec/elements/tfoots_spec.rb +42 -40
  121. data/spec/watirspec/elements/thead_spec.rb +65 -63
  122. data/spec/watirspec/elements/theads_spec.rb +42 -40
  123. data/spec/watirspec/elements/tr_spec.rb +48 -46
  124. data/spec/watirspec/elements/trs_spec.rb +42 -40
  125. data/spec/watirspec/elements/ul_spec.rb +56 -54
  126. data/spec/watirspec/elements/uls_spec.rb +26 -24
  127. data/spec/watirspec/radio_set_spec.rb +269 -267
  128. data/spec/watirspec/screenshot_spec.rb +20 -18
  129. data/spec/watirspec/scroll_spec.rb +152 -148
  130. data/spec/watirspec/shadow_root_spec.rb +86 -83
  131. data/spec/watirspec/user_editable_spec.rb +200 -198
  132. data/spec/watirspec/wait_spec.rb +289 -295
  133. data/spec/watirspec/window_switching_spec.rb +422 -434
  134. data/spec/watirspec_helper.rb +1 -23
  135. data/watir.gemspec +5 -4
  136. metadata +44 -33
  137. data/spec/watirspec/attributes_spec.rb +0 -18
  138. data/spec/watirspec/elements/table_nesting_spec.rb +0 -51
  139. data/spec/watirspec/special_chars_spec.rb +0 -23
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'watirspec'
4
4
  require 'spec_helper'
5
- require 'webdrivers'
6
5
  require 'selenium/webdriver/support/guards'
7
6
 
8
7
  Watir.default_timeout = 5
@@ -25,28 +24,10 @@ class LocalConfig
25
24
  @imp.browser_class = Watir::Browser
26
25
  set_webdriver
27
26
  set_browser_args
28
- load_webdrivers
29
27
  end
30
28
 
31
29
  private
32
30
 
33
- def load_webdrivers
34
- @imp.driver_info = case browser
35
- when :chrome
36
- Webdrivers::Chromedriver.update
37
- "chromedriver version: #{Webdrivers::Chromedriver.current_version.version}"
38
- when :edge
39
- Webdrivers::Edgedriver.update
40
- "edgedriver version: #{Webdrivers::Edgedriver.current_version.version}"
41
- when :firefox
42
- Webdrivers::Geckodriver.update
43
- "geckodriver version: #{Webdrivers::Geckodriver.current_version.version}"
44
- when :ie
45
- Webdrivers::IEdriver.update
46
- "iedriver version: #{Webdrivers::IEdriver.current_version.version}"
47
- end
48
- end
49
-
50
31
  def set_webdriver
51
32
  @imp.name = :local_driver
52
33
  end
@@ -123,14 +104,11 @@ end
123
104
 
124
105
  class RemoteConfig < LocalConfig
125
106
  def configure
126
- load_webdrivers
127
107
  @url = ENV['REMOTE_SERVER_URL'] || begin
128
108
  require 'watirspec/remote_server'
129
109
 
130
110
  remote_server = WatirSpec::RemoteServer.new
131
- args = ["-Dwebdriver.chrome.driver=#{Webdrivers::Chromedriver.driver_path}",
132
- "-Dwebdriver.gecko.driver=#{Webdrivers::Geckodriver.driver_path}"]
133
- remote_server.start(4444, args: args)
111
+ remote_server.start(4444)
134
112
  remote_server.server.webdriver_url
135
113
  end
136
114
  super
data/watir.gemspec CHANGED
@@ -27,22 +27,23 @@ Gem::Specification.new do |s|
27
27
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
28
28
  s.require_paths = ['lib']
29
29
 
30
- s.add_dependency 'selenium-webdriver', '~> 4.2'
31
30
  s.add_runtime_dependency 'regexp_parser', '>= 1.2', '< 3'
31
+ s.add_runtime_dependency 'selenium-webdriver', '~> 4.2'
32
32
 
33
33
  s.add_development_dependency 'activesupport', '~> 4.0', '>= 4.1.11' # for pluralization during code generation
34
34
  s.add_development_dependency 'coveralls_reborn'
35
- s.add_development_dependency 'nokogiri'
35
+ s.add_development_dependency 'nokogiri', '>= 1.14.0.rc1'
36
36
  s.add_development_dependency 'pry', '~> 0.14'
37
37
  s.add_development_dependency 'rake', '>= 12.3.3'
38
38
  s.add_development_dependency 'rspec', '~> 3.0'
39
39
  s.add_development_dependency 'rspec-retry'
40
- s.add_development_dependency 'rubocop', '= 1.40'
40
+ s.add_development_dependency 'rubocop', '~> 1.42'
41
41
  s.add_development_dependency 'rubocop-performance', '~> 1.15'
42
42
  s.add_development_dependency 'rubocop-rake', '~> 0.6'
43
+ s.add_development_dependency 'rubocop-rspec', '~> 2.16'
43
44
  s.add_development_dependency 'selenium_statistics'
45
+ s.add_development_dependency 'selenium-webdriver', '~> 4.7'
44
46
  s.add_development_dependency 'simplecov-console'
45
- s.add_development_dependency 'webdrivers', '~> 4.7'
46
47
  s.add_development_dependency 'webidl', '>= 0.2.2'
47
48
  s.add_development_dependency 'yard', '> 0.9.11'
48
49
  s.add_development_dependency 'yard-doctest', '~> 0.1.14'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 7.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -10,22 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-12-24 00:00:00.000000000 Z
13
+ date: 2023-01-02 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: selenium-webdriver
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '4.2'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '4.2'
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: regexp_parser
31
17
  requirement: !ruby/object:Gem::Requirement
@@ -46,6 +32,20 @@ dependencies:
46
32
  - - "<"
47
33
  - !ruby/object:Gem::Version
48
34
  version: '3'
35
+ - !ruby/object:Gem::Dependency
36
+ name: selenium-webdriver
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '4.2'
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '4.2'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: activesupport
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 1.14.0.rc1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 1.14.0.rc1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: rubocop
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '='
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.40'
159
+ version: '1.42'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '='
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.40'
166
+ version: '1.42'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubocop-performance
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -193,21 +193,21 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.6'
195
195
  - !ruby/object:Gem::Dependency
196
- name: selenium_statistics
196
+ name: rubocop-rspec
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: '2.16'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
208
+ version: '2.16'
209
209
  - !ruby/object:Gem::Dependency
210
- name: simplecov-console
210
+ name: selenium_statistics
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
@@ -221,7 +221,7 @@ dependencies:
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: webdrivers
224
+ name: selenium-webdriver
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: '4.7'
237
+ - !ruby/object:Gem::Dependency
238
+ name: simplecov-console
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
237
251
  - !ruby/object:Gem::Dependency
238
252
  name: webidl
239
253
  requirement: !ruby/object:Gem::Requirement
@@ -448,7 +462,6 @@ files:
448
462
  - spec/watirspec/adjacent_spec.rb
449
463
  - spec/watirspec/after_hooks_spec.rb
450
464
  - spec/watirspec/alert_spec.rb
451
- - spec/watirspec/attributes_spec.rb
452
465
  - spec/watirspec/browser_spec.rb
453
466
  - spec/watirspec/capabilities_spec.rb
454
467
  - spec/watirspec/cookies_spec.rb
@@ -523,7 +536,6 @@ files:
523
536
  - spec/watirspec/elements/spans_spec.rb
524
537
  - spec/watirspec/elements/strong_spec.rb
525
538
  - spec/watirspec/elements/strongs_spec.rb
526
- - spec/watirspec/elements/table_nesting_spec.rb
527
539
  - spec/watirspec/elements/table_spec.rb
528
540
  - spec/watirspec/elements/tables_spec.rb
529
541
  - spec/watirspec/elements/tbody_spec.rb
@@ -609,7 +621,6 @@ files:
609
621
  - spec/watirspec/screenshot_spec.rb
610
622
  - spec/watirspec/scroll_spec.rb
611
623
  - spec/watirspec/shadow_root_spec.rb
612
- - spec/watirspec/special_chars_spec.rb
613
624
  - spec/watirspec/support/rspec_matchers.rb
614
625
  - spec/watirspec/user_editable_spec.rb
615
626
  - spec/watirspec/wait_spec.rb
@@ -639,7 +650,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
639
650
  - !ruby/object:Gem::Version
640
651
  version: '0'
641
652
  requirements: []
642
- rubygems_version: 3.3.7
653
+ rubygems_version: 3.4.1
643
654
  signing_key:
644
655
  specification_version: 4
645
656
  summary: Watir powered by Selenium
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'watirspec_helper'
4
-
5
- describe 'Attributes' do
6
- before :each do
7
- browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
8
- end
9
-
10
- it 'finds tab index' do
11
- expect(browser.checkbox(tabindex: '4').tabindex).to eq 4
12
- end
13
-
14
- it 'finds element with boolean' do
15
- expect(browser.checkbox(tabindex: false).id).to eq 'toggle_button_checkbox'
16
- expect(browser.checkbox(tabindex: true).id).to eq 'new_user_interests_books'
17
- end
18
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'watirspec_helper'
4
-
5
- describe 'Table' do
6
- before :each do
7
- browser.goto(WatirSpec.url_for('nested_tables.html'))
8
- end
9
-
10
- it 'returns the correct number of rows under a table element' do
11
- tables = browser.div(id: 'table-rows-test').tables(id: /^tbl/)
12
- expect(tables.length).to be > 0
13
-
14
- tables.each do |table|
15
- expected = Integer(table.data_row_count)
16
- actual = table.rows.length
17
- browser_count = Integer(table.data_browser_count)
18
-
19
- msg = "expected #{expected} rows, got #{actual} for table id=#{table.id}, browser reported: #{browser_count}"
20
- expect(actual).to eql(expected), msg
21
- end
22
- end
23
-
24
- it 'returns the correct number of cells under a row' do
25
- rows = browser.div(id: 'row-cells-test').trs(id: /^row/)
26
- expect(rows.length).to be > 0
27
-
28
- rows.each do |row|
29
- expected = Integer(row.data_cell_count)
30
- actual = row.cells.length
31
- browser_count = Integer(row.data_browser_count)
32
-
33
- msg = "expected #{expected} cells, got #{actual} for row id=#{row.id}, browser reported: #{browser_count}"
34
- expect(actual).to eql(expected), msg
35
- end
36
- end
37
-
38
- it 'returns the correct number of rows under a table section' do
39
- tbodies = browser.table(id: 'tbody-rows-test').tbodys(id: /^body/)
40
- expect(tbodies.length).to be > 0
41
-
42
- tbodies.each do |tbody|
43
- expected = Integer(tbody.data_rows_count)
44
- actual = tbody.rows.count
45
- browser_count = Integer(tbody.data_browser_count)
46
-
47
- msg = "expected #{expected} rows, got #{actual} for tbody id=#{tbody.id}, browser reported: #{browser_count}"
48
- expect(actual).to eql(expected), msg
49
- end
50
- end
51
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'watirspec_helper'
4
-
5
- describe Watir::Browser do
6
- before do
7
- browser.goto WatirSpec.url_for('special_chars.html')
8
- end
9
-
10
- it 'finds elements with single quotes' do
11
- expect(browser.div(text: "single 'quotes'")).to exist
12
- end
13
-
14
- it 'finds elements with non-standard character locators' do
15
- expect(browser.div('we{ird' => 'foo')).to exist
16
- expect(browser.div('we{ird': 'foo')).to exist
17
- end
18
-
19
- it 'finds element with underscored attribute' do
20
- expect(browser.div('underscored_attribute' => 'true')).to exist
21
- expect(browser.div('underscored_attribute' => true)).to exist
22
- end
23
- end