watir 6.16.5 → 6.19.1

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 (110) 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 +11 -0
  4. data/.github/workflows/linux.yml +61 -0
  5. data/.github/workflows/mac.yml +55 -0
  6. data/.github/workflows/unit.yml +37 -0
  7. data/.github/workflows/windows.yml +39 -0
  8. data/.rubocop.yml +32 -107
  9. data/.rubocop_todo.yml +36 -0
  10. data/CHANGES.md +52 -0
  11. data/Gemfile +3 -1
  12. data/LICENSE +2 -2
  13. data/README.md +9 -10
  14. data/Rakefile +4 -4
  15. data/lib/watir/adjacent.rb +8 -10
  16. data/lib/watir/after_hooks.rb +4 -4
  17. data/lib/watir/alert.rb +1 -0
  18. data/lib/watir/attribute_helper.rb +2 -0
  19. data/lib/watir/browser.rb +7 -3
  20. data/lib/watir/capabilities.rb +245 -97
  21. data/lib/watir/cookies.rb +3 -1
  22. data/lib/watir/element_collection.rb +21 -6
  23. data/lib/watir/elements/element.rb +66 -53
  24. data/lib/watir/elements/file_field.rb +1 -0
  25. data/lib/watir/elements/html_elements.rb +0 -1
  26. data/lib/watir/elements/iframe.rb +4 -3
  27. data/lib/watir/elements/link.rb +0 -9
  28. data/lib/watir/elements/radio.rb +1 -1
  29. data/lib/watir/elements/select.rb +22 -7
  30. data/lib/watir/generator/base/spec_extractor.rb +4 -4
  31. data/lib/watir/generator/html/generator.rb +1 -1
  32. data/lib/watir/has_window.rb +17 -15
  33. data/lib/watir/http_client.rb +17 -0
  34. data/lib/watir/js_execution.rb +3 -3
  35. data/lib/watir/js_snippets.rb +2 -2
  36. data/lib/watir/legacy_wait.rb +1 -1
  37. data/lib/watir/locators/element/selector_builder/xpath.rb +50 -15
  38. data/lib/watir/locators/element/selector_builder.rb +12 -13
  39. data/lib/watir/locators/text_field/selector_builder/xpath.rb +3 -1
  40. data/lib/watir/locators.rb +1 -3
  41. data/lib/watir/logger.rb +7 -20
  42. data/lib/watir/radio_set.rb +2 -2
  43. data/lib/watir/user_editable.rb +6 -2
  44. data/lib/watir/version.rb +1 -1
  45. data/lib/watir/wait/timer.rb +1 -1
  46. data/lib/watir/wait.rb +2 -0
  47. data/lib/watir/window.rb +8 -4
  48. data/lib/watir/window_collection.rb +114 -0
  49. data/lib/watir-webdriver.rb +1 -1
  50. data/lib/watir.rb +3 -1
  51. data/lib/watirspec/guards.rb +1 -1
  52. data/lib/watirspec/implementation.rb +3 -5
  53. data/lib/watirspec/rake_tasks.rb +2 -0
  54. data/lib/watirspec/runner.rb +6 -2
  55. data/lib/watirspec/server.rb +1 -1
  56. data/lib/watirspec.rb +2 -1
  57. data/spec/spec_helper.rb +2 -7
  58. data/spec/unit/capabilities_spec.rb +1234 -18
  59. data/spec/unit/container_spec.rb +1 -1
  60. data/spec/unit/logger_spec.rb +5 -7
  61. data/spec/unit/match_elements/element_spec.rb +17 -15
  62. data/spec/unit/selector_builder/button_spec.rb +16 -15
  63. data/spec/unit/selector_builder/element_spec.rb +58 -9
  64. data/spec/unit/selector_builder/text_field_spec.rb +14 -14
  65. data/spec/unit/unit_helper.rb +2 -4
  66. data/spec/watirspec/after_hooks_spec.rb +58 -68
  67. data/spec/watirspec/alert_spec.rb +69 -79
  68. data/spec/watirspec/browser_spec.rb +51 -48
  69. data/spec/watirspec/cookies_spec.rb +52 -37
  70. data/spec/watirspec/drag_and_drop_spec.rb +14 -38
  71. data/spec/watirspec/elements/button_spec.rb +2 -0
  72. data/spec/watirspec/elements/buttons_spec.rb +1 -1
  73. data/spec/watirspec/elements/checkbox_spec.rb +8 -4
  74. data/spec/watirspec/elements/date_field_spec.rb +18 -9
  75. data/spec/watirspec/elements/date_time_field_spec.rb +3 -4
  76. data/spec/watirspec/elements/div_spec.rb +62 -54
  77. data/spec/watirspec/elements/element_spec.rb +73 -88
  78. data/spec/watirspec/elements/elements_spec.rb +12 -3
  79. data/spec/watirspec/elements/filefield_spec.rb +25 -50
  80. data/spec/watirspec/elements/form_spec.rb +6 -8
  81. data/spec/watirspec/elements/frame_spec.rb +10 -13
  82. data/spec/watirspec/elements/iframe_spec.rb +12 -9
  83. data/spec/watirspec/elements/iframes_spec.rb +2 -2
  84. data/spec/watirspec/elements/link_spec.rb +23 -12
  85. data/spec/watirspec/elements/links_spec.rb +11 -3
  86. data/spec/watirspec/elements/option_spec.rb +15 -17
  87. data/spec/watirspec/elements/select_list_spec.rb +222 -117
  88. data/spec/watirspec/elements/text_field_spec.rb +8 -4
  89. data/spec/watirspec/elements/tr_spec.rb +0 -9
  90. data/spec/watirspec/html/forms_with_input_elements.html +1 -0
  91. data/spec/watirspec/html/iframes.html +3 -0
  92. data/spec/watirspec/html/non_control_elements.html +4 -4
  93. data/spec/watirspec/html/right_click.html +12 -0
  94. data/spec/watirspec/html/special_chars.html +3 -0
  95. data/spec/watirspec/html/wait.html +6 -6
  96. data/spec/watirspec/html/window_switching.html +10 -0
  97. data/spec/watirspec/legacy_wait_spec.rb +216 -0
  98. data/spec/watirspec/special_chars_spec.rb +10 -0
  99. data/spec/watirspec/support/rspec_matchers.rb +33 -14
  100. data/spec/watirspec/user_editable_spec.rb +1 -1
  101. data/spec/watirspec/wait_spec.rb +257 -305
  102. data/spec/watirspec/window_switching_spec.rb +347 -211
  103. data/spec/watirspec_helper.rb +17 -20
  104. data/support/doctest_helper.rb +0 -2
  105. data/watir.gemspec +6 -7
  106. metadata +37 -26
  107. data/.travis.yml +0 -84
  108. data/appveyor.yml +0 -12
  109. data/lib/watir/elements/area.rb +0 -10
  110. data/spec/watirspec/relaxed_locate_spec.rb +0 -113
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fa8314c42d13abbcf8c23676254674e9f7db6072
4
- data.tar.gz: aab0634d0461fb0f67749b48625ef6b86f337929
2
+ SHA256:
3
+ metadata.gz: c714ef62b6caccbf6f2885fd9ea9ece26d42c9b64f64642dadd445e35029da0c
4
+ data.tar.gz: 2621db569beaa32c36577da613a0c27e16a64ca45e286a37e1cd000c3bf46db1
5
5
  SHA512:
6
- metadata.gz: 42511b036683635c9f960753ed429a332f91a6917af42c71b2d619f8004d1e4147f76e41f89e0eebd39a2043129662ccd7ce673521edac87ad759e52d9ba27c3
7
- data.tar.gz: 3d581c12b5be6ae282824b7ec9ce9785d2a7991b95f520f108017ba2c93bb3bda6881fb535ee38799b31521319e36585e194bd230af5ae1d70f2e09f24cf3dec
6
+ metadata.gz: 510bf92bb5212caec7334540076448f43bf13e4fcef510a36c78188718a1e744094b7cfe6dad3b713f51a2cf36f9ad22d5dfbf5983406fdb0bddcf75fb9a3fff
7
+ data.tar.gz: 634cff1ed0f60d0d88f6596b377933b0ec6eda95dae9fd554352e4bb6c55ef2f8f7b791fd0b2abc8bcc39d3bc4e4a4f52429c7db6efae533fb1d8f0e45159159
@@ -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,11 @@
1
+ name: 'Install Chrome'
2
+ runs:
3
+ using: "composite"
4
+ steps:
5
+ - run: |
6
+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
7
+ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list
8
+ sudo apt-get update -qqy
9
+ sudo apt-get -qqy install google-chrome-stable
10
+ sudo rm /etc/apt/sources.list.d/google-chrome.list
11
+ shell: bash
@@ -0,0 +1,61 @@
1
+ name: Linux Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ chrome-test:
9
+ name: Chrome Test
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ task: [ 'chrome' ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.5
20
+ - run: bundle install
21
+ - uses: ./.github/actions/install-chrome
22
+ - run: Xvfb :99 &
23
+ - run: |
24
+ bundle exec rake spec:${{ matrix.task }}
25
+ env:
26
+ DISPLAY: :99
27
+
28
+ firefox-test:
29
+ name: Firefox Test
30
+ runs-on: ubuntu-latest
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ task: [ 'firefox' ]
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+ - uses: ruby/setup-ruby@v1
38
+ with:
39
+ ruby-version: 2.5
40
+ - run: bundle install
41
+ - run: Xvfb :99 &
42
+ - run: |
43
+ bundle exec rake spec:${{ matrix.task }}
44
+ env:
45
+ DISPLAY: :99
46
+
47
+ documentation-test:
48
+ name: Yard Doc Test
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@v2
52
+ - uses: ruby/setup-ruby@v1
53
+ with:
54
+ ruby-version: 2.5
55
+ - run: bundle install
56
+ - uses: ./.github/actions/install-chrome
57
+ - run: Xvfb :99 &
58
+ - run: |
59
+ bundle exec rake yard:doctest
60
+ env:
61
+ DISPLAY: :99
@@ -0,0 +1,55 @@
1
+ name: Mac Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ chrome-test:
9
+ name: Chrome Test
10
+ runs-on: macos-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ task: [ 'chrome' ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.5
20
+ - run: bundle install
21
+ - run: |
22
+ bundle exec rake spec:${{ matrix.task }}
23
+
24
+ firefox-test:
25
+ name: Firefox Test
26
+ runs-on: macos-latest
27
+ strategy:
28
+ fail-fast: false
29
+ matrix:
30
+ task: [ 'firefox' ]
31
+ steps:
32
+ - uses: actions/checkout@v2
33
+ - uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: 2.5
36
+ - run: bundle install
37
+ - run: |
38
+ bundle exec rake spec:${{ matrix.task }}
39
+
40
+ safari-test:
41
+ name: Safari Test
42
+ runs-on: macos-latest
43
+ strategy:
44
+ fail-fast: false
45
+ matrix:
46
+ task: [ 'safari' ]
47
+ steps:
48
+ - uses: actions/checkout@v2
49
+ - uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: 2.5
52
+ - run: bundle install
53
+ - uses: ./.github/actions/enable-safari
54
+ - run: |
55
+ bundle exec rake spec:${{ matrix.task }}
@@ -0,0 +1,37 @@
1
+ name: Unit Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ unit-test:
9
+ name: Unit Tests
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: ['2.5', '2.6', '2.7', '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
+ - uses: ./.github/actions/install-chrome
22
+ - run: Xvfb :99 &
23
+ - run: |
24
+ bundle exec rake spec:unit
25
+ env:
26
+ DISPLAY: :99
27
+
28
+ linter-test:
29
+ name: Rubocop Tests
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v2
33
+ - uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: 2.5
36
+ - run: bundle install
37
+ - run: bundle exec rubocop
@@ -0,0 +1,39 @@
1
+ name: Windows Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ chrome-test:
9
+ name: Chrome Test
10
+ runs-on: windows-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ task: [ 'chrome' ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.5
20
+ - run: bundle install
21
+ - run: |
22
+ bundle exec rake spec:${{ matrix.task }}
23
+ firefox-test:
24
+ name: Firefox Test
25
+ runs-on: windows-latest
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ task: [ 'firefox' ]
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: 2.5
35
+ - run: bundle install
36
+ - run: |
37
+ bundle exec rake spec:${{ matrix.task }}
38
+
39
+
data/.rubocop.yml CHANGED
@@ -1,46 +1,36 @@
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.5.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: 20
23
+ Exclude:
24
+ - 'lib/watir/capabilities.rb'
25
+ - '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'
29
+ - 'lib/watir/generator/base/generator.rb'
30
+ - 'lib/watir/generator/base/visitor.rb'
31
+ - 'spec/locator_spec_helper.rb'
32
+ - 'spec/watirspec_helper.rb'
33
+
44
34
  Metrics/BlockLength:
45
35
  Exclude:
46
36
  - 'spec/**/*'
@@ -48,21 +38,6 @@ Metrics/BlockLength:
48
38
  - 'watir.gemspec'
49
39
  - 'Rakefile'
50
40
 
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
41
  Metrics/ClassLength:
67
42
  Max: 93
68
43
  Exclude:
@@ -77,42 +52,24 @@ Metrics/ClassLength:
77
52
  - 'lib/watir/generator/base/spec_extractor.rb'
78
53
  - 'lib/watir/element_collection.rb'
79
54
 
80
- Metrics/PerceivedComplexity:
81
- Max: 10
82
-
55
+ # Default: 7
83
56
  Metrics/CyclomaticComplexity:
84
- Max: 8
57
+ Max: 9
85
58
  Exclude:
86
- - 'lib/watir/locators/element/selector_builder.rb'
59
+ - 'lib/watir/locators/element/selector_builder.rb'
87
60
 
88
- Metrics/AbcSize:
89
- Max: 20
61
+ # Configuration parameters: CountComments.
62
+ Metrics/MethodLength:
63
+ Max: 18
90
64
  Exclude:
91
65
  - 'lib/watir/locators/element/selector_builder.rb'
92
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
93
66
  - 'lib/watir/locators/element/selector_builder/xpath.rb'
94
- - 'lib/watir/locators/element/locator.rb'
95
- - 'lib/watir/generator/base/generator.rb'
96
- - 'lib/watir/generator/base/visitor.rb'
97
- - 'spec/locator_spec_helper.rb'
98
-
99
- # TODO: fix with Watir 7
100
- # Configuration parameters: CountKeywordArgs.
101
- Metrics/ParameterLists:
102
- Exclude:
103
- - 'lib/watir/wait.rb'
67
+ - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
104
68
 
105
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
106
- # URISchemes: http, https
107
- Metrics/LineLength:
108
- Max: 120
69
+ # Default: 8
70
+ Metrics/PerceivedComplexity:
71
+ Max: 10
109
72
 
110
- # Cop supports --auto-correct.
111
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
112
- # SupportedStyles: line_count_based, semantic, braces_for_chaining
113
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
114
- # FunctionalMethods: let, let!, subject, watch
115
- # IgnoredMethods: lambda, proc, it
116
73
  Style/BlockDelimiters:
117
74
  EnforcedStyle: braces_for_chaining
118
75
 
@@ -122,44 +79,12 @@ Style/CommentedKeyword:
122
79
  Style/DoubleNegation:
123
80
  Enabled: false
124
81
 
125
- ## Configuration parameters: AllowedVariables.
126
82
  Style/GlobalVars:
127
83
  AllowedVariables:
128
84
  - $browser
129
85
 
130
- Style/RegexpLiteral:
131
- Exclude:
132
- - 'spec/watirspec/selector_builder/element_spec.rb'
133
-
134
- ### Cop supports --auto-correct.
135
- ### Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
136
- ## SupportedStyles: single_quotes, double_quotes
137
- Style/StringLiterals:
138
- Exclude:
139
- - 'lib/watir/elements/html_elements.rb'
140
- - 'lib/watir/elements/svg_elements.rb'
141
-
142
- Style/MethodCallWithoutArgsParentheses:
86
+ Style/HashEachMethods:
143
87
  Enabled: false
144
88
 
145
- # TODO: I can't tell if this applies
146
- ## Configuration parameters: EnforcedStyle.
147
- ## SupportedStyles: annotated, template, unannotated
148
- Style/FormatStringToken:
149
- Exclude:
150
- - 'lib/watir/browser.rb'
151
- - 'lib/watir/locators/text_field/selector_builder/xpath.rb'
152
- - 'lib/watir/window.rb'
153
-
154
- Style/Documentation:
89
+ Style/OptionalBooleanParameter:
155
90
  Enabled: false
156
-
157
- # Cop supports --auto-correct.
158
- # Configuration parameters: EnforcedStyle.
159
- # SupportedStyles: when_needed, always, never
160
- Style/FrozenStringLiteralComment:
161
- Enabled: false
162
-
163
- Naming/FileName:
164
- Exclude:
165
- - '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,55 @@
1
+ ### 6.19.1 (2021-03-17)
2
+
3
+ * Fix bug preventing using Selenium 4
4
+ * Fix bug preventing non-xml characters in attributes (#787)
5
+
6
+ ### 6.19.0 (2021-03-12)
7
+
8
+ * Create custom Watir HTTP Client
9
+ * Require minimum of Selenium 3.142.7
10
+ * Add support for starting browser with :http_client and :service hashes
11
+ * Allow inferring desired browser from Capabilities or Options if browser not specified
12
+ * Deprecate WindowCollection#to_a method
13
+ * Deprecate starting browser with both Capabilities and Options
14
+ * Deprecate starting browser with both URL and Service
15
+ * Deprecate using :desired_capabilities
16
+ * Deprecate starting browser service keywords in top level Hash
17
+ * Deprecate using :remote to start a browser; browser name must be specified
18
+ * Deprecate sending unknown keywords into the top level
19
+ * Fix bug preventing Safari Options from being recognized
20
+ * Fix bug preventing options provided without :remote keyword from being properly recognized (#812, #870)
21
+ * Fix bug preventing :headless from being recognized when :options specified (#692)
22
+
23
+ ### 6.18.0 (2021-02-26)
24
+
25
+ * Implement `WindowCollection` to manage multiple `Window` objects
26
+ * Add support for locating `Window` by `:element`
27
+ * Deprecate locating `Window` by `:index`
28
+ * Deprecate `Select#select_all` in favor of `#select` and an `Array`
29
+ * Implement `Browser#switch_window` (#849)
30
+ * Add support for `Numeric` attribute values to `Waitable`
31
+ * Allow users to specify Selenium 4 in their projects
32
+ * Update stale element handling behavior to match webdriver spec (#905 #909)
33
+ * Implement `Waitable` for `ElementCollection` (#853 #857)
34
+ * Improve performance for nested elements (#843)
35
+ * Less strict version check for `regexp_parser` gem (thanks Pavel Lobashov)
36
+
37
+ ### 6.17.0 (2020-08-27)
38
+ * Require Ruby > 2.5
39
+ * Implement Logger#selenium= to set selenium level from Watir
40
+ * Implement FileField#upload
41
+ * Fix bug with staleness handling in #exist and #present? (#853 & #852)
42
+ * Fix bug when locating elements by text with RegExp (#866 #871)
43
+ * Implement modifiers for `Element#right_click` (thanks Lakshya Kapoor #861)
44
+ * Updated locator code to adhere to spec on what attributes are case sensitive (#507 #856)
45
+ * Fix locating bug when iframe is nested under another element (thanks Matthew Mazaika #885 #886)
46
+ * Deprecate Element#scroll_into_view in favor of the new Scroll methods (#884)
47
+ * Fix threading bugs by allowing each Browser instance its own Timer (#881)
48
+ * Allow adjacent locators to return Input subtype when applicable (#878)
49
+ * Removed unnecessary reference to rubyforge (thanks olleolleolle #874)
50
+ * Removed deprecated Selenium classes (thanks joesho112358 #867)
51
+ * Add support for :service parameter for initializing Browser
52
+
1
53
  ### 6.16.5 (2018-12-25)
2
54
 
3
55
  * Fix bug with nested elements using scopes (#842)
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,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,12 @@
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
+ [![Unit Tests](https://github.com/watir/watir/workflows/Unit%20Tests/badge.svg)](https://github.com/watir/watir/actions?query=workflow%3A%22Unit+Tests%22)
7
+ [![Mac Tests](https://github.com/watir/watir/workflows/Mac%20Tests/badge.svg)](https://github.com/watir/watir/actions?query=workflow%3A%22Mac+Tests%22)
8
+ [![Windows Tests](https://github.com/watir/watir/workflows/Windows%20Tests/badge.svg)](https://github.com/watir/watir/actions?query=workflow%3A%22Windows+Tests%22)
9
+ [![Linux Tests](https://github.com/watir/watir/workflows/Linux%20Tests/badge.svg)](https://github.com/watir/watir/actions?query=workflow%3A%22Linux+Tests%22)
8
10
  [![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)
11
+ [![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=main)](https://coveralls.io/github/watir/watir?branch=main)
10
12
 
11
13
  ## Using Watir
12
14
 
@@ -69,11 +71,11 @@ $ bundle exec rake svg:update
69
71
 
70
72
  ## Specs
71
73
 
72
- #### Travis CI
74
+ #### Github Actions
73
75
 
74
- Watir specs are run on [Travis CI](https://travis-ci.org/watir/watir).
76
+ Watir specs are run with [Github Actions](https://github.com/watir/watir/workflows).
75
77
 
76
- Watir code is tested with 2.3, 2.4 and 2.5 versions in multiple browsers and with multiple configurations.
78
+ Watir code is tested on Linux with latest versions of supported browsers and all active Ruby versions.
77
79
 
78
80
  #### Doctests
79
81
 
@@ -95,7 +97,7 @@ to ensure all paths in their code have tests associated with them.
95
97
 
96
98
  Watir is using [Rubocop](https://github.com/rubocop-hq/rubocop) to ensure a consistent style across the
97
99
  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)
100
+ We have some [established exceptions](https://github.com/watir/watir/blob/main/.rubocop.yml)
99
101
  that might need to be tweaked for new code submissions. This can be addressed in the PR as necessary.
100
102
 
101
103
  #### Statistics
@@ -107,7 +109,4 @@ on wire calls.
107
109
 
108
110
  ## Copyright
109
111
 
110
- Copyright (c) 2009-2015 Jari Bakken
111
- Copyright (c) 2015-2018 Alex Rodionov, Titus Fortner
112
- Copyright (c) 2018 Justin Ko
113
112
  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
@@ -61,7 +61,7 @@ end
61
61
 
62
62
  if extractor.errors.any?
63
63
  puts "\n\n<======================= ERRORS =======================>\n\n"
64
- puts extractor.errors.join("\n" + '=' * 80 + "\n")
64
+ puts extractor.errors.join("\n#{'=' * 80}\n")
65
65
  end
66
66
  end
67
67
 
@@ -93,7 +93,7 @@ YARD::Rake::YardocTask.new do |task|
93
93
  task.options = %w[--debug] # this is pretty slow, so nice with some output
94
94
  end
95
95
 
96
- require 'yard-doctest'
96
+ require 'yard/doctest/rake'
97
97
  YARD::Doctest::RakeTask.new do |task|
98
98
  task.doctest_opts = ['-v']
99
99
  end
@@ -115,7 +115,7 @@ namespace :changes do
115
115
 
116
116
  desc 'Print latest diff'
117
117
  task print: :differ do
118
- VersionDiffer.new.print_latest(STDOUT)
118
+ VersionDiffer.new.print_latest($stdout)
119
119
  end
120
120
  end
121
121
 
@@ -113,16 +113,14 @@ module Watir
113
113
  def xpath_adjacent(opt = {})
114
114
  plural = opt.delete(:plural)
115
115
  opt[:index] ||= 0 unless plural || opt.values.any? { |e| e.is_a? Regexp }
116
- klass = if !plural && opt[:tag_name]
117
- Watir.element_class_for(opt[:tag_name])
118
- elsif !plural
119
- HTMLElement
120
- elsif opt[:tag_name]
121
- Object.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection")
122
- else
123
- HTMLElementCollection
124
- end
125
- klass.new(self, opt)
116
+ if !plural
117
+ el = Watir.element_class_for(opt[:tag_name] || '').new(self, opt)
118
+ el.is_a?(Input) ? el.to_subtype : el
119
+ elsif opt[:tag_name]
120
+ Watir.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
121
+ else
122
+ HTMLElementCollection.new(self, opt)
123
+ end
126
124
  end
127
125
  end # Adjacent
128
126
  end # Watir
@@ -69,8 +69,8 @@ module Watir
69
69
  return unless @after_hooks.any? && !@browser.alert.exists?
70
70
 
71
71
  each { |after_hook| after_hook.call(@browser) }
72
- rescue Selenium::WebDriver::Error::NoSuchWindowError => ex
73
- Watir.logger.info "Could not execute After Hooks because browser window was closed #{ex}"
72
+ rescue Selenium::WebDriver::Error::NoSuchWindowError => e
73
+ Watir.logger.info "Could not execute After Hooks because browser window was closed #{e}"
74
74
  end
75
75
 
76
76
  #
@@ -99,8 +99,8 @@ module Watir
99
99
  # @yieldparam [#call] after_hook Object responding to call
100
100
  #
101
101
 
102
- def each
103
- @after_hooks.each { |after_hook| yield after_hook }
102
+ def each(&blk)
103
+ @after_hooks.each { |after_hook| blk.call(after_hook) }
104
104
  end
105
105
 
106
106
  #