feat(erp-frontend-vue): add Playwright E2E tests and update layout

Add Playwright configuration and E2E specs for key production, purchasing, and warehouse flows, and update layout/login to align with the new testing setup.

Made-with: Cursor
This commit is contained in:
panchengyong
2026-03-02 21:44:03 +08:00
parent e45616a09b
commit 283f727857
16 changed files with 3230 additions and 818 deletions

View File

@@ -0,0 +1,33 @@
import { expect, Page } from '@playwright/test'
export const USERNAME = process.env.ERP_USER || 'admin'
export const PASSWORD = process.env.ERP_PASS || 'admin123'
export async function login(page: Page) {
await page.goto('/login')
await page.getByPlaceholder(/用户名|账号/).fill(USERNAME)
await page.getByPlaceholder(/密码/).fill(PASSWORD)
const codeInput = page.getByPlaceholder(/验证码/).first()
if (await codeInput.isVisible().catch(() => false)) {
await codeInput.fill('0000')
}
await page.getByRole('button', { name: /登录|登 录/ }).click()
await expect(page).toHaveURL(/dashboard/)
}
export async function clickSubMenu(page: Page, title: string) {
await page.click(`.el-sub-menu__title:has-text("${title}")`)
}
export async function clickMenuItem(page: Page, path: string) {
await page.click(`.el-menu-item[index="${path}"]`)
}
export async function expectBasicList(page: Page) {
await expect(page.locator('.el-form').first()).toBeVisible()
await expect(page.locator('.el-table').first()).toBeVisible()
}