mirror of
https://github.com/jo-inc/camofox-browser.git
synced 2026-10-02 04:14:41 +08:00
test: cover no-proxy navigation timeout tab isolation
This commit is contained in:
@@ -49,6 +49,27 @@ describe('Navigation', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('keeps sibling tabs alive when a no-proxy navigation times out', async () => {
|
||||
const client = createClient(serverUrl);
|
||||
|
||||
try {
|
||||
const { tabId: existingTabId } = await client.createTab(`${testSiteUrl}/pageA`);
|
||||
const { tabId } = await client.createTab();
|
||||
|
||||
await expect(client.request(
|
||||
'POST',
|
||||
`/tabs/${tabId}/navigate`,
|
||||
{ userId: client.userId, url: `${testSiteUrl}/slow-navigation` },
|
||||
{ timeout: 45000 },
|
||||
)).rejects.toMatchObject({ status: 500 });
|
||||
|
||||
const existingTabSnapshot = await client.getSnapshot(existingTabId);
|
||||
expect(existingTabSnapshot.snapshot).toContain('Welcome to Page A');
|
||||
} finally {
|
||||
await client.cleanup();
|
||||
}
|
||||
}, 60000);
|
||||
|
||||
test('reports a destination 404 without discarding the rendered page', async () => {
|
||||
const client = createClient(serverUrl);
|
||||
|
||||
|
||||
@@ -41,6 +41,11 @@ function createTestApp() {
|
||||
res.status(503).send('Temporarily unavailable');
|
||||
});
|
||||
|
||||
// A response that never completes, used to exercise navigation timeouts.
|
||||
app.get('/slow-navigation', () => {
|
||||
// Deliberately leave the HTTP response open until the browser aborts it.
|
||||
});
|
||||
|
||||
// Page that fires a client-side redirect shortly after DOMContentLoaded
|
||||
app.get('/lateRedirect', (req, res) => {
|
||||
res.send(`
|
||||
|
||||
Reference in New Issue
Block a user