watir 7.0.0.beta3 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/chrome.yml +34 -0
  3. data/.github/workflows/edge.yml +28 -0
  4. data/.github/workflows/firefox.yml +35 -0
  5. data/.github/workflows/ie.yml +24 -0
  6. data/.github/workflows/safari.yml +27 -0
  7. data/.github/workflows/unit.yml +52 -0
  8. data/.rubocop.yml +1 -1
  9. data/CHANGES.md +26 -0
  10. data/lib/watir/attribute_helper.rb +1 -1
  11. data/lib/watir/browser.rb +3 -3
  12. data/lib/watir/capabilities.rb +14 -0
  13. data/lib/watir/elements/date_field.rb +4 -1
  14. data/lib/watir/elements/date_time_field.rb +4 -1
  15. data/lib/watir/elements/element.rb +39 -13
  16. data/lib/watir/elements/table.rb +1 -1
  17. data/lib/watir/js_snippets/isElementInViewport.js +20 -0
  18. data/lib/watir/locators/element/selector_builder/xpath.rb +3 -2
  19. data/lib/watir/scroll.rb +2 -1
  20. data/lib/watir/version.rb +1 -1
  21. data/lib/watir/window.rb +22 -0
  22. data/lib/watirspec/remote_server.rb +2 -6
  23. data/spec/unit/capabilities_spec.rb +99 -5
  24. data/spec/watirspec/after_hooks_spec.rb +0 -2
  25. data/spec/watirspec/drag_and_drop_spec.rb +12 -0
  26. data/spec/watirspec/elements/date_time_field_spec.rb +3 -6
  27. data/spec/watirspec/elements/div_spec.rb +12 -1
  28. data/spec/watirspec/elements/element_spec.rb +91 -18
  29. data/spec/watirspec/html/scroll.html +8 -25
  30. data/spec/watirspec/html/sticky_elements.html +10 -0
  31. data/spec/watirspec/scroll_spec.rb +72 -42
  32. data/spec/watirspec/window_switching_spec.rb +40 -14
  33. data/spec/watirspec_helper.rb +2 -0
  34. data/watir.gemspec +3 -3
  35. metadata +24 -18
  36. data/.github/workflows/tests.yml +0 -104
  37. data/spec/watirspec/html/hover.html +0 -12
@@ -402,13 +402,16 @@ describe Watir::Window do
402
402
  context 'manipulating size and position', except: {headless: true} do
403
403
  before do
404
404
  browser.goto WatirSpec.url_for('window_switching.html')
405
+ @initial_size = browser.window.size
405
406
  end
406
407
 
407
- it 'should get the size of the current window' do
408
- size = browser.window.size
408
+ after do
409
+ browser.window.resize_to @initial_size.width, @initial_size.height
410
+ end
409
411
 
410
- expect(size.width).to eq browser.execute_script('return window.outerWidth;')
411
- expect(size.height).to eq browser.execute_script('return window.outerHeight;')
412
+ it 'should get the size of the current window' do
413
+ expect(@initial_size.width).to eq browser.execute_script('return window.outerWidth;')
414
+ expect(@initial_size.height).to eq browser.execute_script('return window.outerHeight;')
412
415
  end
413
416
 
414
417
  it 'should get the position of the current window' do
@@ -419,16 +422,15 @@ describe Watir::Window do
419
422
  end
420
423
 
421
424
  it 'should resize the window' do
422
- initial_size = browser.window.size
423
425
  browser.window.resize_to(
424
- initial_size.width - 20,
425
- initial_size.height - 20
426
+ @initial_size.width - 20,
427
+ @initial_size.height - 20
426
428
  )
427
429
 
428
430
  new_size = browser.window.size
429
431
 
430
- expect(new_size.width).to eq initial_size.width - 20
431
- expect(new_size.height).to eq initial_size.height - 20
432
+ expect(new_size.width).to eq @initial_size.width - 20
433
+ expect(new_size.height).to eq @initial_size.height - 20
432
434
  end
433
435
 
434
436
  it 'should move the window' do
@@ -445,12 +447,11 @@ describe Watir::Window do
445
447
  end
446
448
 
447
449
  it 'should maximize the window', except: {browser: :firefox, window_manager: false} do
448
- initial_size = browser.window.size
449
450
  browser.window.resize_to(
450
- initial_size.width - 40,
451
- initial_size.height - 40
451
+ @initial_size.width - 40,
452
+ @initial_size.height - 40
452
453
  )
453
- browser.wait_until { |b| b.window.size != initial_size }
454
+ browser.wait_until { |b| b.window.size != @initial_size }
454
455
  new_size = browser.window.size
455
456
 
456
457
  browser.window.maximize
@@ -458,7 +459,32 @@ describe Watir::Window do
458
459
 
459
460
  final_size = browser.window.size
460
461
  expect(final_size.width).to be >= new_size.width
461
- expect(final_size.height).to be > (new_size.height)
462
+ expect(final_size.height).to be > new_size.height
463
+ end
464
+
465
+ it 'should make the window full screen', except: {browser: :firefox, window_manager: false} do
466
+ browser.window.resize_to(
467
+ @initial_size.width - 40,
468
+ @initial_size.height - 40
469
+ )
470
+ new_size = browser.window.size
471
+
472
+ browser.window.full_screen
473
+ browser.wait_until { |b| b.window.size != new_size }
474
+
475
+ final_size = browser.window.size
476
+ expect(final_size.width).to be >= new_size.width
477
+ expect(final_size.height).to be > new_size.height
478
+ end
479
+
480
+ it 'should minimize the window', except: {window_manager: false} do
481
+ expect(browser.execute_script('return document.visibilityState;')).to eq 'visible'
482
+
483
+ browser.window.minimize
484
+
485
+ browser.wait_until { |b| b.execute_script('return document.visibilityState;') != 'visible' }
486
+
487
+ expect(browser.execute_script('return document.visibilityState;')).to eq 'hidden'
462
488
  end
463
489
  end
464
490
  end
@@ -155,6 +155,8 @@ RSpec.configure do |config|
155
155
  headless = WatirSpec.implementation.browser_args.last[:headless]
156
156
  guards.add_condition(:headless, headless)
157
157
 
158
+ guards.add_condition(:ci, ENV['DESKTOP_SESSION'].nil?)
159
+
158
160
  window_manager = !Selenium::WebDriver::Platform.linux? || !ENV['DESKTOP_SESSION'].nil?
159
161
  guards.add_condition(:window_manager, window_manager)
160
162
 
data/watir.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'watir/version'
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'watir'
8
8
  s.version = Watir::VERSION
9
- s.required_ruby_version = '>= 2.5.0'
9
+ s.required_ruby_version = '>= 2.6.0'
10
10
 
11
11
  s.platform = Gem::Platform::RUBY
12
12
  s.authors = ['Alex Rodionov', 'Titus Fortner', 'Justin Ko']
@@ -25,7 +25,7 @@ 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', '>= 4.0.0.beta2'
28
+ s.add_dependency 'selenium-webdriver', '~> 4.0'
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
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
39
39
  s.add_development_dependency 'rubocop', '~> 0.59'
40
40
  s.add_development_dependency 'selenium_statistics'
41
41
  s.add_development_dependency 'simplecov-console'
42
- s.add_development_dependency 'webdrivers', '~> 4.6'
42
+ s.add_development_dependency 'webdrivers', '~> 4.7'
43
43
  s.add_development_dependency 'webidl', '>= 0.2.2'
44
44
  s.add_development_dependency 'yard', '> 0.8.2.1'
45
45
  s.add_development_dependency 'yard-doctest', '~> 0.1.14'
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0.beta3
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
8
8
  - Titus Fortner
9
9
  - Justin Ko
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-05 00:00:00.000000000 Z
13
+ date: 2021-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 4.0.0.beta2
21
+ version: '4.0'
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: 4.0.0.beta2
28
+ version: '4.0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: regexp_parser
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '4.6'
215
+ version: '4.7'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '4.6'
222
+ version: '4.7'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: webidl
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -278,7 +278,12 @@ files:
278
278
  - ".github/actions/enable-safari/action.yml"
279
279
  - ".github/actions/install-chrome/action.yml"
280
280
  - ".github/actions/setup-linux/action.yml"
281
- - ".github/workflows/tests.yml"
281
+ - ".github/workflows/chrome.yml"
282
+ - ".github/workflows/edge.yml"
283
+ - ".github/workflows/firefox.yml"
284
+ - ".github/workflows/ie.yml"
285
+ - ".github/workflows/safari.yml"
286
+ - ".github/workflows/unit.yml"
282
287
  - ".gitignore"
283
288
  - ".rubocop.yml"
284
289
  - ".rubocop_todo.yml"
@@ -359,6 +364,7 @@ files:
359
364
  - lib/watir/js_snippets/getInnerText.js
360
365
  - lib/watir/js_snippets/getOuterHtml.js
361
366
  - lib/watir/js_snippets/getTextContent.js
367
+ - lib/watir/js_snippets/isElementInViewport.js
362
368
  - lib/watir/js_snippets/isImageLoaded.js
363
369
  - lib/watir/js_snippets/selectOptionsLabel.js
364
370
  - lib/watir/js_snippets/selectOptionsText.js
@@ -538,7 +544,6 @@ files:
538
544
  - spec/watirspec/html/frame_1.html
539
545
  - spec/watirspec/html/frame_2.html
540
546
  - spec/watirspec/html/frames.html
541
- - spec/watirspec/html/hover.html
542
547
  - spec/watirspec/html/iframe_1.html
543
548
  - spec/watirspec/html/iframes.html
544
549
  - spec/watirspec/html/images.html
@@ -576,6 +581,7 @@ files:
576
581
  - spec/watirspec/html/right_click.html
577
582
  - spec/watirspec/html/scroll.html
578
583
  - spec/watirspec/html/special_chars.html
584
+ - spec/watirspec/html/sticky_elements.html
579
585
  - spec/watirspec/html/tables.html
580
586
  - spec/watirspec/html/timeout_window_location.html
581
587
  - spec/watirspec/html/uneven_table.html
@@ -599,7 +605,7 @@ homepage: http://github.com/watir/watir
599
605
  licenses:
600
606
  - MIT
601
607
  metadata: {}
602
- post_install_message:
608
+ post_install_message:
603
609
  rdoc_options: []
604
610
  require_paths:
605
611
  - lib
@@ -607,15 +613,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
607
613
  requirements:
608
614
  - - ">="
609
615
  - !ruby/object:Gem::Version
610
- version: 2.5.0
616
+ version: 2.6.0
611
617
  required_rubygems_version: !ruby/object:Gem::Requirement
612
618
  requirements:
613
- - - ">"
619
+ - - ">="
614
620
  - !ruby/object:Gem::Version
615
- version: 1.3.1
621
+ version: '0'
616
622
  requirements: []
617
- rubygems_version: 3.1.4
618
- signing_key:
623
+ rubygems_version: 3.2.22
624
+ signing_key:
619
625
  specification_version: 4
620
626
  summary: Watir powered by Selenium
621
627
  test_files:
@@ -746,7 +752,6 @@ test_files:
746
752
  - spec/watirspec/html/frame_1.html
747
753
  - spec/watirspec/html/frame_2.html
748
754
  - spec/watirspec/html/frames.html
749
- - spec/watirspec/html/hover.html
750
755
  - spec/watirspec/html/iframe_1.html
751
756
  - spec/watirspec/html/iframes.html
752
757
  - spec/watirspec/html/images.html
@@ -784,6 +789,7 @@ test_files:
784
789
  - spec/watirspec/html/right_click.html
785
790
  - spec/watirspec/html/scroll.html
786
791
  - spec/watirspec/html/special_chars.html
792
+ - spec/watirspec/html/sticky_elements.html
787
793
  - spec/watirspec/html/tables.html
788
794
  - spec/watirspec/html/timeout_window_location.html
789
795
  - spec/watirspec/html/uneven_table.html
@@ -1,104 +0,0 @@
1
- name: All Tests
2
-
3
- on:
4
- - push
5
- - pull_request
6
-
7
- jobs:
8
- documentation-test:
9
- name: Yard Doctest
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v2
13
- - uses: ruby/setup-ruby@v1
14
- with:
15
- ruby-version: 2.6
16
- - run: bundle install
17
- - uses: ./.github/actions/install-chrome
18
- - uses: ./.github/actions/setup-linux
19
- - run: |
20
- bundle exec rake yard:doctest
21
-
22
- unit-test:
23
- name: Unit Tests
24
- runs-on: ubuntu-latest
25
- strategy:
26
- fail-fast: false
27
- matrix:
28
- ruby: ['2.5', '2.6', '2.7', '3.0']
29
- steps:
30
- - uses: actions/checkout@v2
31
- - uses: ruby/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- - run: bundle install
35
- - uses: ./.github/actions/install-chrome
36
- - uses: ./.github/actions/setup-linux
37
- - run: |
38
- bundle exec rake spec:unit
39
- env:
40
- DISPLAY: :99
41
-
42
- linter-test:
43
- name: Rubocop Tests
44
- runs-on: ubuntu-latest
45
- steps:
46
- - uses: actions/checkout@v2
47
- - uses: ruby/setup-ruby@v1
48
- with:
49
- ruby-version: 2.6
50
- - run: bundle install
51
- - run: bundle exec rubocop
52
-
53
- local-tests:
54
- name: Local Tests
55
- runs-on: ${{ matrix.os }}
56
- strategy:
57
- fail-fast: false
58
- matrix:
59
- os: [ubuntu-latest, macos-latest, windows-latest]
60
- ruby: [ 2.6, 3.0 ]
61
- task: [ chrome, firefox, edge ]
62
- include:
63
- - os: 'macos-latest'
64
- ruby: 2.6
65
- task: 'safari'
66
- - os: 'macos-latest'
67
- ruby: 3.0
68
- task: 'safari'
69
- - os: 'windows-latest'
70
- ruby: 2.6
71
- task: 'ie'
72
- - os: 'windows-latest'
73
- ruby: 3.0
74
- task: 'ie'
75
- exclude:
76
- - os: 'ubuntu-latest'
77
- task: 'edge'
78
- steps:
79
- - uses: actions/checkout@v2
80
- - uses: ./.github/actions/install-chrome
81
- if: |
82
- matrix.task == 'chrome' &&
83
- matrix.os == 'ubuntu-latest'
84
- - uses: ./.github/actions/setup-linux
85
- if: matrix.os == 'ubuntu-latest'
86
- - uses: browser-actions/setup-firefox@latest
87
- with:
88
- firefox-version: '86.0'
89
- if: matrix.task == 'firefox'
90
- - uses: ./.github/actions/enable-safari
91
- if: matrix.task == 'safari'
92
- - run: |
93
- echo "COVERAGE=true" >> $GITHUB_ENV
94
- if: |
95
- matrix.os == 'ubuntu-latest' ||
96
- matrix.os == 'macos-latest'
97
- - uses: ruby/setup-ruby@v1
98
- with:
99
- ruby-version: ${{ matrix.ruby }}
100
- - run: bundle install
101
- - run: |
102
- bundle exec rake spec:${{ matrix.task }}
103
- env:
104
- DISPLAY: :99
@@ -1,12 +0,0 @@
1
- <html>
2
- <head>
3
- <style type="text/css" media="screen">
4
- a { font-size: 10px; }
5
- a:hover { font-size: 20px; }
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <a href="#">hello</a>
11
- </body>
12
- </html>