2026-03-02 21:44:03 +08:00
|
|
|
|
import { test, expect } from '@playwright/test'
|
|
|
|
|
|
import { login, clickSubMenu, clickMenuItem, expectBasicList } from './utils/erpTestUtils'
|
|
|
|
|
|
|
|
|
|
|
|
test.describe('采购订单页面', () => {
|
|
|
|
|
|
test('列表搜索与新增采购订单表单', async ({ page }) => {
|
2026-03-06 02:02:59 +08:00
|
|
|
|
await test.step('步骤1:登录系统', async () => {
|
|
|
|
|
|
await login(page)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
await test.step('步骤2:导航到采购订单页面', async () => {
|
|
|
|
|
|
await clickSubMenu(page, '采购管理')
|
|
|
|
|
|
await clickMenuItem(page, '/purchasing/order')
|
|
|
|
|
|
await expect(page).toHaveURL(/\/purchasing\/order/)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
await test.step('步骤3:检查页面基本布局', async () => {
|
|
|
|
|
|
await expectBasicList(page)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
await test.step('步骤4:输入搜索条件', async () => {
|
|
|
|
|
|
const codeInput = page.getByPlaceholder(/订单编号|采购订单/).first()
|
|
|
|
|
|
if (await codeInput.count() > 0) {
|
|
|
|
|
|
await codeInput.fill('TEST')
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
await test.step('步骤5:执行搜索', async () => {
|
|
|
|
|
|
const searchBtn = page.getByRole('button', { name: /搜索|查询/ }).first()
|
|
|
|
|
|
await searchBtn.click()
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
await test.step('步骤6:点击新增按钮', async () => {
|
|
|
|
|
|
const addBtn = page.getByRole('button', { name: /新增|新建/ }).first()
|
|
|
|
|
|
await addBtn.click()
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
await test.step('步骤7:检查新增页面', async () => {
|
|
|
|
|
|
await expect(page).toHaveURL(/\/purchasing\/order\/(new|edit|form)/)
|
|
|
|
|
|
await expect(page.locator('.el-form').first()).toBeVisible()
|
|
|
|
|
|
await expect(page.locator('.el-table').first()).toBeVisible()
|
|
|
|
|
|
})
|
2026-03-02 21:44:03 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
|