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

const baseUrl = (process.env.E2E_BASE_URL ?? 'https://www.taxbaik.com').replace(/\/$/, '');

test.describe('route isolation', () => {
  test('public home does not boot the admin app', async ({ page }) => {
    await page.goto(baseUrl);
    await expect(page).not.toHaveTitle(/관리자/);
    await expect(page).toHaveTitle(/백원숙 세무회계/);
    await expect(page.getByRole('heading', { name: /상담 과정/ })).toBeVisible();
    await expect(page.getByRole('link', { name: /카카오 상담하기|카카오채널 문의/ })).toBeVisible();
  });

  test('admin login boots the admin app under the admin base path', async ({ page }) => {
    await page.goto(`${baseUrl}/admin/login`);
    await expect(page).toHaveTitle(/관리자 로그인/);
    await expect(page).toHaveURL(/\/admin\/login$/);
    await expect(page.getByRole('heading', { name: /관리자 로그인/ })).toBeVisible();
  });
});
