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

test.describe('OMS-ORD-002 주문등록 Golden Screen', () => {
  test('키보드 중심 주문등록: F2 lookup → detail entry → F8 save', async ({ page }) => {
    await page.goto('/oms/orders/new')

    await expect(page.locator('[data-screen-id="OMS-ORD-002"]')).toBeVisible()

    // 거래처 Lookup: real test environment should seed deterministic customer fixture.
    const customerCode = page.getByLabel('코드').first()
    await customerCode.focus()
    await page.keyboard.press('F2')
    await expect(page.getByText('거래처 검색')).toBeVisible()
    await page.keyboard.press('Escape')

    // Header validation is visible without losing entered data.
    await page.keyboard.press('F8')
    await expect(page.getByText(/항목을 확인하세요/)).toBeVisible()
  })
})
