watir 7.2.0 → 7.2.2
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.
- checksums.yaml +4 -4
- data/.github/workflows/chrome.yml +1 -1
- data/.github/workflows/edge.yml +1 -1
- data/.github/workflows/firefox.yml +1 -1
- data/.github/workflows/ie.yml +1 -1
- data/.github/workflows/safari.yml +1 -1
- data/.github/workflows/unit.yml +1 -1
- data/.rubocop.yml +25 -12
- data/.rubocop_todo.yml +8 -1
- data/CHANGES.md +10 -1
- data/LICENSE +2 -2
- data/lib/watir/capabilities.rb +1 -4
- data/lib/watir/locators/anchor/selector_builder.rb +3 -0
- data/lib/watir/locators/element/matcher.rb +2 -1
- data/lib/watir/locators/element/selector_builder/regexp_disassembler.rb +2 -1
- data/lib/watir/locators/text_field/matcher.rb +0 -4
- data/lib/watir/version.rb +1 -1
- data/spec/locator_spec_helper.rb +0 -8
- data/spec/unit/capabilities_spec.rb +553 -561
- data/spec/unit/element_locator_spec.rb +89 -78
- data/spec/unit/match_elements/button_spec.rb +69 -62
- data/spec/unit/match_elements/element_spec.rb +303 -309
- data/spec/unit/match_elements/text_field_spec.rb +76 -73
- data/spec/unit/selector_builder/anchor_spec.rb +39 -33
- data/spec/unit/selector_builder/button_spec.rb +209 -202
- data/spec/unit/selector_builder/cell_spec.rb +48 -42
- data/spec/unit/selector_builder/element_spec.rb +634 -627
- data/spec/unit/selector_builder/row_spec.rb +119 -113
- data/spec/unit/selector_builder/text_field_spec.rb +195 -188
- data/spec/unit/selector_builder/textarea_spec.rb +22 -14
- data/spec/unit/wait_spec.rb +85 -81
- data/spec/watirspec/adjacent_spec.rb +249 -247
- data/spec/watirspec/after_hooks_spec.rb +161 -159
- data/spec/watirspec/alert_spec.rb +61 -58
- data/spec/watirspec/browser_spec.rb +409 -409
- data/spec/watirspec/capabilities_spec.rb +96 -99
- data/spec/watirspec/cookies_spec.rb +120 -118
- data/spec/watirspec/drag_and_drop_spec.rb +26 -24
- data/spec/watirspec/element_hidden_spec.rb +66 -60
- data/spec/watirspec/elements/area_spec.rb +49 -47
- data/spec/watirspec/elements/areas_spec.rb +27 -25
- data/spec/watirspec/elements/button_spec.rb +253 -251
- data/spec/watirspec/elements/buttons_spec.rb +36 -34
- data/spec/watirspec/elements/checkbox_spec.rb +48 -36
- data/spec/watirspec/elements/checkboxes_spec.rb +29 -27
- data/spec/watirspec/elements/collections_spec.rb +126 -119
- data/spec/watirspec/elements/date_field_spec.rb +185 -183
- data/spec/watirspec/elements/date_fields_spec.rb +29 -27
- data/spec/watirspec/elements/date_time_field_spec.rb +197 -195
- data/spec/watirspec/elements/date_time_fields_spec.rb +30 -28
- data/spec/watirspec/elements/dd_spec.rb +87 -85
- data/spec/watirspec/elements/dds_spec.rb +27 -25
- data/spec/watirspec/elements/del_spec.rb +106 -104
- data/spec/watirspec/elements/dels_spec.rb +26 -24
- data/spec/watirspec/elements/div_spec.rb +225 -221
- data/spec/watirspec/elements/divs_spec.rb +37 -35
- data/spec/watirspec/elements/dl_spec.rb +110 -108
- data/spec/watirspec/elements/dls_spec.rb +28 -26
- data/spec/watirspec/elements/dt_spec.rb +86 -84
- data/spec/watirspec/elements/dts_spec.rb +27 -25
- data/spec/watirspec/elements/element_spec.rb +794 -775
- data/spec/watirspec/elements/elements_spec.rb +40 -38
- data/spec/watirspec/elements/em_spec.rb +62 -60
- data/spec/watirspec/elements/ems_spec.rb +28 -26
- data/spec/watirspec/elements/filefield_spec.rb +116 -114
- data/spec/watirspec/elements/filefields_spec.rb +28 -26
- data/spec/watirspec/elements/font_spec.rb +20 -18
- data/spec/watirspec/elements/form_spec.rb +51 -49
- data/spec/watirspec/elements/forms_spec.rb +29 -27
- data/spec/watirspec/elements/frame_spec.rb +89 -87
- data/spec/watirspec/elements/frames_spec.rb +27 -25
- data/spec/watirspec/elements/hidden_spec.rb +81 -79
- data/spec/watirspec/elements/hiddens_spec.rb +28 -26
- data/spec/watirspec/elements/hn_spec.rb +59 -57
- data/spec/watirspec/elements/hns_spec.rb +26 -24
- data/spec/watirspec/elements/iframe_spec.rb +195 -191
- data/spec/watirspec/elements/iframes_spec.rb +31 -29
- data/spec/watirspec/elements/image_spec.rb +148 -146
- data/spec/watirspec/elements/images_spec.rb +26 -24
- data/spec/watirspec/elements/input_spec.rb +9 -7
- data/spec/watirspec/elements/ins_spec.rb +106 -104
- data/spec/watirspec/elements/inses_spec.rb +26 -24
- data/spec/watirspec/elements/label_spec.rb +56 -54
- data/spec/watirspec/elements/labels_spec.rb +26 -24
- data/spec/watirspec/elements/li_spec.rb +76 -74
- data/spec/watirspec/elements/link_spec.rb +173 -177
- data/spec/watirspec/elements/links_spec.rb +45 -43
- data/spec/watirspec/elements/lis_spec.rb +27 -25
- data/spec/watirspec/elements/list_spec.rb +44 -42
- data/spec/watirspec/elements/map_spec.rb +57 -55
- data/spec/watirspec/elements/maps_spec.rb +27 -25
- data/spec/watirspec/elements/meta_spec.rb +16 -14
- data/spec/watirspec/elements/metas_spec.rb +26 -24
- data/spec/watirspec/elements/ol_spec.rb +56 -65
- data/spec/watirspec/elements/ols_spec.rb +26 -24
- data/spec/watirspec/elements/option_spec.rb +91 -89
- data/spec/watirspec/elements/p_spec.rb +81 -79
- data/spec/watirspec/elements/pre_spec.rb +77 -75
- data/spec/watirspec/elements/pres_spec.rb +26 -24
- data/spec/watirspec/elements/ps_spec.rb +26 -24
- data/spec/watirspec/elements/radio_spec.rb +251 -249
- data/spec/watirspec/elements/radios_spec.rb +28 -26
- data/spec/watirspec/elements/select_list_spec.rb +537 -526
- data/spec/watirspec/elements/select_lists_spec.rb +32 -30
- data/spec/watirspec/elements/span_spec.rb +112 -110
- data/spec/watirspec/elements/spans_spec.rb +26 -24
- data/spec/watirspec/elements/strong_spec.rb +58 -58
- data/spec/watirspec/elements/strongs_spec.rb +28 -26
- data/spec/watirspec/elements/table_spec.rb +192 -139
- data/spec/watirspec/elements/tables_spec.rb +28 -26
- data/spec/watirspec/elements/tbody_spec.rb +74 -72
- data/spec/watirspec/elements/tbodys_spec.rb +40 -38
- data/spec/watirspec/elements/td_spec.rb +66 -64
- data/spec/watirspec/elements/tds_spec.rb +41 -39
- data/spec/watirspec/elements/text_field_spec.rb +206 -204
- data/spec/watirspec/elements/text_fields_spec.rb +30 -28
- data/spec/watirspec/elements/textarea_spec.rb +20 -18
- data/spec/watirspec/elements/textareas_spec.rb +18 -16
- data/spec/watirspec/elements/tfoot_spec.rb +65 -63
- data/spec/watirspec/elements/tfoots_spec.rb +42 -40
- data/spec/watirspec/elements/thead_spec.rb +65 -63
- data/spec/watirspec/elements/theads_spec.rb +42 -40
- data/spec/watirspec/elements/tr_spec.rb +48 -46
- data/spec/watirspec/elements/trs_spec.rb +42 -40
- data/spec/watirspec/elements/ul_spec.rb +56 -54
- data/spec/watirspec/elements/uls_spec.rb +26 -24
- data/spec/watirspec/radio_set_spec.rb +269 -267
- data/spec/watirspec/screenshot_spec.rb +20 -18
- data/spec/watirspec/scroll_spec.rb +152 -148
- data/spec/watirspec/shadow_root_spec.rb +86 -83
- data/spec/watirspec/user_editable_spec.rb +200 -198
- data/spec/watirspec/wait_spec.rb +289 -295
- data/spec/watirspec/window_switching_spec.rb +422 -434
- data/spec/watirspec_helper.rb +1 -23
- data/watir.gemspec +5 -4
- metadata +44 -33
- data/spec/watirspec/attributes_spec.rb +0 -18
- data/spec/watirspec/elements/table_nesting_spec.rb +0 -51
- data/spec/watirspec/special_chars_spec.rb +0 -23
|
@@ -30,7 +30,7 @@ module Watir
|
|
|
30
30
|
Watir.logger.ignore(:watir_client)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
after
|
|
33
|
+
after { @browser&.close }
|
|
34
34
|
|
|
35
35
|
after(:all) { $browser = nil }
|
|
36
36
|
|
|
@@ -55,10 +55,10 @@ module Watir
|
|
|
55
55
|
# :capabilities (default Generated; Selenium object, or built from Hash; incompatible with options)
|
|
56
56
|
|
|
57
57
|
context 'when local', exclusive: {driver: :local_driver} do
|
|
58
|
-
context '
|
|
58
|
+
context 'when any browser' do
|
|
59
59
|
it 'accepts driver instance' do
|
|
60
60
|
driver = Selenium::WebDriver.for browser_symbol
|
|
61
|
-
@browser =
|
|
61
|
+
@browser = described_class.new(driver)
|
|
62
62
|
|
|
63
63
|
expect(actual_http).not_to be_a(Watir::HttpClient)
|
|
64
64
|
end
|
|
@@ -68,14 +68,14 @@ module Watir
|
|
|
68
68
|
client = Remote::Http::Default.new
|
|
69
69
|
capabilities = Watir::Capabilities.new(browser_symbol, service: service, http_client: client)
|
|
70
70
|
|
|
71
|
-
@browser =
|
|
71
|
+
@browser = described_class.new(capabilities)
|
|
72
72
|
|
|
73
73
|
expect(actual_service.instance_variable_get(:@port)).to eq 1234
|
|
74
74
|
expect(actual_http).to eq client
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
it 'browser symbol uses designated options and watir client without service' do
|
|
78
|
-
@browser =
|
|
78
|
+
@browser = described_class.new(browser_symbol)
|
|
79
79
|
|
|
80
80
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
81
81
|
expect(selenium_args).not_to include(:service)
|
|
@@ -83,8 +83,15 @@ module Watir
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
describe 'capabilities' do
|
|
86
|
+
it 'accepts namespaced value' do
|
|
87
|
+
options = {'key:value' => 'something'}
|
|
88
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
89
|
+
|
|
90
|
+
expect(generated_options.instance_variable_get(:@options)['key:value']).to eq 'something'
|
|
91
|
+
end
|
|
92
|
+
|
|
86
93
|
it 'just options object has options and watir client without capabilities or service' do
|
|
87
|
-
@browser =
|
|
94
|
+
@browser = described_class.new(options: Options.send(browser_symbol))
|
|
88
95
|
|
|
89
96
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
90
97
|
expect(selenium_args).not_to include(:service)
|
|
@@ -95,7 +102,7 @@ module Watir
|
|
|
95
102
|
service = Service.send(browser_symbol, port: 1234)
|
|
96
103
|
client = Remote::Http::Default.new
|
|
97
104
|
options = {browser_name: browser_name, unhandled_prompt_behavior: :accept_and_notify}
|
|
98
|
-
@browser =
|
|
105
|
+
@browser = described_class.new(options: options, service: service, http_client: client)
|
|
99
106
|
|
|
100
107
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
101
108
|
expect(selenium_args[:service]).to eq service
|
|
@@ -107,7 +114,7 @@ module Watir
|
|
|
107
114
|
caps = Remote::Capabilities.new(browser_name: browser_name)
|
|
108
115
|
|
|
109
116
|
expect {
|
|
110
|
-
@browser =
|
|
117
|
+
@browser = described_class.new(capabilities: caps)
|
|
111
118
|
}.to have_deprecated(:capabilities)
|
|
112
119
|
|
|
113
120
|
expect(selenium_args[:capabilities]).to eq(caps)
|
|
@@ -118,20 +125,20 @@ module Watir
|
|
|
118
125
|
it 'accepts page load and script timeouts in seconds' do
|
|
119
126
|
options = {page_load_timeout: 11,
|
|
120
127
|
script_timeout: 12}
|
|
121
|
-
@browser =
|
|
128
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
122
129
|
|
|
123
130
|
expect(actual_capabilities.timeouts[:page_load]).to eq 11_000
|
|
124
131
|
expect(actual_capabilities.timeouts[:script]).to eq 12_000
|
|
125
132
|
end
|
|
126
133
|
|
|
127
134
|
it 'unhandled prompt behavior defaults to ignore' do
|
|
128
|
-
@browser =
|
|
135
|
+
@browser = described_class.new(browser_symbol)
|
|
129
136
|
|
|
130
137
|
expect(actual_capabilities.unhandled_prompt_behavior).to eq 'ignore'
|
|
131
138
|
end
|
|
132
139
|
|
|
133
140
|
it 'unhandled prompt behavior can be overridden' do
|
|
134
|
-
@browser =
|
|
141
|
+
@browser = described_class.new(browser_symbol, options: {unhandled_prompt_behavior: :accept_and_notify})
|
|
135
142
|
|
|
136
143
|
expect(actual_capabilities.unhandled_prompt_behavior).to eq 'accept and notify'
|
|
137
144
|
end
|
|
@@ -139,7 +146,7 @@ module Watir
|
|
|
139
146
|
it 'generates options from Hash', except: {browser: :safari,
|
|
140
147
|
reason: 'Does not accept unrecognized args'} do
|
|
141
148
|
options = {page_load_strategy: 'eager', args: %w[--foo --bar]}
|
|
142
|
-
@browser =
|
|
149
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
143
150
|
|
|
144
151
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
145
152
|
expect(generated_options.page_load_strategy).to eq 'eager'
|
|
@@ -150,7 +157,7 @@ module Watir
|
|
|
150
157
|
describe 'service' do
|
|
151
158
|
it 'uses provided service' do
|
|
152
159
|
service = Service.send(browser_symbol, port: 1234)
|
|
153
|
-
@browser =
|
|
160
|
+
@browser = described_class.new(browser_symbol, service: service)
|
|
154
161
|
|
|
155
162
|
expect(selenium_browser).to eq browser_symbol
|
|
156
163
|
expect(selenium_args[:service]).to eq service
|
|
@@ -159,7 +166,7 @@ module Watir
|
|
|
159
166
|
|
|
160
167
|
it 'builds service from a Hash' do
|
|
161
168
|
@service = {port: 1234}
|
|
162
|
-
@browser =
|
|
169
|
+
@browser = described_class.new(browser_symbol, service: @service)
|
|
163
170
|
|
|
164
171
|
expect(selenium_browser).to eq browser_symbol
|
|
165
172
|
expect(selenium_args[:service]).to be_a Service
|
|
@@ -169,21 +176,21 @@ module Watir
|
|
|
169
176
|
|
|
170
177
|
describe 'http_client' do
|
|
171
178
|
it 'uses default HTTP Client' do
|
|
172
|
-
@browser =
|
|
179
|
+
@browser = described_class.new(browser_symbol)
|
|
173
180
|
|
|
174
181
|
expect(actual_http).to be_a HttpClient
|
|
175
182
|
end
|
|
176
183
|
|
|
177
184
|
it 'accepts an HTTP Client object' do
|
|
178
185
|
client = Remote::Http::Default.new
|
|
179
|
-
@browser =
|
|
186
|
+
@browser = described_class.new(browser_symbol, http_client: client)
|
|
180
187
|
|
|
181
188
|
expect(actual_http).to eq client
|
|
182
189
|
end
|
|
183
190
|
|
|
184
191
|
it 'builds an HTTP Client from Hash' do
|
|
185
192
|
client_opts = {open_timeout: 9, read_timeout: 11}
|
|
186
|
-
@browser =
|
|
193
|
+
@browser = described_class.new(browser_symbol, http_client: client_opts)
|
|
187
194
|
|
|
188
195
|
expect(actual_http).to be_a HttpClient
|
|
189
196
|
expect(actual_http.instance_variable_get(:@open_timeout)).to eq 9
|
|
@@ -193,7 +200,7 @@ module Watir
|
|
|
193
200
|
|
|
194
201
|
it 'uses a listener' do
|
|
195
202
|
listener = Selenium::WebDriver::Support::AbstractEventListener.new
|
|
196
|
-
@browser =
|
|
203
|
+
@browser = described_class.new(browser_symbol, listener: listener)
|
|
197
204
|
|
|
198
205
|
expect(actual_listener).to eq listener
|
|
199
206
|
end
|
|
@@ -202,7 +209,7 @@ module Watir
|
|
|
202
209
|
it 'adds Selenium Proxy to empty Options', except: {browser: :safari,
|
|
203
210
|
reason: 'Safari does not like proxies'} do
|
|
204
211
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
205
|
-
@browser =
|
|
212
|
+
@browser = described_class.new(browser_symbol, proxy: proxy)
|
|
206
213
|
|
|
207
214
|
expect(actual_capabilities.proxy).to eq proxy
|
|
208
215
|
end
|
|
@@ -210,7 +217,7 @@ module Watir
|
|
|
210
217
|
it 'builds a Proxy from Hash for Options', except: {browser: :safari,
|
|
211
218
|
reason: 'Safari does not like proxies'} do
|
|
212
219
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
213
|
-
@browser =
|
|
220
|
+
@browser = described_class.new(browser_symbol, proxy: proxy)
|
|
214
221
|
|
|
215
222
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
216
223
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -224,7 +231,7 @@ module Watir
|
|
|
224
231
|
options = {unhandled_prompt_behavior: :accept,
|
|
225
232
|
page_load_strategy: :eager}
|
|
226
233
|
|
|
227
|
-
@browser =
|
|
234
|
+
@browser = described_class.new(browser_symbol, options: options, proxy: proxy)
|
|
228
235
|
|
|
229
236
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
230
237
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -239,7 +246,7 @@ module Watir
|
|
|
239
246
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
240
247
|
options = Options.send(browser_symbol, unhandled_prompt_behavior: :accept, page_load_strategy: :eager)
|
|
241
248
|
|
|
242
|
-
@browser =
|
|
249
|
+
@browser = described_class.new(browser_symbol, options: options, proxy: proxy)
|
|
243
250
|
|
|
244
251
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
245
252
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -251,9 +258,9 @@ module Watir
|
|
|
251
258
|
end
|
|
252
259
|
end
|
|
253
260
|
|
|
254
|
-
context 'chrome', exclusive: {browser: :chrome} do
|
|
261
|
+
context 'when chrome', exclusive: {browser: :chrome} do
|
|
255
262
|
it 'by default uses chrome, has client, options, but not capabilities' do
|
|
256
|
-
@browser =
|
|
263
|
+
@browser = described_class.new
|
|
257
264
|
|
|
258
265
|
expect(generated_options).to be_a Selenium::WebDriver::Chrome::Options
|
|
259
266
|
expect(actual_http).to be_a HttpClient
|
|
@@ -261,116 +268,106 @@ module Watir
|
|
|
261
268
|
end
|
|
262
269
|
|
|
263
270
|
it 'sets headless by creating options' do
|
|
264
|
-
@browser =
|
|
271
|
+
@browser = described_class.new(:chrome, headless: true)
|
|
265
272
|
|
|
266
273
|
expect(generated_options.args).to include '--headless'
|
|
267
274
|
end
|
|
268
275
|
|
|
269
276
|
it 'sets headless in existing options class' do
|
|
270
|
-
@browser =
|
|
271
|
-
|
|
272
|
-
|
|
277
|
+
@browser = described_class.new(:chrome,
|
|
278
|
+
options: Options.chrome,
|
|
279
|
+
headless: true)
|
|
273
280
|
|
|
274
281
|
expect(generated_options.args).to include '--headless'
|
|
275
282
|
end
|
|
276
283
|
|
|
277
284
|
it 'sets headless when existing options is a Hash' do
|
|
278
285
|
options = {args: ['--foo']}
|
|
279
|
-
@browser =
|
|
280
|
-
|
|
281
|
-
|
|
286
|
+
@browser = described_class.new(:chrome,
|
|
287
|
+
options: options,
|
|
288
|
+
headless: true)
|
|
282
289
|
|
|
283
290
|
expect(generated_options.args).to include '--headless'
|
|
284
291
|
end
|
|
285
292
|
end
|
|
286
293
|
|
|
287
|
-
context 'edge', exclusive: {browser: :edge} do
|
|
294
|
+
context 'when edge', exclusive: {browser: :edge} do
|
|
288
295
|
it 'sets headless by creating options' do
|
|
289
|
-
@browser =
|
|
296
|
+
@browser = described_class.new(:edge, headless: true)
|
|
290
297
|
|
|
291
298
|
expect(generated_options.args).to include '--headless'
|
|
292
299
|
end
|
|
293
300
|
|
|
294
301
|
it 'sets headless in existing options class' do
|
|
295
|
-
@browser =
|
|
296
|
-
|
|
297
|
-
|
|
302
|
+
@browser = described_class.new(:edge,
|
|
303
|
+
options: Options.edge,
|
|
304
|
+
headless: true)
|
|
298
305
|
|
|
299
306
|
expect(generated_options.args).to include '--headless'
|
|
300
307
|
end
|
|
301
308
|
|
|
302
309
|
it 'sets headless when existing options is a Hash' do
|
|
303
310
|
options = {args: ['--foo']}
|
|
304
|
-
@browser =
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
@browser = described_class.new(:edge,
|
|
312
|
+
options: options,
|
|
313
|
+
headless: true)
|
|
307
314
|
|
|
308
315
|
expect(generated_options.args).to include '--headless'
|
|
309
316
|
end
|
|
310
317
|
end
|
|
311
318
|
|
|
312
|
-
context 'firefox', exclusive: {browser: :firefox} do
|
|
319
|
+
context 'when firefox', exclusive: {browser: :firefox} do
|
|
313
320
|
it 'puts Profile inside Options as Hash' do
|
|
314
321
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
|
315
322
|
options = {args: ['--foo'], profile: profile}
|
|
316
323
|
|
|
317
|
-
@browser =
|
|
318
|
-
|
|
319
|
-
expect(generated_options.args).to include '--foo'
|
|
320
|
-
expect(generated_options.profile).to eq profile
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
it 'puts Profile inside Hash options' do
|
|
324
|
-
profile = Selenium::WebDriver::Firefox::Profile.new
|
|
325
|
-
options = {args: ['--foo'], profile: profile}
|
|
326
|
-
|
|
327
|
-
@browser = Browser.new(:firefox, options: options)
|
|
324
|
+
@browser = described_class.new(:firefox, options: options)
|
|
328
325
|
|
|
329
326
|
expect(generated_options.args).to include '--foo'
|
|
330
327
|
expect(generated_options.profile).to eq profile
|
|
331
328
|
end
|
|
332
329
|
|
|
333
330
|
it 'sets headless by creating options' do
|
|
334
|
-
@browser =
|
|
331
|
+
@browser = described_class.new(:firefox, headless: true)
|
|
335
332
|
|
|
336
333
|
expect(generated_options.args).to include '-headless'
|
|
337
334
|
end
|
|
338
335
|
|
|
339
336
|
it 'sets headless in existing options class' do
|
|
340
|
-
@browser =
|
|
341
|
-
|
|
342
|
-
|
|
337
|
+
@browser = described_class.new(:firefox,
|
|
338
|
+
options: Options.firefox,
|
|
339
|
+
headless: true)
|
|
343
340
|
|
|
344
341
|
expect(generated_options.args).to include '-headless'
|
|
345
342
|
end
|
|
346
343
|
|
|
347
344
|
it 'sets headless when existing options is a Hash' do
|
|
348
345
|
options = {args: ['-foo']}
|
|
349
|
-
@browser =
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
@browser = described_class.new(:firefox,
|
|
347
|
+
options: options,
|
|
348
|
+
headless: true)
|
|
352
349
|
|
|
353
350
|
expect(generated_options.args).to include '-headless', '-foo'
|
|
354
351
|
end
|
|
355
352
|
end
|
|
356
353
|
|
|
357
|
-
context 'safari', exclusive: {browser: :safari} do
|
|
358
|
-
after
|
|
354
|
+
context 'when safari', exclusive: {browser: :safari} do
|
|
355
|
+
after { Selenium::WebDriver::Safari.use_technology_preview = false }
|
|
359
356
|
|
|
360
357
|
it 'sets Technology Preview', exclude: {browser: :safari,
|
|
361
358
|
reason: 'Broken in Selenium'} do
|
|
362
|
-
@browser =
|
|
359
|
+
@browser = described_class.new(:safari, technology_preview: true)
|
|
363
360
|
|
|
364
|
-
expect(Selenium::WebDriver::Safari.technology_preview?).to
|
|
361
|
+
expect(Selenium::WebDriver::Safari.technology_preview?).to be true
|
|
365
362
|
end
|
|
366
363
|
|
|
367
364
|
it 'generates options from Hash with custom option' do
|
|
368
365
|
options = {page_load_strategy: 'eager', automatic_inspection: true}
|
|
369
|
-
@browser =
|
|
366
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
370
367
|
|
|
371
368
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
372
369
|
expect(actual_capabilities.page_load_strategy).to eq 'eager'
|
|
373
|
-
expect(actual_capabilities['safari:automaticInspection']).to
|
|
370
|
+
expect(actual_capabilities['safari:automaticInspection']).to be true
|
|
374
371
|
end
|
|
375
372
|
end
|
|
376
373
|
end
|
|
@@ -388,7 +385,7 @@ module Watir
|
|
|
388
385
|
let(:url) { "#{WatirSpec.implementation.browser_args.last[:url]}/" }
|
|
389
386
|
|
|
390
387
|
it 'with just url' do
|
|
391
|
-
@browser =
|
|
388
|
+
@browser = described_class.new(url: url)
|
|
392
389
|
|
|
393
390
|
expect(selenium_browser).to eq :remote
|
|
394
391
|
expect(selenium_args).not_to include(:service)
|
|
@@ -399,7 +396,7 @@ module Watir
|
|
|
399
396
|
end
|
|
400
397
|
|
|
401
398
|
it 'just url & browser name has options and client but not service' do
|
|
402
|
-
@browser =
|
|
399
|
+
@browser = described_class.new(browser_symbol, url: url)
|
|
403
400
|
|
|
404
401
|
expect(selenium_browser).to eq :remote
|
|
405
402
|
expect(selenium_args).not_to include(:service)
|
|
@@ -411,9 +408,9 @@ module Watir
|
|
|
411
408
|
|
|
412
409
|
it 'accepts a listener' do
|
|
413
410
|
listener = Selenium::WebDriver::Support::AbstractEventListener.new
|
|
414
|
-
@browser =
|
|
415
|
-
|
|
416
|
-
|
|
411
|
+
@browser = described_class.new(browser_symbol,
|
|
412
|
+
url: url,
|
|
413
|
+
listener: listener)
|
|
417
414
|
|
|
418
415
|
expect(actual_listener).to eq listener
|
|
419
416
|
|
|
@@ -425,9 +422,9 @@ module Watir
|
|
|
425
422
|
|
|
426
423
|
it 'accepts http client object' do
|
|
427
424
|
client = HttpClient.new
|
|
428
|
-
@browser =
|
|
429
|
-
|
|
430
|
-
|
|
425
|
+
@browser = described_class.new(browser_symbol,
|
|
426
|
+
url: url,
|
|
427
|
+
http_client: client)
|
|
431
428
|
|
|
432
429
|
expect(actual_http).to eq client
|
|
433
430
|
|
|
@@ -439,9 +436,9 @@ module Watir
|
|
|
439
436
|
end
|
|
440
437
|
|
|
441
438
|
it 'accepts http client Hash' do
|
|
442
|
-
@browser =
|
|
443
|
-
|
|
444
|
-
|
|
439
|
+
@browser = described_class.new(browser_symbol,
|
|
440
|
+
url: url,
|
|
441
|
+
http_client: {read_timeout: 30})
|
|
445
442
|
|
|
446
443
|
expect(actual_http.instance_variable_get(:@read_timeout)).to eq 30
|
|
447
444
|
|
|
@@ -454,9 +451,9 @@ module Watir
|
|
|
454
451
|
|
|
455
452
|
it 'accepts proxy object' do
|
|
456
453
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
457
|
-
@browser =
|
|
458
|
-
|
|
459
|
-
|
|
454
|
+
@browser = described_class.new(browser_symbol,
|
|
455
|
+
url: url,
|
|
456
|
+
proxy: proxy)
|
|
460
457
|
|
|
461
458
|
expect(actual_capabilities.proxy).to eq proxy
|
|
462
459
|
|
|
@@ -470,9 +467,9 @@ module Watir
|
|
|
470
467
|
|
|
471
468
|
it 'accepts proxy Hash' do
|
|
472
469
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
473
|
-
@browser =
|
|
474
|
-
|
|
475
|
-
|
|
470
|
+
@browser = described_class.new(browser_symbol,
|
|
471
|
+
url: url,
|
|
472
|
+
proxy: proxy)
|
|
476
473
|
|
|
477
474
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
478
475
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -488,9 +485,9 @@ module Watir
|
|
|
488
485
|
end
|
|
489
486
|
|
|
490
487
|
it 'accepts options object' do
|
|
491
|
-
@browser =
|
|
492
|
-
|
|
493
|
-
|
|
488
|
+
@browser = described_class.new(browser_symbol,
|
|
489
|
+
url: url,
|
|
490
|
+
options: Options.send(browser_symbol, args: ['--foo']))
|
|
494
491
|
|
|
495
492
|
expect(generated_options.args).to include('--foo')
|
|
496
493
|
|
|
@@ -504,9 +501,9 @@ module Watir
|
|
|
504
501
|
|
|
505
502
|
it 'accepts options hash' do
|
|
506
503
|
options = {prefs: {foo: 'bar'}}
|
|
507
|
-
@browser =
|
|
508
|
-
|
|
509
|
-
|
|
504
|
+
@browser = described_class.new(browser_symbol,
|
|
505
|
+
url: url,
|
|
506
|
+
options: options)
|
|
510
507
|
|
|
511
508
|
expect(selenium_browser).to eq :remote
|
|
512
509
|
expect(selenium_args).not_to include(:service)
|
|
@@ -519,9 +516,9 @@ module Watir
|
|
|
519
516
|
|
|
520
517
|
it 'accepts capabilities object' do
|
|
521
518
|
capabilities = Remote::Capabilities.send(browser_symbol)
|
|
522
|
-
@browser =
|
|
523
|
-
|
|
524
|
-
|
|
519
|
+
@browser = described_class.new(browser_symbol,
|
|
520
|
+
url: url,
|
|
521
|
+
capabilities: capabilities)
|
|
525
522
|
|
|
526
523
|
expect(selenium_browser).to eq :remote
|
|
527
524
|
expect(selenium_args).not_to include(:service)
|
|
@@ -534,10 +531,10 @@ module Watir
|
|
|
534
531
|
it 'accepts http client & capabilities objects' do
|
|
535
532
|
client = HttpClient.new
|
|
536
533
|
capabilities = Remote::Capabilities.send(browser_symbol)
|
|
537
|
-
@browser =
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
534
|
+
@browser = described_class.new(browser_symbol,
|
|
535
|
+
url: url,
|
|
536
|
+
capabilities: capabilities,
|
|
537
|
+
http_client: client)
|
|
541
538
|
|
|
542
539
|
expect(selenium_browser).to eq :remote
|
|
543
540
|
expect(selenium_args).not_to include(:service)
|
|
@@ -551,11 +548,11 @@ module Watir
|
|
|
551
548
|
client = HttpClient.new
|
|
552
549
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
553
550
|
options = Options.send(browser_symbol, prefs: {foo: 'bar'})
|
|
554
|
-
@browser =
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
551
|
+
@browser = described_class.new(browser_symbol,
|
|
552
|
+
url: url,
|
|
553
|
+
proxy: proxy,
|
|
554
|
+
options: options,
|
|
555
|
+
http_client: client)
|
|
559
556
|
|
|
560
557
|
expect(selenium_browser).to eq :remote
|
|
561
558
|
expect(selenium_args).not_to include :service
|