Files
iptvnator/apps/electron-backend-e2e/src/workspace-route.e2e-support.ts
T
4grayandClaude Opus 5.5 8fabb88106 fix(collections): one confirmed Clear recently viewed action (#1865)
A playlist's own recently viewed page (/workspace/<provider>/<id>/recent,
opened from the dashboard's recently viewed rails) showed two clear buttons:
the page's "Clear recently viewed <type>", which confirms through
createClearCollectionAction, and a header delete_sweep button that cleared
every tab of the playlist at once without asking. Remove the header bulk
action end to end, and the unreachable, unconfirmed clear button of the M3U
channel list's recent view, so every clear goes through
createClearCollectionAction. Drop the two i18n keys only those buttons used.

E2E: a shared helper asserts one clear control per page and one confirmation
per press; the M3U, Xtream and Stalker recent tests cancel first (rows stay),
then clear once on the playlist's own recently viewed page.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 09:45:21 +02:00

29 lines
1.1 KiB
TypeScript

import type { Page } from '@playwright/test';
/**
* Moves the renderer to a workspace route without reloading it, as a router
* link would. The packaged renderer lives below its own path, so only the
* part from `/workspace` on is replaced.
*/
export async function navigateWithinWorkspace(
page: Page,
path: string
): Promise<void> {
const targetPathname = await page.evaluate((target) => {
const targetUrl = new URL(window.location.href);
const workspaceIndex = targetUrl.pathname.lastIndexOf('/workspace');
const rendererPath =
workspaceIndex >= 0
? targetUrl.pathname.slice(0, workspaceIndex)
: targetUrl.pathname.replace(/\/$/, '');
targetUrl.pathname = `${rendererPath}${target}`;
targetUrl.search = '';
targetUrl.hash = '';
window.history.pushState(null, '', targetUrl);
window.dispatchEvent(new PopStateEvent('popstate'));
return targetUrl.pathname;
}, path);
await page.waitForURL((url) => url.pathname === targetPathname);
}