From 2d80d6962b1bd7ffeeca89d405e94a48a021c07a Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 22 Oct 2024 17:56:36 +0700 Subject: [PATCH] test: try to scroll to bottom e2e --- .github/workflows/jan-electron-linter-and-test.yml | 1 - electron/tests/e2e/hub.e2e.spec.ts | 1 + electron/tests/pages/basePage.ts | 11 ++++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/jan-electron-linter-and-test.yml b/.github/workflows/jan-electron-linter-and-test.yml index b2105acb4..300ee59bc 100644 --- a/.github/workflows/jan-electron-linter-and-test.yml +++ b/.github/workflows/jan-electron-linter-and-test.yml @@ -320,7 +320,6 @@ jobs: # TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}' - uses: actions/upload-artifact@v4 - if: always() with: name: playwright-report path: electron/playwright-report/ diff --git a/electron/tests/e2e/hub.e2e.spec.ts b/electron/tests/e2e/hub.e2e.spec.ts index 9b1b8305f..ef305e9c3 100644 --- a/electron/tests/e2e/hub.e2e.spec.ts +++ b/electron/tests/e2e/hub.e2e.spec.ts @@ -16,6 +16,7 @@ test.beforeAll(async () => { test('explores hub', async ({ hubPage }) => { await hubPage.navigateByMenu() await hubPage.verifyContainerVisible() + await hubPage.scrollToBottom() const useModelBtn = page.getByTestId(/^use-model-btn-.*/).first() await expect(useModelBtn).toBeVisible({ diff --git a/electron/tests/pages/basePage.ts b/electron/tests/pages/basePage.ts index 1817bc731..11e3ba81a 100644 --- a/electron/tests/pages/basePage.ts +++ b/electron/tests/pages/basePage.ts @@ -8,9 +8,8 @@ export class BasePage { constructor( protected readonly page: Page, readonly action: CommonActions, - protected containerId: string, - ) { - } + protected containerId: string + ) {} public getValue(key: string) { return this.action.getValue(key) @@ -37,6 +36,12 @@ export class BasePage { expect(container.isVisible()).toBeTruthy() } + async scrollToBottom() { + await this.page.evaluate(() => { + window.scrollTo(0, document.body.scrollHeight) + }) + } + async waitUpdateLoader() { await this.isElementVisible('img[alt="Jan - Logo"]') }