test(e2e): update favorites and recently viewed handling to use global paths

This commit is contained in:
4gray committed 2026-04-23 00:03:48 +02:00
1 parent 4b4d0abfab
commit c123fbf115
5 files changed
+67 -77

No files matched your search

@@ -662,19 +662,27 @@ export async function openWorkspaceSection(
page: Page,
label: string
): Promise<void> {
if (label === 'Favorites') {
await openPlaylistFavorites(page);
return;
}
if (label === 'Recently viewed') {
await openPlaylistRecent(page);
return;
}
await page.getByRole('link', { name: label, exact: true }).click();
}
export async function openPlaylistFavorites(page: Page): Promise<void> {
await openWorkspaceSection(page, 'Favorites');
await expect
.poll(() => new URL(page.url()).pathname)
.toMatch(/\/favorites$/);
await openGlobalFavorites(page);
await switchUnifiedCollectionScope(page, 'This playlist');
}
export async function openPlaylistRecent(page: Page): Promise<void> {
await openWorkspaceSection(page, 'Recently viewed');
await expect.poll(() => new URL(page.url()).pathname).toMatch(/\/recent$/);
await openGlobalRecent(page);
await switchUnifiedCollectionScope(page, 'This playlist');
}
export async function openGlobalFavorites(page: Page): Promise<void> {
+8 -20
View File
@@ -345,16 +345,13 @@ test.describe('Electron Favorites', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/xtreams\/[^/]+\/favorites$/,
pathname: /\/workspace\/global-favorites$/,
title: movieTitle,
playlistTitle: hostPortalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/xtreams\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await expectVisibleContentCardTitle(app.mainWindow, movieTitle);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
@@ -363,16 +360,13 @@ test.describe('Electron Favorites', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/xtreams\/[^/]+\/favorites$/,
pathname: /\/workspace\/global-favorites$/,
title: seriesTitle,
playlistTitle: hostPortalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/xtreams\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
await expectVisibleContentCardTitle(app.mainWindow, seriesTitle);
} finally {
@@ -543,16 +537,13 @@ test.describe('Electron Favorites', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/stalker\/[^/]+\/favorites$/,
pathname: /\/workspace\/global-favorites$/,
title: movieTitle,
playlistTitle: portalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/stalker\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await expectVisibleContentCardTitle(app.mainWindow, movieTitle);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
@@ -561,16 +552,13 @@ test.describe('Electron Favorites', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/stalker\/[^/]+\/favorites$/,
pathname: /\/workspace\/global-favorites$/,
title: seriesTitle,
playlistTitle: portalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/stalker\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
await expectVisibleContentCardTitle(app.mainWindow, seriesTitle);
} finally {
@@ -15,6 +15,7 @@ import {
openSourceEditor,
openSources,
openWorkspaceSection,
playlistSwitcherTitle,
resetMockServers,
restartElectronApp,
saveSettings,
@@ -95,22 +96,19 @@ test.describe('Electron Playlist Switcher', () => {
.first()
.click();
await waitForM3uCatalog(app.mainWindow);
await openWorkspaceSection(app.mainWindow, 'Recently viewed');
await expectPathname(
app.mainWindow,
/\/workspace\/playlists\/[^/]+\/recent$/
);
await openPlaylistRecent(app.mainWindow);
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await switchPlaylistFromHeader(app.mainWindow, localBDisplayName);
await expectPathname(
app.mainWindow,
/\/workspace\/playlists\/[^/]+\/recent$/
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await expect(playlistSwitcherTitle(app.mainWindow)).toContainText(
localBDisplayName
);
await switchPlaylistFromHeader(app.mainWindow, xtreamAName);
await expectPathname(
app.mainWindow,
/\/workspace\/xtreams\/[^/]+\/recent$/
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await expect(playlistSwitcherTitle(app.mainWindow)).toContainText(
xtreamAName
);
await openWorkspaceSection(app.mainWindow, 'Live TV');
@@ -167,16 +165,19 @@ test.describe('Electron Playlist Switcher', () => {
/\/workspace\/playlists\/[^/]+\/all$/
);
await openWorkspaceSection(app.mainWindow, 'Favorites');
await openPlaylistFavorites(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/playlists\/[^/]+\/favorites$/
/\/workspace\/global-favorites$/
);
await switchPlaylistFromHeader(app.mainWindow, stalkerBName);
await expectPathname(
app.mainWindow,
/\/workspace\/stalker\/[^/]+\/favorites$/
/\/workspace\/global-favorites$/
);
await expect(playlistSwitcherTitle(app.mainWindow)).toContainText(
stalkerBName
);
} finally {
await closeElectronApp(app);
@@ -243,7 +244,7 @@ test.describe('Electron Playlist Switcher', () => {
await switchPlaylistFromHeader(app.mainWindow, localBDisplayName);
await expectPathname(
app.mainWindow,
/\/workspace\/playlists\/[^/]+\/favorites$/
/\/workspace\/global-favorites$/
);
await expect(channelItemByTitle(app.mainWindow, localBChannelName)).toHaveCount(
1
@@ -263,7 +264,7 @@ test.describe('Electron Playlist Switcher', () => {
await switchPlaylistFromHeader(app.mainWindow, localADisplayName);
await expectPathname(
app.mainWindow,
/\/workspace\/playlists\/[^/]+\/recent$/
/\/workspace\/global-recent$/
);
await expect(channelItemByTitle(app.mainWindow, localAChannelName)).toHaveCount(
1
+8 -20
View File
@@ -328,16 +328,13 @@ test.describe('Electron Recently Viewed', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/xtreams\/[^/]+\/recent$/,
pathname: /\/workspace\/global-recent$/,
title: movieTitle,
playlistTitle: portalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/xtreams\/[^/]+\/recent$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await expectVisibleContentCardTitle(app.mainWindow, movieTitle);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
@@ -346,16 +343,13 @@ test.describe('Electron Recently Viewed', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/xtreams\/[^/]+\/recent$/,
pathname: /\/workspace\/global-recent$/,
title: seriesTitle,
playlistTitle: portalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/xtreams\/[^/]+\/recent$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
await expectVisibleContentCardTitle(app.mainWindow, seriesTitle);
} finally {
@@ -525,16 +519,13 @@ test.describe('Electron Recently Viewed', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/stalker\/[^/]+\/recent$/,
pathname: /\/workspace\/global-recent$/,
title: movieTitle,
playlistTitle: portalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/stalker\/[^/]+\/recent$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await expectVisibleContentCardTitle(app.mainWindow, movieTitle);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
@@ -543,16 +534,13 @@ test.describe('Electron Recently Viewed', () => {
.first()
.click();
await expectInlineCollectionDetail(app.mainWindow, {
pathname: /\/workspace\/stalker\/[^/]+\/recent$/,
pathname: /\/workspace\/global-recent$/,
title: seriesTitle,
playlistTitle: portalTitle,
});
await goBackFromDetail(app.mainWindow);
await expectPathname(
app.mainWindow,
/\/workspace\/stalker\/[^/]+\/recent$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-recent$/);
await switchUnifiedCollectionContent(app.mainWindow, 'Series');
await expectVisibleContentCardTitle(app.mainWindow, seriesTitle);
} finally {
+20 -15
View File
@@ -206,12 +206,12 @@ test.describe('Electron Workspace Search', () => {
await fillWorkspaceSearch(app.mainWindow, sample.groupTitle);
await expectPathname(
app.mainWindow,
/\/workspace\/playlists\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await expectQueryParam(app.mainWindow, 'q', sample.groupTitle);
await expectWorkspaceSearchScope(app.mainWindow, 'Favorites');
await expectWorkspaceSearchScope(
app.mainWindow,
'Global favorites'
);
await expect(
channelItemByTitle(app.mainWindow, sample.targetTitle).first()
).toBeVisible();
@@ -561,10 +561,7 @@ test.describe('Electron Workspace Search', () => {
);
await openWorkspaceSection(app.mainWindow, 'Favorites');
await expectPathname(
app.mainWindow,
/\/workspace\/xtreams\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await expect(
contentCardByTitle(
app.mainWindow,
@@ -588,7 +585,10 @@ test.describe('Electron Workspace Search', () => {
'q',
resolvedTitles.targetTitle
);
await expectWorkspaceSearchScope(app.mainWindow, 'Favorites');
await expectWorkspaceSearchScope(
app.mainWindow,
'Global favorites'
);
await expect(
contentCardByTitle(
app.mainWindow,
@@ -801,10 +801,7 @@ test.describe('Electron Workspace Search', () => {
await toggleFavoriteForChannel(app.mainWindow, sample.controlTitle);
await openWorkspaceSection(app.mainWindow, 'Favorites');
await expectPathname(
app.mainWindow,
/\/workspace\/stalker\/[^/]+\/favorites$/
);
await expectPathname(app.mainWindow, /\/workspace\/global-favorites$/);
await expect(
channelItemByTitle(app.mainWindow, sample.targetTitle).first()
).toBeVisible({ timeout: 20000 });
@@ -815,7 +812,10 @@ test.describe('Electron Workspace Search', () => {
await fillWorkspaceSearch(app.mainWindow, sample.targetTitle);
await expectQueryParam(app.mainWindow, 'q', sample.targetTitle);
await expectWorkspaceSearchScope(app.mainWindow, 'Favorites');
await expectWorkspaceSearchScope(
app.mainWindow,
'Global favorites'
);
await expect(
channelItemByTitle(app.mainWindow, sample.targetTitle).first()
).toBeVisible();
@@ -1227,6 +1227,11 @@ async function clickCategoryByNameExact(
}
async function openWorkspaceSection(page: Page, label: string): Promise<void> {
if (label === 'Favorites') {
await openGlobalFavorites(page);
return;
}
await page.getByRole('link', { name: label, exact: true }).click();
}