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
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
||
import { login, clickSubMenu, clickMenuItem, expectBasicList } from './utils/erpTestUtils'
|
||
|
||
test.describe('产品 BOM(EBOM)页面', () => {
|
||
test('明细/单据视图切换与搜索', async ({ page }) => {
|
||
await login(page)
|
||
|
||
await clickSubMenu(page, '研发管理')
|
||
await clickMenuItem(page, '/rd/ebom')
|
||
await expect(page).toHaveURL(/\/rd\/ebom/)
|
||
await expectBasicList(page)
|
||
|
||
// 明细视图:物料分类筛选存在
|
||
await expect(page.getByText('物料分类')).toBeVisible()
|
||
|
||
// 切换到单据视图
|
||
await page.getByRole('button', { name: '单据' }).click()
|
||
await expect(page.getByText('业务状态')).toBeVisible()
|
||
|
||
// 单据视图按单据状态/业务状态查询
|
||
const statusSelect = page.getByLabel('单据状态')
|
||
await statusSelect.click()
|
||
await page.getByRole('option').first().click()
|
||
await page.getByRole('button', { name: /搜索/ }).click()
|
||
})
|
||
|
||
test('新增 BOM 表单基本交互', async ({ page }) => {
|
||
await login(page)
|
||
|
||
await clickSubMenu(page, '研发管理')
|
||
await clickMenuItem(page, '/rd/ebom')
|
||
|
||
await page.getByRole('button', { name: /新增/ }).click()
|
||
await expect(page).toHaveURL(/\/ebom\/(new|edit)/)
|
||
await expect(page.locator('.el-form').first()).toBeVisible()
|
||
|
||
// 母件物料选择弹窗
|
||
const itemSelectBtn = page.getByRole('button', { name: /选择物料|选择/ }).first().catch(() => null)
|
||
if (itemSelectBtn) {
|
||
await itemSelectBtn
|
||
await expect(page.locator('.el-dialog').filter({ hasText: /选择物料/ })).toBeVisible()
|
||
await page.getByRole('button', { name: /关 闭|关闭|取 消/ }).click().catch(() => {})
|
||
}
|
||
|
||
// 明细表格存在
|
||
await expect(page.locator('.el-table').first()).toBeVisible()
|
||
})
|
||
})
|
||
|