/** E2E-EXEC-002 — execution row expand when data exists (MCP-EXEC-001沉淀) */
import { test, expect } from '../fixtures.mjs'
import { login, nav } from '../helpers.mjs'

test('E2E-EXEC-002 execution detail expand', async ({ page }) => {
  await login(page)
  await nav(page, '/executions')
  await expect(page.getByRole('combobox', { name: '状态筛选' })).toBeVisible({ timeout: 20000 })
  const rows = page.locator('tbody tr')
  const count = await rows.count()
  if (count === 0) {
    await expect(page.getByText('暂无数据')).toBeVisible()
    return
  }
  const expand = rows.first().locator('button').first()
  if (await expand.isVisible()) {
    await expand.click()
    await expect(page.locator('.v-expansion-panel-text, pre, code').first()).toBeVisible({
      timeout: 10000,
    })
  }
})
