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:
32
erp-frontend-vue/tests/production-purchase-plan.spec.ts
Normal file
32
erp-frontend-vue/tests/production-purchase-plan.spec.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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, '/production/purchase-plan')
|
||||
await expect(page).toHaveURL(/\/production\/purchase-plan/)
|
||||
await expectBasicList(page)
|
||||
|
||||
const planCodeInput = page.getByPlaceholder(/计划单号|采购计划/).first().catch(() => null)
|
||||
if (planCodeInput) {
|
||||
await planCodeInput.fill('TEST')
|
||||
await page.getByRole('button', { name: /搜索|查询/ }).click()
|
||||
}
|
||||
|
||||
const addBtn = page.getByRole('button', { name: /新增|新建/ }).first()
|
||||
await addBtn.click()
|
||||
await expect(page).toHaveURL(/\/production\/purchase-plan\/(new|edit|form)/)
|
||||
await expect(page.locator('.el-form').first()).toBeVisible()
|
||||
await page.goBack().catch(() => {})
|
||||
|
||||
const exportBtn = page.getByRole('button', { name: /导出/ }).first()
|
||||
if (await exportBtn.isVisible().catch(() => false)) {
|
||||
await exportBtn.click()
|
||||
// 此处主要校验点击不报错
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user