test: XMLHttpRequest upload events (#21501)
https://github.com/microsoft/playwright/issues/21489
This commit is contained in:
parent
7746807d9f
commit
9191c72a3f
|
|
@ -208,3 +208,23 @@ it('webkit should define window.safari', async ({ page, server, browserName }) =
|
||||||
const defined = await page.evaluate(() => !!(window as any).safari);
|
const defined = await page.evaluate(() => !!(window as any).safari);
|
||||||
expect(defined).toBeTruthy();
|
expect(defined).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('make sure that XMLHttpRequest upload events are emitted correctly', async ({ page, server, browserName, platform }) => {
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21489' });
|
||||||
|
it.fixme(browserName === 'webkit' && platform === 'win32');
|
||||||
|
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
const events = await page.evaluate(async () => {
|
||||||
|
const events: string[] = [];
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
xhr.upload.addEventListener('loadstart', () => events.push('loadstart'));
|
||||||
|
xhr.upload.addEventListener('progress', () => events.push('progress'));
|
||||||
|
xhr.upload.addEventListener('load', () => events.push('load'));
|
||||||
|
xhr.upload.addEventListener('loadend', () => events.push('loadend'));
|
||||||
|
xhr.open('POST', '/simple.json');
|
||||||
|
xhr.send('hello');
|
||||||
|
await new Promise(f => xhr.onload = f);
|
||||||
|
return events;
|
||||||
|
});
|
||||||
|
expect(events).toEqual(['loadstart', 'progress', 'load', 'loadend']);
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue