test(portals): match the movie detail's icon-only favorite button

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 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5 committed 2026-08-02 20:08:26 +02:00
1 parent 5b93392421
commit 63ce638458
4 files changed
+26 -12

No files matched your search

@@ -254,13 +254,18 @@ async function goBackFromDetail(page: Page): Promise<void> {
}
}
// 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<void> {
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,
});
@@ -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<void> {
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,
});
+5 -6
View File
@@ -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<void> {
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 });
}
@@ -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(