mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
test(ui): deflake workboard view provider release and drawer dialog tests (#114722)
The provider-release test raced vi.waitFor's 1s default against the lazy workboard-card-dashboard import; on loaded CI runners the import chain outlives the timeout, so board.get was never observed. Await the element definition and its first update instead, which issue board.get synchronously. Wrap the body in try/finally: the leaked open drawer from a failure corrupted scoped querySelector results in the shared jsdom document and cascaded into the drawer dialog test.
This commit is contained in:
committed by
GitHub
parent
9e2ffea0de
commit
26eae2ef3e
@@ -143,15 +143,29 @@ describe("renderWorkboard", () => {
|
||||
} as unknown as GatewayBrowserClient,
|
||||
});
|
||||
|
||||
renderInto(container, props);
|
||||
await vi.waitFor(() => expect(request).toHaveBeenCalledWith("board.get", { sessionKey }));
|
||||
try {
|
||||
renderInto(container, props);
|
||||
// The dashboard element is lazily imported; on loaded CI runners that
|
||||
// import can outlive vi.waitFor's default timeout. Await the definition
|
||||
// and the upgraded element's first update, which acquires the provider
|
||||
// and issues board.get synchronously.
|
||||
await customElements.whenDefined("openclaw-workboard-card-dashboard");
|
||||
const dashboard = container.querySelector("openclaw-workboard-card-dashboard");
|
||||
expect(dashboard).not.toBeNull();
|
||||
await dashboard!.updateComplete;
|
||||
expect(request).toHaveBeenCalledWith("board.get", { sessionKey });
|
||||
|
||||
state.detailCardId = null;
|
||||
renderInto(container, props);
|
||||
await nextFrame();
|
||||
state.detailCardId = null;
|
||||
renderInto(container, props);
|
||||
await nextFrame();
|
||||
|
||||
expect(removeListener).toHaveBeenCalledOnce();
|
||||
container.remove();
|
||||
expect(removeListener).toHaveBeenCalledOnce();
|
||||
} finally {
|
||||
// A leaked open drawer poisons later dialog tests in this shared jsdom
|
||||
// document, so tear down even when an assertion above fails.
|
||||
render(nothing, container);
|
||||
container.remove();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps manual recovery refresh visible while data is loading", () => {
|
||||
|
||||
Reference in New Issue
Block a user