From ce2dad2dec9a13fa1e90e5778526866ead03a8b0 Mon Sep 17 00:00:00 2001 From: 4gray Date: Wed, 22 Apr 2026 22:24:46 +0200 Subject: [PATCH] test(e2e): update dashboard rail interactions and improve global favorites handling in tests --- .../src/dashboard-activation.e2e.ts | 37 ++++++++++--------- .../src/electron-test-fixtures.ts | 7 +--- apps/electron-backend-e2e/src/search.e2e.ts | 10 ++--- .../src/xtream-responsiveness.e2e.ts | 5 ++- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts b/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts index b36c41409..007a473f7 100644 --- a/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts +++ b/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts @@ -84,9 +84,10 @@ test.describe('Dashboard Activation', () => { await goToDashboard(app.mainWindow); - await dashboardActivityItemByTitle( + await expectDashboardRail(app.mainWindow, 'dashboard-global-favorites-rail'); + await dashboardRailCardByTitle( app.mainWindow, - 'Global Favorites', + 'dashboard-global-favorites-rail', liveTitle ).click(); await app.mainWindow.waitForURL( @@ -99,9 +100,9 @@ test.describe('Dashboard Activation', () => { await app.mainWindow.goBack(); await app.mainWindow.waitForURL(/\/workspace\/dashboard$/); - await dashboardActivityItemByTitle( + await dashboardRailCardByTitle( app.mainWindow, - 'Global Favorites', + 'dashboard-global-favorites-rail', movieTitle ).click(); await expectInlineCollectionDetail(app.mainWindow, { @@ -112,9 +113,9 @@ test.describe('Dashboard Activation', () => { await goBackFromDetail(app.mainWindow); await expectPathname(app.mainWindow, /\/workspace\/dashboard$/); - await dashboardActivityItemByTitle( + await dashboardRailCardByTitle( app.mainWindow, - 'Recently Watched', + 'dashboard-recently-watched-rail', movieTitle ).click(); await expectInlineCollectionDetail(app.mainWindow, { @@ -125,9 +126,9 @@ test.describe('Dashboard Activation', () => { await app.mainWindow.goBack(); await expectPathname(app.mainWindow, /\/workspace\/dashboard$/); - await dashboardActivityItemByTitle( + await dashboardRailCardByTitle( app.mainWindow, - 'Recently Watched', + 'dashboard-recently-watched-rail', seriesTitle ).click(); await expectInlineCollectionDetail(app.mainWindow, { @@ -148,18 +149,20 @@ const xtreamCredentials = { password: defaultXtreamPassword, }; -function dashboardActivityItemByTitle( +async function expectDashboardRail(page: Page, railTestId: string): Promise { + await expect(page.locator(`[data-test-id="${railTestId}"]`)).toBeVisible({ + timeout: 20000, + }); +} + +function dashboardRailCardByTitle( page: Page, - widgetTitle: string, + railTestId: string, title: string ) { - return page - .locator('.widget-slot') - .filter({ hasText: widgetTitle }) - .first() - .locator('.activity-item') - .filter({ hasText: title }) - .first(); + return page.locator(`[data-test-id="${railTestId}-card"]`).filter({ + hasText: title, + }).first(); } async function goBackFromDetail(page: Page): Promise { diff --git a/apps/electron-backend-e2e/src/electron-test-fixtures.ts b/apps/electron-backend-e2e/src/electron-test-fixtures.ts index a0d710cb5..c4ff7f589 100644 --- a/apps/electron-backend-e2e/src/electron-test-fixtures.ts +++ b/apps/electron-backend-e2e/src/electron-test-fixtures.ts @@ -678,12 +678,7 @@ export async function openPlaylistRecent(page: Page): Promise { } export async function openGlobalFavorites(page: Page): Promise { - await page - .getByRole('button', { - name: 'All favorites (all playlists)', - exact: true, - }) - .click(); + await openWorkspaceSection(page, 'Global favorites'); await page.waitForURL(/\/workspace\/global-favorites(?:\?.*)?$/); } diff --git a/apps/electron-backend-e2e/src/search.e2e.ts b/apps/electron-backend-e2e/src/search.e2e.ts index 7f04cf703..0308ca81c 100644 --- a/apps/electron-backend-e2e/src/search.e2e.ts +++ b/apps/electron-backend-e2e/src/search.e2e.ts @@ -13,6 +13,7 @@ import { importM3uPlaylistFromNativeDialog, launchElectronApp, m3uFixturePath, + openGlobalFavorites, resetMockServers, stalkerMockServer, test, @@ -222,7 +223,7 @@ test.describe('Electron Workspace Search', () => { } }); - test('@search @m3u filters global favorites from the workspace header without leaving the persisted query model', async ({ + test('@search @m3u filters global favorites from the workspace rail without leaving the persisted query model', async ({ dataDir, }) => { const sample = loadM3uSearchFixture(); @@ -233,12 +234,7 @@ test.describe('Electron Workspace Search', () => { await waitForM3uCatalog(app.mainWindow); await toggleFavoriteForChannel(app.mainWindow, sample.targetTitle); await toggleFavoriteForChannel(app.mainWindow, sample.controlTitle); - await app.mainWindow - .getByRole('button', { - name: 'All favorites (all playlists)', - exact: true, - }) - .click(); + await openGlobalFavorites(app.mainWindow); await expectPathname( app.mainWindow, diff --git a/apps/electron-backend-e2e/src/xtream-responsiveness.e2e.ts b/apps/electron-backend-e2e/src/xtream-responsiveness.e2e.ts index 00efcd744..e2621d79b 100644 --- a/apps/electron-backend-e2e/src/xtream-responsiveness.e2e.ts +++ b/apps/electron-backend-e2e/src/xtream-responsiveness.e2e.ts @@ -96,7 +96,10 @@ test.describe('Electron Xtream Responsiveness', () => { .poll( async () => (await overlay.locator('p').allInnerTexts()).some( - (text) => /\d+\s*\/\s*\d+/.test(text) + (text) => + /(Live TV|Movies|Series).*?\d+\s*\/\s*\d+/.test( + text + ) ), { timeout: 30000 } )