From 63ce63845818e814bad8ea50768e10e1023b4fc5 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 2 Aug 2026 20:08:26 +0200 Subject: [PATCH] test(portals): match the movie detail's icon-only favorite button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Xtream movie detail's favorite control is now an icon-only button, so the shared "add this detail to favorites" helpers no longer found it by class. They are used against series and Stalker details too, which still render the labeled variant, so they now select by accessible name — the icon button carries the same label in aria-label. Co-Authored-By: Claude Fable 5 --- .../src/dashboard-activation.e2e.ts | 9 +++++++-- apps/electron-backend-e2e/src/favorites.e2e.ts | 9 +++++++-- apps/electron-backend-e2e/src/search.e2e.ts | 11 +++++------ .../src/xtream-vod-details.e2e.ts | 9 +++++++-- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts b/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts index 0b99de0f4..ed9ded21b 100644 --- a/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts +++ b/apps/electron-backend-e2e/src/dashboard-activation.e2e.ts @@ -254,13 +254,18 @@ async function goBackFromDetail(page: Page): Promise { } } +// By accessible name, not class: the Xtream movie detail's favorite control is +// an icon-only button that carries its label in aria-label, while series and +// Stalker details still use the labeled variant. This matches both. async function addCurrentDetailToFavorites(page: Page): Promise { - const addButton = page.locator('button.favorite-btn').first(); + const addButton = page + .getByRole('button', { name: /add to favorites/i }) + .first(); await expect(addButton).toBeVisible({ timeout: 20000 }); await addButton.click(); await expect( - page.locator('button.favorite-btn--active').first() + page.getByRole('button', { name: /remove from favorites/i }).first() ).toBeVisible({ timeout: 20000, }); diff --git a/apps/electron-backend-e2e/src/favorites.e2e.ts b/apps/electron-backend-e2e/src/favorites.e2e.ts index 4db9c3edc..dcea53471 100644 --- a/apps/electron-backend-e2e/src/favorites.e2e.ts +++ b/apps/electron-backend-e2e/src/favorites.e2e.ts @@ -576,13 +576,18 @@ const xtreamCredentials = { password: defaultXtreamPassword, }; +// By accessible name, not class: the Xtream movie detail's favorite control is +// an icon-only button that carries its label in aria-label, while series and +// Stalker details still use the labeled variant. This matches both. async function addCurrentDetailToFavorites(page: Page): Promise { - const addButton = page.locator('button.favorite-btn').first(); + const addButton = page + .getByRole('button', { name: /add to favorites/i }) + .first(); await expect(addButton).toBeVisible({ timeout: 20000 }); await addButton.click(); await expect( - page.locator('button.favorite-btn--active').first() + page.getByRole('button', { name: /remove from favorites/i }).first() ).toBeVisible({ timeout: 20000, }); diff --git a/apps/electron-backend-e2e/src/search.e2e.ts b/apps/electron-backend-e2e/src/search.e2e.ts index dc96e4b45..974e7c17c 100644 --- a/apps/electron-backend-e2e/src/search.e2e.ts +++ b/apps/electron-backend-e2e/src/search.e2e.ts @@ -1524,19 +1524,18 @@ async function expectXtreamRootCatalogSearch( ); } +// By accessible name, not class plus visible text: the Xtream movie detail's +// favorite control is an icon-only button whose label lives in aria-label, +// while series and Stalker details still use the labeled variant. async function addCurrentDetailToFavorites(page: Page): Promise { const addButton = page - .locator('button.favorite-btn') - .filter({ hasText: /Add to favorites/i }) + .getByRole('button', { name: /add to favorites/i }) .first(); await expect(addButton).toBeVisible({ timeout: 20000 }); await addButton.click(); await expect( - page - .locator('button.favorite-btn.favorite-btn--active') - .filter({ hasText: /Remove from favorites/i }) - .first() + page.getByRole('button', { name: /remove from favorites/i }).first() ).toBeVisible({ timeout: 20000 }); } diff --git a/apps/electron-backend-e2e/src/xtream-vod-details.e2e.ts b/apps/electron-backend-e2e/src/xtream-vod-details.e2e.ts index b1565689c..cda0f7f52 100644 --- a/apps/electron-backend-e2e/src/xtream-vod-details.e2e.ts +++ b/apps/electron-backend-e2e/src/xtream-vod-details.e2e.ts @@ -93,11 +93,16 @@ test.describe('Xtream VOD Details', () => { .locator('button.play-btn') .first(); await expect(playButton).toBeVisible(); + // Both secondaries are icon-only on the movie detail now. await expect( - app.mainWindow.locator('button.favorite-btn').first() + app.mainWindow + .locator('[data-testid="vod-favorite-toggle"]') + .first() ).toBeVisible(); await expect( - app.mainWindow.locator('button.download-btn').first() + app.mainWindow + .locator('[data-testid="vod-download-start"]') + .first() ).toBeVisible(); const movieResponsePromise = app.mainWindow.waitForResponse(