test: CloseEvent.wasClean=false when WS server terminates (#20594)
https://github.com/microsoft/playwright/issues/12353
This commit is contained in:
parent
3e4d22d04a
commit
b803128a81
|
|
@ -175,3 +175,16 @@ it('navigator.clipboard should be present', async ({ page, server, browserName,
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(await page.evaluate(() => navigator.clipboard)).toBeTruthy();
|
expect(await page.evaluate(() => navigator.clipboard)).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set CloseEvent.wasClean to false when the server terminates a WebSocket connection', async ({ page, server, browserName, platform }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/12353' });
|
||||||
|
it.fixme(browserName === 'webkit' && platform === 'win32');
|
||||||
|
server.onceWebSocketConnection(socket => {
|
||||||
|
socket.terminate();
|
||||||
|
});
|
||||||
|
const wasClean = await page.evaluate(port => new Promise<boolean>(resolve => {
|
||||||
|
const ws = new WebSocket('ws://localhost:' + port + '/ws');
|
||||||
|
ws.addEventListener('close', error => resolve(error.wasClean));
|
||||||
|
}), server.PORT);
|
||||||
|
expect(wasClean).toBe(false);
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue