test(network): adding failing post data test for chromium and webkit (#6484)

This commit is contained in:
Joel Einbinder 2021-05-11 11:46:29 -07:00 committed by GitHub
parent 269a1b6407
commit 6c821a08b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,3 +87,23 @@ it('should return post data for PUT requests', async ({page, server}) => {
]);
expect(request.postDataJSON()).toEqual({ value: 42 });
});
it('should get post data for file/blob', async ({page, server, isWebKit, isChromium}) => {
it.fail(isWebKit || isChromium);
await page.goto(server.EMPTY_PAGE);
const [request] = await Promise.all([
page.waitForRequest('**/*'),
page.evaluate(() => {
const file = new File(['file-contents'], 'filename.txt');
fetch('/data', {
method: 'POST',
headers: {
'content-type': 'application/octet-stream'
},
body: file
});
})
]);
expect(request.postData()).toBe('file-contents');
});