mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
test(e2e): update dashboard rail interactions and improve global favorites handling in tests
This commit is contained in:
1 parent
db200167ba
commit
ce2dad2dec
4 files changed
+28
-31
No files matched your search
@@ -84,9 +84,10 @@ test.describe('Dashboard Activation', () => {
|
||||
|
||||
await goToDashboard(app.mainWindow);
|
||||
|
||||
await dashboardActivityItemByTitle(
|
||||
await expectDashboardRail(app.mainWindow, 'dashboard-global-favorites-rail');
|
||||
await dashboardRailCardByTitle(
|
||||
app.mainWindow,
|
||||
'Global Favorites',
|
||||
'dashboard-global-favorites-rail',
|
||||
liveTitle
|
||||
).click();
|
||||
await app.mainWindow.waitForURL(
|
||||
@@ -99,9 +100,9 @@ test.describe('Dashboard Activation', () => {
|
||||
await app.mainWindow.goBack();
|
||||
await app.mainWindow.waitForURL(/\/workspace\/dashboard$/);
|
||||
|
||||
await dashboardActivityItemByTitle(
|
||||
await dashboardRailCardByTitle(
|
||||
app.mainWindow,
|
||||
'Global Favorites',
|
||||
'dashboard-global-favorites-rail',
|
||||
movieTitle
|
||||
).click();
|
||||
await expectInlineCollectionDetail(app.mainWindow, {
|
||||
@@ -112,9 +113,9 @@ test.describe('Dashboard Activation', () => {
|
||||
await goBackFromDetail(app.mainWindow);
|
||||
await expectPathname(app.mainWindow, /\/workspace\/dashboard$/);
|
||||
|
||||
await dashboardActivityItemByTitle(
|
||||
await dashboardRailCardByTitle(
|
||||
app.mainWindow,
|
||||
'Recently Watched',
|
||||
'dashboard-recently-watched-rail',
|
||||
movieTitle
|
||||
).click();
|
||||
await expectInlineCollectionDetail(app.mainWindow, {
|
||||
@@ -125,9 +126,9 @@ test.describe('Dashboard Activation', () => {
|
||||
await app.mainWindow.goBack();
|
||||
await expectPathname(app.mainWindow, /\/workspace\/dashboard$/);
|
||||
|
||||
await dashboardActivityItemByTitle(
|
||||
await dashboardRailCardByTitle(
|
||||
app.mainWindow,
|
||||
'Recently Watched',
|
||||
'dashboard-recently-watched-rail',
|
||||
seriesTitle
|
||||
).click();
|
||||
await expectInlineCollectionDetail(app.mainWindow, {
|
||||
@@ -148,18 +149,20 @@ const xtreamCredentials = {
|
||||
password: defaultXtreamPassword,
|
||||
};
|
||||
|
||||
function dashboardActivityItemByTitle(
|
||||
async function expectDashboardRail(page: Page, railTestId: string): Promise<void> {
|
||||
await expect(page.locator(`[data-test-id="${railTestId}"]`)).toBeVisible({
|
||||
timeout: 20000,
|
||||
});
|
||||
}
|
||||
|
||||
function dashboardRailCardByTitle(
|
||||
page: Page,
|
||||
widgetTitle: string,
|
||||
railTestId: string,
|
||||
title: string
|
||||
) {
|
||||
return page
|
||||
.locator('.widget-slot')
|
||||
.filter({ hasText: widgetTitle })
|
||||
.first()
|
||||
.locator('.activity-item')
|
||||
.filter({ hasText: title })
|
||||
.first();
|
||||
return page.locator(`[data-test-id="${railTestId}-card"]`).filter({
|
||||
hasText: title,
|
||||
}).first();
|
||||
}
|
||||
|
||||
async function goBackFromDetail(page: Page): Promise<void> {
|
||||
|
||||
@@ -678,12 +678,7 @@ export async function openPlaylistRecent(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
export async function openGlobalFavorites(page: Page): Promise<void> {
|
||||
await page
|
||||
.getByRole('button', {
|
||||
name: 'All favorites (all playlists)',
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
await openWorkspaceSection(page, 'Global favorites');
|
||||
await page.waitForURL(/\/workspace\/global-favorites(?:\?.*)?$/);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
importM3uPlaylistFromNativeDialog,
|
||||
launchElectronApp,
|
||||
m3uFixturePath,
|
||||
openGlobalFavorites,
|
||||
resetMockServers,
|
||||
stalkerMockServer,
|
||||
test,
|
||||
@@ -222,7 +223,7 @@ test.describe('Electron Workspace Search', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('@search @m3u filters global favorites from the workspace header without leaving the persisted query model', async ({
|
||||
test('@search @m3u filters global favorites from the workspace rail without leaving the persisted query model', async ({
|
||||
dataDir,
|
||||
}) => {
|
||||
const sample = loadM3uSearchFixture();
|
||||
@@ -233,12 +234,7 @@ test.describe('Electron Workspace Search', () => {
|
||||
await waitForM3uCatalog(app.mainWindow);
|
||||
await toggleFavoriteForChannel(app.mainWindow, sample.targetTitle);
|
||||
await toggleFavoriteForChannel(app.mainWindow, sample.controlTitle);
|
||||
await app.mainWindow
|
||||
.getByRole('button', {
|
||||
name: 'All favorites (all playlists)',
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
await openGlobalFavorites(app.mainWindow);
|
||||
|
||||
await expectPathname(
|
||||
app.mainWindow,
|
||||
|
||||
@@ -96,7 +96,10 @@ test.describe('Electron Xtream Responsiveness', () => {
|
||||
.poll(
|
||||
async () =>
|
||||
(await overlay.locator('p').allInnerTexts()).some(
|
||||
(text) => /\d+\s*\/\s*\d+/.test(text)
|
||||
(text) =>
|
||||
/(Live TV|Movies|Series).*?\d+\s*\/\s*\d+/.test(
|
||||
text
|
||||
)
|
||||
),
|
||||
{ timeout: 30000 }
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user