Skip to content

Commit db1c6c1

Browse files
fix test_file_dialog tests
1 parent 0975bd1 commit db1c6c1

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

tests/input/file_dialog/__snapshots__/test_file_dialog_opened.ambr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# serializer version: 1
2-
# name: test_file_dialog_input_click_event[False]
2+
# name: test_file_dialog_input_click_event[False-capabilities0]
33
list([
44
dict({
55
'id': 'stable_0',
@@ -45,7 +45,7 @@
4545
}),
4646
])
4747
# ---
48-
# name: test_file_dialog_input_click_event[True]
48+
# name: test_file_dialog_input_click_event[True-capabilities0]
4949
list([
5050
dict({
5151
'id': 'stable_0',

tests/input/file_dialog/test_file_dialog_opened.py

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121

2222

2323
@pytest.mark.asyncio
24+
@pytest.mark.parametrize('capabilities', [{
25+
'acceptInsecureCerts': True
26+
}],
27+
indirect=True)
2428
@pytest.mark.parametrize('multiple', [True, False])
25-
async def test_file_dialog_show_file_event(websocket, context_id, url_example,
29+
async def test_file_dialog_show_file_event(websocket, context_id, url_bad_ssl,
2630
multiple):
27-
await goto_url(websocket, context_id, url_example)
31+
await goto_url(websocket, context_id, url_bad_ssl)
2832

2933
await subscribe(websocket, ["input.fileDialogOpened"])
3034

@@ -88,6 +92,10 @@ async def test_file_dialog_show_directory_event(websocket, context_id,
8892

8993

9094
@pytest.mark.asyncio
95+
@pytest.mark.parametrize('capabilities', [{
96+
'acceptInsecureCerts': True
97+
}],
98+
indirect=True)
9199
@pytest.mark.parametrize('multiple', [True, False])
92100
async def test_file_dialog_input_click_event(websocket, context_id, html,
93101
read_messages, multiple,
@@ -118,34 +126,42 @@ async def test_file_dialog_input_click_event(websocket, context_id, html,
118126
@pytest.mark.asyncio
119127
@pytest.mark.parametrize('capabilities', [
120128
{
129+
'acceptInsecureCerts': True,
121130
'unhandledPromptBehavior': 'dismiss'
122131
},
123132
{
133+
'acceptInsecureCerts': True,
124134
'unhandledPromptBehavior': 'dismiss and notify'
125135
},
126136
{
137+
'acceptInsecureCerts': True,
127138
'unhandledPromptBehavior': {
128139
'default': 'dismiss'
129140
}
130141
},
131142
{
143+
'acceptInsecureCerts': True,
132144
'unhandledPromptBehavior': {
133145
'file': 'dismiss',
134146
'default': 'ignore'
135147
}
136148
},
137149
{
150+
'acceptInsecureCerts': True,
138151
'unhandledPromptBehavior': 'accept'
139152
},
140153
{
154+
'acceptInsecureCerts': True,
141155
'unhandledPromptBehavior': 'accept and notify'
142156
},
143157
{
158+
'acceptInsecureCerts': True,
144159
'unhandledPromptBehavior': {
145160
'default': 'accept'
146161
}
147162
},
148163
{
164+
'acceptInsecureCerts': True,
149165
'unhandledPromptBehavior': {
150166
'file': 'accept',
151167
'default': 'ignore'
@@ -191,13 +207,18 @@ async def test_file_dialog_unhandled_prompt_behavior_input_cancel(
191207

192208

193209
@pytest.mark.asyncio
194-
@pytest.mark.parametrize('capabilities', [{}, {
210+
@pytest.mark.parametrize('capabilities', [{
211+
'acceptInsecureCerts': True
212+
}, {
213+
'acceptInsecureCerts': True,
195214
'unhandledPromptBehavior': 'ignore'
196215
}, {
216+
'acceptInsecureCerts': True,
197217
'unhandledPromptBehavior': {
198218
'default': 'ignore'
199219
}
200220
}, {
221+
'acceptInsecureCerts': True,
201222
'unhandledPromptBehavior': {
202223
'file': 'ignore',
203224
'default': 'dismiss'
@@ -251,34 +272,42 @@ async def test_file_dialog_unhandled_prompt_behavior_input_ignore(
251272
@pytest.mark.asyncio
252273
@pytest.mark.parametrize('capabilities', [
253274
{
275+
'acceptInsecureCerts': True,
254276
'unhandledPromptBehavior': 'dismiss'
255277
},
256278
{
279+
'acceptInsecureCerts': True,
257280
'unhandledPromptBehavior': 'dismiss and notify'
258281
},
259282
{
283+
'acceptInsecureCerts': True,
260284
'unhandledPromptBehavior': {
261285
'default': 'dismiss'
262286
}
263287
},
264288
{
289+
'acceptInsecureCerts': True,
265290
'unhandledPromptBehavior': {
266291
'file': 'dismiss',
267292
'default': 'ignore'
268293
}
269294
},
270295
{
296+
'acceptInsecureCerts': True,
271297
'unhandledPromptBehavior': 'accept'
272298
},
273299
{
300+
'acceptInsecureCerts': True,
274301
'unhandledPromptBehavior': 'accept and notify'
275302
},
276303
{
304+
'acceptInsecureCerts': True,
277305
'unhandledPromptBehavior': {
278306
'default': 'accept'
279307
}
280308
},
281309
{
310+
'acceptInsecureCerts': True,
282311
'unhandledPromptBehavior': {
283312
'file': 'accept',
284313
'default': 'ignore'
@@ -287,8 +316,8 @@ async def test_file_dialog_unhandled_prompt_behavior_input_ignore(
287316
],
288317
indirect=True)
289318
async def test_file_dialog_unhandled_prompt_behavior_show_file_cancel(
290-
websocket, context_id, url_example):
291-
await goto_url(websocket, context_id, url_example)
319+
websocket, context_id, url_bad_ssl):
320+
await goto_url(websocket, context_id, url_bad_ssl)
292321
await subscribe(websocket, ["input.fileDialogOpened"])
293322

294323
resp = await execute_command(
@@ -313,21 +342,26 @@ async def test_file_dialog_unhandled_prompt_behavior_show_file_cancel(
313342

314343

315344
@pytest.mark.asyncio
316-
@pytest.mark.parametrize('capabilities', [{}, {
345+
@pytest.mark.parametrize('capabilities', [{
346+
'acceptInsecureCerts': True
347+
}, {
348+
'acceptInsecureCerts': True,
317349
'unhandledPromptBehavior': 'ignore'
318350
}, {
351+
'acceptInsecureCerts': True,
319352
'unhandledPromptBehavior': {
320353
'default': 'ignore'
321354
}
322355
}, {
356+
'acceptInsecureCerts': True,
323357
'unhandledPromptBehavior': {
324358
'file': 'ignore',
325359
'default': 'dismiss'
326360
}
327361
}],
328362
indirect=True)
329363
async def test_file_dialog_unhandled_prompt_behavior_show_file_ignore(
330-
websocket, context_id, url_example, test_headless_mode):
364+
websocket, context_id, url_bad_ssl, test_headless_mode):
331365
"""
332366
The test exploits the fact that the file picker dialog can't be opened
333367
twice. This is used as an indicator that the dialog was shown.
@@ -336,7 +370,7 @@ async def test_file_dialog_unhandled_prompt_behavior_show_file_ignore(
336370
pytest.xfail("Headless browser always cancels the file dialog")
337371
return
338372

339-
await goto_url(websocket, context_id, url_example)
373+
await goto_url(websocket, context_id, url_bad_ssl)
340374

341375
resp = await execute_command(
342376
websocket, {

0 commit comments

Comments
 (0)