Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: unflake "should not result in unhandled rejection" (#4602)
Dmitry Gozmanaed3d14b8199
diff --git a/test/page-expose-function.spec.ts b/test/page-expose-function.spec.tsindex ff369c0d39..a8fc016991 100644--- a/test/page-expose-function.spec.ts+++ b/test/page-expose-function.spec.ts@@ -224,10 +224,15 @@ it('exposeBindingHandle should throw for multiple arguments', async ({page}) =>});it('should not result in unhandled rejection', async ({page}) => {+ const closedPromise = page.waitForEvent('close');await page.exposeFunction('foo', async () => {await page.close();});await page.evaluate(() => {- (window as any).foo();+ setTimeout(() => (window as any).foo(), 0);+ return undefined;});+ await closedPromise;+ // Make a round-trip to be sure we did not throw immediately after closing.+ expect(await page.evaluate('1 + 1').catch(e => e)).toBeInstanceOf(Error);});