Files
my-mom-system/erp-frontend-vue/tests/production-plan-order.spec.ts

92 lines
3.2 KiB
TypeScript
Raw Normal View History

import { test, expect } from '@playwright/test'
2026-03-06 02:02:59 +08:00
import { login, clickSubMenu, clickMenuItem, expectBasicList, closeMessageBox } 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, '/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 }) => {
2026-03-06 02:02:59 +08:00
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 }) => {
2026-03-06 02:02:59 +08:00
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()
}
})
})
})