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

test.describe('Frontend', () => {
  test('can go on homepage (default locale redirect)', async ({ page }) => {
    // Root redirects to default locale /de
    const response = await page.goto('/')

    // Check page loaded successfully (status < 400)
    expect(response?.status()).toBeLessThan(400)

    // Wait for page to be interactive
    await page.waitForLoadState('domcontentloaded')
  })

  test('can access German locale page', async ({ page }) => {
    // Should load without error
    const response = await page.goto('/de')
    expect(response?.status()).toBeLessThan(400)

    await page.waitForLoadState('domcontentloaded')
  })

  test('can access English locale page', async ({ page }) => {
    // Should load without error
    const response = await page.goto('/en')
    expect(response?.status()).toBeLessThan(400)

    await page.waitForLoadState('domcontentloaded')
  })
})
