import { test, expect } from '@playwright/test' import { login, clickSubMenu, clickMenuItem, expectBasicList } 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/report/need') await expect(page).toHaveURL(/\/production\/report\/need/) }) await test.step('步骤3:检查页面基本布局', async () => { await expectBasicList(page) }) await test.step('步骤4:选择日期范围', async () => { const dateRange = page.getByPlaceholder(/开始日期|结束日期|选择日期范围/).first() if (await dateRange.count() > 0) { await dateRange.click() const todayBtn = page.getByRole('button', { name: /今/ }).first() if (await todayBtn.count() > 0) { await todayBtn.click() } const confirmBtn = page.getByRole('button', { name: /确 定|确定/ }).first() if (await confirmBtn.count() > 0) { await confirmBtn.click() } } }) await test.step('步骤5:点击搜索按钮并检查表格', async () => { const searchBtn = page.getByRole('button', { name: /搜索|查询/ }).first() await searchBtn.click() await expect(page.locator('.el-table').first()).toBeVisible() }) }) })