watir 7.0.0 → 7.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/chrome.yml +29 -16
  3. data/.github/workflows/edge.yml +19 -11
  4. data/.github/workflows/firefox.yml +28 -16
  5. data/.github/workflows/ie.yml +13 -7
  6. data/.github/workflows/safari.yml +22 -11
  7. data/.github/workflows/unit.yml +31 -23
  8. data/.rubocop.yml +33 -13
  9. data/.rubocop_todo.yml +7 -26
  10. data/CHANGES.md +33 -0
  11. data/Gemfile +6 -1
  12. data/LICENSE +2 -2
  13. data/README.md +15 -11
  14. data/Rakefile +9 -7
  15. data/lib/watir/adjacent.rb +3 -1
  16. data/lib/watir/after_hooks.rb +5 -3
  17. data/lib/watir/alert.rb +2 -0
  18. data/lib/watir/aliases.rb +2 -0
  19. data/lib/watir/attribute_helper.rb +4 -2
  20. data/lib/watir/browser.rb +10 -14
  21. data/lib/watir/capabilities.rb +53 -33
  22. data/lib/watir/cell_container.rb +2 -0
  23. data/lib/watir/container.rb +2 -0
  24. data/lib/watir/cookies.rb +5 -5
  25. data/lib/watir/element_collection.rb +3 -1
  26. data/lib/watir/elements/button.rb +2 -0
  27. data/lib/watir/elements/cell.rb +2 -0
  28. data/lib/watir/elements/checkbox.rb +2 -0
  29. data/lib/watir/elements/date_field.rb +2 -0
  30. data/lib/watir/elements/date_time_field.rb +2 -0
  31. data/lib/watir/elements/dlist.rb +3 -1
  32. data/lib/watir/elements/element.rb +68 -118
  33. data/lib/watir/elements/file_field.rb +2 -0
  34. data/lib/watir/elements/font.rb +2 -0
  35. data/lib/watir/elements/form.rb +2 -0
  36. data/lib/watir/elements/hidden.rb +2 -0
  37. data/lib/watir/elements/iframe.rb +2 -0
  38. data/lib/watir/elements/image.rb +2 -0
  39. data/lib/watir/elements/input.rb +2 -0
  40. data/lib/watir/elements/link.rb +2 -0
  41. data/lib/watir/elements/list.rb +2 -0
  42. data/lib/watir/elements/option.rb +2 -0
  43. data/lib/watir/elements/radio.rb +2 -0
  44. data/lib/watir/elements/row.rb +2 -0
  45. data/lib/watir/elements/select.rb +2 -0
  46. data/lib/watir/elements/table.rb +3 -1
  47. data/lib/watir/elements/table_cell.rb +2 -0
  48. data/lib/watir/elements/table_row.rb +2 -0
  49. data/lib/watir/elements/table_section.rb +2 -0
  50. data/lib/watir/elements/text_area.rb +2 -0
  51. data/lib/watir/elements/text_field.rb +2 -0
  52. data/lib/watir/exception.rb +2 -0
  53. data/lib/watir/extensions/nokogiri.rb +2 -0
  54. data/lib/watir/generator/base/generator.rb +2 -0
  55. data/lib/watir/generator/base/idl_sorter.rb +3 -1
  56. data/lib/watir/generator/base/spec_extractor.rb +6 -4
  57. data/lib/watir/generator/base/util.rb +2 -0
  58. data/lib/watir/generator/base/visitor.rb +5 -5
  59. data/lib/watir/generator/base.rb +2 -1
  60. data/lib/watir/generator/html/generator.rb +2 -0
  61. data/lib/watir/generator/html/spec_extractor.rb +2 -0
  62. data/lib/watir/generator/html/visitor.rb +2 -0
  63. data/lib/watir/generator/html.rb +2 -0
  64. data/lib/watir/generator/svg/generator.rb +2 -0
  65. data/lib/watir/generator/svg/spec_extractor.rb +2 -0
  66. data/lib/watir/generator/svg/visitor.rb +2 -0
  67. data/lib/watir/generator/svg.rb +2 -0
  68. data/lib/watir/generator.rb +2 -0
  69. data/lib/watir/has_window.rb +3 -1
  70. data/lib/watir/http_client.rb +2 -0
  71. data/lib/watir/js_execution.rb +2 -0
  72. data/lib/watir/js_snippets/isElementInViewport.js +20 -0
  73. data/lib/watir/js_snippets.rb +2 -0
  74. data/lib/watir/locators/anchor/selector_builder.rb +5 -0
  75. data/lib/watir/locators/button/matcher.rb +2 -0
  76. data/lib/watir/locators/button/selector_builder/xpath.rb +15 -19
  77. data/lib/watir/locators/button/selector_builder.rb +2 -0
  78. data/lib/watir/locators/cell/selector_builder/xpath.rb +2 -0
  79. data/lib/watir/locators/cell/selector_builder.rb +2 -0
  80. data/lib/watir/locators/element/locator.rb +2 -0
  81. data/lib/watir/locators/element/matcher.rb +4 -1
  82. data/lib/watir/locators/element/selector_builder/regexp_disassembler.rb +4 -1
  83. data/lib/watir/locators/element/selector_builder/xpath.rb +16 -15
  84. data/lib/watir/locators/element/selector_builder/xpath_support.rb +4 -2
  85. data/lib/watir/locators/element/selector_builder.rb +16 -6
  86. data/lib/watir/locators/option/matcher.rb +2 -0
  87. data/lib/watir/locators/option/selector_builder/xpath.rb +2 -0
  88. data/lib/watir/locators/option/selector_builder.rb +2 -0
  89. data/lib/watir/locators/row/selector_builder/xpath.rb +2 -0
  90. data/lib/watir/locators/row/selector_builder.rb +2 -0
  91. data/lib/watir/locators/text_area/selector_builder/xpath.rb +2 -0
  92. data/lib/watir/locators/text_area/selector_builder.rb +2 -0
  93. data/lib/watir/locators/text_field/matcher.rb +2 -4
  94. data/lib/watir/locators/text_field/selector_builder/xpath.rb +2 -0
  95. data/lib/watir/locators/text_field/selector_builder.rb +2 -0
  96. data/lib/watir/locators.rb +2 -0
  97. data/lib/watir/logger.rb +2 -0
  98. data/lib/watir/navigation.rb +3 -1
  99. data/lib/watir/radio_set.rb +2 -0
  100. data/lib/watir/row_container.rb +2 -0
  101. data/lib/watir/screenshot.rb +2 -0
  102. data/lib/watir/scroll.rb +29 -3
  103. data/lib/watir/search_context.rb +96 -0
  104. data/lib/watir/shadow_root.rb +60 -0
  105. data/lib/watir/user_editable.rb +3 -1
  106. data/lib/watir/version.rb +3 -1
  107. data/lib/watir/wait/timer.rb +3 -1
  108. data/lib/watir/wait.rb +5 -5
  109. data/lib/watir/window.rb +7 -3
  110. data/lib/watir/window_collection.rb +4 -1
  111. data/lib/watir.rb +4 -0
  112. data/lib/watirspec/guards.rb +2 -0
  113. data/lib/watirspec/implementation.rb +14 -10
  114. data/lib/watirspec/rake_tasks.rb +4 -4
  115. data/lib/watirspec/remote_server.rb +5 -3
  116. data/lib/watirspec/runner.rb +3 -1
  117. data/lib/watirspec/server/app.rb +2 -0
  118. data/lib/watirspec/server.rb +2 -0
  119. data/lib/watirspec.rb +7 -4
  120. data/spec/locator_spec_helper.rb +2 -8
  121. data/spec/spec_helper.rb +2 -0
  122. data/spec/unit/capabilities_spec.rb +561 -550
  123. data/spec/unit/element_locator_spec.rb +71 -58
  124. data/spec/unit/match_elements/button_spec.rb +58 -49
  125. data/spec/unit/match_elements/element_spec.rb +305 -309
  126. data/spec/unit/match_elements/text_field_spec.rb +78 -73
  127. data/spec/unit/selector_builder/anchor_spec.rb +41 -33
  128. data/spec/unit/selector_builder/button_spec.rb +211 -201
  129. data/spec/unit/selector_builder/cell_spec.rb +50 -42
  130. data/spec/unit/selector_builder/element_spec.rb +636 -628
  131. data/spec/unit/selector_builder/row_spec.rb +121 -104
  132. data/spec/unit/selector_builder/text_field_spec.rb +197 -182
  133. data/spec/unit/selector_builder/textarea_spec.rb +24 -14
  134. data/spec/unit/unit_helper.rb +2 -0
  135. data/spec/unit/wait_spec.rb +77 -71
  136. data/spec/watirspec/adjacent_spec.rb +251 -247
  137. data/spec/watirspec/after_hooks_spec.rb +160 -162
  138. data/spec/watirspec/alert_spec.rb +63 -58
  139. data/spec/watirspec/browser_spec.rb +411 -407
  140. data/spec/watirspec/capabilities_spec.rb +566 -0
  141. data/spec/watirspec/cookies_spec.rb +122 -118
  142. data/spec/watirspec/drag_and_drop_spec.rb +30 -14
  143. data/spec/watirspec/element_hidden_spec.rb +68 -60
  144. data/spec/watirspec/elements/area_spec.rb +51 -47
  145. data/spec/watirspec/elements/areas_spec.rb +29 -25
  146. data/spec/watirspec/elements/button_spec.rb +255 -251
  147. data/spec/watirspec/elements/buttons_spec.rb +38 -34
  148. data/spec/watirspec/elements/checkbox_spec.rb +50 -36
  149. data/spec/watirspec/elements/checkboxes_spec.rb +31 -27
  150. data/spec/watirspec/elements/collections_spec.rb +128 -119
  151. data/spec/watirspec/elements/date_field_spec.rb +187 -183
  152. data/spec/watirspec/elements/date_fields_spec.rb +31 -27
  153. data/spec/watirspec/elements/date_time_field_spec.rb +199 -195
  154. data/spec/watirspec/elements/date_time_fields_spec.rb +32 -28
  155. data/spec/watirspec/elements/dd_spec.rb +89 -85
  156. data/spec/watirspec/elements/dds_spec.rb +29 -25
  157. data/spec/watirspec/elements/del_spec.rb +108 -104
  158. data/spec/watirspec/elements/dels_spec.rb +28 -24
  159. data/spec/watirspec/elements/div_spec.rb +227 -211
  160. data/spec/watirspec/elements/divs_spec.rb +39 -35
  161. data/spec/watirspec/elements/dl_spec.rb +112 -110
  162. data/spec/watirspec/elements/dls_spec.rb +30 -26
  163. data/spec/watirspec/elements/dt_spec.rb +88 -84
  164. data/spec/watirspec/elements/dts_spec.rb +29 -25
  165. data/spec/watirspec/elements/element_spec.rb +815 -715
  166. data/spec/watirspec/elements/elements_spec.rb +42 -38
  167. data/spec/watirspec/elements/em_spec.rb +64 -60
  168. data/spec/watirspec/elements/ems_spec.rb +30 -26
  169. data/spec/watirspec/elements/filefield_spec.rb +100 -96
  170. data/spec/watirspec/elements/filefields_spec.rb +30 -26
  171. data/spec/watirspec/elements/font_spec.rb +22 -18
  172. data/spec/watirspec/elements/form_spec.rb +53 -49
  173. data/spec/watirspec/elements/forms_spec.rb +31 -27
  174. data/spec/watirspec/elements/frame_spec.rb +91 -87
  175. data/spec/watirspec/elements/frames_spec.rb +29 -25
  176. data/spec/watirspec/elements/hidden_spec.rb +81 -77
  177. data/spec/watirspec/elements/hiddens_spec.rb +30 -26
  178. data/spec/watirspec/elements/hn_spec.rb +61 -57
  179. data/spec/watirspec/elements/hns_spec.rb +28 -24
  180. data/spec/watirspec/elements/iframe_spec.rb +197 -191
  181. data/spec/watirspec/elements/iframes_spec.rb +33 -29
  182. data/spec/watirspec/elements/image_spec.rb +146 -142
  183. data/spec/watirspec/elements/images_spec.rb +28 -24
  184. data/spec/watirspec/elements/input_spec.rb +11 -7
  185. data/spec/watirspec/elements/ins_spec.rb +108 -104
  186. data/spec/watirspec/elements/inses_spec.rb +28 -24
  187. data/spec/watirspec/elements/label_spec.rb +58 -54
  188. data/spec/watirspec/elements/labels_spec.rb +28 -24
  189. data/spec/watirspec/elements/li_spec.rb +76 -72
  190. data/spec/watirspec/elements/link_spec.rb +175 -179
  191. data/spec/watirspec/elements/links_spec.rb +47 -43
  192. data/spec/watirspec/elements/lis_spec.rb +29 -25
  193. data/spec/watirspec/elements/list_spec.rb +46 -42
  194. data/spec/watirspec/elements/map_spec.rb +59 -55
  195. data/spec/watirspec/elements/maps_spec.rb +29 -25
  196. data/spec/watirspec/elements/meta_spec.rb +18 -14
  197. data/spec/watirspec/elements/metas_spec.rb +28 -24
  198. data/spec/watirspec/elements/ol_spec.rb +58 -65
  199. data/spec/watirspec/elements/ols_spec.rb +28 -24
  200. data/spec/watirspec/elements/option_spec.rb +93 -89
  201. data/spec/watirspec/elements/p_spec.rb +79 -75
  202. data/spec/watirspec/elements/pre_spec.rb +77 -73
  203. data/spec/watirspec/elements/pres_spec.rb +28 -24
  204. data/spec/watirspec/elements/ps_spec.rb +28 -24
  205. data/spec/watirspec/elements/radio_spec.rb +253 -249
  206. data/spec/watirspec/elements/radios_spec.rb +30 -26
  207. data/spec/watirspec/elements/select_list_spec.rb +539 -522
  208. data/spec/watirspec/elements/select_lists_spec.rb +34 -30
  209. data/spec/watirspec/elements/span_spec.rb +114 -110
  210. data/spec/watirspec/elements/spans_spec.rb +28 -24
  211. data/spec/watirspec/elements/strong_spec.rb +60 -58
  212. data/spec/watirspec/elements/strongs_spec.rb +30 -26
  213. data/spec/watirspec/elements/table_spec.rb +194 -139
  214. data/spec/watirspec/elements/tables_spec.rb +30 -26
  215. data/spec/watirspec/elements/tbody_spec.rb +71 -67
  216. data/spec/watirspec/elements/tbodys_spec.rb +42 -38
  217. data/spec/watirspec/elements/td_spec.rb +68 -64
  218. data/spec/watirspec/elements/tds_spec.rb +43 -39
  219. data/spec/watirspec/elements/text_field_spec.rb +208 -204
  220. data/spec/watirspec/elements/text_fields_spec.rb +32 -28
  221. data/spec/watirspec/elements/textarea_spec.rb +22 -18
  222. data/spec/watirspec/elements/textareas_spec.rb +20 -16
  223. data/spec/watirspec/elements/tfoot_spec.rb +67 -63
  224. data/spec/watirspec/elements/tfoots_spec.rb +44 -40
  225. data/spec/watirspec/elements/thead_spec.rb +67 -63
  226. data/spec/watirspec/elements/theads_spec.rb +44 -40
  227. data/spec/watirspec/elements/tr_spec.rb +50 -46
  228. data/spec/watirspec/elements/trs_spec.rb +44 -40
  229. data/spec/watirspec/elements/ul_spec.rb +58 -54
  230. data/spec/watirspec/elements/uls_spec.rb +28 -24
  231. data/spec/watirspec/html/child_frame.html +29 -0
  232. data/spec/watirspec/html/class_locator.html +2 -0
  233. data/spec/watirspec/html/scroll.html +8 -25
  234. data/spec/watirspec/html/scroll_nested.html +17 -0
  235. data/spec/watirspec/html/scroll_nested_offscreen.html +18 -0
  236. data/spec/watirspec/html/shadow_dom.html +28 -0
  237. data/spec/watirspec/html/sticky_elements.html +10 -0
  238. data/spec/watirspec/radio_set_spec.rb +271 -267
  239. data/spec/watirspec/screenshot_spec.rb +22 -18
  240. data/spec/watirspec/scroll_spec.rb +179 -77
  241. data/spec/watirspec/shadow_root_spec.rb +106 -0
  242. data/spec/watirspec/support/rspec_matchers.rb +35 -32
  243. data/spec/watirspec/user_editable_spec.rb +202 -198
  244. data/spec/watirspec/wait_spec.rb +291 -295
  245. data/spec/watirspec/window_switching_spec.rb +426 -428
  246. data/spec/watirspec_helper.rb +25 -42
  247. data/support/doctest_helper.rb +2 -0
  248. data/support/version_differ.rb +2 -0
  249. data/watir.gemspec +14 -10
  250. metadata +91 -240
  251. data/.github/actions/enable-safari/action.yml +0 -11
  252. data/.github/actions/install-chrome/action.yml +0 -12
  253. data/.github/actions/setup-linux/action.yml +0 -8
  254. data/lib/watir-webdriver.rb +0 -2
  255. data/spec/watirspec/attributes_spec.rb +0 -16
  256. data/spec/watirspec/elements/table_nesting_spec.rb +0 -49
  257. data/spec/watirspec/html/hover.html +0 -12
  258. data/spec/watirspec/special_chars_spec.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaa0e3a2614b0cdae93ebbae36c1f1c4ae58f55fd7d79a1b333144969354346f
4
- data.tar.gz: 349abd59394dcd77d9f4aaf2050ab75dd613872c7aff3de96f8acc13cd797213
3
+ metadata.gz: 635faa9aa111937b2d90f6ab1585a148d8eea5cf375b4a1dc4d3e164b3e24c38
4
+ data.tar.gz: 31bb99fbba606a62c369c4a89b8c12764e00feff89048179e5958bf4b0abca3d
5
5
  SHA512:
6
- metadata.gz: 2abac0e5c8e81acf27b5edefd507c9056bca728f2ccab2aa858176287cf7e544a6961ab7bcc0edf7a01d78735038fedf77cbb70798aacdd490be4fc987f88602
7
- data.tar.gz: a32076a9af54abfbcc470bb96095aa1441f812640029fa492233f7d7cbc5f9fb327de0397417103519cf674e7c03a91de85b749bf87e6cc8483cbf16bcefa3e7
6
+ metadata.gz: 131f2cccc8debc1afd14462f90fbafff4d5f349b4caa193247f2adf8efa6f91e03c8218ff8bec23a86d8c4c8e4de18b1c63b38f6cc5c9c878420a9bc01d816f3
7
+ data.tar.gz: c4f5abb5e301fcee62f25a091f299933f2c10e1b703a3378fcd6d850012d989f3e5ac2f9d8fcec170fee44f97ec4758c5894d85e7a7a62d3efaf2f609a733676
@@ -1,6 +1,7 @@
1
1
  name: Chrome Tests
2
2
 
3
3
  on:
4
+ - workflow_dispatch
4
5
  - push
5
6
  - pull_request
6
7
 
@@ -12,23 +13,35 @@ jobs:
12
13
  fail-fast: false
13
14
  matrix:
14
15
  os: [ubuntu-latest, macos-latest, windows-latest]
15
- ruby: [ 2.6, 3.0 ]
16
+ ruby: [ 2.7, 3.2 ]
16
17
  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
18
+ - name: Checkout source tree
19
+ uses: actions/checkout@v2
20
+ - name: Setup Fluxbox
21
+ if: matrix.os == 'ubuntu-latest'
22
+ run: sudo apt-get -y install fluxbox
23
+ - name: Start XVFB
24
+ if: matrix.os == 'ubuntu-latest'
25
+ run: Xvfb :99 -screen 0 1920x1280x24 > /dev/null 2>&1 &
26
+ - name: Start Fluxbox
27
+ if: matrix.os == 'ubuntu-latest'
28
+ run: fluxbox -display :99 &
29
+ - name: Set Windows resolution
30
+ if: matrix.os == 'windows-latest'
31
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
32
+ - name: Set Mac resolution
33
+ if: ${{ matrix.os == 'macos-latest' }}
34
+ run: |
35
+ system_profiler SPDisplaysDataType | grep Resolution
36
+ "/Library/Application Support/VMware Tools/vmware-resolutionSet" 2560 1440
37
+ system_profiler SPDisplaysDataType | grep Resolution
38
+ - name: Install Ruby
39
+ uses: ruby/setup-ruby@v1
28
40
  with:
29
41
  ruby-version: ${{ matrix.ruby }}
30
- - run: bundle install
31
- - run: |
32
- bundle exec rake spec:chrome
42
+ - name: Install gems
43
+ run: bundle install
44
+ - name: Run tests
45
+ run: bundle exec rake spec:chrome
33
46
  env:
34
- DISPLAY: :99
47
+ DISPLAY: :99.0
@@ -1,6 +1,7 @@
1
1
  name: Edge Tests
2
2
 
3
3
  on:
4
+ - workflow_dispatch
4
5
  - push
5
6
  - pull_request
6
7
 
@@ -12,17 +13,24 @@ jobs:
12
13
  fail-fast: false
13
14
  matrix:
14
15
  os: [macos-latest, windows-latest]
15
- ruby: [ 2.6, 3.0 ]
16
+ ruby: [ 2.7, 3.2 ]
16
17
  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
18
+ - name: Checkout source tree
19
+ uses: actions/checkout@v2
20
+ - name: Set Windows resolution
21
+ if: matrix.os == 'windows-latest'
22
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
23
+ - name: Set Mac resolution
24
+ if: ${{ matrix.os == 'macos-latest' }}
25
+ run: |
26
+ system_profiler SPDisplaysDataType | grep Resolution
27
+ "/Library/Application Support/VMware Tools/vmware-resolutionSet" 2560 1440
28
+ system_profiler SPDisplaysDataType | grep Resolution
29
+ - name: Install Ruby
30
+ uses: ruby/setup-ruby@v1
22
31
  with:
23
32
  ruby-version: ${{ matrix.ruby }}
24
- - run: bundle install
25
- - run: |
26
- bundle exec rake spec:edge
27
- env:
28
- DISPLAY: :99
33
+ - name: Install gems
34
+ run: bundle install
35
+ - name: Run tests
36
+ run: bundle exec rake spec:chrome
@@ -1,6 +1,7 @@
1
1
  name: Firefox Tests
2
2
 
3
3
  on:
4
+ - workflow_dispatch
4
5
  - push
5
6
  - pull_request
6
7
 
@@ -12,24 +13,35 @@ jobs:
12
13
  fail-fast: false
13
14
  matrix:
14
15
  os: [ubuntu-latest, macos-latest, windows-latest]
15
- ruby: [ 2.6, 3.0 ]
16
+ ruby: [ 2.7, 3.2 ]
16
17
  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
18
+ - name: Checkout source tree
19
+ uses: actions/checkout@v2
20
+ - name: Setup Fluxbox
21
+ if: matrix.os == 'ubuntu-latest'
22
+ run: sudo apt-get -y install fluxbox
23
+ - name: Start XVFB
24
+ if: matrix.os == 'ubuntu-latest'
25
+ run: Xvfb :99 -screen 0 1920x1280x24 > /dev/null 2>&1 &
26
+ - name: Start Fluxbox
27
+ if: matrix.os == 'ubuntu-latest'
28
+ run: fluxbox -display :99 &
29
+ - name: Set Windows resolution
30
+ if: matrix.os == 'windows-latest'
31
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
32
+ - name: Set Mac resolution
33
+ if: ${{ matrix.os == 'macos-latest' }}
34
+ run: |
35
+ system_profiler SPDisplaysDataType | grep Resolution
36
+ "/Library/Application Support/VMware Tools/vmware-resolutionSet" 2560 1440
37
+ system_profiler SPDisplaysDataType | grep Resolution
38
+ - name: Install Ruby
39
+ uses: ruby/setup-ruby@v1
29
40
  with:
30
41
  ruby-version: ${{ matrix.ruby }}
31
- - run: bundle install
32
- - run: |
33
- bundle exec rake spec:firefox
42
+ - name: Install gems
43
+ run: bundle install
44
+ - name: Run tests
45
+ run: bundle exec rake spec:chrome
34
46
  env:
35
47
  DISPLAY: :99
@@ -1,6 +1,7 @@
1
1
  name: IE Tests
2
2
 
3
3
  on:
4
+ - workflow_dispatch
4
5
  - push
5
6
  - pull_request
6
7
 
@@ -11,14 +12,19 @@ jobs:
11
12
  strategy:
12
13
  fail-fast: false
13
14
  matrix:
14
- ruby: [ 2.6, 3.0 ]
15
+ ruby: [ 2.7, 3.2 ]
15
16
  steps:
16
- - uses: actions/checkout@v2
17
- - uses: ruby/setup-ruby@v1
17
+ - name: Checkout source tree
18
+ uses: actions/checkout@v2
19
+ - name: Set Windows resolution
20
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
21
+ - name: Install Ruby
22
+ uses: ruby/setup-ruby@v1
18
23
  with:
19
24
  ruby-version: ${{ matrix.ruby }}
20
- - run: bundle install
21
- - run: |
22
- bundle exec rake spec:ie
25
+ - name: Install gems
26
+ run: bundle install
27
+ - name: Run tests
28
+ run: bundle exec rake spec:ie
23
29
  env:
24
- DISPLAY: :99
30
+ GITHUB_TOKEN: ${{ github.token }}
@@ -1,6 +1,7 @@
1
1
  name: Safari Tests
2
2
 
3
3
  on:
4
+ - workflow_dispatch
4
5
  - push
5
6
  - pull_request
6
7
 
@@ -11,17 +12,27 @@ jobs:
11
12
  strategy:
12
13
  fail-fast: false
13
14
  matrix:
14
- ruby: [ 2.6, 3.0 ]
15
+ ruby: [ 2.7, 3.2 ]
15
16
  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
17
+ - name: Checkout source tree
18
+ uses: actions/checkout@v2
19
+ - name: Set Mac resolution
20
+ run: |
21
+ system_profiler SPDisplaysDataType | grep Resolution
22
+ "/Library/Application Support/VMware Tools/vmware-resolutionSet" 2560 1440
23
+ system_profiler SPDisplaysDataType | grep Resolution
24
+ - name: Install Ruby
25
+ uses: ruby/setup-ruby@v1
21
26
  with:
22
27
  ruby-version: ${{ matrix.ruby }}
23
- - run: bundle install
24
- - run: |
25
- bundle exec rake spec:safari
26
- env:
27
- DISPLAY: :99
28
+ - name: Install gems
29
+ run: bundle install
30
+ - name: Configure safaridriver
31
+ run: |
32
+ defaults write com.apple.Safari IncludeDevelopMenu YES
33
+ defaults write com.apple.Safari AllowRemoteAutomation 1
34
+ sudo safaridriver --enable
35
+ safaridriver --version
36
+ safaridriver -p 0 &
37
+ - name: Run tests
38
+ run: bundle exec rake spec:safari
@@ -1,6 +1,7 @@
1
1
  name: Unit Tests
2
2
 
3
3
  on:
4
+ - workflow_dispatch
4
5
  - push
5
6
  - pull_request
6
7
 
@@ -9,16 +10,22 @@ jobs:
9
10
  name: Yard Doctest
10
11
  runs-on: ubuntu-latest
11
12
  steps:
12
- - uses: actions/checkout@v2
13
- - uses: ruby/setup-ruby@v1
13
+ - name: Checkout source tree
14
+ uses: actions/checkout@v2
15
+ - name: Setup Fluxbox
16
+ run: sudo apt-get -y install fluxbox
17
+ - name: Start XVFB
18
+ run: Xvfb :99 -screen 0 1920x1280x24 > /dev/null 2>&1 &
19
+ - name: Start Fluxbox
20
+ run: fluxbox -display :99 &
21
+ - name: Install Ruby
22
+ uses: ruby/setup-ruby@v1
14
23
  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
-
24
+ ruby-version: 2.7
25
+ - name: Install gems
26
+ run: bundle install
27
+ - name: Run tests
28
+ run: bundle exec rake yard:doctest
22
29
 
23
30
  unit-test:
24
31
  name: Unit Tests
@@ -26,27 +33,28 @@ jobs:
26
33
  strategy:
27
34
  fail-fast: false
28
35
  matrix:
29
- ruby: ['2.6', '2.7', '3.0']
36
+ ruby: ['2.7', '3.0', '3.1', '3.2', 'jruby-9.4.0.0', 'truffleruby-22.3.0']
30
37
  steps:
31
- - uses: actions/checkout@v2
32
- - uses: ruby/setup-ruby@v1
38
+ - name: Checkout source tree
39
+ uses: actions/checkout@v2
40
+ - name: Install Ruby
41
+ uses: ruby/setup-ruby@v1
33
42
  with:
34
43
  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
44
+ - name: Install gems
45
+ run: bundle install
46
+ - run: bundle exec rake spec:unit
42
47
 
43
48
  linter-test:
44
49
  name: Rubocop Tests
45
50
  runs-on: ubuntu-latest
46
51
  steps:
47
- - uses: actions/checkout@v2
48
- - uses: ruby/setup-ruby@v1
52
+ - name: Checkout source tree
53
+ uses: actions/checkout@v2
54
+ - name: Install Ruby
55
+ uses: ruby/setup-ruby@v1
49
56
  with:
50
- ruby-version: 2.6
51
- - run: bundle install
57
+ ruby-version: 2.7
58
+ - name: Install gems
59
+ run: bundle install
52
60
  - run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -1,23 +1,20 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
3
8
  AllCops:
4
- TargetRubyVersion: 2.6.8
9
+ TargetRubyVersion: 2.7
5
10
  NewCops: enable
6
11
  Exclude:
7
12
  - 'lib/watir/elements/html_elements.rb'
8
13
  - 'lib/watir/elements/svg_elements.rb'
9
14
 
10
- Layout/LineLength:
11
- Max: 120
12
-
13
15
  Layout/SpaceInsideHashLiteralBraces:
14
16
  EnforcedStyle: no_space
15
17
 
16
- Lint/UnifiedInteger:
17
- Exclude:
18
- - 'lib/watir/locators/element/selector_builder.rb'
19
-
20
- # Default: 17
21
18
  Metrics/AbcSize:
22
19
  Max: 22
23
20
  Exclude:
@@ -28,7 +25,6 @@ Metrics/AbcSize:
28
25
 
29
26
  Metrics/BlockLength:
30
27
  Exclude:
31
- - 'spec/**/*'
32
28
  - 'support/doctest_helper.rb'
33
29
  - 'watir.gemspec'
34
30
  - 'Rakefile'
@@ -46,8 +42,8 @@ Metrics/ClassLength:
46
42
  - 'lib/watir/elements/select.rb'
47
43
  - 'lib/watir/generator/base/spec_extractor.rb'
48
44
  - 'lib/watir/element_collection.rb'
45
+ - 'spec/**/*_spec.rb'
49
46
 
50
- # Default: 7
51
47
  Metrics/CyclomaticComplexity:
52
48
  Max: 9
53
49
  Exclude:
@@ -58,19 +54,42 @@ Metrics/MethodLength:
58
54
  Max: 18
59
55
  Exclude:
60
56
  - 'lib/watir/locators/element/selector_builder.rb'
61
- - 'lib/watir/locators/element/selector_builder/xpath.rb'
62
57
  - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
63
58
 
64
- # Default: 8
59
+ Metrics/ModuleLength:
60
+ Exclude:
61
+ - 'spec/**/*'
62
+
65
63
  Metrics/PerceivedComplexity:
66
64
  Max: 10
67
65
 
66
+ RSpec/AnyInstance:
67
+ Enabled: false
68
+
69
+ RSpec/BeforeAfterAll:
70
+ Enabled: false
71
+
72
+ RSpec/ExampleLength:
73
+ Enabled: false
74
+
75
+ RSpec/MultipleExpectations:
76
+ Enabled: false
77
+
78
+ RSpec/MultipleMemoizedHelpers:
79
+ Exclude:
80
+ - 'spec/watirspec/capabilities_spec.rb'
81
+
82
+ RSpec/NoExpectationExample:
83
+ Exclude:
84
+ - 'spec/watirspec/cookies_spec.rb'
85
+
68
86
  Style/BlockDelimiters:
69
87
  EnforcedStyle: braces_for_chaining
70
88
 
71
89
  Style/CommentedKeyword:
72
90
  Enabled: false
73
91
 
92
+ # truthy is not true
74
93
  Style/DoubleNegation:
75
94
  Enabled: false
76
95
 
@@ -78,6 +97,7 @@ Style/GlobalVars:
78
97
  AllowedVariables:
79
98
  - $browser
80
99
 
100
+ # Need to add new keys into hash during iteration
81
101
  Style/HashEachMethods:
82
102
  Enabled: false
83
103
 
data/.rubocop_todo.yml CHANGED
@@ -1,36 +1,17 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-08-27 01:55:04 UTC using RuboCop version 0.89.1.
3
+ # on 2022-12-31 19:29:43 UTC using RuboCop version 1.40.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
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:
9
+ # Offense count: 1
10
+ RSpec/PendingWithoutReason:
17
11
  Exclude:
18
- - 'lib/watir/browser.rb'
19
- - 'lib/watir/window.rb'
12
+ - 'spec/watirspec/browser_spec.rb'
20
13
 
21
- # Offense count: 229
22
- # Cop supports --auto-correct.
23
- # Configuration parameters: EnforcedStyle.
24
- # SupportedStyles: always, always_true, never
25
- Style/FrozenStringLiteralComment:
14
+ # Offense count: 114
15
+ # Configuration parameters: AllowedConstants.
16
+ Style/Documentation:
26
17
  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,36 @@
1
+ ### 7.2.2 (2023-01-03)
2
+
3
+ * Fix bug with processing vendor name-spaced capabilities
4
+
5
+ ### 7.2.1 (2023-01-02)
6
+
7
+ * Fix bug for building locators with JRuby
8
+ * Fix bug for inferring internet explorer browser name from options
9
+
10
+ ### 7.2.0 (2022-12-24)
11
+
12
+ * Implement Shadow DOM support (#953)
13
+ * Implement existing `Scroll#by` with Selenium Actions Class instead of JavaScript
14
+ * Implement `Scroll#from` to set origin points
15
+ * Implement `Scroll#to(:viewport)` for elements using Selenium Actions Class
16
+ * Fix bug for regex matching on single quotes (#957)
17
+ * Fix bug for unexpected whitespace in classes (#956)
18
+ * Fix bug for inferring Edge browser name from Capabilities parameter
19
+ * Allow starting `Browser` with `Watir::Capabilities`
20
+ * Allow starting `Browser` with just a `Hash` for generating a `Watir::Capabilities`
21
+ * Have `Capabilities` use `:options` to generate Selenium `Options` instance
22
+ * Deprecate allowing `:capabilities` argument in `Browser` constructor
23
+ * Require Ruby 2.7 and Selenium 4.2
24
+
25
+ ### 7.1.0 (2021-11-15)
26
+
27
+ * Add automatic scroll to `Element#click` with method parameters to ensure element is in viewport
28
+ * Provide `:scroll_to` parameter for element methods implemented with `Actions` class (thanks osadasami #948, #949)
29
+ * Allow `:scroll_to` parameter to accept `nil` argument to avoid automatic scrolling
30
+ * Implement `Element#in_viewport?`
31
+ * Fix bug where `Scroll#to` for `Browser` with `:center` argument did not scroll to center of page
32
+ * Change `Element#obscured?` to only scroll when element out of viewport and then scroll to bottom instead of top
33
+
1
34
  ### 7.0.0 (2021-10-18)
2
35
 
3
36
  * Requires Selenium 4.0.0+
data/Gemfile CHANGED
@@ -1,8 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gem 'webidl', path: File.expand_path('../webidl') if ENV['LOCAL_WEBIDL']
4
6
 
5
- gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb') if ENV['LOCAL_SELENIUM']
7
+ if ENV['LOCAL_SELENIUM']
8
+ ENV['RUBYOPT'] = '-I../selenium/bazel-bin/rb'
9
+ gem 'selenium-webdriver', path: File.expand_path('../selenium/rb')
10
+ end
6
11
 
7
12
  gem 'ffi' if Gem.win_platform? # For selenium-webdriver on Windows
8
13
 
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-2021 Alex Rodionov, Titus Fortner
5
- Copyright (c) 2018-2021 Justin Ko
4
+ Copyright (c) 2015-2023 Alex Rodionov, Titus Fortner
5
+ Copyright (c) 2018-2023 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,16 +3,19 @@
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
- [![All Tests](https://github.com/watir/watir/actions/workflows/tests.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/tests.yml)
7
- [![Code Climate](https://codeclimate.com/github/watir/watir.svg)](https://codeclimate.com/github/watir/watir)
8
- [![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=main)](https://coveralls.io/github/watir/watir?branch=main)
6
+ [![Chrome Tests](https://github.com/watir/watir/actions/workflows/chrome.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/chrome.yml)
7
+ [![Edge Tests](https://github.com/watir/watir/actions/workflows/edge.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/edge.yml)
8
+ [![Firefox Tests](https://github.com/watir/watir/actions/workflows/firefox.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/firefox.yml)
9
+ [![IE Tests](https://github.com/watir/watir/actions/workflows/ie.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/ie.yml)
10
+ [![Safari Tests](https://github.com/watir/watir/actions/workflows/safari.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/safari.yml)
11
+ [![Unit Tests](https://github.com/watir/watir/actions/workflows/unit.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/unit.yml)
9
12
 
10
13
  ## Using Watir
11
14
 
12
15
  This README is for people interested in writing code for Watir or gems in the Watir ecosystem
13
16
  that leverage private-api Watir code.
14
17
 
15
- For our users, everything you'll need is on the [Watir website](http://watir.com):
18
+ For our users, everything you'll need is on the [Watir website](http://watir.com):
16
19
  examples, news, guides, additional resources, support information and more.
17
20
 
18
21
  ## Procedure for Patches/Pull Requests
@@ -30,7 +33,7 @@ examples, news, guides, additional resources, support information and more.
30
33
 
31
34
  ## Developing Extensions
32
35
 
33
- When developing a gem intended to be used with Watir, you can run your code with WatirSpec
36
+ When developing a gem intended to be used with Watir, you can run your code with WatirSpec
34
37
  to make sure that requiring your code does not break something else in Watir.
35
38
 
36
39
  First, add WatirSpec Rake tasks to your gem:
@@ -52,7 +55,7 @@ This command will walk you through how to customize your code.
52
55
  ## Automatic Element Generation
53
56
 
54
57
  The majority of element methods Watir provides is autogenerated from specifications.
55
- This is done by extracting the IDL parts from the spec and processing them with the
58
+ This is done by extracting the IDL parts from the spec and processing them with the
56
59
  [WebIDL gem](https://github.com/jarib/webidl).
57
60
 
58
61
  Generated elements are currently based on the following specifications:
@@ -61,6 +64,7 @@ Generated elements are currently based on the following specifications:
61
64
  * [SVG](https://www.w3.org/TR/2018/CR-SVG2-20180807/) (`lib/watir/elements/svg_elements.rb`)
62
65
 
63
66
  To run:
67
+
64
68
  ```bash
65
69
  $ bundle exec rake html:update
66
70
  $ bundle exec rake svg:update
@@ -70,7 +74,7 @@ $ bundle exec rake svg:update
70
74
 
71
75
  #### Github Actions
72
76
 
73
- Watir specs are run with [Github Actions](https://github.com/watir/watir/workflows).
77
+ Watir specs are run with [Github Actions](https://github.com/watir/watir/tree/main/.github/workflows).
74
78
 
75
79
  Watir code is tested on Linux with latest versions of supported browsers and all active Ruby versions.
76
80
 
@@ -92,14 +96,14 @@ to ensure all paths in their code have tests associated with them.
92
96
 
93
97
  #### Rubocop
94
98
 
95
- Watir is using [Rubocop](https://github.com/rubocop-hq/rubocop) to ensure a consistent style across the
96
- code base. It is run with our minimum supported Ruby version (2.3)
97
- We have some [established exceptions](https://github.com/watir/watir/blob/main/.rubocop.yml)
99
+ Watir is using [Rubocop](https://github.com/rubocop/rubocop) to ensure a consistent style across the
100
+ code base. It is run with our minimum supported Ruby version (2.3)
101
+ We have some established exceptions at `.rubocop.yml`
98
102
  that might need to be tweaked for new code submissions. This can be addressed in the PR as necessary.
99
103
 
100
104
  #### Statistics
101
105
 
102
- Element specs are run with
106
+ Element specs are run with
103
107
  [Selenium Statistics gem](https://github.com/titusfortner/selenium_statistics)
104
108
  to verify that changes to the code do not dramatically decrease the performance based
105
109
  on wire calls.