Yuki Takei 10 месяцев назад
Родитель
Сommit
70fcf72591

+ 0 - 11
apps/app/playwright/20-basic-features/presentation.spec.ts

@@ -17,15 +17,4 @@ test('Presentation', async({ page }) => {
   // check the content of the h1
   await expect(page.getByRole('application').getByRole('heading', { level: 1 }))
     .toHaveText(/What can you do with GROWI?/);
-
-  // forward the slide with button
-  const nextSlideButton = await page.getByRole('application').getByLabel('next slide');
-  await expect(nextSlideButton).toBeVisible();
-  await expect(nextSlideButton).toBeEnabled();
-  await nextSlideButton.click();
-
-  // check the content of the h2
-  await expect(page.getByRole('application').getByRole('heading', { level: 2 }))
-    .toHaveText(/1. Knowledge Management: Create pages to store information and knowledge/);
-
 });

+ 3 - 8
apps/app/playwright/20-basic-features/use-tools.spec.ts

@@ -1,7 +1,5 @@
 import { test, expect, type Page } from '@playwright/test';
 
-import { scrollToTop } from '../utils/scroll';
-
 const openPageItemControl = async(page: Page): Promise<void> => {
   const nav = page.getByTestId('grw-contextual-sub-nav');
   const button = nav.getByTestId('open-page-item-control-btn');
@@ -30,16 +28,13 @@ const openPutBackPageModal = async(page: Page): Promise<void> => {
   await alert.waitFor({ state: 'visible' });
 
   // Wait for button to be visible, enabled and attached
-  await expect(button).toBeVisible();
+  await expect(button).toBeInViewport();
   await expect(button).toBeEnabled();
   await button.waitFor({ state: 'visible' });
-
-  // Scroll to the top and ensure the button is visible
-  await scrollToTop(page);
-  await expect(button).toBeInViewport();
   await button.waitFor({ state: 'attached' });
+  // Force click to ensure the button is clicked even if it's not fully visible
+  await button.click({ force: true });
 
-  await button.click();
   await expect(page.getByTestId('put-back-page-modal')).toBeVisible();
 };
 

+ 0 - 34
apps/app/playwright/utils/scroll.ts

@@ -1,34 +0,0 @@
-import type { Page } from '@playwright/test';
-
-/**
- * Scrolls the page to the top and waits for the scroll animation to complete
- * @param page Playwright page object
- */
-export const scrollToTop = async(page: Page): Promise<void> => {
-  await page.evaluate(async() => {
-    const waitForScrollComplete = async(): Promise<void> => {
-      document.documentElement.scrollTop = 0;
-      document.body.scrollTop = 0; // For Safari and older browsers
-
-      // Promise that resolves when scroll animation is complete
-      return new Promise<void>((resolve) => {
-        if (document.documentElement.scrollTop === 0) {
-          resolve();
-          return;
-        }
-
-        const checkScroll = () => {
-          if (document.documentElement.scrollTop === 0) {
-            resolve();
-          }
-          else {
-            requestAnimationFrame(checkScroll);
-          }
-        };
-        requestAnimationFrame(checkScroll);
-      });
-    };
-
-    await waitForScrollComplete();
-  });
-};