Skip to content

Commit 725f45a

Browse files
Bug 1855045 - [wdspec] Add input file_dialog_opened test for input.showPicker API r=Sasha
Differential Revision: https://phabricator.services.mozilla.com/D271793
1 parent 75ac0fc commit 725f45a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

testing/web-platform/tests/webdriver/tests/bidi/input/file_dialog_opened/file_dialog_opened.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async def test_unsubscribe(bidi_session, inline, top_context, wait_for_event,
1616
await bidi_session.session.subscribe(events=[FILE_DIALOG_OPENED_EVENT])
1717
await bidi_session.session.unsubscribe(events=[FILE_DIALOG_OPENED_EVENT])
1818

19-
# Track all received browsingContext.navigationStarted events in the events array
19+
# Track all received input.fileDialogOpened events in the events array
2020
events = []
2121

2222
async def on_event(method, data):
@@ -62,6 +62,26 @@ async def test_subscribe(bidi_session, subscribe_events, inline, top_context,
6262
assert_file_dialog_opened_event(event, top_context["context"])
6363

6464

65+
async def test_show_picker(bidi_session, subscribe_events, inline, top_context,
66+
wait_for_event, wait_for_future_safe):
67+
await subscribe_events(events=[FILE_DIALOG_OPENED_EVENT])
68+
on_entry = wait_for_event(FILE_DIALOG_OPENED_EVENT)
69+
70+
url = inline("<input id=input type=file />")
71+
await bidi_session.browsing_context.navigate(context=top_context["context"],
72+
url=url, wait="complete")
73+
74+
await bidi_session.script.evaluate(
75+
expression="input.showPicker()",
76+
target=ContextTarget(top_context["context"]),
77+
await_promise=False,
78+
user_activation=True
79+
)
80+
81+
event = await wait_for_future_safe(on_entry)
82+
assert_file_dialog_opened_event(event, top_context["context"])
83+
84+
6585
@pytest.mark.parametrize("multiple", [True, False])
6686
async def test_multiple(bidi_session, subscribe_events, inline, top_context,
6787
wait_for_event, wait_for_future_safe, multiple):

0 commit comments

Comments
 (0)