This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
|
||||
const password = process.env.E2E_ADMIN_PASSWORD;
|
||||
const username = process.env.E2E_ADMIN_USERNAME ?? 'test_admin';
|
||||
const password = process.env.E2E_ADMIN_PASSWORD ?? 'TestAdmin@123456';
|
||||
const baseUrl = (process.env.E2E_BASE_URL ?? 'https://www.taxbaik.com').replace(/\/$/, '');
|
||||
|
||||
test.describe('admin authentication', () => {
|
||||
@@ -48,10 +48,12 @@ test.describe('admin authentication', () => {
|
||||
console.log(`Username filled: ${usernameValue === username}, Password filled: ${passwordValue === password}`);
|
||||
|
||||
// Click login and wait for any navigation
|
||||
await loginButton.click();
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/admin\/dashboard$/, { timeout: 30_000 }).catch(() => {}),
|
||||
loginButton.click()
|
||||
]);
|
||||
|
||||
// Wait a bit for form submission + page reload
|
||||
await page.waitForTimeout(3000);
|
||||
await page.waitForLoadState('networkidle').catch(() => {});
|
||||
|
||||
// Check localStorage and current state
|
||||
const localStorageData = await page.evaluate(() => ({
|
||||
@@ -64,16 +66,7 @@ test.describe('admin authentication', () => {
|
||||
console.log(`Current URL after login: ${page.url()}`);
|
||||
console.log(`Network requests: ${JSON.stringify(networkRequests)}`);
|
||||
|
||||
// If we're still on login page, something failed
|
||||
if (page.url().includes('/admin/login')) {
|
||||
console.log('Still on login page after 3 seconds!');
|
||||
// Try to find error message
|
||||
const errorMsg = await page.locator('.login-error-message').textContent().catch(() => null);
|
||||
console.log(`Error message: ${errorMsg}`);
|
||||
}
|
||||
|
||||
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/, { timeout: 20_000 });
|
||||
// WASM 부팅에 시간이 걸릴 수 있으므로 더 긴 타임아웃 사용
|
||||
await expect(page).toHaveURL(/\/admin\/dashboard$/, { timeout: 20_000 });
|
||||
await expect(page.locator('.admin-page-hero')).toBeVisible({ timeout: 60_000 });
|
||||
await expect(page.locator('.admin-page-hero')).toContainText('대시보드');
|
||||
await expect(page.getByRole('link', { name: /로그아웃/ })).toBeVisible({ timeout: 30_000 });
|
||||
|
||||
Reference in New Issue
Block a user