mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 12:06:16 -08:00
Merge origin/master into PR 955
This commit is contained in:
commit
2a769ad44e
89 files changed
+6476
-465
No files matched your search
@@ -30,3 +30,21 @@ test('basic test', async ({ page }) => {
|
||||
await expect(page.getByText('1. Channel 1')).toBeVisible();
|
||||
await expect(page.getByText('4. HappyKids TV')).toBeVisible();
|
||||
});
|
||||
|
||||
test('keyboard shortcuts help opens from question mark', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await page.getByRole('button', { name: 'Open keyboard shortcuts' }).focus();
|
||||
await page.keyboard.press('?');
|
||||
|
||||
const dialog = page.getByRole('dialog');
|
||||
await expect(
|
||||
dialog.getByRole('heading', { name: 'Keyboard shortcuts' })
|
||||
).toBeVisible();
|
||||
await expect(dialog.getByText('Open command palette')).toBeVisible();
|
||||
await expect(dialog.getByText('Toggle sidebar')).toBeVisible();
|
||||
await expect(dialog.getByText('Mute audio')).toBeVisible();
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(dialog).toBeHidden();
|
||||
});
|
||||
@@ -51,6 +51,27 @@ async function addXtreamPortal(page: Page): Promise<void> {
|
||||
await page.waitForURL(/xtreams.*vod/);
|
||||
}
|
||||
|
||||
async function addM3uPlaylist(page: Page): Promise<void> {
|
||||
await page.getByRole('button', { name: 'Add playlist' }).click();
|
||||
const dialog = page.locator('mat-dialog-container');
|
||||
await expect(dialog).toBeVisible();
|
||||
|
||||
await setInputValue(
|
||||
dialog.getByRole('textbox', { name: /Playlist URL/ }),
|
||||
`${XTREAM_MOCK_SERVER}/playlist.m3u`
|
||||
);
|
||||
await setInputValue(
|
||||
dialog.getByRole('textbox', { name: 'Playlist title' }),
|
||||
'Self-hosted M3U'
|
||||
);
|
||||
|
||||
await dialog
|
||||
.getByRole('button', { name: 'Add playlist', exact: true })
|
||||
.click();
|
||||
await expect(dialog).toBeHidden();
|
||||
await page.waitForURL(/playlists.*all/);
|
||||
}
|
||||
|
||||
async function addStalkerPortal(page: Page): Promise<void> {
|
||||
await page.getByRole('button', { name: 'Add playlist' }).click();
|
||||
const dialog = page.locator('mat-dialog-container');
|
||||
@@ -69,6 +90,29 @@ async function addStalkerPortal(page: Page): Promise<void> {
|
||||
await page.waitForURL(/stalker.*vod/);
|
||||
}
|
||||
|
||||
function collectBackendRequests(page: Page, path: string): string[] {
|
||||
const requests: string[] = [];
|
||||
page.on('request', (request) => {
|
||||
const requestUrl = request.url();
|
||||
const url = new URL(requestUrl);
|
||||
if (url.origin === WEB_BACKEND_URL && url.pathname === path) {
|
||||
requests.push(requestUrl);
|
||||
}
|
||||
});
|
||||
return requests;
|
||||
}
|
||||
|
||||
function expectRequestsUseTargetId(requests: string[], path: string): void {
|
||||
expect(requests.length).toBeGreaterThan(0);
|
||||
for (const requestUrl of requests) {
|
||||
const url = new URL(requestUrl);
|
||||
expect(url.pathname).toBe(path);
|
||||
expect(url.searchParams.get('targetId')).not.toBeNull();
|
||||
expect(url.searchParams.get('targetId')).not.toBe('');
|
||||
expect(url.searchParams.has('url')).toBe(false);
|
||||
}
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ page, request }) => {
|
||||
await request.post(`${XTREAM_MOCK_SERVER}/reset`);
|
||||
await request.post(`${STALKER_MOCK_SERVER}/reset`);
|
||||
@@ -94,17 +138,62 @@ test('@self-hosted runtime config points PWA calls at the monorepo backend', asy
|
||||
test('@self-hosted Xtream portal loads through web-backend proxy', async ({
|
||||
page,
|
||||
}) => {
|
||||
const xtreamRequests = collectBackendRequests(page, '/xtream');
|
||||
const consoleErrors: string[] = [];
|
||||
page.on('console', (message) => {
|
||||
if (message.type() === 'error') {
|
||||
consoleErrors.push(message.text());
|
||||
}
|
||||
});
|
||||
|
||||
await addXtreamPortal(page);
|
||||
|
||||
const rail = page.locator('app-workspace-shell-rail');
|
||||
await expect(rail.locator('a[aria-label="Movies"]')).toBeVisible();
|
||||
await expect(rail.locator('a[aria-label="Live TV"]')).toBeVisible();
|
||||
await expect(rail.locator('a[aria-label="Series"]')).toBeVisible();
|
||||
await expect(rail.locator('a[aria-label="Recently added"]')).toBeVisible();
|
||||
await expect(rail.locator('a[aria-label="Advanced search"]')).toBeVisible();
|
||||
|
||||
const categoryItems = page.locator('.category-item');
|
||||
await expect(categoryItems.first()).toBeVisible({ timeout: 15_000 });
|
||||
const vodItem = page.locator('app-grid-list mat-card').first();
|
||||
await expect(vodItem).toBeVisible({ timeout: 30_000 });
|
||||
await vodItem.click();
|
||||
await expect(page).toHaveURL(/\/workspace\/xtreams\/[^/]+\/vod\/\d+\/\d+/);
|
||||
await expect(
|
||||
page.getByRole('button', { name: 'Play', exact: true })
|
||||
).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
expect(
|
||||
consoleErrors.filter((message) =>
|
||||
/db(SetAppState|GetContentByXtreamId)/.test(message)
|
||||
)
|
||||
).toEqual([]);
|
||||
expectRequestsUseTargetId(xtreamRequests, '/xtream');
|
||||
});
|
||||
|
||||
test('@self-hosted M3U URL loads through web-backend proxy', async ({
|
||||
page,
|
||||
}) => {
|
||||
const parseRequests = collectBackendRequests(page, '/parse');
|
||||
|
||||
await addM3uPlaylist(page);
|
||||
|
||||
await expect(page.getByText('4 channels')).toBeVisible({ timeout: 15_000 });
|
||||
await expect(page.getByText('1. Channel 1')).toBeVisible();
|
||||
await expect(page.getByText('4. HappyKids TV')).toBeVisible();
|
||||
expectRequestsUseTargetId(parseRequests, '/parse');
|
||||
});
|
||||
|
||||
test('@self-hosted Stalker portal loads through web-backend proxy', async ({
|
||||
page,
|
||||
}) => {
|
||||
const stalkerRequests = collectBackendRequests(page, '/stalker');
|
||||
|
||||
await addStalkerPortal(page);
|
||||
|
||||
const categoryItems = page.locator('.category-item');
|
||||
await expect(categoryItems.first()).toBeVisible({ timeout: 15_000 });
|
||||
expectRequestsUseTargetId(stalkerRequests, '/stalker');
|
||||
});
|
||||
Reference in new issue
Block a user