Sfoglia il codice sorgente

Fix scrolling behavior in openPutBackPageModal for better button interaction

Yuki Takei 10 mesi fa
parent
commit
3c1fb4ed61

+ 5 - 1
apps/app/playwright/20-basic-features/use-tools.spec.ts

@@ -34,9 +34,13 @@ const openPutBackPageModal = async(page: Page): Promise<void> => {
 
 
   // Scroll to the top of the page to prevent the subnav hide the button
   // Scroll to the top of the page to prevent the subnav hide the button
   await page.evaluate(() => {
   await page.evaluate(() => {
-    window.scrollTo(0, 0);
+    document.documentElement.scrollTop = 0;
+    document.body.scrollTop = 0; // For Safari and older browsers
   });
   });
 
 
+  // Add a small delay to ensure scrolling is complete and the button is interactive
+  await page.waitForTimeout(200); // Increased delay
+
   await button.click();
   await button.click();
   await expect(page.getByTestId('put-back-page-modal')).toBeVisible();
   await expect(page.getByTestId('put-back-page-modal')).toBeVisible();
 };
 };