@@ -246,10 +246,13 @@ test("Opens a feedback widget in the bottom right by default", async ({
246246
247247 await expect ( container ) . toBeAttached ( ) ;
248248
249- const bbox = await container . locator ( ".dialog" ) . boundingBox ( ) ;
250- expect ( bbox ?. x ) . toEqual ( WINDOW_WIDTH - bbox ! . width - 16 ) ;
251- expect ( bbox ?. y ) . toBeGreaterThan ( WINDOW_HEIGHT - bbox ! . height - 30 ) ; // Account for browser differences
252- expect ( bbox ?. y ) . toBeLessThan ( WINDOW_HEIGHT - bbox ! . height ) ;
249+ // Attachment happens before the entrance animation has reached its position.
250+ await expect ( async ( ) => {
251+ const bbox = await container . locator ( ".dialog" ) . boundingBox ( ) ;
252+ expect ( bbox ?. x ) . toEqual ( WINDOW_WIDTH - bbox ! . width - 16 ) ;
253+ expect ( bbox ?. y ) . toBeGreaterThan ( WINDOW_HEIGHT - bbox ! . height - 30 ) ; // Account for browser differences
254+ expect ( bbox ?. y ) . toBeLessThan ( WINDOW_HEIGHT - bbox ! . height ) ;
255+ } ) . toPass ( { timeout : 5000 } ) ;
253256} ) ;
254257
255258test ( "Opens a feedback widget in the correct position when overridden" , async ( {
@@ -268,10 +271,12 @@ test("Opens a feedback widget in the correct position when overridden", async ({
268271
269272 await expect ( container ) . toBeAttached ( ) ;
270273
271- const bbox = await container . locator ( ".dialog" ) . boundingBox ( ) ;
272- expect ( bbox ?. x ) . toEqual ( 16 ) ;
273- expect ( bbox ?. y ) . toBeGreaterThan ( 0 ) ; // Account for browser differences
274- expect ( bbox ?. y ) . toBeLessThanOrEqual ( 16 ) ;
274+ await expect ( async ( ) => {
275+ const bbox = await container . locator ( ".dialog" ) . boundingBox ( ) ;
276+ expect ( bbox ?. x ) . toEqual ( 16 ) ;
277+ expect ( bbox ?. y ) . toBeGreaterThan ( 0 ) ; // Account for browser differences
278+ expect ( bbox ?. y ) . toBeLessThanOrEqual ( 16 ) ;
279+ } ) . toPass ( { timeout : 5000 } ) ;
275280} ) ;
276281
277282test ( "Opens a feedback widget with the correct translations" , async ( {
0 commit comments