watir 6.19.1 → 7.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/actions/install-chrome/action.yml +1 -0
  3. data/.github/actions/setup-linux/action.yml +8 -0
  4. data/.github/workflows/tests.yml +100 -0
  5. data/CHANGES.md +7 -0
  6. data/README.md +1 -4
  7. data/Rakefile +1 -1
  8. data/lib/watir.rb +1 -45
  9. data/lib/watir/alert.rb +3 -8
  10. data/lib/watir/capabilities.rb +54 -230
  11. data/lib/watir/cell_container.rb +4 -4
  12. data/lib/watir/container.rb +4 -26
  13. data/lib/watir/elements/checkbox.rb +4 -4
  14. data/lib/watir/elements/date_field.rb +4 -4
  15. data/lib/watir/elements/date_time_field.rb +4 -4
  16. data/lib/watir/elements/element.rb +12 -49
  17. data/lib/watir/elements/file_field.rb +4 -4
  18. data/lib/watir/elements/font.rb +4 -4
  19. data/lib/watir/elements/hidden.rb +4 -4
  20. data/lib/watir/elements/html_elements.rb +444 -445
  21. data/lib/watir/elements/iframe.rb +4 -4
  22. data/lib/watir/elements/radio.rb +4 -4
  23. data/lib/watir/elements/select.rb +12 -78
  24. data/lib/watir/elements/svg_elements.rb +96 -96
  25. data/lib/watir/elements/text_field.rb +4 -4
  26. data/lib/watir/generator/base/generator.rb +4 -4
  27. data/lib/watir/generator/base/visitor.rb +0 -29
  28. data/lib/watir/generator/html/generator.rb +2 -1
  29. data/lib/watir/has_window.rb +4 -4
  30. data/lib/watir/http_client.rb +0 -8
  31. data/lib/watir/locators.rb +1 -5
  32. data/lib/watir/locators/button/matcher.rb +0 -23
  33. data/lib/watir/locators/button/selector_builder/xpath.rb +4 -15
  34. data/lib/watir/locators/element/matcher.rb +4 -19
  35. data/lib/watir/locators/element/selector_builder.rb +2 -37
  36. data/lib/watir/locators/element/selector_builder/xpath.rb +26 -41
  37. data/lib/watir/radio_set.rb +2 -2
  38. data/lib/watir/row_container.rb +4 -4
  39. data/lib/watir/version.rb +1 -1
  40. data/lib/watir/wait.rb +4 -74
  41. data/lib/watir/window.rb +6 -22
  42. data/lib/watir/window_collection.rb +5 -49
  43. data/lib/watirspec/implementation.rb +4 -0
  44. data/spec/spec_helper.rb +2 -7
  45. data/spec/unit/capabilities_spec.rb +196 -929
  46. data/spec/unit/match_elements/button_spec.rb +0 -13
  47. data/spec/unit/match_elements/element_spec.rb +38 -47
  48. data/spec/unit/match_elements/text_field_spec.rb +6 -6
  49. data/spec/unit/selector_builder/element_spec.rb +6 -23
  50. data/spec/unit/selector_builder/text_field_spec.rb +6 -7
  51. data/spec/watirspec/alert_spec.rb +4 -21
  52. data/spec/watirspec/browser_spec.rb +2 -2
  53. data/spec/watirspec/cookies_spec.rb +1 -1
  54. data/spec/watirspec/elements/button_spec.rb +0 -10
  55. data/spec/watirspec/elements/checkbox_spec.rb +10 -22
  56. data/spec/watirspec/elements/div_spec.rb +4 -34
  57. data/spec/watirspec/elements/divs_spec.rb +2 -2
  58. data/spec/watirspec/elements/element_spec.rb +38 -84
  59. data/spec/watirspec/elements/form_spec.rb +2 -4
  60. data/spec/watirspec/elements/links_spec.rb +4 -4
  61. data/spec/watirspec/elements/select_list_spec.rb +7 -108
  62. data/spec/watirspec/elements/span_spec.rb +2 -2
  63. data/spec/watirspec/elements/spans_spec.rb +1 -1
  64. data/spec/watirspec/elements/strong_spec.rb +1 -1
  65. data/spec/watirspec/html/non_control_elements.html +8 -3
  66. data/spec/watirspec/support/rspec_matchers.rb +1 -32
  67. data/spec/watirspec/window_switching_spec.rb +2 -49
  68. data/spec/watirspec_helper.rb +6 -1
  69. data/watir.gemspec +3 -4
  70. metadata +11 -32
  71. data/.github/workflows/linux.yml +0 -61
  72. data/.github/workflows/mac.yml +0 -55
  73. data/.github/workflows/unit.yml +0 -37
  74. data/.github/workflows/windows.yml +0 -39
  75. data/lib/watir/legacy_wait.rb +0 -123
  76. data/spec/unit/container_spec.rb +0 -35
  77. data/spec/watirspec/legacy_wait_spec.rb +0 -216
@@ -1,36 +1,5 @@
1
1
  if defined?(RSpec)
2
- DEPRECATION_WARNINGS = %i[selector_parameters
3
- options_capabilities
4
- firefox_profile
5
- remote_keyword
6
- desired_capabilities
7
- port_keyword
8
- switches_keyword
9
- args_keyword
10
- url_service
11
- driver_opts_keyword
12
- http_open_timeout
13
- http_read_timeout
14
- http_client_timeout
15
- unknown_keyword
16
- element_cache
17
- ready_state
18
- caption
19
- class_array
20
- use_capabilities
21
- visible_text
22
- link_text
23
- text_regexp
24
- scroll_into_view
25
- stale_exists
26
- stale_visible
27
- stale_present
28
- select_all
29
- select_by
30
- value_button
31
- wait_until_present
32
- wait_while_present
33
- window_index].freeze
2
+ DEPRECATION_WARNINGS = %i[use_capabilities].freeze
34
3
 
35
4
  DEPRECATION_WARNINGS.each do |deprecation|
36
5
  RSpec::Matchers.define "have_deprecated_#{deprecation}" do
@@ -43,12 +43,6 @@ describe Watir::Browser do
43
43
  expect(browser.window(title: 'closeable window').use).to be_a(Watir::Window)
44
44
  end
45
45
 
46
- it 'finds window by :index' do
47
- expect {
48
- expect(browser.window(index: 1).use).to be_a(Watir::Window)
49
- }.to have_deprecated_window_index
50
- end
51
-
52
46
  it 'finds window by :element' do
53
47
  expect(browser.window(element: browser.a(id: 'close')).use).to be_a(Watir::Window)
54
48
  end
@@ -91,12 +85,6 @@ describe Watir::Browser do
91
85
  expect { browser.window(title: 'noop').use }.to raise_no_matching_window_exception
92
86
  end
93
87
 
94
- it "raises a NoMatchingWindowFoundException error if there's no window at the given index" do
95
- expect {
96
- expect { browser.window(index: 100).use }.to raise_no_matching_window_exception
97
- }.to have_deprecated_window_index
98
- end
99
-
100
88
  it 'raises NoMatchingWindowFoundException error when attempting to use a window with an incorrect handle' do
101
89
  expect { browser.window(handle: 'bar').use }.to raise_no_matching_window_exception
102
90
  end
@@ -256,12 +244,6 @@ describe Watir::Window do
256
244
  expect(browser.window(title: 'closeable window').handle).to_not be_nil
257
245
  end
258
246
 
259
- it 'finds window by :index' do
260
- expect {
261
- expect(browser.window(index: 1).handle).to_not be_nil
262
- }.to have_deprecated_window_index
263
- end
264
-
265
247
  it 'finds window by :element' do
266
248
  expect(browser.window(element: browser.a(id: 'close')).handle).to_not be_nil
267
249
  end
@@ -390,12 +372,6 @@ describe Watir::Window do
390
372
  end
391
373
 
392
374
  describe '#present?' do
393
- it 'should find window by index' do
394
- expect {
395
- expect(browser.window(index: 0)).to be_present
396
- }.to have_deprecated_window_index
397
- end
398
-
399
375
  it 'should find window by url' do
400
376
  expect(browser.window(url: /window_switching\.html/)).to be_present
401
377
  end
@@ -411,11 +387,6 @@ describe Watir::Window do
411
387
 
412
388
  describe '#use' do
413
389
  context 'switching windows without blocks' do
414
- it 'by index' do
415
- expect { browser.window(index: 0).use }.to have_deprecated_window_index
416
- expect(browser.title).to be == 'window switching'
417
- end
418
-
419
390
  it 'by url' do
420
391
  browser.window(url: /window_switching\.html/).use
421
392
  expect(browser.title).to be == 'window switching'
@@ -433,12 +404,6 @@ describe Watir::Window do
433
404
  end
434
405
 
435
406
  context 'Switching windows with blocks' do
436
- it 'by index' do
437
- expect {
438
- browser.window(index: 0).use { expect(browser.title).to be == 'window switching' }
439
- }.to have_deprecated_window_index
440
- end
441
-
442
407
  it 'by url' do
443
408
  browser.window(url: /window_switching\.html/).use { expect(browser.title).to be == 'window switching' }
444
409
  end
@@ -536,10 +501,10 @@ describe Watir::WindowCollection do
536
501
  browser.windows.reject(&:current?).each(&:close)
537
502
  end
538
503
 
539
- it '#to_a' do
504
+ it '#to_a raises exception' do
540
505
  expect {
541
506
  Watir::WindowCollection.new(browser).to_a
542
- }.to have_deprecated_window_index
507
+ }.to raise_exception(NoMethodError, 'indexing not reliable on WindowCollection')
543
508
  end
544
509
 
545
510
  describe '#new' do
@@ -580,24 +545,12 @@ describe Watir::WindowCollection do
580
545
  end
581
546
  end
582
547
 
583
- describe '#[]' do
584
- it 'returns window instance at provided index' do
585
- windows = Watir::WindowCollection.new(browser)
586
-
587
- expect {
588
- expect(windows).to all(be_an(Watir::Window))
589
- expect(windows.first).to_not eq windows.last
590
- }.to have_deprecated_window_index
591
- end
592
- end
593
-
594
548
  describe '#eq?' do
595
549
  it 'compares the equivalence of window handles' do
596
550
  windows1 = Watir::WindowCollection.new(browser, title: //)
597
551
  windows2 = Watir::WindowCollection.new(browser, url: //)
598
552
 
599
553
  expect(windows1).to eq windows2
600
- expect(windows1.to_a.map(&:handle)).to eq windows2.to_a.map(&:handle)
601
554
  end
602
555
  end
603
556
  end
@@ -32,9 +32,15 @@ class LocalConfig
32
32
  when :chrome
33
33
  Webdrivers::Chromedriver.update
34
34
  "chromedriver version: #{Webdrivers::Chromedriver.current_version.version}"
35
+ when :edge
36
+ Webdrivers::Edgedriver.update
37
+ "edgedriver version: #{Webdrivers::Edgedriver.current_version.version}"
35
38
  when :firefox
36
39
  Webdrivers::Geckodriver.update
37
40
  "geckodriver version: #{Webdrivers::Geckodriver.current_version.version}"
41
+ when :ie
42
+ Webdrivers::IEdriver.update
43
+ "iedriver version: #{Webdrivers::IEdriver.current_version.version}"
38
44
  end
39
45
  end
40
46
 
@@ -83,7 +89,6 @@ class LocalConfig
83
89
  def common_guards
84
90
  matching_guards = [browser]
85
91
  matching_guards << [browser, Selenium::WebDriver::Platform.os]
86
- matching_guards << :relaxed_locate if Watir.relaxed_locate?
87
92
  matching_guards << :headless if @imp.browser_args.last[:headless]
88
93
  matching_guards << "v#{Watir::VERSION.tr('.', '_')[/.*(?=_)/]}".to_sym
89
94
  matching_guards << :w3c if ENV['W3C']
data/watir.gemspec CHANGED
@@ -25,11 +25,11 @@ Gem::Specification.new do |s|
25
25
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
26
26
  s.require_paths = ['lib']
27
27
 
28
- s.add_dependency 'selenium-webdriver', '>= 3.142.7'
28
+ s.add_dependency 'selenium-webdriver', '>= 4.0.0.beta2'
29
29
  s.add_runtime_dependency 'regexp_parser', '>= 1.2', '< 3'
30
30
 
31
31
  s.add_development_dependency 'activesupport', '~> 4.0', '>= 4.1.11' # for pluralization during code generation
32
- s.add_development_dependency 'coveralls'
32
+ s.add_development_dependency 'coveralls_reborn'
33
33
  s.add_development_dependency 'fuubar'
34
34
  s.add_development_dependency 'nokogiri'
35
35
  s.add_development_dependency 'pry'
@@ -38,9 +38,8 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency 'rspec-retry'
39
39
  s.add_development_dependency 'rubocop', '~> 0.59'
40
40
  s.add_development_dependency 'selenium_statistics'
41
- s.add_development_dependency 'simplecov'
42
41
  s.add_development_dependency 'simplecov-console'
43
- s.add_development_dependency 'webdrivers', '~> 4.1'
42
+ s.add_development_dependency 'webdrivers', '~> 4.6'
44
43
  s.add_development_dependency 'webidl', '>= 0.2.2'
45
44
  s.add_development_dependency 'yard', '> 0.8.2.1'
46
45
  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: 6.19.1
4
+ version: 7.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-03-17 00:00:00.000000000 Z
13
+ date: 2021-03-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 3.142.7
21
+ version: 4.0.0.beta2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 3.142.7
28
+ version: 4.0.0.beta2
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: regexp_parser
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 4.1.11
69
69
  - !ruby/object:Gem::Dependency
70
- name: coveralls
70
+ name: coveralls_reborn
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -192,20 +192,6 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: simplecov
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: simplecov-console
211
197
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +212,14 @@ dependencies:
226
212
  requirements:
227
213
  - - "~>"
228
214
  - !ruby/object:Gem::Version
229
- version: '4.1'
215
+ version: '4.6'
230
216
  type: :development
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
219
  requirements:
234
220
  - - "~>"
235
221
  - !ruby/object:Gem::Version
236
- version: '4.1'
222
+ version: '4.6'
237
223
  - !ruby/object:Gem::Dependency
238
224
  name: webidl
239
225
  requirement: !ruby/object:Gem::Requirement
@@ -291,10 +277,8 @@ files:
291
277
  - ".github/ISSUE_TEMPLATE.md"
292
278
  - ".github/actions/enable-safari/action.yml"
293
279
  - ".github/actions/install-chrome/action.yml"
294
- - ".github/workflows/linux.yml"
295
- - ".github/workflows/mac.yml"
296
- - ".github/workflows/unit.yml"
297
- - ".github/workflows/windows.yml"
280
+ - ".github/actions/setup-linux/action.yml"
281
+ - ".github/workflows/tests.yml"
298
282
  - ".gitignore"
299
283
  - ".rubocop.yml"
300
284
  - ".rubocop_todo.yml"
@@ -384,7 +368,6 @@ files:
384
368
  - lib/watir/js_snippets/selectedText.js
385
369
  - lib/watir/js_snippets/setText.js
386
370
  - lib/watir/js_snippets/setValue.js
387
- - lib/watir/legacy_wait.rb
388
371
  - lib/watir/locators.rb
389
372
  - lib/watir/locators/anchor/selector_builder.rb
390
373
  - lib/watir/locators/button/matcher.rb
@@ -429,7 +412,6 @@ files:
429
412
  - spec/locator_spec_helper.rb
430
413
  - spec/spec_helper.rb
431
414
  - spec/unit/capabilities_spec.rb
432
- - spec/unit/container_spec.rb
433
415
  - spec/unit/element_locator_spec.rb
434
416
  - spec/unit/logger_spec.rb
435
417
  - spec/unit/match_elements/button_spec.rb
@@ -599,7 +581,6 @@ files:
599
581
  - spec/watirspec/html/wait.html
600
582
  - spec/watirspec/html/watirspec.css
601
583
  - spec/watirspec/html/window_switching.html
602
- - spec/watirspec/legacy_wait_spec.rb
603
584
  - spec/watirspec/radio_set_spec.rb
604
585
  - spec/watirspec/screenshot_spec.rb
605
586
  - spec/watirspec/scroll_spec.rb
@@ -628,9 +609,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
628
609
  version: 2.5.0
629
610
  required_rubygems_version: !ruby/object:Gem::Requirement
630
611
  requirements:
631
- - - ">="
612
+ - - ">"
632
613
  - !ruby/object:Gem::Version
633
- version: '0'
614
+ version: 1.3.1
634
615
  requirements: []
635
616
  rubygems_version: 3.1.4
636
617
  signing_key:
@@ -641,7 +622,6 @@ test_files:
641
622
  - spec/locator_spec_helper.rb
642
623
  - spec/spec_helper.rb
643
624
  - spec/unit/capabilities_spec.rb
644
- - spec/unit/container_spec.rb
645
625
  - spec/unit/element_locator_spec.rb
646
626
  - spec/unit/logger_spec.rb
647
627
  - spec/unit/match_elements/button_spec.rb
@@ -811,7 +791,6 @@ test_files:
811
791
  - spec/watirspec/html/wait.html
812
792
  - spec/watirspec/html/watirspec.css
813
793
  - spec/watirspec/html/window_switching.html
814
- - spec/watirspec/legacy_wait_spec.rb
815
794
  - spec/watirspec/radio_set_spec.rb
816
795
  - spec/watirspec/screenshot_spec.rb
817
796
  - spec/watirspec/scroll_spec.rb
@@ -1,61 +0,0 @@
1
- name: Linux Tests
2
-
3
- on:
4
- - push
5
- - pull_request
6
-
7
- jobs:
8
- chrome-test:
9
- name: Chrome Test
10
- runs-on: ubuntu-latest
11
- strategy:
12
- fail-fast: false
13
- matrix:
14
- task: [ 'chrome' ]
15
- steps:
16
- - uses: actions/checkout@v2
17
- - uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: 2.5
20
- - run: bundle install
21
- - uses: ./.github/actions/install-chrome
22
- - run: Xvfb :99 &
23
- - run: |
24
- bundle exec rake spec:${{ matrix.task }}
25
- env:
26
- DISPLAY: :99
27
-
28
- firefox-test:
29
- name: Firefox Test
30
- runs-on: ubuntu-latest
31
- strategy:
32
- fail-fast: false
33
- matrix:
34
- task: [ 'firefox' ]
35
- steps:
36
- - uses: actions/checkout@v2
37
- - uses: ruby/setup-ruby@v1
38
- with:
39
- ruby-version: 2.5
40
- - run: bundle install
41
- - run: Xvfb :99 &
42
- - run: |
43
- bundle exec rake spec:${{ matrix.task }}
44
- env:
45
- DISPLAY: :99
46
-
47
- documentation-test:
48
- name: Yard Doc Test
49
- runs-on: ubuntu-latest
50
- steps:
51
- - uses: actions/checkout@v2
52
- - uses: ruby/setup-ruby@v1
53
- with:
54
- ruby-version: 2.5
55
- - run: bundle install
56
- - uses: ./.github/actions/install-chrome
57
- - run: Xvfb :99 &
58
- - run: |
59
- bundle exec rake yard:doctest
60
- env:
61
- DISPLAY: :99
@@ -1,55 +0,0 @@
1
- name: Mac Tests
2
-
3
- on:
4
- - push
5
- - pull_request
6
-
7
- jobs:
8
- chrome-test:
9
- name: Chrome Test
10
- runs-on: macos-latest
11
- strategy:
12
- fail-fast: false
13
- matrix:
14
- task: [ 'chrome' ]
15
- steps:
16
- - uses: actions/checkout@v2
17
- - uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: 2.5
20
- - run: bundle install
21
- - run: |
22
- bundle exec rake spec:${{ matrix.task }}
23
-
24
- firefox-test:
25
- name: Firefox Test
26
- runs-on: macos-latest
27
- strategy:
28
- fail-fast: false
29
- matrix:
30
- task: [ 'firefox' ]
31
- steps:
32
- - uses: actions/checkout@v2
33
- - uses: ruby/setup-ruby@v1
34
- with:
35
- ruby-version: 2.5
36
- - run: bundle install
37
- - run: |
38
- bundle exec rake spec:${{ matrix.task }}
39
-
40
- safari-test:
41
- name: Safari Test
42
- runs-on: macos-latest
43
- strategy:
44
- fail-fast: false
45
- matrix:
46
- task: [ 'safari' ]
47
- steps:
48
- - uses: actions/checkout@v2
49
- - uses: ruby/setup-ruby@v1
50
- with:
51
- ruby-version: 2.5
52
- - run: bundle install
53
- - uses: ./.github/actions/enable-safari
54
- - run: |
55
- bundle exec rake spec:${{ matrix.task }}