This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
const WEB_URL = 'http://localhost:3000';
|
||||
|
||||
export const openProjectDashboard = async (page: Page) => {
|
||||
await page.goto(`${WEB_URL}/main`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForURL(/\/main\/project\/\d+\/dashboard/, {
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
const projectId = new URL(page.url()).pathname.split('/')[3];
|
||||
if (!projectId) throw new Error(`Project id was not found in ${page.url()}`);
|
||||
return projectId;
|
||||
};
|
||||
|
||||
export const openFeedbackPage = async (page: Page) => {
|
||||
const projectId = await openProjectDashboard(page);
|
||||
await page.goto(`${WEB_URL}/main/project/${projectId}/feedback`, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
await page.waitForURL(/channelId=/, { timeout: 30000 });
|
||||
|
||||
const channelId = new URL(page.url()).searchParams.get('channelId');
|
||||
if (!channelId) throw new Error(`Channel id was not found in ${page.url()}`);
|
||||
return { projectId, channelId };
|
||||
};
|
||||
|
||||
export const openIssuePage = async (page: Page) => {
|
||||
const projectId = await openProjectDashboard(page);
|
||||
await page.goto(`${WEB_URL}/main/project/${projectId}/issue`, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
});
|
||||
return projectId;
|
||||
};
|
||||
Reference in New Issue
Block a user