watir 6.15.1 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +5 -5
  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/chrome.yml +34 -0
  6. data/.github/workflows/edge.yml +28 -0
  7. data/.github/workflows/firefox.yml +35 -0
  8. data/.github/workflows/ie.yml +24 -0
  9. data/.github/workflows/safari.yml +27 -0
  10. data/.github/workflows/unit.yml +52 -0
  11. data/.rubocop.yml +30 -108
  12. data/.rubocop_todo.yml +36 -0
  13. data/CHANGES.md +144 -0
  14. data/Gemfile +3 -1
  15. data/LICENSE +2 -1
  16. data/README.md +6 -9
  17. data/Rakefile +11 -5
  18. data/lib/watir/adjacent.rb +8 -10
  19. data/lib/watir/after_hooks.rb +6 -3
  20. data/lib/watir/alert.rb +4 -8
  21. data/lib/watir/attribute_helper.rb +3 -1
  22. data/lib/watir/browser.rb +35 -23
  23. data/lib/watir/capabilities.rb +123 -106
  24. data/lib/watir/cell_container.rb +4 -4
  25. data/lib/watir/container.rb +4 -26
  26. data/lib/watir/cookies.rb +3 -1
  27. data/lib/watir/element_collection.rb +65 -22
  28. data/lib/watir/elements/checkbox.rb +4 -4
  29. data/lib/watir/elements/date_field.rb +8 -5
  30. data/lib/watir/elements/date_time_field.rb +8 -5
  31. data/lib/watir/elements/element.rb +163 -118
  32. data/lib/watir/elements/file_field.rb +5 -4
  33. data/lib/watir/elements/font.rb +5 -4
  34. data/lib/watir/elements/hidden.rb +4 -4
  35. data/lib/watir/elements/html_elements.rb +444 -446
  36. data/lib/watir/elements/iframe.rb +15 -15
  37. data/lib/watir/elements/link.rb +0 -9
  38. data/lib/watir/elements/radio.rb +14 -9
  39. data/lib/watir/elements/select.rb +65 -91
  40. data/lib/watir/elements/svg_elements.rb +96 -96
  41. data/lib/watir/elements/table.rb +1 -1
  42. data/lib/watir/elements/text_field.rb +4 -4
  43. data/lib/watir/generator/base/generator.rb +4 -4
  44. data/lib/watir/generator/base/spec_extractor.rb +4 -4
  45. data/lib/watir/generator/base/visitor.rb +0 -29
  46. data/lib/watir/generator/html/generator.rb +2 -1
  47. data/lib/watir/has_window.rb +22 -18
  48. data/lib/watir/http_client.rb +9 -0
  49. data/lib/watir/js_execution.rb +3 -3
  50. data/lib/watir/js_snippets/getElementTags.js +3 -0
  51. data/lib/watir/js_snippets/isElementInViewport.js +20 -0
  52. data/lib/watir/js_snippets.rb +2 -2
  53. data/lib/watir/locators/button/{validator.rb → matcher.rb} +4 -4
  54. data/lib/watir/locators/button/selector_builder/xpath.rb +4 -15
  55. data/lib/watir/locators/cell/selector_builder.rb +3 -0
  56. data/lib/watir/locators/element/locator.rb +42 -171
  57. data/lib/watir/locators/element/matcher.rb +115 -0
  58. data/lib/watir/locators/element/selector_builder/xpath.rb +81 -70
  59. data/lib/watir/locators/element/selector_builder.rb +50 -34
  60. data/lib/watir/locators/option/matcher.rb +24 -0
  61. data/lib/watir/locators/option/selector_builder/xpath.rb +37 -0
  62. data/lib/watir/locators/option/selector_builder.rb +8 -0
  63. data/lib/watir/locators/row/selector_builder.rb +5 -5
  64. data/lib/watir/locators/text_area/selector_builder/xpath.rb +2 -2
  65. data/lib/watir/locators/text_area/selector_builder.rb +0 -14
  66. data/lib/watir/locators/text_field/matcher.rb +39 -0
  67. data/lib/watir/locators/text_field/selector_builder/xpath.rb +3 -1
  68. data/lib/watir/locators.rb +22 -24
  69. data/lib/watir/logger.rb +6 -90
  70. data/lib/watir/radio_set.rb +33 -35
  71. data/lib/watir/row_container.rb +4 -4
  72. data/lib/watir/screenshot.rb +2 -8
  73. data/lib/watir/scroll.rb +70 -0
  74. data/lib/watir/user_editable.rb +13 -2
  75. data/lib/watir/version.rb +1 -1
  76. data/lib/watir/wait/timer.rb +1 -1
  77. data/lib/watir/wait.rb +6 -74
  78. data/lib/watir/window.rb +47 -26
  79. data/lib/watir/window_collection.rb +79 -0
  80. data/lib/watir-webdriver.rb +1 -1
  81. data/lib/watir.rb +5 -51
  82. data/lib/watirspec/guards.rb +2 -2
  83. data/lib/watirspec/implementation.rb +7 -5
  84. data/lib/watirspec/rake_tasks.rb +2 -0
  85. data/lib/watirspec/remote_server.rb +2 -6
  86. data/lib/watirspec/runner.rb +6 -2
  87. data/lib/watirspec/server.rb +2 -2
  88. data/lib/watirspec.rb +6 -3
  89. data/spec/locator_spec_helper.rb +58 -14
  90. data/spec/spec_helper.rb +14 -34
  91. data/spec/unit/capabilities_spec.rb +654 -21
  92. data/spec/unit/element_locator_spec.rb +46 -591
  93. data/spec/unit/match_elements/button_spec.rb +67 -0
  94. data/spec/unit/match_elements/element_spec.rb +428 -0
  95. data/spec/unit/match_elements/text_field_spec.rb +79 -0
  96. data/spec/unit/selector_builder/anchor_spec.rb +51 -0
  97. data/spec/unit/selector_builder/button_spec.rb +207 -0
  98. data/spec/unit/selector_builder/cell_spec.rb +63 -0
  99. data/spec/unit/selector_builder/element_spec.rb +798 -0
  100. data/spec/unit/selector_builder/row_spec.rb +111 -0
  101. data/spec/unit/selector_builder/text_field_spec.rb +188 -0
  102. data/spec/unit/selector_builder/textarea_spec.rb +25 -0
  103. data/spec/unit/unit_helper.rb +2 -4
  104. data/spec/watirspec/after_hooks_spec.rb +76 -97
  105. data/spec/watirspec/alert_spec.rb +57 -84
  106. data/spec/watirspec/browser_spec.rb +221 -240
  107. data/spec/watirspec/cookies_spec.rb +74 -64
  108. data/spec/watirspec/drag_and_drop_spec.rb +23 -37
  109. data/spec/watirspec/element_hidden_spec.rb +1 -2
  110. data/spec/watirspec/elements/area_spec.rb +1 -5
  111. data/spec/watirspec/elements/button_spec.rb +6 -13
  112. data/spec/watirspec/elements/buttons_spec.rb +1 -1
  113. data/spec/watirspec/elements/checkbox_spec.rb +12 -0
  114. data/spec/watirspec/elements/checkboxes_spec.rb +1 -1
  115. data/spec/watirspec/elements/collections_spec.rb +49 -0
  116. data/spec/watirspec/elements/date_field_spec.rb +9 -3
  117. data/spec/watirspec/elements/date_time_field_spec.rb +11 -14
  118. data/spec/watirspec/elements/dd_spec.rb +3 -4
  119. data/spec/watirspec/elements/del_spec.rb +10 -12
  120. data/spec/watirspec/elements/div_spec.rb +91 -104
  121. data/spec/watirspec/elements/divs_spec.rb +2 -2
  122. data/spec/watirspec/elements/dl_spec.rb +4 -12
  123. data/spec/watirspec/elements/element_spec.rb +311 -191
  124. data/spec/watirspec/elements/elements_spec.rb +9 -1
  125. data/spec/watirspec/elements/filefield_spec.rb +27 -54
  126. data/spec/watirspec/elements/form_spec.rb +9 -13
  127. data/spec/watirspec/elements/forms_spec.rb +3 -5
  128. data/spec/watirspec/elements/frame_spec.rb +22 -30
  129. data/spec/watirspec/elements/iframe_spec.rb +30 -33
  130. data/spec/watirspec/elements/iframes_spec.rb +2 -2
  131. data/spec/watirspec/elements/ins_spec.rb +10 -12
  132. data/spec/watirspec/elements/labels_spec.rb +1 -1
  133. data/spec/watirspec/elements/link_spec.rb +24 -15
  134. data/spec/watirspec/elements/links_spec.rb +11 -4
  135. data/spec/watirspec/elements/option_spec.rb +15 -17
  136. data/spec/watirspec/elements/radio_spec.rb +11 -14
  137. data/spec/watirspec/elements/select_list_spec.rb +379 -244
  138. data/spec/watirspec/elements/span_spec.rb +12 -14
  139. data/spec/watirspec/elements/spans_spec.rb +1 -1
  140. data/spec/watirspec/elements/strong_spec.rb +1 -1
  141. data/spec/watirspec/elements/table_nesting_spec.rb +31 -34
  142. data/spec/watirspec/elements/table_spec.rb +11 -14
  143. data/spec/watirspec/elements/tbody_spec.rb +10 -12
  144. data/spec/watirspec/elements/td_spec.rb +4 -6
  145. data/spec/watirspec/elements/text_field_spec.rb +7 -5
  146. data/spec/watirspec/elements/tr_spec.rb +5 -16
  147. data/spec/watirspec/html/forms_with_input_elements.html +12 -0
  148. data/spec/watirspec/html/iframes.html +3 -0
  149. data/spec/watirspec/html/non_control_elements.html +9 -4
  150. data/spec/watirspec/html/obscured.html +3 -1
  151. data/spec/watirspec/html/right_click.html +12 -0
  152. data/spec/watirspec/html/scroll.html +15 -0
  153. data/spec/watirspec/html/special_chars.html +3 -0
  154. data/spec/watirspec/html/sticky_elements.html +10 -0
  155. data/spec/watirspec/html/wait.html +6 -6
  156. data/spec/watirspec/html/window_switching.html +10 -0
  157. data/spec/watirspec/scroll_spec.rb +136 -0
  158. data/spec/watirspec/special_chars_spec.rb +10 -0
  159. data/spec/watirspec/support/rspec_matchers.rb +19 -26
  160. data/spec/watirspec/user_editable_spec.rb +26 -28
  161. data/spec/watirspec/wait_spec.rb +151 -202
  162. data/spec/watirspec/window_switching_spec.rb +366 -252
  163. data/spec/watirspec_helper.rb +57 -44
  164. data/support/doctest_helper.rb +0 -2
  165. data/watir.gemspec +9 -13
  166. metadata +79 -81
  167. data/.travis.yml +0 -82
  168. data/appveyor.yml +0 -13
  169. data/lib/watir/elements/area.rb +0 -10
  170. data/lib/watir/legacy_wait.rb +0 -122
  171. data/lib/watir/locators/button/locator.rb +0 -32
  172. data/lib/watir/locators/cell/locator.rb +0 -13
  173. data/lib/watir/locators/element/validator.rb +0 -11
  174. data/lib/watir/locators/row/locator.rb +0 -13
  175. data/lib/watir/locators/text_field/locator.rb +0 -31
  176. data/lib/watir/locators/text_field/validator.rb +0 -13
  177. data/spec/implementation_spec.rb +0 -24
  178. data/spec/unit/anchor_locator_spec.rb +0 -68
  179. data/spec/unit/container_spec.rb +0 -35
  180. data/spec/unit/logger_spec.rb +0 -83
  181. data/spec/watirspec/click_spec.rb +0 -19
  182. data/spec/watirspec/html/hover.html +0 -12
  183. data/spec/watirspec/relaxed_locate_spec.rb +0 -108
  184. data/spec/watirspec/selector_builder/button_spec.rb +0 -250
  185. data/spec/watirspec/selector_builder/cell_spec.rb +0 -92
  186. data/spec/watirspec/selector_builder/element_spec.rb +0 -628
  187. data/spec/watirspec/selector_builder/row_spec.rb +0 -148
  188. data/spec/watirspec/selector_builder/text_spec.rb +0 -199
  189. data/support/appveyor.cmd +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8c5ac0f3aeeeec1422ef300b30ffc292113a053e
4
- data.tar.gz: a12b41e42257e86152ffb7e8b3c4e5777e657acf
2
+ SHA256:
3
+ metadata.gz: e8a3f59dcd9f56e63cf532cc2ba8c9605e8ffad78bd59d3f104e6677c9f5e20c
4
+ data.tar.gz: 1f1cb55a4270ebdce957f4a8dc33e76403eef391ed59e3179f4f6772595d3f59
5
5
  SHA512:
6
- metadata.gz: 057b9175188bef9121cb6bd5970db44ef90119e57e0c910c4fcec06762f66b9a8f8eebccc627826da31ba40bba0cf999fcf4110d07273b120879f3e93a3f7112
7
- data.tar.gz: c7e93f0e181b4c11d3b20d7bd91e5a9f3fb4bb0fe8c0a98ad49a8daee676cf8fa35cb41c5d622714c6ee4c5dfc991b6dfbf010bd885b132e55d25d4d7df8c276
6
+ metadata.gz: 488c6b2f0a93a20390350da8b95025f9e33d2be9bb7bd84b130808906bca067860b3db6908c59961ef3914ccbb682d2d15d2418656749f8916a1416fa8c6cbb5
7
+ data.tar.gz: 64bc4a7b36c294a75ceb86c3fea21809dbefc158cbca08ba72dc6bf7b3b64d76f04b5c02130a8cce15e78d5156659cb317ee397e27d93d06e537e804695e425b
@@ -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,34 @@
1
+ name: Chrome Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ ruby: [ 2.6, 3.0 ]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: ./.github/actions/setup-linux
19
+ if: matrix.os == 'ubuntu-latest'
20
+ - uses: ./.github/actions/install-chrome
21
+ if: matrix.os == 'ubuntu-latest'
22
+ - run: |
23
+ echo "COVERAGE=true" >> $GITHUB_ENV
24
+ if: |
25
+ matrix.os == 'ubuntu-latest' ||
26
+ matrix.os == 'macos-latest'
27
+ - uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ - run: bundle install
31
+ - run: |
32
+ bundle exec rake spec:chrome
33
+ env:
34
+ DISPLAY: :99
@@ -0,0 +1,28 @@
1
+ name: Edge Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [macos-latest, windows-latest]
15
+ ruby: [ 2.6, 3.0 ]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - run: |
19
+ echo "COVERAGE=true" >> $GITHUB_ENV
20
+ if: matrix.os == 'macos-latest'
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ - run: bundle install
25
+ - run: |
26
+ bundle exec rake spec:edge
27
+ env:
28
+ DISPLAY: :99
@@ -0,0 +1,35 @@
1
+ name: Firefox Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ ruby: [ 2.6, 3.0 ]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: ./.github/actions/setup-linux
19
+ if: matrix.os == 'ubuntu-latest'
20
+ - uses: browser-actions/setup-firefox@latest
21
+ with:
22
+ firefox-version: '93.0'
23
+ - run: |
24
+ echo "COVERAGE=true" >> $GITHUB_ENV
25
+ if: |
26
+ matrix.os == 'ubuntu-latest' ||
27
+ matrix.os == 'macos-latest'
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - run: bundle install
32
+ - run: |
33
+ bundle exec rake spec:firefox
34
+ env:
35
+ DISPLAY: :99
@@ -0,0 +1,24 @@
1
+ name: IE Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: windows-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: [ 2.6, 3.0 ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - run: bundle install
21
+ - run: |
22
+ bundle exec rake spec:ie
23
+ env:
24
+ DISPLAY: :99
@@ -0,0 +1,27 @@
1
+ name: Safari Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: macos-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: [ 2.6, 3.0 ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ./.github/actions/enable-safari
18
+ - run: |
19
+ echo "COVERAGE=true" >> $GITHUB_ENV
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - run: bundle install
24
+ - run: |
25
+ bundle exec rake spec:safari
26
+ env:
27
+ DISPLAY: :99
@@ -0,0 +1,52 @@
1
+ name: Unit 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
+
23
+ unit-test:
24
+ name: Unit Tests
25
+ runs-on: ubuntu-latest
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ ruby: ['2.6', '2.7', '3.0']
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ - run: bundle install
36
+ - uses: ./.github/actions/install-chrome
37
+ - uses: ./.github/actions/setup-linux
38
+ - run: |
39
+ bundle exec rake spec:unit
40
+ env:
41
+ DISPLAY: :99
42
+
43
+ linter-test:
44
+ name: Rubocop Tests
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - uses: actions/checkout@v2
48
+ - uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: 2.6
51
+ - run: bundle install
52
+ - run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -1,46 +1,31 @@
1
- # Offense count: 144
2
- # Cop supports --auto-correct.
3
- # Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
4
- Layout/EmptyLineBetweenDefs:
5
- Exclude:
6
- - 'lib/watir/elements/html_elements.rb'
7
- - 'lib/watir/elements/svg_elements.rb'
1
+ inherit_from: .rubocop_todo.yml
8
2
 
9
- # Offense count: 2
10
- # Cop supports --auto-correct.
11
- Layout/EmptyLines:
3
+ AllCops:
4
+ TargetRubyVersion: 2.6.8
5
+ NewCops: enable
12
6
  Exclude:
13
7
  - 'lib/watir/elements/html_elements.rb'
14
8
  - 'lib/watir/elements/svg_elements.rb'
15
9
 
16
- # Offense count: 2
17
- # Cop supports --auto-correct.
18
- # Configuration parameters: EnforcedStyle.
19
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
20
- Layout/EmptyLinesAroundModuleBody:
21
- Exclude:
22
- - 'lib/watir/elements/html_elements.rb'
23
- - 'lib/watir/elements/svg_elements.rb'
10
+ Layout/LineLength:
11
+ Max: 120
24
12
 
25
- # Offense count: 85
26
- # Cop supports --auto-correct.
27
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
28
- # SupportedStyles: space, no_space, compact
29
- # SupportedStylesForEmptyBraces: space, no_space
30
13
  Layout/SpaceInsideHashLiteralBraces:
31
14
  EnforcedStyle: no_space
32
15
 
33
- # Offense count: 1
34
- Lint/HandleExceptions:
35
- Exclude:
36
- - 'lib/watirspec.rb'
37
-
38
16
  Lint/UnifiedInteger:
39
17
  Exclude:
40
18
  - 'lib/watir/locators/element/selector_builder.rb'
41
19
 
42
- # Configuration parameters: CountComments, ExcludedMethods.
43
- # ExcludedMethods: refine
20
+ # Default: 17
21
+ Metrics/AbcSize:
22
+ Max: 22
23
+ Exclude:
24
+ - 'lib/watir/locators/element/selector_builder.rb'
25
+ - 'lib/watir/locators/element/selector_builder/*.rb'
26
+ - 'lib/watir/generator/base/generator.rb'
27
+ - 'spec/locator_spec_helper.rb'
28
+
44
29
  Metrics/BlockLength:
45
30
  Exclude:
46
31
  - 'spec/**/*'
@@ -48,26 +33,11 @@ Metrics/BlockLength:
48
33
  - 'watir.gemspec'
49
34
  - 'Rakefile'
50
35
 
51
- ## Configuration parameters: CountComments.
52
- Metrics/ModuleLength:
53
- Exclude:
54
- - 'lib/watir/elements/html_elements.rb'
55
- - 'lib/watir/elements/svg_elements.rb'
56
-
57
- # Configuration parameters: CountComments.
58
- Metrics/MethodLength:
59
- Max: 18
60
- Exclude:
61
- - 'lib/watir/locators/element/selector_builder.rb'
62
- - 'lib/watir/locators/element/selector_builder/xpath.rb'
63
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
64
-
65
- # Configuration parameters: CountComments.
66
36
  Metrics/ClassLength:
67
- Max: 95
37
+ Max: 93
68
38
  Exclude:
69
39
  - 'lib/watir/capabilities.rb'
70
- - 'lib/watir/locators/element/locator.rb'
40
+ - 'lib/watir/locators/element/matcher.rb'
71
41
  - 'lib/watir/locators/element/selector_builder.rb'
72
42
  - 'lib/watir/locators/element/selector_builder/xpath.rb'
73
43
  - 'lib/watir/browser.rb'
@@ -75,42 +45,26 @@ Metrics/ClassLength:
75
45
  - 'lib/watir/elements/element.rb'
76
46
  - 'lib/watir/elements/select.rb'
77
47
  - 'lib/watir/generator/base/spec_extractor.rb'
48
+ - 'lib/watir/element_collection.rb'
78
49
 
79
- Metrics/PerceivedComplexity:
80
- Max: 10
81
-
50
+ # Default: 7
82
51
  Metrics/CyclomaticComplexity:
83
- Max: 8
52
+ Max: 9
84
53
  Exclude:
85
- - 'lib/watir/locators/element/selector_builder.rb'
54
+ - 'lib/watir/locators/element/selector_builder.rb'
86
55
 
87
- Metrics/AbcSize:
88
- Max: 20
56
+ # Configuration parameters: CountComments.
57
+ Metrics/MethodLength:
58
+ Max: 18
89
59
  Exclude:
90
60
  - 'lib/watir/locators/element/selector_builder.rb'
91
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
92
61
  - 'lib/watir/locators/element/selector_builder/xpath.rb'
93
- - 'lib/watir/locators/element/locator.rb'
94
- - 'lib/watir/generator/base/generator.rb'
95
- - 'lib/watir/generator/base/visitor.rb'
96
-
97
- # TODO: fix with Watir 7
98
- # Configuration parameters: CountKeywordArgs.
99
- Metrics/ParameterLists:
100
- Exclude:
101
- - 'lib/watir/wait.rb'
62
+ - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
102
63
 
103
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
104
- # URISchemes: http, https
105
- Metrics/LineLength:
106
- Max: 120
64
+ # Default: 8
65
+ Metrics/PerceivedComplexity:
66
+ Max: 10
107
67
 
108
- # Cop supports --auto-correct.
109
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
110
- # SupportedStyles: line_count_based, semantic, braces_for_chaining
111
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
112
- # FunctionalMethods: let, let!, subject, watch
113
- # IgnoredMethods: lambda, proc, it
114
68
  Style/BlockDelimiters:
115
69
  EnforcedStyle: braces_for_chaining
116
70
 
@@ -120,44 +74,12 @@ Style/CommentedKeyword:
120
74
  Style/DoubleNegation:
121
75
  Enabled: false
122
76
 
123
- ## Configuration parameters: AllowedVariables.
124
77
  Style/GlobalVars:
125
78
  AllowedVariables:
126
79
  - $browser
127
80
 
128
- Style/RegexpLiteral:
129
- Exclude:
130
- - 'spec/watirspec/selector_builder/element_spec.rb'
131
-
132
- ### Cop supports --auto-correct.
133
- ### Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
134
- ## SupportedStyles: single_quotes, double_quotes
135
- Style/StringLiterals:
136
- Exclude:
137
- - 'lib/watir/elements/html_elements.rb'
138
- - 'lib/watir/elements/svg_elements.rb'
139
-
140
- Style/MethodCallWithoutArgsParentheses:
141
- Enabled: false
142
-
143
- # TODO: I can't tell if this applies
144
- ## Configuration parameters: EnforcedStyle.
145
- ## SupportedStyles: annotated, template, unannotated
146
- Style/FormatStringToken:
147
- Exclude:
148
- - 'lib/watir/browser.rb'
149
- - 'lib/watir/locators/text_field/selector_builder/xpath.rb'
150
- - 'lib/watir/window.rb'
151
-
152
- Style/Documentation:
81
+ Style/HashEachMethods:
153
82
  Enabled: false
154
83
 
155
- # Cop supports --auto-correct.
156
- # Configuration parameters: EnforcedStyle.
157
- # SupportedStyles: when_needed, always, never
158
- Style/FrozenStringLiteralComment:
84
+ Style/OptionalBooleanParameter:
159
85
  Enabled: false
160
-
161
- Naming/FileName:
162
- Exclude:
163
- - 'lib/watir-webdriver.rb'
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,147 @@
1
+ ### 7.1.0 (2021-11-15)
2
+
3
+ * Add automatic scroll to `Element#click` with method parameters to ensure element is in viewport
4
+ * Provide `:scroll_to` parameter for element methods implemented with `Actions` class (thanks osadasami #948, #949)
5
+ * Allow `:scroll_to` parameter to accept `nil` argument to avoid automatic scrolling
6
+ * Implement `Element#in_viewport?`
7
+ * Fix but where `Scroll#to` for `Browser` with `:center` argument did not scroll to center of page
8
+ * Change `Element#obscured?` to only scroll when element out of viewport and then scroll to bottom instead of top
9
+
10
+ ### 7.0.0 (2021-10-18)
11
+
12
+ * Requires Selenium 4.0.0+
13
+ * Requires Ruby 2.6+
14
+ * Implement `Window#minimize`
15
+ * Implement `Window#full_screen`
16
+
17
+ ### 7.0.0.beta5 (2021-08-02)
18
+
19
+ * Add support for passing in Proxy and proxy Hash to Capabilities (#933)
20
+ * Trigger change event when setting values on date and date-time fields (#938)
21
+ * Allow user to obtain Capabilities instance from Browser instance
22
+
23
+ ### 7.0.0.beta4 (2021-05-29)
24
+
25
+ * Fix Bug in using negative class names within a collection (#934)
26
+
27
+ ### 7.0.0.beta3 (2021-05-05)
28
+
29
+ * Fix Bug preventing proper use of vendor extension capabilities
30
+ * Changed how timeouts are supported in Watir Capabilities (#932)
31
+ * Changed the default Alert Behavior not to automatically get dismissed when an exception happens (#931)
32
+
33
+ ### 7.0.0.beta2 (2021-03-28)
34
+
35
+ * Replace Watir Logger implementation with Selenium Logger subclass
36
+ * Change Watir Guards to use Selenium's new Guards. Tests run as pending when guarded.
37
+ * Implement `#set` as standard interface for each Input Element (#405)
38
+ * Implement `Element#set` to take correct `#set` behavior based on evaluated element (#664)
39
+ * Optimize Performance for Select Lists (#846)
40
+ * Allow user to set values on Select List exclusively by `:label`, `:text`, or `:value` (#846)
41
+ * Allow user to check if option selected in Select List by `:label`, `:text`, or `:value` (#929)
42
+ * Implement `Window#restore!` to return to original Window and close all others (#923)
43
+ * Minor performance improvement for iterating over windows (#923)
44
+ * Implement `Browser#closed?`; same as `Browser#exists?` without the Windows checks (#923)
45
+ * Update methods that use Selenium's Actions class to scroll element into view before acting (#847)
46
+ * Fix bug for `:text` locator with `Regexp` value based on whitespace (#924)
47
+ * Remove executing after hooks when changing frames (#888)
48
+
49
+ ### 7.0.0.beta1 (2021-03-18)
50
+
51
+ * Requires Selenium 4
52
+ * Supports Ruby 3
53
+ * Add support for Microsoft Edge Chromium
54
+ * Remove support for all deprecated functionality
55
+
56
+ ### 6.19.1 (2021-03-17)
57
+
58
+ * Fix bug preventing using Selenium 4
59
+ * Fix bug preventing non-xml characters in attributes (#787)
60
+
61
+ ### 6.19.0 (2021-03-12)
62
+
63
+ * Create custom Watir HTTP Client
64
+ * Require minimum of Selenium 3.142.7
65
+ * Add support for starting browser with :http_client and :service hashes
66
+ * Allow inferring desired browser from Capabilities or Options if browser not specified
67
+ * Deprecate WindowCollection#to_a method
68
+ * Deprecate starting browser with both Capabilities and Options
69
+ * Deprecate starting browser with both URL and Service
70
+ * Deprecate using :desired_capabilities
71
+ * Deprecate starting browser service keywords in top level Hash
72
+ * Deprecate using :remote to start a browser; browser name must be specified
73
+ * Deprecate sending unknown keywords into the top level
74
+ * Fix bug preventing Safari Options from being recognized
75
+ * Fix bug preventing options provided without :remote keyword from being properly recognized (#812, #870)
76
+ * Fix bug preventing :headless from being recognized when :options specified (#692)
77
+
78
+ ### 6.18.0 (2021-02-26)
79
+
80
+ * Implement `WindowCollection` to manage multiple `Window` objects
81
+ * Add support for locating `Window` by `:element`
82
+ * Deprecate locating `Window` by `:index`
83
+ * Deprecate `Select#select_all` in favor of `#select` and an `Array`
84
+ * Implement `Browser#switch_window` (#849)
85
+ * Add support for `Numeric` attribute values to `Waitable`
86
+ * Allow users to specify Selenium 4 in their projects
87
+ * Update stale element handling behavior to match webdriver spec (#905 #909)
88
+ * Implement `Waitable` for `ElementCollection` (#853 #857)
89
+ * Improve performance for nested elements (#843)
90
+ * Less strict version check for `regexp_parser` gem (thanks Pavel Lobashov)
91
+
92
+ ### 6.17.0 (2020-08-27)
93
+ * Require Ruby > 2.5
94
+ * Implement Logger#selenium= to set selenium level from Watir
95
+ * Implement FileField#upload
96
+ * Fix bug with staleness handling in #exist and #present? (#853 & #852)
97
+ * Fix bug when locating elements by text with RegExp (#866 #871)
98
+ * Implement modifiers for `Element#right_click` (thanks Lakshya Kapoor #861)
99
+ * Updated locator code to adhere to spec on what attributes are case sensitive (#507 #856)
100
+ * Fix locating bug when iframe is nested under another element (thanks Matthew Mazaika #885 #886)
101
+ * Deprecate Element#scroll_into_view in favor of the new Scroll methods (#884)
102
+ * Fix threading bugs by allowing each Browser instance its own Timer (#881)
103
+ * Allow adjacent locators to return Input subtype when applicable (#878)
104
+ * Removed unnecessary reference to rubyforge (thanks olleolleolle #874)
105
+ * Removed deprecated Selenium classes (thanks joesho112358 #867)
106
+ * Add support for :service parameter for initializing Browser
107
+
108
+ ### 6.16.5 (2018-12-25)
109
+
110
+ * Fix bug with nested elements using scopes (#842)
111
+
112
+ ### 6.16.4 (2018-12-24)
113
+
114
+ * Minor adjustments to support locator extensions
115
+
116
+ ### 6.16.3 (2018-12-24)
117
+
118
+ * Minor adjustments to support locator extensions
119
+
120
+ ### 6.16.2 (2018-12-24)
121
+
122
+ * Fix bug merging scope when locating nested elements with css locator (#841)
123
+ * Fix bug with IFrame#to_subtype
124
+ * Improve performance for nested frames
125
+
126
+ ### 6.16.1 (2018-12-23)
127
+
128
+ * Improve collection performance with JavaScript (thanks Lucas Tierney)
129
+ * Update deprecation warnings
130
+ * Improve performance when using previously located elements
131
+
132
+ ### 6.16.0 (2018-12-16)
133
+
134
+ * Fix bug that did not re-locate Stale elements when taking an action on them (#814)
135
+ * Implement `Element#cache=` to assign otherwise located Selenium Element to `Element`
136
+ * Allow `:class` and `:class_name` locators to be used at the same time
137
+ * Allow `:class` locator with empty `Array` value to find all elements without a `class` attribute
138
+ * Fix bug that forced nested elements to wait when calling predicate methods (#827)
139
+ * Locator filtering behavior and Validate class moved into new `Matcher` classes
140
+ * Selector is built on Element initialization rather than during location
141
+ * Allow some nested elements to be located with a single XPath call
142
+ * Merge p0deje's watir-scroll gem functionality directly into Watir
143
+ * Fix bug with `#obscured?` for non-interactive elements (#818)
144
+
1
145
  ### 6.15.1 (2018-12-04)
2
146
 
3
147
  * Locator value type check error message now returns array of allowed class types
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'webidl', path: File.expand_path('../webidl') if ENV['LOCAL_WEBIDL']
4
4
 
5
5
  gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb') if ENV['LOCAL_SELENIUM']
6
6
 
7
+ gem 'ffi' if Gem.win_platform? # For selenium-webdriver on Windows
8
+
7
9
  # Specify your gem's dependencies in watir.gemspec
8
10
  gemspec
data/LICENSE CHANGED
@@ -1,7 +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
4
+ Copyright (c) 2015-2021 Alex Rodionov, Titus Fortner
5
+ Copyright (c) 2018-2021 Justin Ko
5
6
 
6
7
  Permission is hereby granted, free of charge, to any person obtaining
7
8
  a copy of this software and associated documentation files (the