Files
my-mom-system/erp-frontend-vue/tests/purchasing-checkin.spec.ts

31 lines
1.2 KiB
TypeScript
Raw Normal View History

import { test, expect } from '@playwright/test'
import { login, clickSubMenu, clickMenuItem, expectBasicList } from './utils/erpTestUtils'
test.describe('采购到货单页面', () => {
test('列表页加载 & 查询 & 查看详情', async ({ page }) => {
await login(page)
await clickSubMenu(page, '采购管理')
await clickMenuItem(page, '/purchasing/checkin')
await expect(page).toHaveURL(/\/purchasing\/checkin/)
await expectBasicList(page)
const supplierInput = page.getByPlaceholder(/供应商/).first().catch(() => null)
if (supplierInput) {
await supplierInput.fill('测试供应商')
await page.getByRole('button', { name: /搜索|查询/ }).click()
}
const firstRow = page.locator('.el-table__row').first()
if (await firstRow.isVisible().catch(() => false)) {
const viewBtn = firstRow.getByRole('button', { name: /查看/ }).first()
if (await viewBtn.isVisible().catch(() => false)) {
await viewBtn.click()
await expect(page.locator('.el-dialog__body')).toBeVisible()
await page.getByRole('button', { name: /关 闭|关闭|取 消/ }).click().catch(() => {})
}
}
})
})