test: blazor 내부 이동으로 관리자 e2e 안정화
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { loginThroughAdminUi } from './helpers/admin-auth';
|
||||
import { loginThroughAdminUi, navigateInBlazor } from './helpers/admin-auth';
|
||||
|
||||
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
|
||||
const password = process.env.E2E_ADMIN_PASSWORD;
|
||||
@@ -29,7 +29,7 @@ test.describe('admin smoke', () => {
|
||||
];
|
||||
|
||||
for (const check of menuChecks) {
|
||||
await page.goto(`${baseUrl}${check.path}`);
|
||||
await navigateInBlazor(page, `${baseUrl}${check.path}`);
|
||||
await expect(page).toHaveURL(new RegExp(`${check.path}$`));
|
||||
await expect(page.locator('.mud-main-content').getByText(check.content).first()).toBeVisible({ timeout: 20_000 });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { findInquiryByName, getAdminToken, loginThroughAdminUi } from './helpers/admin-auth';
|
||||
import { findInquiryByName, getAdminToken, loginThroughAdminUi, navigateInBlazor } from './helpers/admin-auth';
|
||||
|
||||
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
|
||||
const password = process.env.E2E_ADMIN_PASSWORD;
|
||||
@@ -49,7 +49,7 @@ test.describe('contact submit', () => {
|
||||
expect(inquiry.message).toContain(message.slice(0, 20));
|
||||
|
||||
await loginThroughAdminUi(page, baseUrl, username, password);
|
||||
await page.goto(`${baseUrl}/admin/inquiries`);
|
||||
await navigateInBlazor(page, `${baseUrl}/admin/inquiries`);
|
||||
await expect(page.locator('.mud-main-content').getByText('문의 관리').first()).toBeVisible({ timeout: 20_000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,6 +41,18 @@ export async function loginThroughAdminUi(
|
||||
await expect(page.getByRole('heading', { name: '대시보드' })).toBeVisible({ timeout: 20_000 });
|
||||
}
|
||||
|
||||
export async function navigateInBlazor(page: Page, targetUrl: string) {
|
||||
await page.evaluate(url => {
|
||||
const blazor = (window as typeof window & { Blazor?: { navigateTo: (target: string) => void } }).Blazor;
|
||||
if (blazor) {
|
||||
blazor.navigateTo(url);
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.href = url;
|
||||
}, targetUrl);
|
||||
}
|
||||
|
||||
export async function findInquiryByName(
|
||||
request: APIRequestContext,
|
||||
baseUrl: string,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { findInquiryByName, getAdminToken, loginThroughAdminUi } from './helpers/admin-auth';
|
||||
import { findInquiryByName, getAdminToken, loginThroughAdminUi, navigateInBlazor } from './helpers/admin-auth';
|
||||
|
||||
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
|
||||
const password = process.env.E2E_ADMIN_PASSWORD;
|
||||
@@ -32,7 +32,7 @@ test.describe('inquiry detail', () => {
|
||||
const inquiry = await findInquiryByName(request, baseUrl, token, name);
|
||||
|
||||
await loginThroughAdminUi(page, baseUrl, username, password);
|
||||
await page.goto(`${baseUrl}/admin/inquiries/${inquiry.id}`);
|
||||
await navigateInBlazor(page, `${baseUrl}/admin/inquiries/${inquiry.id}`);
|
||||
|
||||
await expect(page).toHaveURL(/\/taxbaik\/admin\/inquiries\/\d+$/);
|
||||
await expect(page.getByText(name)).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user