Closed
Bug 1878842
Opened 1 year ago
Closed 1 year ago
[wdspec] Add BiDi fixture to wait for N events
Categories
(Remote Protocol :: WebDriver BiDi, task, P3)
Remote Protocol
WebDriver BiDi
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jdescottes, Assigned: jdescottes)
References
()
Details
(Whiteboard: [webdriver:m10])
Attachments
(4 obsolete files)
Many BiDi wdspec tests locally build arrays of events, eg:
events = []
async def on_event(method, data):
events.append(data)
remove_listener = bidi_session.add_event_listener(CONTEXT_CREATED_EVENT, on_event)
await subscribe_events([CONTEXT_CREATED_EVENT])
await bidi_session.browsing_context.navigate(
context=top_context["context"], url=test_page_multiple_frames, wait="complete"
)
wait = AsyncPoll(
bidi_session, message="Didn't receive context created events for frames"
)
await wait.until(lambda _: len(events) >= 2)
assert len(events) == 2
With a fixture to wait for several events we could reduce the boilerplate to something like
await subscribe_events([CONTEXT_CREATED_EVENT])
wait_for_events = wait_for_n_events(CONTEXT_CREATED_EVENT, 2)
await bidi_session.browsing_context.navigate(
context=top_context["context"], url=test_page_multiple_frames, wait="complete"
)
events = await wait_for_events()
assert len(events) == 2
Comment 1•1 year ago
|
||
I assume we would still have to pass a minimum amount of events to wait for into wait_for_events(). Also do we need an escape hatch via a timeout in case we do not see the expected amount of events? Right now we don't have that and as such test modules would run into a timeout.
| Assignee | ||
Comment 2•1 year ago
|
||
Using await would blocks the loop forever, so we can never have more than one listener for the same event.
Updated•1 year ago
|
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•1 year ago
|
||
| Assignee | ||
Comment 4•1 year ago
|
||
Depends on D200803
| Assignee | ||
Comment 5•1 year ago
|
||
Depends on 200805
| Assignee | ||
Updated•1 year ago
|
Points: --- → 3
Priority: -- → P3
Whiteboard: [webdriver:backlog]
| Assignee | ||
Updated•1 year ago
|
Whiteboard: [webdriver:backlog] → [webdriver:m10]
| Assignee | ||
Comment 6•1 year ago
|
||
The work and discussion will happen upstream https://github.com/web-platform-tests/wpt/issues/44702
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → WONTFIX
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Attachment #9378533 -
Attachment is obsolete: true
Updated•1 year ago
|
Attachment #9378530 -
Attachment is obsolete: true
Updated•1 year ago
|
Attachment #9378527 -
Attachment is obsolete: true
Updated•1 year ago
|
Attachment #9378526 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•