test: add test for crash on label with input file

This commit is contained in:
Max Schmitt 2024-11-18 15:31:53 +00:00
parent 3fa33ca81f
commit b6285af1a7

View file

@ -408,3 +408,23 @@ it('should be able to render avif images', {
}));
expect(await page.evaluate(() => (window as any).error)).toBe(undefined);
});
it('should not crash when clicking a label with a <input type="file"/>', {
annotation: {
type: 'issue',
description: 'https://github.com/microsoft/playwright/issues/33257'
}
}, async ({ page }) => {
await page.setContent(`
<form>
<label>
A second file
<input type="file" />
</label>
</form>
`);
const fileChooserPromise = page.waitForEvent('filechooser');
await page.getByText('A second file').click();
const fileChooser = await fileChooserPromise;
expect(fileChooser.page()).toBe(page);
});