/** E2E-AUTH-001 — wrong password shows error, stays on login */
import { test, expect } from '@playwright/test'
import { APP, USER } from '../helpers.mjs'

test.use({ storageState: { cookies: [], origins: [] } })

test('E2E-AUTH-001 wrong password shows error', async ({ page }) => {
  await page.goto(`${APP}#/login`)
  await page.getByLabel('用户名').fill(USER)
  await page.getByLabel('密码', { exact: true }).fill('definitely-wrong-password-e2e')
  await page.getByRole('button', { name: '登录' }).click()
  await expect(page).toHaveURL(/#\/login/, { timeout: 15000 })
  await expect(page.getByText(/错误|失败|无效|不正确/).first()).toBeVisible({ timeout: 10000 })
})
