import { expect, type Page } from '@playwright/test';

export const Wait = {
  short: 2_000,
  medium: 5_000,
  long: 12_000,
  page: 12_000,
  api: 8_000,
  render: 12_000,
} as const;

export async function waitForAppReady(page: Page) {
  await expect(page.locator('#blazor-loading')).toBeHidden({ timeout: Wait.long });
}

export async function waitForDashboardReady(page: Page) {
  await waitForAppReady(page);
  await page.waitForTimeout(500);
  await expect(page.getByRole('link', { name: '로그아웃' })).toBeVisible({ timeout: Wait.page });
  await expect(page.getByText('세무 운영 콘솔')).toBeVisible({ timeout: Wait.page });
}
