watir 7.2.0 → 7.2.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.
- 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 +6 -1
- data/LICENSE +2 -2
- data/lib/watir/capabilities.rb +1 -1
- 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 +89 -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)
|
|
@@ -84,7 +84,7 @@ module Watir
|
|
|
84
84
|
|
|
85
85
|
describe 'capabilities' do
|
|
86
86
|
it 'just options object has options and watir client without capabilities or service' do
|
|
87
|
-
@browser =
|
|
87
|
+
@browser = described_class.new(options: Options.send(browser_symbol))
|
|
88
88
|
|
|
89
89
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
90
90
|
expect(selenium_args).not_to include(:service)
|
|
@@ -95,7 +95,7 @@ module Watir
|
|
|
95
95
|
service = Service.send(browser_symbol, port: 1234)
|
|
96
96
|
client = Remote::Http::Default.new
|
|
97
97
|
options = {browser_name: browser_name, unhandled_prompt_behavior: :accept_and_notify}
|
|
98
|
-
@browser =
|
|
98
|
+
@browser = described_class.new(options: options, service: service, http_client: client)
|
|
99
99
|
|
|
100
100
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
101
101
|
expect(selenium_args[:service]).to eq service
|
|
@@ -107,7 +107,7 @@ module Watir
|
|
|
107
107
|
caps = Remote::Capabilities.new(browser_name: browser_name)
|
|
108
108
|
|
|
109
109
|
expect {
|
|
110
|
-
@browser =
|
|
110
|
+
@browser = described_class.new(capabilities: caps)
|
|
111
111
|
}.to have_deprecated(:capabilities)
|
|
112
112
|
|
|
113
113
|
expect(selenium_args[:capabilities]).to eq(caps)
|
|
@@ -118,20 +118,20 @@ module Watir
|
|
|
118
118
|
it 'accepts page load and script timeouts in seconds' do
|
|
119
119
|
options = {page_load_timeout: 11,
|
|
120
120
|
script_timeout: 12}
|
|
121
|
-
@browser =
|
|
121
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
122
122
|
|
|
123
123
|
expect(actual_capabilities.timeouts[:page_load]).to eq 11_000
|
|
124
124
|
expect(actual_capabilities.timeouts[:script]).to eq 12_000
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
it 'unhandled prompt behavior defaults to ignore' do
|
|
128
|
-
@browser =
|
|
128
|
+
@browser = described_class.new(browser_symbol)
|
|
129
129
|
|
|
130
130
|
expect(actual_capabilities.unhandled_prompt_behavior).to eq 'ignore'
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
it 'unhandled prompt behavior can be overridden' do
|
|
134
|
-
@browser =
|
|
134
|
+
@browser = described_class.new(browser_symbol, options: {unhandled_prompt_behavior: :accept_and_notify})
|
|
135
135
|
|
|
136
136
|
expect(actual_capabilities.unhandled_prompt_behavior).to eq 'accept and notify'
|
|
137
137
|
end
|
|
@@ -139,7 +139,7 @@ module Watir
|
|
|
139
139
|
it 'generates options from Hash', except: {browser: :safari,
|
|
140
140
|
reason: 'Does not accept unrecognized args'} do
|
|
141
141
|
options = {page_load_strategy: 'eager', args: %w[--foo --bar]}
|
|
142
|
-
@browser =
|
|
142
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
143
143
|
|
|
144
144
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
145
145
|
expect(generated_options.page_load_strategy).to eq 'eager'
|
|
@@ -150,7 +150,7 @@ module Watir
|
|
|
150
150
|
describe 'service' do
|
|
151
151
|
it 'uses provided service' do
|
|
152
152
|
service = Service.send(browser_symbol, port: 1234)
|
|
153
|
-
@browser =
|
|
153
|
+
@browser = described_class.new(browser_symbol, service: service)
|
|
154
154
|
|
|
155
155
|
expect(selenium_browser).to eq browser_symbol
|
|
156
156
|
expect(selenium_args[:service]).to eq service
|
|
@@ -159,7 +159,7 @@ module Watir
|
|
|
159
159
|
|
|
160
160
|
it 'builds service from a Hash' do
|
|
161
161
|
@service = {port: 1234}
|
|
162
|
-
@browser =
|
|
162
|
+
@browser = described_class.new(browser_symbol, service: @service)
|
|
163
163
|
|
|
164
164
|
expect(selenium_browser).to eq browser_symbol
|
|
165
165
|
expect(selenium_args[:service]).to be_a Service
|
|
@@ -169,21 +169,21 @@ module Watir
|
|
|
169
169
|
|
|
170
170
|
describe 'http_client' do
|
|
171
171
|
it 'uses default HTTP Client' do
|
|
172
|
-
@browser =
|
|
172
|
+
@browser = described_class.new(browser_symbol)
|
|
173
173
|
|
|
174
174
|
expect(actual_http).to be_a HttpClient
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
it 'accepts an HTTP Client object' do
|
|
178
178
|
client = Remote::Http::Default.new
|
|
179
|
-
@browser =
|
|
179
|
+
@browser = described_class.new(browser_symbol, http_client: client)
|
|
180
180
|
|
|
181
181
|
expect(actual_http).to eq client
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
it 'builds an HTTP Client from Hash' do
|
|
185
185
|
client_opts = {open_timeout: 9, read_timeout: 11}
|
|
186
|
-
@browser =
|
|
186
|
+
@browser = described_class.new(browser_symbol, http_client: client_opts)
|
|
187
187
|
|
|
188
188
|
expect(actual_http).to be_a HttpClient
|
|
189
189
|
expect(actual_http.instance_variable_get(:@open_timeout)).to eq 9
|
|
@@ -193,7 +193,7 @@ module Watir
|
|
|
193
193
|
|
|
194
194
|
it 'uses a listener' do
|
|
195
195
|
listener = Selenium::WebDriver::Support::AbstractEventListener.new
|
|
196
|
-
@browser =
|
|
196
|
+
@browser = described_class.new(browser_symbol, listener: listener)
|
|
197
197
|
|
|
198
198
|
expect(actual_listener).to eq listener
|
|
199
199
|
end
|
|
@@ -202,7 +202,7 @@ module Watir
|
|
|
202
202
|
it 'adds Selenium Proxy to empty Options', except: {browser: :safari,
|
|
203
203
|
reason: 'Safari does not like proxies'} do
|
|
204
204
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
205
|
-
@browser =
|
|
205
|
+
@browser = described_class.new(browser_symbol, proxy: proxy)
|
|
206
206
|
|
|
207
207
|
expect(actual_capabilities.proxy).to eq proxy
|
|
208
208
|
end
|
|
@@ -210,7 +210,7 @@ module Watir
|
|
|
210
210
|
it 'builds a Proxy from Hash for Options', except: {browser: :safari,
|
|
211
211
|
reason: 'Safari does not like proxies'} do
|
|
212
212
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
213
|
-
@browser =
|
|
213
|
+
@browser = described_class.new(browser_symbol, proxy: proxy)
|
|
214
214
|
|
|
215
215
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
216
216
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -224,7 +224,7 @@ module Watir
|
|
|
224
224
|
options = {unhandled_prompt_behavior: :accept,
|
|
225
225
|
page_load_strategy: :eager}
|
|
226
226
|
|
|
227
|
-
@browser =
|
|
227
|
+
@browser = described_class.new(browser_symbol, options: options, proxy: proxy)
|
|
228
228
|
|
|
229
229
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
230
230
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -239,7 +239,7 @@ module Watir
|
|
|
239
239
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
240
240
|
options = Options.send(browser_symbol, unhandled_prompt_behavior: :accept, page_load_strategy: :eager)
|
|
241
241
|
|
|
242
|
-
@browser =
|
|
242
|
+
@browser = described_class.new(browser_symbol, options: options, proxy: proxy)
|
|
243
243
|
|
|
244
244
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
245
245
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -251,9 +251,9 @@ module Watir
|
|
|
251
251
|
end
|
|
252
252
|
end
|
|
253
253
|
|
|
254
|
-
context 'chrome', exclusive: {browser: :chrome} do
|
|
254
|
+
context 'when chrome', exclusive: {browser: :chrome} do
|
|
255
255
|
it 'by default uses chrome, has client, options, but not capabilities' do
|
|
256
|
-
@browser =
|
|
256
|
+
@browser = described_class.new
|
|
257
257
|
|
|
258
258
|
expect(generated_options).to be_a Selenium::WebDriver::Chrome::Options
|
|
259
259
|
expect(actual_http).to be_a HttpClient
|
|
@@ -261,116 +261,106 @@ module Watir
|
|
|
261
261
|
end
|
|
262
262
|
|
|
263
263
|
it 'sets headless by creating options' do
|
|
264
|
-
@browser =
|
|
264
|
+
@browser = described_class.new(:chrome, headless: true)
|
|
265
265
|
|
|
266
266
|
expect(generated_options.args).to include '--headless'
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
it 'sets headless in existing options class' do
|
|
270
|
-
@browser =
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
@browser = described_class.new(:chrome,
|
|
271
|
+
options: Options.chrome,
|
|
272
|
+
headless: true)
|
|
273
273
|
|
|
274
274
|
expect(generated_options.args).to include '--headless'
|
|
275
275
|
end
|
|
276
276
|
|
|
277
277
|
it 'sets headless when existing options is a Hash' do
|
|
278
278
|
options = {args: ['--foo']}
|
|
279
|
-
@browser =
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
@browser = described_class.new(:chrome,
|
|
280
|
+
options: options,
|
|
281
|
+
headless: true)
|
|
282
282
|
|
|
283
283
|
expect(generated_options.args).to include '--headless'
|
|
284
284
|
end
|
|
285
285
|
end
|
|
286
286
|
|
|
287
|
-
context 'edge', exclusive: {browser: :edge} do
|
|
287
|
+
context 'when edge', exclusive: {browser: :edge} do
|
|
288
288
|
it 'sets headless by creating options' do
|
|
289
|
-
@browser =
|
|
289
|
+
@browser = described_class.new(:edge, headless: true)
|
|
290
290
|
|
|
291
291
|
expect(generated_options.args).to include '--headless'
|
|
292
292
|
end
|
|
293
293
|
|
|
294
294
|
it 'sets headless in existing options class' do
|
|
295
|
-
@browser =
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
@browser = described_class.new(:edge,
|
|
296
|
+
options: Options.edge,
|
|
297
|
+
headless: true)
|
|
298
298
|
|
|
299
299
|
expect(generated_options.args).to include '--headless'
|
|
300
300
|
end
|
|
301
301
|
|
|
302
302
|
it 'sets headless when existing options is a Hash' do
|
|
303
303
|
options = {args: ['--foo']}
|
|
304
|
-
@browser =
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
@browser = described_class.new(:edge,
|
|
305
|
+
options: options,
|
|
306
|
+
headless: true)
|
|
307
307
|
|
|
308
308
|
expect(generated_options.args).to include '--headless'
|
|
309
309
|
end
|
|
310
310
|
end
|
|
311
311
|
|
|
312
|
-
context 'firefox', exclusive: {browser: :firefox} do
|
|
312
|
+
context 'when firefox', exclusive: {browser: :firefox} do
|
|
313
313
|
it 'puts Profile inside Options as Hash' do
|
|
314
314
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
|
315
315
|
options = {args: ['--foo'], profile: profile}
|
|
316
316
|
|
|
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)
|
|
317
|
+
@browser = described_class.new(:firefox, options: options)
|
|
328
318
|
|
|
329
319
|
expect(generated_options.args).to include '--foo'
|
|
330
320
|
expect(generated_options.profile).to eq profile
|
|
331
321
|
end
|
|
332
322
|
|
|
333
323
|
it 'sets headless by creating options' do
|
|
334
|
-
@browser =
|
|
324
|
+
@browser = described_class.new(:firefox, headless: true)
|
|
335
325
|
|
|
336
326
|
expect(generated_options.args).to include '-headless'
|
|
337
327
|
end
|
|
338
328
|
|
|
339
329
|
it 'sets headless in existing options class' do
|
|
340
|
-
@browser =
|
|
341
|
-
|
|
342
|
-
|
|
330
|
+
@browser = described_class.new(:firefox,
|
|
331
|
+
options: Options.firefox,
|
|
332
|
+
headless: true)
|
|
343
333
|
|
|
344
334
|
expect(generated_options.args).to include '-headless'
|
|
345
335
|
end
|
|
346
336
|
|
|
347
337
|
it 'sets headless when existing options is a Hash' do
|
|
348
338
|
options = {args: ['-foo']}
|
|
349
|
-
@browser =
|
|
350
|
-
|
|
351
|
-
|
|
339
|
+
@browser = described_class.new(:firefox,
|
|
340
|
+
options: options,
|
|
341
|
+
headless: true)
|
|
352
342
|
|
|
353
343
|
expect(generated_options.args).to include '-headless', '-foo'
|
|
354
344
|
end
|
|
355
345
|
end
|
|
356
346
|
|
|
357
|
-
context 'safari', exclusive: {browser: :safari} do
|
|
358
|
-
after
|
|
347
|
+
context 'when safari', exclusive: {browser: :safari} do
|
|
348
|
+
after { Selenium::WebDriver::Safari.use_technology_preview = false }
|
|
359
349
|
|
|
360
350
|
it 'sets Technology Preview', exclude: {browser: :safari,
|
|
361
351
|
reason: 'Broken in Selenium'} do
|
|
362
|
-
@browser =
|
|
352
|
+
@browser = described_class.new(:safari, technology_preview: true)
|
|
363
353
|
|
|
364
|
-
expect(Selenium::WebDriver::Safari.technology_preview?).to
|
|
354
|
+
expect(Selenium::WebDriver::Safari.technology_preview?).to be true
|
|
365
355
|
end
|
|
366
356
|
|
|
367
357
|
it 'generates options from Hash with custom option' do
|
|
368
358
|
options = {page_load_strategy: 'eager', automatic_inspection: true}
|
|
369
|
-
@browser =
|
|
359
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
370
360
|
|
|
371
361
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
372
362
|
expect(actual_capabilities.page_load_strategy).to eq 'eager'
|
|
373
|
-
expect(actual_capabilities['safari:automaticInspection']).to
|
|
363
|
+
expect(actual_capabilities['safari:automaticInspection']).to be true
|
|
374
364
|
end
|
|
375
365
|
end
|
|
376
366
|
end
|
|
@@ -388,7 +378,7 @@ module Watir
|
|
|
388
378
|
let(:url) { "#{WatirSpec.implementation.browser_args.last[:url]}/" }
|
|
389
379
|
|
|
390
380
|
it 'with just url' do
|
|
391
|
-
@browser =
|
|
381
|
+
@browser = described_class.new(url: url)
|
|
392
382
|
|
|
393
383
|
expect(selenium_browser).to eq :remote
|
|
394
384
|
expect(selenium_args).not_to include(:service)
|
|
@@ -399,7 +389,7 @@ module Watir
|
|
|
399
389
|
end
|
|
400
390
|
|
|
401
391
|
it 'just url & browser name has options and client but not service' do
|
|
402
|
-
@browser =
|
|
392
|
+
@browser = described_class.new(browser_symbol, url: url)
|
|
403
393
|
|
|
404
394
|
expect(selenium_browser).to eq :remote
|
|
405
395
|
expect(selenium_args).not_to include(:service)
|
|
@@ -411,9 +401,9 @@ module Watir
|
|
|
411
401
|
|
|
412
402
|
it 'accepts a listener' do
|
|
413
403
|
listener = Selenium::WebDriver::Support::AbstractEventListener.new
|
|
414
|
-
@browser =
|
|
415
|
-
|
|
416
|
-
|
|
404
|
+
@browser = described_class.new(browser_symbol,
|
|
405
|
+
url: url,
|
|
406
|
+
listener: listener)
|
|
417
407
|
|
|
418
408
|
expect(actual_listener).to eq listener
|
|
419
409
|
|
|
@@ -425,9 +415,9 @@ module Watir
|
|
|
425
415
|
|
|
426
416
|
it 'accepts http client object' do
|
|
427
417
|
client = HttpClient.new
|
|
428
|
-
@browser =
|
|
429
|
-
|
|
430
|
-
|
|
418
|
+
@browser = described_class.new(browser_symbol,
|
|
419
|
+
url: url,
|
|
420
|
+
http_client: client)
|
|
431
421
|
|
|
432
422
|
expect(actual_http).to eq client
|
|
433
423
|
|
|
@@ -439,9 +429,9 @@ module Watir
|
|
|
439
429
|
end
|
|
440
430
|
|
|
441
431
|
it 'accepts http client Hash' do
|
|
442
|
-
@browser =
|
|
443
|
-
|
|
444
|
-
|
|
432
|
+
@browser = described_class.new(browser_symbol,
|
|
433
|
+
url: url,
|
|
434
|
+
http_client: {read_timeout: 30})
|
|
445
435
|
|
|
446
436
|
expect(actual_http.instance_variable_get(:@read_timeout)).to eq 30
|
|
447
437
|
|
|
@@ -454,9 +444,9 @@ module Watir
|
|
|
454
444
|
|
|
455
445
|
it 'accepts proxy object' do
|
|
456
446
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
457
|
-
@browser =
|
|
458
|
-
|
|
459
|
-
|
|
447
|
+
@browser = described_class.new(browser_symbol,
|
|
448
|
+
url: url,
|
|
449
|
+
proxy: proxy)
|
|
460
450
|
|
|
461
451
|
expect(actual_capabilities.proxy).to eq proxy
|
|
462
452
|
|
|
@@ -470,9 +460,9 @@ module Watir
|
|
|
470
460
|
|
|
471
461
|
it 'accepts proxy Hash' do
|
|
472
462
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
473
|
-
@browser =
|
|
474
|
-
|
|
475
|
-
|
|
463
|
+
@browser = described_class.new(browser_symbol,
|
|
464
|
+
url: url,
|
|
465
|
+
proxy: proxy)
|
|
476
466
|
|
|
477
467
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
478
468
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -488,9 +478,9 @@ module Watir
|
|
|
488
478
|
end
|
|
489
479
|
|
|
490
480
|
it 'accepts options object' do
|
|
491
|
-
@browser =
|
|
492
|
-
|
|
493
|
-
|
|
481
|
+
@browser = described_class.new(browser_symbol,
|
|
482
|
+
url: url,
|
|
483
|
+
options: Options.send(browser_symbol, args: ['--foo']))
|
|
494
484
|
|
|
495
485
|
expect(generated_options.args).to include('--foo')
|
|
496
486
|
|
|
@@ -504,9 +494,9 @@ module Watir
|
|
|
504
494
|
|
|
505
495
|
it 'accepts options hash' do
|
|
506
496
|
options = {prefs: {foo: 'bar'}}
|
|
507
|
-
@browser =
|
|
508
|
-
|
|
509
|
-
|
|
497
|
+
@browser = described_class.new(browser_symbol,
|
|
498
|
+
url: url,
|
|
499
|
+
options: options)
|
|
510
500
|
|
|
511
501
|
expect(selenium_browser).to eq :remote
|
|
512
502
|
expect(selenium_args).not_to include(:service)
|
|
@@ -519,9 +509,9 @@ module Watir
|
|
|
519
509
|
|
|
520
510
|
it 'accepts capabilities object' do
|
|
521
511
|
capabilities = Remote::Capabilities.send(browser_symbol)
|
|
522
|
-
@browser =
|
|
523
|
-
|
|
524
|
-
|
|
512
|
+
@browser = described_class.new(browser_symbol,
|
|
513
|
+
url: url,
|
|
514
|
+
capabilities: capabilities)
|
|
525
515
|
|
|
526
516
|
expect(selenium_browser).to eq :remote
|
|
527
517
|
expect(selenium_args).not_to include(:service)
|
|
@@ -534,10 +524,10 @@ module Watir
|
|
|
534
524
|
it 'accepts http client & capabilities objects' do
|
|
535
525
|
client = HttpClient.new
|
|
536
526
|
capabilities = Remote::Capabilities.send(browser_symbol)
|
|
537
|
-
@browser =
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
527
|
+
@browser = described_class.new(browser_symbol,
|
|
528
|
+
url: url,
|
|
529
|
+
capabilities: capabilities,
|
|
530
|
+
http_client: client)
|
|
541
531
|
|
|
542
532
|
expect(selenium_browser).to eq :remote
|
|
543
533
|
expect(selenium_args).not_to include(:service)
|
|
@@ -551,11 +541,11 @@ module Watir
|
|
|
551
541
|
client = HttpClient.new
|
|
552
542
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
553
543
|
options = Options.send(browser_symbol, prefs: {foo: 'bar'})
|
|
554
|
-
@browser =
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
544
|
+
@browser = described_class.new(browser_symbol,
|
|
545
|
+
url: url,
|
|
546
|
+
proxy: proxy,
|
|
547
|
+
options: options,
|
|
548
|
+
http_client: client)
|
|
559
549
|
|
|
560
550
|
expect(selenium_browser).to eq :remote
|
|
561
551
|
expect(selenium_args).not_to include :service
|