Files
my-mom-system/erp-frontend-vue/tests/purchasing-checkin.spec.ts
panchengyong 283f727857 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
2026-03-02 21:44:03 +08:00

31 lines
1.2 KiB
TypeScript

import { test, expect } from '@playwright/test'
import { login, clickSubMenu, clickMenuItem, expectBasicList } from './utils/erpTestUtils'
test.describe('采购到货单页面', () => {
test('列表页加载 & 查询 & 查看详情', async ({ page }) => {
await login(page)
await clickSubMenu(page, '采购管理')
await clickMenuItem(page, '/purchasing/checkin')
await expect(page).toHaveURL(/\/purchasing\/checkin/)
await expectBasicList(page)
const supplierInput = page.getByPlaceholder(/供应商/).first().catch(() => null)
if (supplierInput) {
await supplierInput.fill('测试供应商')
await page.getByRole('button', { name: /搜索|查询/ }).click()
}
const firstRow = page.locator('.el-table__row').first()
if (await firstRow.isVisible().catch(() => false)) {
const viewBtn = firstRow.getByRole('button', { name: /查看/ }).first()
if (await viewBtn.isVisible().catch(() => false)) {
await viewBtn.click()
await expect(page.locator('.el-dialog__body')).toBeVisible()
await page.getByRole('button', { name: /关 闭|关闭|取 消/ }).click().catch(() => {})
}
}
})
})