test: force crash tests on new worker and keep launchOptions (#21818)

Fixes https://github.com/microsoft/playwright/issues/21810
This commit is contained in:
Max Schmitt 2023-03-20 21:43:51 +01:00 committed by GitHub
parent 73b20bc876
commit 55df07fd60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@
import { contextTest as testBase, expect } from '../config/browserTest';
const test = testBase.extend<{ crash: () => void }>({
const test = testBase.extend<{ crash: () => void }, { dummy: string }>({
crash: async ({ page, toImpl, browserName }, run) => {
run(() => {
if (browserName === 'chromium')
@ -27,12 +27,11 @@ const test = testBase.extend<{ crash: () => void }>({
else if (browserName === 'firefox')
toImpl(page)._delegate._session.send('Page.crash', {}).catch(e => {});
});
}
},
// Force a separate worker to avoid messing up with other tests.
dummy: ['', { scope: 'worker' }],
});
// Force a separate worker to avoid messing up with other tests.
test.use({ launchOptions: {} });
test('should emit crash event when page crashes', async ({ page, crash }) => {
await page.setContent(`<div>This page should crash</div>`);
crash();