watir 6.17.0 → 7.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.github/actions/enable-safari/action.yml +11 -0
  3. data/.github/actions/install-chrome/action.yml +12 -0
  4. data/.github/actions/setup-linux/action.yml +8 -0
  5. data/.github/workflows/tests.yml +104 -0
  6. data/.rubocop.yml +2 -7
  7. data/.rubocop_todo.yml +36 -0
  8. data/CHANGES.md +59 -0
  9. data/LICENSE +2 -2
  10. data/README.md +6 -10
  11. data/Rakefile +2 -2
  12. data/lib/watir.rb +4 -45
  13. data/lib/watir/adjacent.rb +1 -1
  14. data/lib/watir/alert.rb +4 -8
  15. data/lib/watir/attribute_helper.rb +2 -0
  16. data/lib/watir/browser.rb +20 -6
  17. data/lib/watir/capabilities.rb +79 -110
  18. data/lib/watir/cell_container.rb +4 -4
  19. data/lib/watir/container.rb +4 -26
  20. data/lib/watir/cookies.rb +2 -0
  21. data/lib/watir/element_collection.rb +21 -6
  22. data/lib/watir/elements/checkbox.rb +4 -4
  23. data/lib/watir/elements/date_field.rb +4 -4
  24. data/lib/watir/elements/date_time_field.rb +4 -4
  25. data/lib/watir/elements/element.rb +51 -59
  26. data/lib/watir/elements/file_field.rb +4 -4
  27. data/lib/watir/elements/font.rb +5 -4
  28. data/lib/watir/elements/hidden.rb +4 -4
  29. data/lib/watir/elements/html_elements.rb +444 -446
  30. data/lib/watir/elements/iframe.rb +6 -6
  31. data/lib/watir/elements/radio.rb +6 -6
  32. data/lib/watir/elements/select.rb +62 -90
  33. data/lib/watir/elements/svg_elements.rb +96 -96
  34. data/lib/watir/elements/text_field.rb +4 -4
  35. data/lib/watir/generator/base/generator.rb +4 -4
  36. data/lib/watir/generator/base/visitor.rb +0 -29
  37. data/lib/watir/generator/html/generator.rb +2 -1
  38. data/lib/watir/has_window.rb +22 -18
  39. data/lib/watir/http_client.rb +9 -0
  40. data/lib/watir/js_execution.rb +2 -2
  41. data/lib/watir/js_snippets.rb +2 -2
  42. data/lib/watir/locators.rb +6 -8
  43. data/lib/watir/locators/button/matcher.rb +0 -23
  44. data/lib/watir/locators/button/selector_builder/xpath.rb +4 -15
  45. data/lib/watir/locators/element/matcher.rb +4 -19
  46. data/lib/watir/locators/element/selector_builder.rb +3 -41
  47. data/lib/watir/locators/element/selector_builder/xpath.rb +34 -41
  48. data/lib/watir/locators/option/matcher.rb +24 -0
  49. data/lib/watir/locators/option/selector_builder.rb +8 -0
  50. data/lib/watir/locators/option/selector_builder/xpath.rb +37 -0
  51. data/lib/watir/logger.rb +4 -91
  52. data/lib/watir/radio_set.rb +5 -4
  53. data/lib/watir/row_container.rb +4 -4
  54. data/lib/watir/screenshot.rb +2 -8
  55. data/lib/watir/user_editable.rb +13 -2
  56. data/lib/watir/version.rb +1 -1
  57. data/lib/watir/wait.rb +6 -74
  58. data/lib/watir/wait/timer.rb +1 -1
  59. data/lib/watir/window.rb +24 -25
  60. data/lib/watir/window_collection.rb +79 -0
  61. data/lib/watirspec.rb +5 -2
  62. data/lib/watirspec/guards.rb +1 -1
  63. data/lib/watirspec/implementation.rb +7 -5
  64. data/lib/watirspec/runner.rb +2 -2
  65. data/lib/watirspec/server.rb +2 -2
  66. data/spec/spec_helper.rb +1 -21
  67. data/spec/unit/capabilities_spec.rb +504 -21
  68. data/spec/unit/match_elements/button_spec.rb +0 -13
  69. data/spec/unit/match_elements/element_spec.rb +55 -51
  70. data/spec/unit/match_elements/text_field_spec.rb +6 -6
  71. data/spec/unit/selector_builder/element_spec.rb +6 -23
  72. data/spec/unit/selector_builder/text_field_spec.rb +6 -7
  73. data/spec/unit/unit_helper.rb +2 -4
  74. data/spec/watirspec/after_hooks_spec.rb +23 -42
  75. data/spec/watirspec/alert_spec.rb +4 -21
  76. data/spec/watirspec/browser_spec.rb +186 -206
  77. data/spec/watirspec/cookies_spec.rb +47 -52
  78. data/spec/watirspec/drag_and_drop_spec.rb +5 -7
  79. data/spec/watirspec/elements/area_spec.rb +1 -5
  80. data/spec/watirspec/elements/button_spec.rb +4 -18
  81. data/spec/watirspec/elements/checkbox_spec.rb +10 -24
  82. data/spec/watirspec/elements/date_field_spec.rb +13 -16
  83. data/spec/watirspec/elements/date_time_field_spec.rb +14 -13
  84. data/spec/watirspec/elements/dd_spec.rb +3 -4
  85. data/spec/watirspec/elements/del_spec.rb +10 -12
  86. data/spec/watirspec/elements/div_spec.rb +45 -84
  87. data/spec/watirspec/elements/divs_spec.rb +2 -2
  88. data/spec/watirspec/elements/dl_spec.rb +4 -12
  89. data/spec/watirspec/elements/element_spec.rb +204 -181
  90. data/spec/watirspec/elements/elements_spec.rb +8 -9
  91. data/spec/watirspec/elements/filefield_spec.rb +5 -7
  92. data/spec/watirspec/elements/form_spec.rb +3 -5
  93. data/spec/watirspec/elements/forms_spec.rb +3 -5
  94. data/spec/watirspec/elements/frame_spec.rb +17 -22
  95. data/spec/watirspec/elements/iframe_spec.rb +25 -33
  96. data/spec/watirspec/elements/ins_spec.rb +10 -12
  97. data/spec/watirspec/elements/link_spec.rb +23 -23
  98. data/spec/watirspec/elements/links_spec.rb +8 -9
  99. data/spec/watirspec/elements/radio_spec.rb +11 -14
  100. data/spec/watirspec/elements/select_list_spec.rb +358 -209
  101. data/spec/watirspec/elements/span_spec.rb +12 -14
  102. data/spec/watirspec/elements/spans_spec.rb +1 -1
  103. data/spec/watirspec/elements/strong_spec.rb +1 -1
  104. data/spec/watirspec/elements/table_nesting_spec.rb +31 -34
  105. data/spec/watirspec/elements/table_spec.rb +11 -13
  106. data/spec/watirspec/elements/tbody_spec.rb +10 -12
  107. data/spec/watirspec/elements/td_spec.rb +4 -6
  108. data/spec/watirspec/elements/text_field_spec.rb +10 -12
  109. data/spec/watirspec/elements/tr_spec.rb +5 -7
  110. data/spec/watirspec/html/non_control_elements.html +8 -3
  111. data/spec/watirspec/html/special_chars.html +3 -0
  112. data/spec/watirspec/html/wait.html +5 -5
  113. data/spec/watirspec/html/window_switching.html +10 -0
  114. data/spec/watirspec/special_chars_spec.rb +10 -0
  115. data/spec/watirspec/support/rspec_matchers.rb +11 -24
  116. data/spec/watirspec/user_editable_spec.rb +26 -28
  117. data/spec/watirspec/wait_spec.rb +154 -201
  118. data/spec/watirspec/window_switching_spec.rb +359 -270
  119. data/spec/watirspec_helper.rb +52 -49
  120. data/support/doctest_helper.rb +0 -2
  121. data/watir.gemspec +4 -5
  122. metadata +30 -39
  123. data/.travis.yml +0 -87
  124. data/appveyor.yml +0 -13
  125. data/lib/watir/legacy_wait.rb +0 -123
  126. data/spec/implementation_spec.rb +0 -24
  127. data/spec/unit/container_spec.rb +0 -35
  128. data/spec/unit/logger_spec.rb +0 -81
  129. data/spec/watirspec/relaxed_locate_spec.rb +0 -109
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c587621e41c1ab878d2e9ff3cfd6c5166c5df9dc66cd02c0719d492aaba48d1e
4
- data.tar.gz: 509ba43afa0272d7b154eb5885e403578e2bc3956ab93803123b519093e7b430
3
+ metadata.gz: 58e502e12250523b603418f4d352663d893762126b5cdb48e046e58a8a19bc20
4
+ data.tar.gz: cd3405850e28a040968c7df99f93d87a2593ff7b2c34da4b8f0789cbe023df42
5
5
  SHA512:
6
- metadata.gz: 5215ff9fc1cfce6fa050532583167e6ed16be6f74b0d305b8d186b83361162c711ae9b63689a00882bf60d559783508ea2369ed9e8d5e25b504688eb2914db01
7
- data.tar.gz: 1b0ba276ea5c83f217151c125b0f645aab7011d86d9049ea7850ea83af4fbeeb9bdfa14ca60d7205c55bee3c0d6f817143bd9f979c7dc5adc368af446367ab8a
6
+ metadata.gz: 0557ff99666998a7104b51ae07439d7245e645e2fe543d8a50ed2c191f3c8d5a04423e52c22b8065e3a5f7793ee7ce9101d64f54c0ca4349eec23d1b5057c3e7
7
+ data.tar.gz: 1d36608975ae96d51ce119cd55f96a2d28eb0c9de2cb1194e33d9fe1429c09c5fdd86022c07bf1350617e60c6f667ce0bd818428f545e37f8eaebf65361fb883
@@ -0,0 +1,11 @@
1
+ name: 'Enable Safari Driver'
2
+ description: 'Set safaridriver to run in automation mode'
3
+ runs:
4
+ using: composite
5
+ steps:
6
+ - run: |
7
+ defaults write com.apple.Safari IncludeDevelopMenu YES
8
+ defaults write com.apple.Safari AllowRemoteAutomation 1
9
+ sudo safaridriver --enable
10
+ safaridriver -p 0 &
11
+ shell: bash
@@ -0,0 +1,12 @@
1
+ name: 'Install Chrome'
2
+ description: 'Install Chrome Stable'
3
+ runs:
4
+ using: "composite"
5
+ steps:
6
+ - run: |
7
+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
8
+ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list
9
+ sudo apt-get update -qqy
10
+ sudo apt-get -qqy install google-chrome-stable
11
+ sudo rm /etc/apt/sources.list.d/google-chrome.list
12
+ shell: bash
@@ -0,0 +1,8 @@
1
+ name: 'Setup Linux'
2
+ description: 'Run Linux in Virtual Desktop'
3
+ runs:
4
+ using: "composite"
5
+ steps:
6
+ - shell: bash
7
+ run: |
8
+ Xvfb :99 &
@@ -0,0 +1,104 @@
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
data/.rubocop.yml CHANGED
@@ -19,17 +19,12 @@ Lint/UnifiedInteger:
19
19
 
20
20
  # Default: 17
21
21
  Metrics/AbcSize:
22
- Max: 20
22
+ Max: 22
23
23
  Exclude:
24
- - 'lib/watir/capabilities.rb'
25
24
  - 'lib/watir/locators/element/selector_builder.rb'
26
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
27
- - 'lib/watir/locators/element/selector_builder/xpath.rb'
28
- - 'lib/watir/locators/element/locator.rb'
25
+ - 'lib/watir/locators/element/selector_builder/*.rb'
29
26
  - 'lib/watir/generator/base/generator.rb'
30
- - 'lib/watir/generator/base/visitor.rb'
31
27
  - 'spec/locator_spec_helper.rb'
32
- - 'spec/watirspec_helper.rb'
33
28
 
34
29
  Metrics/BlockLength:
35
30
  Exclude:
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,36 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-08-27 01:55:04 UTC using RuboCop version 0.89.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 116
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ # Offense count: 11
14
+ # Configuration parameters: EnforcedStyle.
15
+ # SupportedStyles: annotated, template, unannotated
16
+ Style/FormatStringToken:
17
+ Exclude:
18
+ - 'lib/watir/browser.rb'
19
+ - 'lib/watir/window.rb'
20
+
21
+ # Offense count: 229
22
+ # Cop supports --auto-correct.
23
+ # Configuration parameters: EnforcedStyle.
24
+ # SupportedStyles: always, always_true, never
25
+ Style/FrozenStringLiteralComment:
26
+ Enabled: false
27
+
28
+ # Remove for Watir 7
29
+ Naming/FileName:
30
+ Exclude:
31
+ - 'lib/watir-webdriver.rb'
32
+
33
+ # Fix in Watir 7
34
+ Metrics/ParameterLists:
35
+ Exclude:
36
+ - 'lib/watir/wait.rb'
data/CHANGES.md CHANGED
@@ -1,3 +1,62 @@
1
+ ### 7.0.0.beta2 (2021-03-28)
2
+
3
+ * Replace Watir Logger implementation with Selenium Logger subclass
4
+ * Change Watir Guards to use Selenium's new Guards. Tests run as pending when guarded.
5
+ * Implement `#set` as standard interface for each Input Element (#405)
6
+ * Implement `Element#set` to take correct `#set` behavior based on evaluated element (#664)
7
+ * Optimize Performance for Select Lists (#846)
8
+ * Allow user to set values on Select List exclusively by `:label`, `:text`, or `:value` (#846)
9
+ * Allow user to check if option selected in Select List by `:label`, `:text`, or `:value` (#929)
10
+ * Implement `Window#restore!` to return to original Window and close all others (#923)
11
+ * Minor performance improvement for iterating over windows (#923)
12
+ * Implement `Browser#closed?`; same as `Browser#exists?` without the Windows checks (#923)
13
+ * Update methods that use Selenium's Actions class to scroll element into view before acting (#847)
14
+ * Fix bug for `:text` locator with `Regexp` value based on whitespace (#924)
15
+ * Remove executing after hooks when changing frames (#888)
16
+
17
+ ### 7.0.0.beta1 (2021-03-18)
18
+
19
+ * Requires Selenium 4
20
+ * Supports Ruby 3
21
+ * Add support for Microsoft Edge Chromium
22
+ * Remove support for all deprecated functionality
23
+
24
+ ### 6.19.1 (2021-03-17)
25
+
26
+ * Fix bug preventing using Selenium 4
27
+ * Fix bug preventing non-xml characters in attributes (#787)
28
+
29
+ ### 6.19.0 (2021-03-12)
30
+
31
+ * Create custom Watir HTTP Client
32
+ * Require minimum of Selenium 3.142.7
33
+ * Add support for starting browser with :http_client and :service hashes
34
+ * Allow inferring desired browser from Capabilities or Options if browser not specified
35
+ * Deprecate WindowCollection#to_a method
36
+ * Deprecate starting browser with both Capabilities and Options
37
+ * Deprecate starting browser with both URL and Service
38
+ * Deprecate using :desired_capabilities
39
+ * Deprecate starting browser service keywords in top level Hash
40
+ * Deprecate using :remote to start a browser; browser name must be specified
41
+ * Deprecate sending unknown keywords into the top level
42
+ * Fix bug preventing Safari Options from being recognized
43
+ * Fix bug preventing options provided without :remote keyword from being properly recognized (#812, #870)
44
+ * Fix bug preventing :headless from being recognized when :options specified (#692)
45
+
46
+ ### 6.18.0 (2021-02-26)
47
+
48
+ * Implement `WindowCollection` to manage multiple `Window` objects
49
+ * Add support for locating `Window` by `:element`
50
+ * Deprecate locating `Window` by `:index`
51
+ * Deprecate `Select#select_all` in favor of `#select` and an `Array`
52
+ * Implement `Browser#switch_window` (#849)
53
+ * Add support for `Numeric` attribute values to `Waitable`
54
+ * Allow users to specify Selenium 4 in their projects
55
+ * Update stale element handling behavior to match webdriver spec (#905 #909)
56
+ * Implement `Waitable` for `ElementCollection` (#853 #857)
57
+ * Improve performance for nested elements (#843)
58
+ * Less strict version check for `regexp_parser` gem (thanks Pavel Lobashov)
59
+
1
60
  ### 6.17.0 (2020-08-27)
2
61
  * Require Ruby > 2.5
3
62
  * Implement Logger#selenium= to set selenium level from Watir
data/LICENSE CHANGED
@@ -1,8 +1,8 @@
1
1
  (the MIT License)
2
2
 
3
3
  Copyright (c) 2009-2015 Jari Bakken
4
- Copyright (c) 2015-2018 Alex Rodionov, Titus Fortner
5
- Copyright (c) 2018 Justin Ko
4
+ Copyright (c) 2015-2021 Alex Rodionov, Titus Fortner
5
+ Copyright (c) 2018-2021 Justin Ko
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining
8
8
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,10 +3,9 @@
3
3
  Watir Powered By Selenium!
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/watir.svg)](http://badge.fury.io/rb/watir)
6
- [![Travis Status](https://travis-ci.org/watir/watir.svg?branch=master)](https://travis-ci.org/watir/watir)
7
- [![AppVeyor status](https://ci.appveyor.com/api/projects/status/9vbb7pp5p4uyoott/branch/master?svg=true)](https://ci.appveyor.com/project/p0deje/watir)
6
+ [![All Tests](https://github.com/watir/watir/actions/workflows/tests.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/tests.yml)
8
7
  [![Code Climate](https://codeclimate.com/github/watir/watir.svg)](https://codeclimate.com/github/watir/watir)
9
- [![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=master)](https://coveralls.io/github/watir/watir?branch=master)
8
+ [![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=main)](https://coveralls.io/github/watir/watir?branch=main)
10
9
 
11
10
  ## Using Watir
12
11
 
@@ -69,11 +68,11 @@ $ bundle exec rake svg:update
69
68
 
70
69
  ## Specs
71
70
 
72
- #### Travis CI
71
+ #### Github Actions
73
72
 
74
- Watir specs are run on [Travis CI](https://travis-ci.org/watir/watir).
73
+ Watir specs are run with [Github Actions](https://github.com/watir/watir/workflows).
75
74
 
76
- Watir code is tested with 2.3, 2.4 and 2.5 versions in multiple browsers and with multiple configurations.
75
+ Watir code is tested on Linux with latest versions of supported browsers and all active Ruby versions.
77
76
 
78
77
  #### Doctests
79
78
 
@@ -95,7 +94,7 @@ to ensure all paths in their code have tests associated with them.
95
94
 
96
95
  Watir is using [Rubocop](https://github.com/rubocop-hq/rubocop) to ensure a consistent style across the
97
96
  code base. It is run with our minimum supported Ruby version (2.3)
98
- We have some [established exceptions](https://github.com/watir/watir/blob/master/.rubocop.yml)
97
+ We have some [established exceptions](https://github.com/watir/watir/blob/main/.rubocop.yml)
99
98
  that might need to be tweaked for new code submissions. This can be addressed in the PR as necessary.
100
99
 
101
100
  #### Statistics
@@ -107,7 +106,4 @@ on wire calls.
107
106
 
108
107
  ## Copyright
109
108
 
110
- Copyright (c) 2009-2015 Jari Bakken
111
- Copyright (c) 2015-2018 Alex Rodionov, Titus Fortner
112
- Copyright (c) 2018 Justin Ko
113
109
  See LICENSE for details
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ Bundler::GemHelper.install_tasks
5
5
 
6
6
  require 'rspec/core/rake_task'
7
7
  RSpec::Core::RakeTask.new(:spec) do |spec|
8
- spec.rspec_opts = %w[--color --require fuubar --format Fuubar]
8
+ spec.rspec_opts = %w[--color --format doc]
9
9
  spec.pattern = 'spec/**/*_spec.rb'
10
10
  spec.exclude_pattern = 'spec/unit/**/*_spec.rb'
11
11
  end
@@ -25,7 +25,7 @@ end
25
25
 
26
26
  {
27
27
  html: 'https://www.w3.org/TR/html52/single-page.html',
28
- svg: 'http://www.w3.org/TR/SVG2/single-page.html'
28
+ svg: 'https://www.w3.org/TR/2018/CR-SVG2-20180807/single-page.html'
29
29
  }.each do |type, spec_uri|
30
30
  namespace type do
31
31
  spec_path = "support/#{type}.html"
data/lib/watir.rb CHANGED
@@ -2,10 +2,10 @@ require 'selenium-webdriver'
2
2
  require 'time'
3
3
 
4
4
  require 'watir/scroll'
5
- require 'watir/legacy_wait'
6
5
  require 'watir/wait'
7
6
  require 'watir/exception'
8
7
  require 'watir/window'
8
+ require 'watir/window_collection'
9
9
  require 'watir/has_window'
10
10
  require 'watir/adjacent'
11
11
  require 'watir/js_execution'
@@ -13,59 +13,18 @@ require 'watir/alert'
13
13
  require 'watir/js_snippets'
14
14
  require 'watir/container'
15
15
  require 'watir/cookies'
16
+ require 'watir/http_client'
16
17
  require 'watir/capabilities'
17
18
  require 'watir/navigation'
18
19
  require 'watir/browser'
19
20
  require 'watir/screenshot'
20
21
  require 'watir/after_hooks'
21
22
  require 'watir/logger'
23
+ require 'watir/version'
22
24
 
23
25
  module Watir
24
- @relaxed_locate = true
25
-
26
26
  class << self
27
- attr_writer :relaxed_locate, :always_locate, :default_timeout, :prefer_css
28
-
29
- #
30
- # Whether or not Watir should wait for an element to be found or present
31
- # before taking an action.
32
- # Defaults to true.
33
- #
34
-
35
- def relaxed_locate?
36
- @relaxed_locate
37
- end
38
-
39
- #
40
- # Whether or not Watir should re-locate a stale Element on use.
41
- #
42
-
43
- def always_locate?
44
- always_locate_message
45
- true
46
- end
47
-
48
- def always_locate_message
49
- msg = 'Watir#always_locate'
50
- repl_msg = 'Element#stale? or Element#wait_until(&:stale?) if needed for flow control'
51
- Watir.logger.deprecate msg, repl_msg, ids: [:always_locate]
52
- end
53
-
54
- #
55
- # Whether or not Watir should prefer CSS when translating the Watir selector to Selenium.
56
- #
57
-
58
- def prefer_css?
59
- prefer_css_message
60
- false
61
- end
62
-
63
- def prefer_css_message
64
- msg = 'Watir#prefer_css'
65
- repl_msg = 'watir_css gem - https://github.com/watir/watir_css'
66
-
67
- Watir.logger.deprecate msg, repl_msg, ids: [:prefer_css]
68
- end
27
+ attr_writer :default_timeout
69
28
 
70
29
  #
71
30
  # Default wait time for wait methods.
@@ -117,7 +117,7 @@ module Watir
117
117
  el = Watir.element_class_for(opt[:tag_name] || '').new(self, opt)
118
118
  el.is_a?(Input) ? el.to_subtype : el
119
119
  elsif opt[:tag_name]
120
- Object.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
120
+ Watir.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
121
121
  else
122
122
  HTMLElementCollection.new(self, opt)
123
123
  end
data/lib/watir/alert.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Watir
2
2
  class Alert
3
- include EventuallyPresent
4
3
  include Waitable
5
4
  include Exception
6
5
 
@@ -84,6 +83,7 @@ module Watir
84
83
  false
85
84
  end
86
85
  alias present? exists?
86
+ alias exist? exists?
87
87
 
88
88
  #
89
89
  # @api private
@@ -103,13 +103,9 @@ module Watir
103
103
  end
104
104
 
105
105
  def wait_for_exists
106
- return assert_exists unless Watir.relaxed_locate?
107
-
108
- begin
109
- wait_until(message: 'waiting for alert', &:exists?)
110
- rescue Wait::TimeoutError
111
- raise UnknownObjectException, 'unable to locate alert'
112
- end
106
+ wait_until(message: 'waiting for alert', &:exists?)
107
+ rescue Wait::TimeoutError
108
+ raise UnknownObjectException, 'unable to locate alert'
113
109
  end
114
110
  end # Alert
115
111
  end # Watir