test: add test to verify fetching of dataURL requests (#4233)

This commit is contained in:
Andrey Lushnikov 2019-05-31 17:11:55 -07:00 committed by GitHub
parent 015e330815
commit d221c02c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,6 +298,20 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
expect(requests.length).toBe(1); expect(requests.length).toBe(1);
expect(requests[0].url()).toBe(dataURL); expect(requests[0].url()).toBe(dataURL);
}); });
it_fails_ffox('should be able to fetch dataURL and fire dataURL requests', async({page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.setRequestInterception(true);
const requests = [];
page.on('request', request => {
requests.push(request);
request.continue();
});
const dataURL = 'data:text/html,<div>yo</div>';
const text = await page.evaluate(url => fetch(url).then(r => r.text()), dataURL);
console.log(text);
expect(requests.length).toBe(1);
expect(requests[0].url()).toBe(dataURL);
});
it_fails_ffox('should navigate to URL with hash and and fire requests without hash', async({page, server}) => { it_fails_ffox('should navigate to URL with hash and and fire requests without hash', async({page, server}) => {
await page.setRequestInterception(true); await page.setRequestInterception(true);
const requests = []; const requests = [];