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

test.describe('KBX production resilience UX', () => {
  test('version conflict does not silently overwrite latest server data', async ({ page }) => {
    await page.goto('/oms/orders/new')
    // Host repository should stub a 409 KbxConflictProblem after editing.
    // Verify KbxConflictResolver shows latest server values and no second mutation occurs automatically.
  })

  test('long-running operation remains visible after route change', async ({ page }) => {
    await page.goto('/oms/orders/import')
    // Start a background import, navigate away, then verify the runtime Operation Center still exposes progress.
  })

  test('degraded mode is visible without blocking unaffected reads', async ({ page }) => {
    await page.goto('/oms/orders')
    // Stub /api/kbx/runtime/notice as degraded and verify the banner is visible while the list remains usable.
    await expect(page.locator('[data-screen-id="OMS-ORD-001"]')).toBeVisible()
  })
})
