/** E2E-CMD-002 — push log view time columns (MCP-CMD-001沉淀) */
import { test, expect } from '../fixtures.mjs'
import { ISO_UTC_RE, login, nav } from '../helpers.mjs'

test('E2E-CMD-002 push log times not bare ISO UTC', async ({ page }) => {
  await login(page)
  await nav(page, '/commands')
  await expect(page.locator('main .v-card-title').filter({ hasText: '命令日志' })).toBeVisible({
    timeout: 20000,
  })

  await page.locator('.v-card-title .v-select').first().click()
  await page.locator('.v-overlay-container').getByText('推送日志').click()
  await expect(page.locator('table').first()).toBeVisible()

  const cells = page.locator('table tbody td')
  const count = await cells.count()
  for (let i = 0; i < Math.min(count, 20); i++) {
    const text = await cells.nth(i).innerText()
    if (/\d{4}-\d{2}-\d{2}/.test(text)) {
      expect(text).not.toMatch(ISO_UTC_RE)
    }
  }
})
