watir 7.2.0 → 7.3.0
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 +9 -1
- data/.github/workflows/edge.yml +10 -2
- data/.github/workflows/firefox.yml +10 -2
- data/.github/workflows/ie.yml +1 -1
- data/.github/workflows/safari.yml +1 -1
- data/.github/workflows/unit.yml +3 -3
- data/.rubocop.yml +36 -14
- data/.rubocop_todo.yml +8 -1
- data/CHANGES.md +17 -1
- data/LICENSE +2 -2
- data/lib/watir/capabilities.rb +2 -12
- data/lib/watir/cookies.rb +7 -2
- data/lib/watir/elements/date_field.rb +2 -2
- data/lib/watir/elements/date_time_field.rb +2 -2
- data/lib/watir/elements/select.rb +3 -3
- 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/element/selector_builder.rb +1 -1
- data/lib/watir/locators/text_field/matcher.rb +1 -5
- data/lib/watir/version.rb +1 -1
- data/lib/watir.rb +1 -0
- data/lib/watirspec/implementation.rb +1 -1
- data/lib/watirspec.rb +1 -1
- data/spec/locator_spec_helper.rb +3 -15
- data/spec/unit/capabilities_spec.rb +552 -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 +632 -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 +411 -409
- data/spec/watirspec/capabilities_spec.rb +99 -112
- data/spec/watirspec/cookies_spec.rb +144 -115
- 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 +202 -183
- data/spec/watirspec/elements/date_fields_spec.rb +29 -27
- data/spec/watirspec/elements/date_time_field_spec.rb +216 -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 +88 -83
- data/spec/watirspec/support/rspec_matchers.rb +34 -25
- data/spec/watirspec/user_editable_spec.rb +200 -198
- data/spec/watirspec/wait_spec.rb +289 -295
- data/spec/watirspec/window_switching_spec.rb +423 -434
- data/spec/watirspec_helper.rb +1 -23
- data/watir.gemspec +6 -5
- metadata +47 -37
- 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
- data/support/travis.sh +0 -15
|
@@ -21,7 +21,7 @@ module Watir
|
|
|
21
21
|
let(:browser_symbol) { WatirSpec.implementation.browser_args.first }
|
|
22
22
|
let(:actual_capabilities) { @browser.wd.capabilities }
|
|
23
23
|
let(:actual_http) { @browser.wd.instance_variable_get(:@bridge).instance_variable_get(:@http) }
|
|
24
|
-
let(:actual_service) { @browser.wd.instance_variable_get(:@
|
|
24
|
+
let(:actual_service) { @browser.wd.instance_variable_get(:@service_manager) }
|
|
25
25
|
let(:actual_listener) { @browser.wd.instance_variable_get(:@bridge).instance_variable_get(:@listener) }
|
|
26
26
|
|
|
27
27
|
before(:all) do
|
|
@@ -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,16 @@ module Watir
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
describe 'capabilities' do
|
|
86
|
+
it 'accepts namespaced value', except: {browser: :ie,
|
|
87
|
+
reason: 'IE is more strict'} do
|
|
88
|
+
options = {'key:value' => 'something'}
|
|
89
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
90
|
+
|
|
91
|
+
expect(generated_options.instance_variable_get(:@options)['key:value']).to eq 'something'
|
|
92
|
+
end
|
|
93
|
+
|
|
86
94
|
it 'just options object has options and watir client without capabilities or service' do
|
|
87
|
-
@browser =
|
|
95
|
+
@browser = described_class.new(options: Options.send(browser_symbol))
|
|
88
96
|
|
|
89
97
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
90
98
|
expect(selenium_args).not_to include(:service)
|
|
@@ -95,7 +103,7 @@ module Watir
|
|
|
95
103
|
service = Service.send(browser_symbol, port: 1234)
|
|
96
104
|
client = Remote::Http::Default.new
|
|
97
105
|
options = {browser_name: browser_name, unhandled_prompt_behavior: :accept_and_notify}
|
|
98
|
-
@browser =
|
|
106
|
+
@browser = described_class.new(options: options, service: service, http_client: client)
|
|
99
107
|
|
|
100
108
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
101
109
|
expect(selenium_args[:service]).to eq service
|
|
@@ -103,35 +111,23 @@ module Watir
|
|
|
103
111
|
expect(actual_http).to eq client
|
|
104
112
|
end
|
|
105
113
|
|
|
106
|
-
it 'just capabilities has capabilities and watir client without service' do
|
|
107
|
-
caps = Remote::Capabilities.new(browser_name: browser_name)
|
|
108
|
-
|
|
109
|
-
expect {
|
|
110
|
-
@browser = Browser.new(capabilities: caps)
|
|
111
|
-
}.to have_deprecated(:capabilities)
|
|
112
|
-
|
|
113
|
-
expect(selenium_args[:capabilities]).to eq(caps)
|
|
114
|
-
expect(selenium_args).not_to include(:service)
|
|
115
|
-
expect(actual_http).to be_a HttpClient
|
|
116
|
-
end
|
|
117
|
-
|
|
118
114
|
it 'accepts page load and script timeouts in seconds' do
|
|
119
115
|
options = {page_load_timeout: 11,
|
|
120
116
|
script_timeout: 12}
|
|
121
|
-
@browser =
|
|
117
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
122
118
|
|
|
123
119
|
expect(actual_capabilities.timeouts[:page_load]).to eq 11_000
|
|
124
120
|
expect(actual_capabilities.timeouts[:script]).to eq 12_000
|
|
125
121
|
end
|
|
126
122
|
|
|
127
123
|
it 'unhandled prompt behavior defaults to ignore' do
|
|
128
|
-
@browser =
|
|
124
|
+
@browser = described_class.new(browser_symbol)
|
|
129
125
|
|
|
130
126
|
expect(actual_capabilities.unhandled_prompt_behavior).to eq 'ignore'
|
|
131
127
|
end
|
|
132
128
|
|
|
133
129
|
it 'unhandled prompt behavior can be overridden' do
|
|
134
|
-
@browser =
|
|
130
|
+
@browser = described_class.new(browser_symbol, options: {unhandled_prompt_behavior: :accept_and_notify})
|
|
135
131
|
|
|
136
132
|
expect(actual_capabilities.unhandled_prompt_behavior).to eq 'accept and notify'
|
|
137
133
|
end
|
|
@@ -139,7 +135,7 @@ module Watir
|
|
|
139
135
|
it 'generates options from Hash', except: {browser: :safari,
|
|
140
136
|
reason: 'Does not accept unrecognized args'} do
|
|
141
137
|
options = {page_load_strategy: 'eager', args: %w[--foo --bar]}
|
|
142
|
-
@browser =
|
|
138
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
143
139
|
|
|
144
140
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
145
141
|
expect(generated_options.page_load_strategy).to eq 'eager'
|
|
@@ -150,7 +146,7 @@ module Watir
|
|
|
150
146
|
describe 'service' do
|
|
151
147
|
it 'uses provided service' do
|
|
152
148
|
service = Service.send(browser_symbol, port: 1234)
|
|
153
|
-
@browser =
|
|
149
|
+
@browser = described_class.new(browser_symbol, service: service)
|
|
154
150
|
|
|
155
151
|
expect(selenium_browser).to eq browser_symbol
|
|
156
152
|
expect(selenium_args[:service]).to eq service
|
|
@@ -159,7 +155,7 @@ module Watir
|
|
|
159
155
|
|
|
160
156
|
it 'builds service from a Hash' do
|
|
161
157
|
@service = {port: 1234}
|
|
162
|
-
@browser =
|
|
158
|
+
@browser = described_class.new(browser_symbol, service: @service)
|
|
163
159
|
|
|
164
160
|
expect(selenium_browser).to eq browser_symbol
|
|
165
161
|
expect(selenium_args[:service]).to be_a Service
|
|
@@ -169,21 +165,21 @@ module Watir
|
|
|
169
165
|
|
|
170
166
|
describe 'http_client' do
|
|
171
167
|
it 'uses default HTTP Client' do
|
|
172
|
-
@browser =
|
|
168
|
+
@browser = described_class.new(browser_symbol)
|
|
173
169
|
|
|
174
170
|
expect(actual_http).to be_a HttpClient
|
|
175
171
|
end
|
|
176
172
|
|
|
177
173
|
it 'accepts an HTTP Client object' do
|
|
178
174
|
client = Remote::Http::Default.new
|
|
179
|
-
@browser =
|
|
175
|
+
@browser = described_class.new(browser_symbol, http_client: client)
|
|
180
176
|
|
|
181
177
|
expect(actual_http).to eq client
|
|
182
178
|
end
|
|
183
179
|
|
|
184
180
|
it 'builds an HTTP Client from Hash' do
|
|
185
181
|
client_opts = {open_timeout: 9, read_timeout: 11}
|
|
186
|
-
@browser =
|
|
182
|
+
@browser = described_class.new(browser_symbol, http_client: client_opts)
|
|
187
183
|
|
|
188
184
|
expect(actual_http).to be_a HttpClient
|
|
189
185
|
expect(actual_http.instance_variable_get(:@open_timeout)).to eq 9
|
|
@@ -193,16 +189,17 @@ module Watir
|
|
|
193
189
|
|
|
194
190
|
it 'uses a listener' do
|
|
195
191
|
listener = Selenium::WebDriver::Support::AbstractEventListener.new
|
|
196
|
-
@browser =
|
|
192
|
+
@browser = described_class.new(browser_symbol, listener: listener)
|
|
197
193
|
|
|
198
194
|
expect(actual_listener).to eq listener
|
|
199
195
|
end
|
|
200
196
|
|
|
201
|
-
describe 'proxy'
|
|
197
|
+
describe 'proxy', except: {browser: :ie,
|
|
198
|
+
reason: 'Bug in Selenium 4.11 Selenium Manager'} do
|
|
202
199
|
it 'adds Selenium Proxy to empty Options', except: {browser: :safari,
|
|
203
200
|
reason: 'Safari does not like proxies'} do
|
|
204
201
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
205
|
-
@browser =
|
|
202
|
+
@browser = described_class.new(browser_symbol, proxy: proxy)
|
|
206
203
|
|
|
207
204
|
expect(actual_capabilities.proxy).to eq proxy
|
|
208
205
|
end
|
|
@@ -210,7 +207,7 @@ module Watir
|
|
|
210
207
|
it 'builds a Proxy from Hash for Options', except: {browser: :safari,
|
|
211
208
|
reason: 'Safari does not like proxies'} do
|
|
212
209
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
213
|
-
@browser =
|
|
210
|
+
@browser = described_class.new(browser_symbol, proxy: proxy)
|
|
214
211
|
|
|
215
212
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
216
213
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -224,7 +221,7 @@ module Watir
|
|
|
224
221
|
options = {unhandled_prompt_behavior: :accept,
|
|
225
222
|
page_load_strategy: :eager}
|
|
226
223
|
|
|
227
|
-
@browser =
|
|
224
|
+
@browser = described_class.new(browser_symbol, options: options, proxy: proxy)
|
|
228
225
|
|
|
229
226
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
230
227
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -239,7 +236,7 @@ module Watir
|
|
|
239
236
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
240
237
|
options = Options.send(browser_symbol, unhandled_prompt_behavior: :accept, page_load_strategy: :eager)
|
|
241
238
|
|
|
242
|
-
@browser =
|
|
239
|
+
@browser = described_class.new(browser_symbol, options: options, proxy: proxy)
|
|
243
240
|
|
|
244
241
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
245
242
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -251,9 +248,9 @@ module Watir
|
|
|
251
248
|
end
|
|
252
249
|
end
|
|
253
250
|
|
|
254
|
-
context 'chrome', exclusive: {browser: :chrome} do
|
|
251
|
+
context 'when chrome', exclusive: {browser: :chrome} do
|
|
255
252
|
it 'by default uses chrome, has client, options, but not capabilities' do
|
|
256
|
-
@browser =
|
|
253
|
+
@browser = described_class.new
|
|
257
254
|
|
|
258
255
|
expect(generated_options).to be_a Selenium::WebDriver::Chrome::Options
|
|
259
256
|
expect(actual_http).to be_a HttpClient
|
|
@@ -261,116 +258,106 @@ module Watir
|
|
|
261
258
|
end
|
|
262
259
|
|
|
263
260
|
it 'sets headless by creating options' do
|
|
264
|
-
@browser =
|
|
261
|
+
@browser = described_class.new(:chrome, headless: true)
|
|
265
262
|
|
|
266
263
|
expect(generated_options.args).to include '--headless'
|
|
267
264
|
end
|
|
268
265
|
|
|
269
266
|
it 'sets headless in existing options class' do
|
|
270
|
-
@browser =
|
|
271
|
-
|
|
272
|
-
|
|
267
|
+
@browser = described_class.new(:chrome,
|
|
268
|
+
options: Options.chrome,
|
|
269
|
+
headless: true)
|
|
273
270
|
|
|
274
271
|
expect(generated_options.args).to include '--headless'
|
|
275
272
|
end
|
|
276
273
|
|
|
277
274
|
it 'sets headless when existing options is a Hash' do
|
|
278
275
|
options = {args: ['--foo']}
|
|
279
|
-
@browser =
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
@browser = described_class.new(:chrome,
|
|
277
|
+
options: options,
|
|
278
|
+
headless: true)
|
|
282
279
|
|
|
283
280
|
expect(generated_options.args).to include '--headless'
|
|
284
281
|
end
|
|
285
282
|
end
|
|
286
283
|
|
|
287
|
-
context 'edge', exclusive: {browser: :edge} do
|
|
284
|
+
context 'when edge', exclusive: {browser: :edge} do
|
|
288
285
|
it 'sets headless by creating options' do
|
|
289
|
-
@browser =
|
|
286
|
+
@browser = described_class.new(:edge, headless: true)
|
|
290
287
|
|
|
291
288
|
expect(generated_options.args).to include '--headless'
|
|
292
289
|
end
|
|
293
290
|
|
|
294
291
|
it 'sets headless in existing options class' do
|
|
295
|
-
@browser =
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
@browser = described_class.new(:edge,
|
|
293
|
+
options: Options.edge,
|
|
294
|
+
headless: true)
|
|
298
295
|
|
|
299
296
|
expect(generated_options.args).to include '--headless'
|
|
300
297
|
end
|
|
301
298
|
|
|
302
299
|
it 'sets headless when existing options is a Hash' do
|
|
303
300
|
options = {args: ['--foo']}
|
|
304
|
-
@browser =
|
|
305
|
-
|
|
306
|
-
|
|
301
|
+
@browser = described_class.new(:edge,
|
|
302
|
+
options: options,
|
|
303
|
+
headless: true)
|
|
307
304
|
|
|
308
305
|
expect(generated_options.args).to include '--headless'
|
|
309
306
|
end
|
|
310
307
|
end
|
|
311
308
|
|
|
312
|
-
context 'firefox', exclusive: {browser: :firefox} do
|
|
309
|
+
context 'when firefox', exclusive: {browser: :firefox} do
|
|
313
310
|
it 'puts Profile inside Options as Hash' do
|
|
314
311
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
|
315
312
|
options = {args: ['--foo'], profile: profile}
|
|
316
313
|
|
|
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)
|
|
314
|
+
@browser = described_class.new(:firefox, options: options)
|
|
328
315
|
|
|
329
316
|
expect(generated_options.args).to include '--foo'
|
|
330
317
|
expect(generated_options.profile).to eq profile
|
|
331
318
|
end
|
|
332
319
|
|
|
333
320
|
it 'sets headless by creating options' do
|
|
334
|
-
@browser =
|
|
321
|
+
@browser = described_class.new(:firefox, headless: true)
|
|
335
322
|
|
|
336
323
|
expect(generated_options.args).to include '-headless'
|
|
337
324
|
end
|
|
338
325
|
|
|
339
326
|
it 'sets headless in existing options class' do
|
|
340
|
-
@browser =
|
|
341
|
-
|
|
342
|
-
|
|
327
|
+
@browser = described_class.new(:firefox,
|
|
328
|
+
options: Options.firefox,
|
|
329
|
+
headless: true)
|
|
343
330
|
|
|
344
331
|
expect(generated_options.args).to include '-headless'
|
|
345
332
|
end
|
|
346
333
|
|
|
347
334
|
it 'sets headless when existing options is a Hash' do
|
|
348
335
|
options = {args: ['-foo']}
|
|
349
|
-
@browser =
|
|
350
|
-
|
|
351
|
-
|
|
336
|
+
@browser = described_class.new(:firefox,
|
|
337
|
+
options: options,
|
|
338
|
+
headless: true)
|
|
352
339
|
|
|
353
340
|
expect(generated_options.args).to include '-headless', '-foo'
|
|
354
341
|
end
|
|
355
342
|
end
|
|
356
343
|
|
|
357
|
-
context 'safari', exclusive: {browser: :safari} do
|
|
358
|
-
after
|
|
344
|
+
context 'when safari', exclusive: {browser: :safari} do
|
|
345
|
+
after { Selenium::WebDriver::Safari.use_technology_preview = false }
|
|
359
346
|
|
|
360
347
|
it 'sets Technology Preview', exclude: {browser: :safari,
|
|
361
348
|
reason: 'Broken in Selenium'} do
|
|
362
|
-
@browser =
|
|
349
|
+
@browser = described_class.new(:safari, technology_preview: true)
|
|
363
350
|
|
|
364
|
-
expect(Selenium::WebDriver::Safari.technology_preview?).to
|
|
351
|
+
expect(Selenium::WebDriver::Safari.technology_preview?).to be true
|
|
365
352
|
end
|
|
366
353
|
|
|
367
354
|
it 'generates options from Hash with custom option' do
|
|
368
355
|
options = {page_load_strategy: 'eager', automatic_inspection: true}
|
|
369
|
-
@browser =
|
|
356
|
+
@browser = described_class.new(browser_symbol, options: options)
|
|
370
357
|
|
|
371
358
|
expect(generated_options).to be_a Options.send(browser_symbol).class
|
|
372
359
|
expect(actual_capabilities.page_load_strategy).to eq 'eager'
|
|
373
|
-
expect(actual_capabilities['safari:automaticInspection']).to
|
|
360
|
+
expect(actual_capabilities['safari:automaticInspection']).to be true
|
|
374
361
|
end
|
|
375
362
|
end
|
|
376
363
|
end
|
|
@@ -388,7 +375,7 @@ module Watir
|
|
|
388
375
|
let(:url) { "#{WatirSpec.implementation.browser_args.last[:url]}/" }
|
|
389
376
|
|
|
390
377
|
it 'with just url' do
|
|
391
|
-
@browser =
|
|
378
|
+
@browser = described_class.new(url: url)
|
|
392
379
|
|
|
393
380
|
expect(selenium_browser).to eq :remote
|
|
394
381
|
expect(selenium_args).not_to include(:service)
|
|
@@ -399,7 +386,7 @@ module Watir
|
|
|
399
386
|
end
|
|
400
387
|
|
|
401
388
|
it 'just url & browser name has options and client but not service' do
|
|
402
|
-
@browser =
|
|
389
|
+
@browser = described_class.new(browser_symbol, url: url)
|
|
403
390
|
|
|
404
391
|
expect(selenium_browser).to eq :remote
|
|
405
392
|
expect(selenium_args).not_to include(:service)
|
|
@@ -411,9 +398,9 @@ module Watir
|
|
|
411
398
|
|
|
412
399
|
it 'accepts a listener' do
|
|
413
400
|
listener = Selenium::WebDriver::Support::AbstractEventListener.new
|
|
414
|
-
@browser =
|
|
415
|
-
|
|
416
|
-
|
|
401
|
+
@browser = described_class.new(browser_symbol,
|
|
402
|
+
url: url,
|
|
403
|
+
listener: listener)
|
|
417
404
|
|
|
418
405
|
expect(actual_listener).to eq listener
|
|
419
406
|
|
|
@@ -425,9 +412,9 @@ module Watir
|
|
|
425
412
|
|
|
426
413
|
it 'accepts http client object' do
|
|
427
414
|
client = HttpClient.new
|
|
428
|
-
@browser =
|
|
429
|
-
|
|
430
|
-
|
|
415
|
+
@browser = described_class.new(browser_symbol,
|
|
416
|
+
url: url,
|
|
417
|
+
http_client: client)
|
|
431
418
|
|
|
432
419
|
expect(actual_http).to eq client
|
|
433
420
|
|
|
@@ -439,9 +426,9 @@ module Watir
|
|
|
439
426
|
end
|
|
440
427
|
|
|
441
428
|
it 'accepts http client Hash' do
|
|
442
|
-
@browser =
|
|
443
|
-
|
|
444
|
-
|
|
429
|
+
@browser = described_class.new(browser_symbol,
|
|
430
|
+
url: url,
|
|
431
|
+
http_client: {read_timeout: 30})
|
|
445
432
|
|
|
446
433
|
expect(actual_http.instance_variable_get(:@read_timeout)).to eq 30
|
|
447
434
|
|
|
@@ -454,9 +441,9 @@ module Watir
|
|
|
454
441
|
|
|
455
442
|
it 'accepts proxy object' do
|
|
456
443
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
457
|
-
@browser =
|
|
458
|
-
|
|
459
|
-
|
|
444
|
+
@browser = described_class.new(browser_symbol,
|
|
445
|
+
url: url,
|
|
446
|
+
proxy: proxy)
|
|
460
447
|
|
|
461
448
|
expect(actual_capabilities.proxy).to eq proxy
|
|
462
449
|
|
|
@@ -470,9 +457,9 @@ module Watir
|
|
|
470
457
|
|
|
471
458
|
it 'accepts proxy Hash' do
|
|
472
459
|
proxy = {http: '127.0.0.1:8080', ssl: '127.0.0.1:443'}
|
|
473
|
-
@browser =
|
|
474
|
-
|
|
475
|
-
|
|
460
|
+
@browser = described_class.new(browser_symbol,
|
|
461
|
+
url: url,
|
|
462
|
+
proxy: proxy)
|
|
476
463
|
|
|
477
464
|
expect(actual_capabilities.proxy).to be_a Selenium::WebDriver::Proxy
|
|
478
465
|
expect(actual_capabilities.proxy.type).to eq(:manual)
|
|
@@ -488,9 +475,9 @@ module Watir
|
|
|
488
475
|
end
|
|
489
476
|
|
|
490
477
|
it 'accepts options object' do
|
|
491
|
-
@browser =
|
|
492
|
-
|
|
493
|
-
|
|
478
|
+
@browser = described_class.new(browser_symbol,
|
|
479
|
+
url: url,
|
|
480
|
+
options: Options.send(browser_symbol, args: ['--foo']))
|
|
494
481
|
|
|
495
482
|
expect(generated_options.args).to include('--foo')
|
|
496
483
|
|
|
@@ -504,9 +491,9 @@ module Watir
|
|
|
504
491
|
|
|
505
492
|
it 'accepts options hash' do
|
|
506
493
|
options = {prefs: {foo: 'bar'}}
|
|
507
|
-
@browser =
|
|
508
|
-
|
|
509
|
-
|
|
494
|
+
@browser = described_class.new(browser_symbol,
|
|
495
|
+
url: url,
|
|
496
|
+
options: options)
|
|
510
497
|
|
|
511
498
|
expect(selenium_browser).to eq :remote
|
|
512
499
|
expect(selenium_args).not_to include(:service)
|
|
@@ -519,9 +506,9 @@ module Watir
|
|
|
519
506
|
|
|
520
507
|
it 'accepts capabilities object' do
|
|
521
508
|
capabilities = Remote::Capabilities.send(browser_symbol)
|
|
522
|
-
@browser =
|
|
523
|
-
|
|
524
|
-
|
|
509
|
+
@browser = described_class.new(browser_symbol,
|
|
510
|
+
url: url,
|
|
511
|
+
capabilities: capabilities)
|
|
525
512
|
|
|
526
513
|
expect(selenium_browser).to eq :remote
|
|
527
514
|
expect(selenium_args).not_to include(:service)
|
|
@@ -534,10 +521,10 @@ module Watir
|
|
|
534
521
|
it 'accepts http client & capabilities objects' do
|
|
535
522
|
client = HttpClient.new
|
|
536
523
|
capabilities = Remote::Capabilities.send(browser_symbol)
|
|
537
|
-
@browser =
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
524
|
+
@browser = described_class.new(browser_symbol,
|
|
525
|
+
url: url,
|
|
526
|
+
capabilities: capabilities,
|
|
527
|
+
http_client: client)
|
|
541
528
|
|
|
542
529
|
expect(selenium_browser).to eq :remote
|
|
543
530
|
expect(selenium_args).not_to include(:service)
|
|
@@ -551,11 +538,11 @@ module Watir
|
|
|
551
538
|
client = HttpClient.new
|
|
552
539
|
proxy = Selenium::WebDriver::Proxy.new(http: '127.0.0.1:8080', ssl: '127.0.0.1:443')
|
|
553
540
|
options = Options.send(browser_symbol, prefs: {foo: 'bar'})
|
|
554
|
-
@browser =
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
541
|
+
@browser = described_class.new(browser_symbol,
|
|
542
|
+
url: url,
|
|
543
|
+
proxy: proxy,
|
|
544
|
+
options: options,
|
|
545
|
+
http_client: client)
|
|
559
546
|
|
|
560
547
|
expect(selenium_browser).to eq :remote
|
|
561
548
|
expect(selenium_args).not_to include :service
|