Skip to content

Commit f452676

Browse files
fix test_file_dialog tests
1 parent 0975bd1 commit f452676

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
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: 39 additions & 7 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'
@@ -192,12 +208,15 @@ async def test_file_dialog_unhandled_prompt_behavior_input_cancel(
192208

193209
@pytest.mark.asyncio
194210
@pytest.mark.parametrize('capabilities', [{}, {
211+
'acceptInsecureCerts': True,
195212
'unhandledPromptBehavior': 'ignore'
196213
}, {
214+
'acceptInsecureCerts': True,
197215
'unhandledPromptBehavior': {
198216
'default': 'ignore'
199217
}
200218
}, {
219+
'acceptInsecureCerts': True,
201220
'unhandledPromptBehavior': {
202221
'file': 'ignore',
203222
'default': 'dismiss'
@@ -251,34 +270,42 @@ async def test_file_dialog_unhandled_prompt_behavior_input_ignore(
251270
@pytest.mark.asyncio
252271
@pytest.mark.parametrize('capabilities', [
253272
{
273+
'acceptInsecureCerts': True,
254274
'unhandledPromptBehavior': 'dismiss'
255275
},
256276
{
277+
'acceptInsecureCerts': True,
257278
'unhandledPromptBehavior': 'dismiss and notify'
258279
},
259280
{
281+
'acceptInsecureCerts': True,
260282
'unhandledPromptBehavior': {
261283
'default': 'dismiss'
262284
}
263285
},
264286
{
287+
'acceptInsecureCerts': True,
265288
'unhandledPromptBehavior': {
266289
'file': 'dismiss',
267290
'default': 'ignore'
268291
}
269292
},
270293
{
294+
'acceptInsecureCerts': True,
271295
'unhandledPromptBehavior': 'accept'
272296
},
273297
{
298+
'acceptInsecureCerts': True,
274299
'unhandledPromptBehavior': 'accept and notify'
275300
},
276301
{
302+
'acceptInsecureCerts': True,
277303
'unhandledPromptBehavior': {
278304
'default': 'accept'
279305
}
280306
},
281307
{
308+
'acceptInsecureCerts': True,
282309
'unhandledPromptBehavior': {
283310
'file': 'accept',
284311
'default': 'ignore'
@@ -287,8 +314,8 @@ async def test_file_dialog_unhandled_prompt_behavior_input_ignore(
287314
],
288315
indirect=True)
289316
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)
317+
websocket, context_id, url_bad_ssl):
318+
await goto_url(websocket, context_id, url_bad_ssl)
292319
await subscribe(websocket, ["input.fileDialogOpened"])
293320

294321
resp = await execute_command(
@@ -313,21 +340,26 @@ async def test_file_dialog_unhandled_prompt_behavior_show_file_cancel(
313340

314341

315342
@pytest.mark.asyncio
316-
@pytest.mark.parametrize('capabilities', [{}, {
343+
@pytest.mark.parametrize('capabilities', [{
344+
'acceptInsecureCerts': True
345+
}, {
346+
'acceptInsecureCerts': True,
317347
'unhandledPromptBehavior': 'ignore'
318348
}, {
349+
'acceptInsecureCerts': True,
319350
'unhandledPromptBehavior': {
320351
'default': 'ignore'
321352
}
322353
}, {
354+
'acceptInsecureCerts': True,
323355
'unhandledPromptBehavior': {
324356
'file': 'ignore',
325357
'default': 'dismiss'
326358
}
327359
}],
328360
indirect=True)
329361
async def test_file_dialog_unhandled_prompt_behavior_show_file_ignore(
330-
websocket, context_id, url_example, test_headless_mode):
362+
websocket, context_id, url_bad_ssl, test_headless_mode):
331363
"""
332364
The test exploits the fact that the file picker dialog can't be opened
333365
twice. This is used as an indicator that the dialog was shown.
@@ -336,7 +368,7 @@ async def test_file_dialog_unhandled_prompt_behavior_show_file_ignore(
336368
pytest.xfail("Headless browser always cancels the file dialog")
337369
return
338370

339-
await goto_url(websocket, context_id, url_example)
371+
await goto_url(websocket, context_id, url_bad_ssl)
340372

341373
resp = await execute_command(
342374
websocket, {

0 commit comments

Comments
 (0)