watir 7.0.0.beta1 → 7.0.0.beta2
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/tests.yml +7 -3
- data/.rubocop.yml +2 -7
- data/CHANGES.md +16 -0
- data/lib/watir/browser.rb +18 -4
- data/lib/watir/capabilities.rb +1 -1
- data/lib/watir/elements/element.rb +32 -3
- data/lib/watir/elements/font.rb +1 -0
- data/lib/watir/elements/iframe.rb +0 -1
- data/lib/watir/elements/radio.rb +2 -2
- data/lib/watir/elements/select.rb +63 -40
- data/lib/watir/has_window.rb +2 -0
- data/lib/watir/locators.rb +4 -0
- data/lib/watir/locators/element/matcher.rb +1 -1
- data/lib/watir/locators/element/selector_builder.rb +0 -3
- data/lib/watir/locators/option/matcher.rb +24 -0
- data/lib/watir/locators/option/selector_builder.rb +8 -0
- data/lib/watir/locators/option/selector_builder/xpath.rb +37 -0
- data/lib/watir/logger.rb +3 -74
- data/lib/watir/radio_set.rb +1 -0
- data/lib/watir/screenshot.rb +2 -8
- data/lib/watir/user_editable.rb +10 -3
- data/lib/watir/version.rb +1 -1
- data/lib/watir/window.rb +15 -4
- data/lib/watir/window_collection.rb +9 -0
- data/lib/watirspec.rb +4 -2
- data/lib/watirspec/guards.rb +1 -1
- data/lib/watirspec/server.rb +1 -1
- data/spec/spec_helper.rb +0 -10
- data/spec/unit/capabilities_spec.rb +1 -1
- data/spec/unit/match_elements/element_spec.rb +11 -0
- data/spec/watirspec/after_hooks_spec.rb +22 -45
- data/spec/watirspec/browser_spec.rb +185 -206
- data/spec/watirspec/cookies_spec.rb +47 -52
- data/spec/watirspec/drag_and_drop_spec.rb +5 -7
- data/spec/watirspec/elements/area_spec.rb +1 -5
- data/spec/watirspec/elements/button_spec.rb +4 -8
- data/spec/watirspec/elements/checkbox_spec.rb +2 -4
- data/spec/watirspec/elements/date_field_spec.rb +13 -16
- data/spec/watirspec/elements/date_time_field_spec.rb +14 -13
- data/spec/watirspec/elements/dd_spec.rb +3 -4
- data/spec/watirspec/elements/del_spec.rb +10 -12
- data/spec/watirspec/elements/div_spec.rb +41 -50
- data/spec/watirspec/elements/dl_spec.rb +4 -12
- data/spec/watirspec/elements/element_spec.rb +155 -89
- data/spec/watirspec/elements/elements_spec.rb +8 -9
- data/spec/watirspec/elements/filefield_spec.rb +5 -7
- data/spec/watirspec/elements/form_spec.rb +1 -1
- data/spec/watirspec/elements/forms_spec.rb +3 -5
- data/spec/watirspec/elements/frame_spec.rb +17 -22
- data/spec/watirspec/elements/iframe_spec.rb +21 -27
- data/spec/watirspec/elements/ins_spec.rb +10 -12
- data/spec/watirspec/elements/link_spec.rb +24 -26
- data/spec/watirspec/elements/links_spec.rb +8 -9
- data/spec/watirspec/elements/radio_spec.rb +11 -14
- data/spec/watirspec/elements/select_list_spec.rb +248 -117
- data/spec/watirspec/elements/span_spec.rb +10 -12
- data/spec/watirspec/elements/table_nesting_spec.rb +31 -34
- data/spec/watirspec/elements/table_spec.rb +11 -13
- data/spec/watirspec/elements/tbody_spec.rb +10 -12
- data/spec/watirspec/elements/td_spec.rb +4 -6
- data/spec/watirspec/elements/text_field_spec.rb +10 -12
- data/spec/watirspec/elements/tr_spec.rb +5 -7
- data/spec/watirspec/user_editable_spec.rb +26 -28
- data/spec/watirspec/wait_spec.rb +255 -258
- data/spec/watirspec/window_switching_spec.rb +199 -200
- data/spec/watirspec_helper.rb +34 -31
- metadata +5 -6
- data/spec/implementation_spec.rb +0 -24
- data/spec/unit/logger_spec.rb +0 -81
@@ -8,8 +8,7 @@ describe Watir::Browser do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
after do
|
11
|
-
browser.
|
12
|
-
browser.windows.reject(&:current?).each(&:close)
|
11
|
+
browser.windows.restore!
|
13
12
|
end
|
14
13
|
|
15
14
|
describe '#windows' do
|
@@ -65,16 +64,16 @@ describe Watir::Browser do
|
|
65
64
|
expect(original_window.url).to match(/window_switching\.html/)
|
66
65
|
end
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
expect { browser.windows.wait_until(size: 1) }.to_not raise_error
|
67
|
+
it 'it executes the given block in the window',
|
68
|
+
except: {browser: :safari,
|
69
|
+
reason: 'Clicking an Element that Closes a Window is returning NoMatchingWindowFoundException'} do
|
70
|
+
browser.window(title: 'closeable window') do
|
71
|
+
link = browser.a(id: 'close')
|
72
|
+
expect(link).to exist
|
73
|
+
link.click
|
77
74
|
end
|
75
|
+
|
76
|
+
expect { browser.windows.wait_until(size: 1) }.to_not raise_error
|
78
77
|
end
|
79
78
|
|
80
79
|
it 'raises ArgumentError if the selector is invalid' do
|
@@ -97,7 +96,7 @@ describe Watir::Browser do
|
|
97
96
|
browser.original_window.use
|
98
97
|
|
99
98
|
title = browser.title
|
100
|
-
expect { browser.window(title: title).use }.not_to raise_exception
|
99
|
+
expect { browser.window(title: title).use }.not_to raise_exception
|
101
100
|
end
|
102
101
|
|
103
102
|
it 'switches to second window' do
|
@@ -114,7 +113,7 @@ describe Watir::Browser do
|
|
114
113
|
end
|
115
114
|
|
116
115
|
it 'times out if there is no second window' do
|
117
|
-
browser.windows.
|
116
|
+
browser.windows.restore!
|
118
117
|
message = /waiting for true condition on (.*) title="window switching">$/
|
119
118
|
expect { browser.switch_window }.to raise_timeout_exception(message)
|
120
119
|
end
|
@@ -124,8 +123,8 @@ describe Watir::Browser do
|
|
124
123
|
expect(browser.original_window).to_not be_nil
|
125
124
|
end
|
126
125
|
|
127
|
-
it 'waits for second window' do
|
128
|
-
browser.windows.
|
126
|
+
it 'waits for second window', except: {browser: :ie} do
|
127
|
+
browser.windows.restore!
|
129
128
|
expect {
|
130
129
|
browser.a(id: 'delayed').click
|
131
130
|
browser.switch_window
|
@@ -135,6 +134,10 @@ describe Watir::Browser do
|
|
135
134
|
end
|
136
135
|
|
137
136
|
describe Watir::Window do
|
137
|
+
after do
|
138
|
+
browser.windows.restore!
|
139
|
+
end
|
140
|
+
|
138
141
|
context 'multiple windows' do
|
139
142
|
before do
|
140
143
|
browser.goto WatirSpec.url_for('window_switching.html')
|
@@ -142,41 +145,33 @@ describe Watir::Window do
|
|
142
145
|
browser.windows.wait_until(size: 2)
|
143
146
|
end
|
144
147
|
|
145
|
-
after
|
146
|
-
|
147
|
-
browser.
|
148
|
-
end
|
149
|
-
|
150
|
-
bug 'Focus is on newly opened window instead of the first', :safari do
|
151
|
-
it 'allows actions on first window after opening second' do
|
152
|
-
browser.a(id: 'open').click
|
148
|
+
it 'allows actions on first window after opening second',
|
149
|
+
except: {browser: %i[ie safari]}, reason: 'Focus is on newly opened window instead of the first' do
|
150
|
+
browser.a(id: 'open').click
|
153
151
|
|
154
|
-
|
155
|
-
end
|
152
|
+
expect { browser.windows.wait_until(size: 3) }.to_not raise_timeout_exception
|
156
153
|
end
|
157
154
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
browser.windows.wait_until(size: 3)
|
155
|
+
describe '#close', except: {browser: :ie, reason: 'Click is not opening window'} do
|
156
|
+
it 'closes a window' do
|
157
|
+
browser.window(title: 'window switching').use
|
158
|
+
browser.a(id: 'open').click
|
159
|
+
browser.windows.wait_until(size: 3)
|
164
160
|
|
165
|
-
|
161
|
+
Watir::Window.new(browser, title: 'closeable window').close
|
166
162
|
|
167
|
-
|
168
|
-
|
163
|
+
expect { browser.windows.wait_until(size: 2) }.to_not raise_timeout_exception
|
164
|
+
end
|
169
165
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
166
|
+
it 'closes the current window',
|
167
|
+
except: {browser: %i[ie safari]},
|
168
|
+
reason: 'Focus is on newly opened window instead of the first' do
|
169
|
+
browser.a(id: 'open').click
|
170
|
+
browser.windows.wait_until(size: 3)
|
174
171
|
|
175
|
-
|
172
|
+
Watir::Window.new(browser, title: 'closeable window').use.close
|
176
173
|
|
177
|
-
|
178
|
-
end
|
179
|
-
end
|
174
|
+
expect { browser.windows.wait_until(size: 2) }.to_not raise_timeout_exception
|
180
175
|
end
|
181
176
|
end
|
182
177
|
|
@@ -199,9 +194,9 @@ describe Watir::Window do
|
|
199
194
|
|
200
195
|
describe '#title' do
|
201
196
|
it 'returns the title of the window' do
|
197
|
+
browser.wait_while { |b| b.window(title: /^$/).exists? }
|
202
198
|
titles = browser.windows.map(&:title)
|
203
199
|
|
204
|
-
expect(titles.size).to eq 2
|
205
200
|
expect(titles).to include 'window switching', 'closeable window'
|
206
201
|
end
|
207
202
|
end
|
@@ -210,7 +205,6 @@ describe Watir::Window do
|
|
210
205
|
it 'returns the url of the window' do
|
211
206
|
urls = browser.windows.map(&:url)
|
212
207
|
|
213
|
-
expect(urls.size).to eq 2
|
214
208
|
expect(urls).to(include(/window_switching\.html/, /closeable\.html$/))
|
215
209
|
end
|
216
210
|
end
|
@@ -254,77 +248,66 @@ describe Watir::Window do
|
|
254
248
|
end
|
255
249
|
end
|
256
250
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
251
|
+
context 'with a closed window',
|
252
|
+
except: {browser: :safari,
|
253
|
+
reason: 'Clicking an Element that Closes a Window is returning NoMatchingWindowFoundException'} do
|
254
|
+
before do
|
255
|
+
@original_window = browser.window
|
256
|
+
browser.goto WatirSpec.url_for('window_switching.html')
|
257
|
+
browser.a(id: 'open').click
|
258
|
+
browser.windows.wait_until(size: 2)
|
259
|
+
@handles = browser.driver.window_handles
|
260
|
+
@closed_window = browser.window(title: 'closeable window').use
|
261
|
+
browser.a(id: 'close').click
|
262
|
+
browser.windows.wait_until(size: 1)
|
263
|
+
end
|
269
264
|
|
270
|
-
|
271
|
-
|
272
|
-
|
265
|
+
describe '#exists?' do
|
266
|
+
it 'returns false if previously referenced window is closed' do
|
267
|
+
expect(@closed_window).to_not be_present
|
273
268
|
end
|
274
269
|
|
275
|
-
|
276
|
-
|
277
|
-
expect(@closed_window).to_not be_present
|
278
|
-
end
|
279
|
-
|
280
|
-
it 'returns false if closed window is referenced' do
|
281
|
-
expect(browser.window).to_not exist
|
282
|
-
end
|
270
|
+
it 'returns false if closed window is referenced' do
|
271
|
+
expect(browser.window).to_not exist
|
283
272
|
end
|
273
|
+
end
|
284
274
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
end
|
275
|
+
describe '#current?' do
|
276
|
+
it 'returns false if the referenced window is closed' do
|
277
|
+
expect(@original_window).to_not be_current
|
289
278
|
end
|
279
|
+
end
|
290
280
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
end
|
281
|
+
describe '#eql?' do
|
282
|
+
it 'should return false when checking equivalence to a closed window' do
|
283
|
+
expect(browser.window).not_to eq @closed_widow
|
295
284
|
end
|
285
|
+
end
|
296
286
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
end
|
301
|
-
|
302
|
-
bug 'Clicking an Element that Closes a Window is returning NoMatchingWindowFoundException', :safari do
|
303
|
-
it 'raises NoMatchingWindowFoundException error when attempting to use the current window if it is closed' do
|
304
|
-
expect { browser.window.use }.to raise_no_matching_window_exception
|
305
|
-
end
|
306
|
-
end
|
287
|
+
describe '#use' do
|
288
|
+
it 'raises NoMatchingWindowFoundException error when attempting to use a referenced window that is closed' do
|
289
|
+
expect { @closed_window.use }.to raise_no_matching_window_exception
|
307
290
|
end
|
308
291
|
|
309
|
-
|
310
|
-
|
311
|
-
msg = 'browser window was closed'
|
312
|
-
expect { browser.a.text }.to raise_exception(Watir::Exception::NoMatchingWindowFoundException, msg)
|
313
|
-
end
|
292
|
+
it 'raises NoMatchingWindowFoundException error when attempting to use the current window if it is closed' do
|
293
|
+
expect { browser.window.use }.to raise_no_matching_window_exception
|
314
294
|
end
|
295
|
+
end
|
315
296
|
|
316
|
-
|
317
|
-
|
318
|
-
|
297
|
+
it 'raises an exception when using an element on a closed window',
|
298
|
+
exclude: {browser: :firefox,
|
299
|
+
platform: :windows,
|
300
|
+
reason: 'https://github.com/mozilla/geckodriver/issues/1847'} do
|
301
|
+
msg = 'browser window was closed'
|
302
|
+
expect { browser.a.text }.to raise_exception(Watir::Exception::NoMatchingWindowFoundException, msg)
|
319
303
|
end
|
320
|
-
end
|
321
304
|
|
322
|
-
|
323
|
-
|
324
|
-
browser.original_window.use
|
325
|
-
browser.windows.reject(&:current?).each(&:close)
|
305
|
+
it 'raises an exception when locating a closed window' do
|
306
|
+
expect { browser.window(title: 'closeable window').use }.to raise_no_matching_window_exception
|
326
307
|
end
|
308
|
+
end
|
327
309
|
|
310
|
+
context 'with a closed window on a delay' do
|
328
311
|
it 'raises an exception when locating a window closed during lookup' do
|
329
312
|
browser.goto WatirSpec.url_for('window_switching.html')
|
330
313
|
browser.a(id: 'open').click
|
@@ -355,136 +338,127 @@ describe Watir::Window do
|
|
355
338
|
end
|
356
339
|
end
|
357
340
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
341
|
+
context 'with current window closed',
|
342
|
+
except: {browser: :safari,
|
343
|
+
reason: 'Clicking an Element that Closes a Window is returning NoMatchingWindowFoundException'} do
|
344
|
+
before do
|
345
|
+
browser.goto WatirSpec.url_for('window_switching.html')
|
346
|
+
browser.a(id: 'open').click
|
347
|
+
browser.windows.wait_until(size: 2)
|
348
|
+
browser.window(title: 'closeable window').use
|
349
|
+
browser.a(id: 'close').click
|
350
|
+
browser.windows.wait_until(size: 1)
|
351
|
+
end
|
352
|
+
|
353
|
+
describe '#present?' do
|
354
|
+
it 'should find window by url' do
|
355
|
+
expect(browser.window(url: /window_switching\.html/)).to be_present
|
356
|
+
end
|
357
|
+
|
358
|
+
it 'should find window by title' do
|
359
|
+
expect(browser.window(title: 'window switching')).to be_present
|
367
360
|
end
|
368
361
|
|
369
|
-
|
370
|
-
browser.
|
371
|
-
browser.windows.reject(&:current?).each(&:close)
|
362
|
+
it 'should find window by element' do
|
363
|
+
expect(browser.window(element: browser.link(id: 'open'))).to be_present
|
372
364
|
end
|
365
|
+
end
|
373
366
|
|
374
|
-
|
375
|
-
|
376
|
-
|
367
|
+
describe '#use' do
|
368
|
+
context 'switching windows without blocks' do
|
369
|
+
it 'by url' do
|
370
|
+
browser.window(url: /window_switching\.html/).use
|
371
|
+
expect(browser.title).to be == 'window switching'
|
377
372
|
end
|
378
373
|
|
379
|
-
it '
|
380
|
-
|
374
|
+
it 'by title' do
|
375
|
+
browser.window(title: 'window switching').use
|
376
|
+
expect(browser.url).to match(/window_switching\.html/)
|
381
377
|
end
|
382
378
|
|
383
|
-
it '
|
384
|
-
|
379
|
+
it 'by element' do
|
380
|
+
browser.window(element: browser.link(id: 'open')).use
|
381
|
+
expect(browser.url).to match(/window_switching\.html/)
|
385
382
|
end
|
386
383
|
end
|
387
384
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
browser.window(url: /window_switching\.html/).use
|
392
|
-
expect(browser.title).to be == 'window switching'
|
393
|
-
end
|
394
|
-
|
395
|
-
it 'by title' do
|
396
|
-
browser.window(title: 'window switching').use
|
397
|
-
expect(browser.url).to match(/window_switching\.html/)
|
398
|
-
end
|
399
|
-
|
400
|
-
it 'by element' do
|
401
|
-
browser.window(element: browser.link(id: 'open')).use
|
402
|
-
expect(browser.url).to match(/window_switching\.html/)
|
403
|
-
end
|
385
|
+
context 'Switching windows with blocks' do
|
386
|
+
it 'by url' do
|
387
|
+
browser.window(url: /window_switching\.html/).use { expect(browser.title).to be == 'window switching' }
|
404
388
|
end
|
405
389
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
end
|
410
|
-
|
411
|
-
it 'by title' do
|
412
|
-
browser.window(title: 'window switching').use { expect(browser.url).to match(/window_switching\.html/) }
|
413
|
-
end
|
390
|
+
it 'by title' do
|
391
|
+
browser.window(title: 'window switching').use { expect(browser.url).to match(/window_switching\.html/) }
|
392
|
+
end
|
414
393
|
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
end
|
394
|
+
it 'by element' do
|
395
|
+
element = browser.link(id: 'open')
|
396
|
+
browser.window(element: element).use { expect(browser.url).to match(/window_switching\.html/) }
|
419
397
|
end
|
420
398
|
end
|
421
399
|
end
|
422
400
|
end
|
423
401
|
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
end
|
402
|
+
context 'manipulating size and position', except: {headless: true} do
|
403
|
+
before do
|
404
|
+
browser.goto WatirSpec.url_for('window_switching.html')
|
405
|
+
end
|
429
406
|
|
430
|
-
|
431
|
-
|
407
|
+
it 'should get the size of the current window' do
|
408
|
+
size = browser.window.size
|
432
409
|
|
433
|
-
|
434
|
-
|
435
|
-
|
410
|
+
expect(size.width).to eq browser.execute_script('return window.outerWidth;')
|
411
|
+
expect(size.height).to eq browser.execute_script('return window.outerHeight;')
|
412
|
+
end
|
436
413
|
|
437
|
-
|
438
|
-
|
414
|
+
it 'should get the position of the current window' do
|
415
|
+
pos = browser.window.position
|
439
416
|
|
440
|
-
|
441
|
-
|
442
|
-
|
417
|
+
expect(pos.x).to eq browser.execute_script('return window.screenX;')
|
418
|
+
expect(pos.y).to eq browser.execute_script('return window.screenY;')
|
419
|
+
end
|
443
420
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
421
|
+
it 'should resize the window' do
|
422
|
+
initial_size = browser.window.size
|
423
|
+
browser.window.resize_to(
|
424
|
+
initial_size.width - 20,
|
425
|
+
initial_size.height - 20
|
426
|
+
)
|
450
427
|
|
451
|
-
|
428
|
+
new_size = browser.window.size
|
452
429
|
|
453
|
-
|
454
|
-
|
455
|
-
|
430
|
+
expect(new_size.width).to eq initial_size.width - 20
|
431
|
+
expect(new_size.height).to eq initial_size.height - 20
|
432
|
+
end
|
456
433
|
|
457
|
-
|
458
|
-
|
434
|
+
it 'should move the window' do
|
435
|
+
initial_pos = browser.window.position
|
459
436
|
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
437
|
+
browser.window.move_to(
|
438
|
+
initial_pos.x + 2,
|
439
|
+
initial_pos.y + 2
|
440
|
+
)
|
464
441
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
442
|
+
new_pos = browser.window.position
|
443
|
+
expect(new_pos.x).to eq initial_pos.x + 2
|
444
|
+
expect(new_pos.y).to eq initial_pos.y + 2
|
445
|
+
end
|
469
446
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
expect(final_size.height).to be > (new_size.height)
|
486
|
-
end
|
487
|
-
end
|
447
|
+
it 'should maximize the window', except: {browser: :firefox, window_manager: false} do
|
448
|
+
initial_size = browser.window.size
|
449
|
+
browser.window.resize_to(
|
450
|
+
initial_size.width - 40,
|
451
|
+
initial_size.height - 40
|
452
|
+
)
|
453
|
+
browser.wait_until { |b| b.window.size != initial_size }
|
454
|
+
new_size = browser.window.size
|
455
|
+
|
456
|
+
browser.window.maximize
|
457
|
+
browser.wait_until { |b| b.window.size != new_size }
|
458
|
+
|
459
|
+
final_size = browser.window.size
|
460
|
+
expect(final_size.width).to be >= new_size.width
|
461
|
+
expect(final_size.height).to be > (new_size.height)
|
488
462
|
end
|
489
463
|
end
|
490
464
|
end
|
@@ -497,8 +471,7 @@ describe Watir::WindowCollection do
|
|
497
471
|
end
|
498
472
|
|
499
473
|
after do
|
500
|
-
browser.
|
501
|
-
browser.windows.reject(&:current?).each(&:close)
|
474
|
+
browser.windows.restore!
|
502
475
|
end
|
503
476
|
|
504
477
|
it '#to_a raises exception' do
|
@@ -553,4 +526,30 @@ describe Watir::WindowCollection do
|
|
553
526
|
expect(windows1).to eq windows2
|
554
527
|
end
|
555
528
|
end
|
529
|
+
|
530
|
+
it '#reset!' do
|
531
|
+
wins = browser.windows
|
532
|
+
expect(wins.size).to eq 2
|
533
|
+
wins.reset!
|
534
|
+
expect(wins.instance_variable_get('@window_list')).to be_nil
|
535
|
+
end
|
536
|
+
|
537
|
+
describe '#restore!' do
|
538
|
+
it 'when on other window',
|
539
|
+
except: {browser: %i[ie safari], reason: 'Focus is on newly opened window instead of the first'} do
|
540
|
+
browser.a(id: 'open').click
|
541
|
+
browser.windows.wait_until(size: 3)
|
542
|
+
browser.window(title: 'closeable window').use
|
543
|
+
|
544
|
+
browser.windows.restore!
|
545
|
+
expect(browser.windows.size).to eq 1
|
546
|
+
expect(browser.title).to eq 'window switching'
|
547
|
+
end
|
548
|
+
|
549
|
+
it 'when browser closed does not raise exception' do
|
550
|
+
browser.close
|
551
|
+
|
552
|
+
expect { browser.windows.restore! }.not_to raise_exception
|
553
|
+
end
|
554
|
+
end
|
556
555
|
end
|