From 3bfb495e63be43c70d4cbb4dbdb405fb975f2d93 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 14 Jun 2024 13:51:34 +0200 Subject: [PATCH] Fix event dispatch in page --- test/e2e/specs/interactivity/deferred-store.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/specs/interactivity/deferred-store.spec.ts b/test/e2e/specs/interactivity/deferred-store.spec.ts index 8fb1a74a25abd5..b6a7853c40dcd4 100644 --- a/test/e2e/specs/interactivity/deferred-store.spec.ts +++ b/test/e2e/specs/interactivity/deferred-store.spec.ts @@ -21,7 +21,9 @@ test.describe( 'deferred store', () => { } ) => { const resultInput = page.getByTestId( 'result' ); await expect( resultInput ).toHaveText( '' ); - window.dispatchEvent( new Event( '_test_proceed_' ) ); + await page.evaluate( () => { + window.dispatchEvent( new Event( '_test_proceed_' ) ); + } ); await expect( resultInput ).toHaveText( 'Hello, world!' ); } ); @@ -32,7 +34,9 @@ test.describe( 'deferred store', () => { } ) => { const resultInput = page.getByTestId( 'result-getter' ); await expect( resultInput ).toHaveText( '' ); - window.dispatchEvent( new Event( '_test_proceed_' ) ); + await page.evaluate( () => { + window.dispatchEvent( new Event( '_test_proceed_' ) ); + } ); await expect( resultInput ).toHaveText( 'Hello, world!' ); } ); } );