import { test, expect } from '@playwright/test';
const base = process.env.E2E_BASE_URL || 'http://127.0.0.1:8000';
test('employee can login and sees attendance screen', async ({ page }) => {
  await page.goto(`${base}/login`);
  await page.getByLabel(/email/i).fill(process.env.E2E_EMPLOYEE_EMAIL || 'employee@softsuite.local');
  await page.getByLabel(/password/i).fill(process.env.E2E_EMPLOYEE_PASSWORD || 'Password@123');
  await page.getByRole('button', { name: /login|sign in/i }).click();
  await page.goto(`${base}/attendance`);
  await expect(page).toHaveURL(/attendance/);
  await expect(page.getByText(/attendance/i).first()).toBeVisible();
});

test('intern cannot open employee portal', async ({ page }) => {
  await page.goto(`${base}/login`);
  await page.getByLabel(/email/i).fill(process.env.E2E_INTERN_EMAIL || 'intern@softsuite.local');
  await page.getByLabel(/password/i).fill(process.env.E2E_INTERN_PASSWORD || 'Password@123');
  await page.getByRole('button', { name: /login|sign in/i }).click();
  const response = await page.goto(`${base}/employee`);
  expect(response.status()).toBe(403);
});
