92 lines
3.2 KiB
TypeScript
92 lines
3.2 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
||
import { login, clickSubMenu, clickMenuItem, expectBasicList, closeMessageBox } from './utils/erpTestUtils'
|
||
|
||
test.describe('生产计划单页面', () => {
|
||
test('明细视图与单据视图切换 + 查询', async ({ page }) => {
|
||
await test.step('步骤1:登录系统', async () => {
|
||
await login(page)
|
||
})
|
||
|
||
await test.step('步骤2:导航到生产计划单页面', async () => {
|
||
await clickSubMenu(page, '生产计划')
|
||
await clickMenuItem(page, '/production/plan-order')
|
||
await expect(page).toHaveURL(/\/production\/plan-order/)
|
||
})
|
||
|
||
await test.step('步骤3:检查页面基本布局', async () => {
|
||
await expectBasicList(page)
|
||
})
|
||
|
||
await test.step('步骤4:检查明细视图字段', async () => {
|
||
await expect(page.getByText('销售订单号').first()).toBeVisible()
|
||
await expect(page.getByText('物料编码').first()).toBeVisible()
|
||
})
|
||
|
||
await test.step('步骤5:切换到单据视图', async () => {
|
||
const docBtn = page.getByRole('button', { name: '单据' }).first()
|
||
if (await docBtn.count() > 0) {
|
||
await docBtn.click()
|
||
await page.waitForTimeout(300)
|
||
await expect(page.getByText('业务状态').first()).toBeVisible()
|
||
}
|
||
})
|
||
|
||
await test.step('步骤6:执行搜索', async () => {
|
||
const searchBtn = page.getByRole('button', { name: /搜索/ }).first()
|
||
if (await searchBtn.count() > 0) {
|
||
await searchBtn.click()
|
||
}
|
||
})
|
||
})
|
||
|
||
test('新增生产计划单基础表单交互', async ({ page }) => {
|
||
await test.step('步骤1:登录系统并导航到生产计划单页面', async () => {
|
||
await login(page)
|
||
await clickSubMenu(page, '生产计划')
|
||
await clickMenuItem(page, '/production/plan-order')
|
||
await closeMessageBox(page)
|
||
})
|
||
|
||
await test.step('步骤2:点击新增按钮', async () => {
|
||
const addBtn = page.locator('.el-form').first().getByRole('button', { name: /新增/ }).first()
|
||
if (await addBtn.count() > 0) {
|
||
await addBtn.click()
|
||
await page.waitForTimeout(500)
|
||
await closeMessageBox(page)
|
||
}
|
||
})
|
||
|
||
await test.step('步骤3:检查新增页面表单', async () => {
|
||
const form = page.locator('.el-form').first()
|
||
if (await form.count() > 0) {
|
||
await expect(form).toBeVisible()
|
||
}
|
||
})
|
||
})
|
||
|
||
test('物料清单(BOM运算结果)区域交互', async ({ page }) => {
|
||
await test.step('步骤1:登录系统并导航到生产计划单页面', async () => {
|
||
await login(page)
|
||
await clickSubMenu(page, '生产计划')
|
||
await clickMenuItem(page, '/production/plan-order')
|
||
await closeMessageBox(page)
|
||
})
|
||
|
||
await test.step('步骤2:打开一个已存在的计划单', async () => {
|
||
const firstLink = page.locator('.el-table').first().getByRole('link').first()
|
||
if (!(await firstLink.isVisible())) test.skip()
|
||
await firstLink.click()
|
||
await page.waitForTimeout(500)
|
||
await closeMessageBox(page)
|
||
})
|
||
|
||
await test.step('步骤3:检查BOM表格', async () => {
|
||
const mbomTable = page.locator('.el-table').nth(1)
|
||
if (await mbomTable.count() > 0) {
|
||
await expect(mbomTable).toBeVisible()
|
||
}
|
||
})
|
||
})
|
||
})
|
||
|