diff --git a/tests/e2e/dashboard-check.spec.ts b/tests/e2e/dashboard-check.spec.ts index 661c8d9..91b88b3 100644 --- a/tests/e2e/dashboard-check.spec.ts +++ b/tests/e2e/dashboard-check.spec.ts @@ -1,14 +1,13 @@ -import { test } from '@playwright/test'; +import { expect, test } from '@playwright/test'; +import { loginThroughAdminUi } from './helpers/admin-auth'; test('check dashboard metrics', async ({ page }) => { - const baseUrl = 'https://www.taxbaik.com/taxbaik'; + const baseUrl = (process.env.E2E_BASE_URL || 'https://www.taxbaik.com/taxbaik').replace(/\/$/, ''); + const username = process.env.E2E_ADMIN_USERNAME || 'admin'; + const password = process.env.E2E_ADMIN_PASSWORD || 'Admin123!@#456'; - // Login - await page.goto(`${baseUrl}/admin/login`); - await page.fill('input[placeholder="사용자명"]', 'test_admin'); - await page.fill('input[placeholder="비밀번호"]', 'admin123'); - await page.click('button[type="submit"]'); - await page.waitForURL(/admin\/dashboard/); + await loginThroughAdminUi(page, baseUrl, username, password); + await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/); // Wait for page load await page.waitForSelector('.admin-page-hero', { timeout: 5000 });