test(downloads): fix Windows workspace navigation

This commit is contained in:
4gray committed 2026-08-01 16:29:51 +02:00
1 parent d35c255157
commit 25b93bd626
1 file changed
+14 -3
+14 -3
View File
@@ -42,11 +42,22 @@ async function navigateWithinWorkspace(
page: Page,
path: string
): Promise<void> {
await page.evaluate((target) => {
window.history.pushState(null, '', target);
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 === path);
await page.waitForURL((url) => url.pathname === targetPathname);
}
async function getPlaylistId(page: Page, title: string): Promise<string> {