Skip to content

Commit 05161f2

Browse files
committed
ci: wait for SQLocal database reconnection
1 parent 0c9b2d0 commit 05161f2

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎ecosystem-ci/webdriverio.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,29 @@ export async function prepareWebdriverioProject(
4545
'{ timeout: 10000 }',
4646
);
4747

48+
// Deleting client3 broadcasts a reconnect to client2 without awaiting it.
49+
// Wait for client2 to recreate the OPFS file before checking its handle.
50+
// Remove when upstream waits for the other client's asynchronous reconnect.
51+
await replaceOnce(
52+
join(root, 'test', 'delete-database-file.test.ts'),
53+
`\t\t\t\tif (type === 'opfs') {
54+
\t\t\t\t\tawait expect(opfs?.getFileHandle(path)).resolves.instanceOf(
55+
\t\t\t\t\t\tFileSystemFileHandle
56+
\t\t\t\t\t);
57+
\t\t\t\t}
58+
59+
\t\t\t\tawait client2.destroy();`,
60+
`\t\t\t\tif (type === 'opfs') {
61+
\t\t\t\t\tawait vi.waitFor(async () => {
62+
\t\t\t\t\t\tawait expect(opfs?.getFileHandle(path)).resolves.instanceOf(
63+
\t\t\t\t\t\t\tFileSystemFileHandle
64+
\t\t\t\t\t\t);
65+
\t\t\t\t\t});
66+
\t\t\t\t}
67+
68+
\t\t\t\tawait client2.destroy();`,
69+
);
70+
4871
// Vitest 5's browser server does not run the SQLocal plugin's middleware.
4972
// Keep the same isolation headers explicitly; OPFS tests assert isolation.
5073
// Remove when the upstream plugin supports the separate browser server.

0 commit comments

Comments
 (0)