mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-08 12:28:46 +03:00
test: responseSize incorrect for 404 with content (#9328)
This commit is contained in:
parent
0469a7552b
commit
dbc3c11b8e
@ -167,3 +167,31 @@ for (const statusCode of [200, 401, 404, 500]) {
|
|||||||
expect(sizes.responseBodySize).toBe(3);
|
expect(sizes.responseBodySize).toBe(3);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it('should have correct responseBodySize for 404 with content', async ({ page, server, browserName }) => {
|
||||||
|
it.fail(browserName === 'chromium');
|
||||||
|
|
||||||
|
server.setRoute('/broken-image.png', (req, resp) => {
|
||||||
|
resp.writeHead(404);
|
||||||
|
resp.end(`<p>this should have a non-negative size</p>`);
|
||||||
|
});
|
||||||
|
server.setRoute('/page-with-404-image.html', (req, resp) => {
|
||||||
|
resp.end(`
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head><title>Page with Broken Image</title></head>
|
||||||
|
<body>
|
||||||
|
<img src="/broken-image.png" />
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const [req] = await Promise.all([
|
||||||
|
page.waitForRequest(/broken-image\.png$/),
|
||||||
|
page.goto(server.PREFIX + '/page-with-404-image.html'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const { responseBodySize } = await req.sizes();
|
||||||
|
expect(responseBodySize).toBeGreaterThanOrEqual(0);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user