const { test, expect } = require('@playwright/test'); const BASE_URL = 'https://ajy.danclub.cn'; const TEST_ADMIN = { username: 'admin', password: 'admin123' }; test.describe('2.1 穴位列表', () => { test.beforeEach(async ({ page }) => { await page.goto(BASE_URL); await page.waitForLoadState('networkidle'); await page.getByPlaceholder('请输入用户名').fill(TEST_ADMIN.username); await page.getByPlaceholder('请输入密码').fill(TEST_ADMIN.password); await page.getByRole('button', { name: '登 录' }).click(); await page.waitForURL(`${BASE_URL}/#/user/app`, { timeout: 10000 }); }); test('AM-001: 查看穴位列表-显示列', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); await expect(page.locator('.el-table__body')).toBeVisible(); }); test('AM-002: 按穴位名称搜索', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); await page.getByPlaceholder('请输入穴位名称').first().fill('大椎'); await page.getByRole('button', { name: '查询' }).click(); await page.waitForTimeout(1000); }); test('AM-003: 按经络筛选', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); test('AM-004: 按定位方式筛选', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); test('AM-005: 按状态筛选', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); }); test.describe('2.2 新增穴位', () => { test.beforeEach(async ({ page }) => { await page.goto(BASE_URL); await page.waitForLoadState('networkidle'); await page.getByPlaceholder('请输入用户名').fill(TEST_ADMIN.username); await page.getByPlaceholder('请输入密码').fill(TEST_ADMIN.password); await page.getByRole('button', { name: '登 录' }).click(); await page.waitForURL(`${BASE_URL}/#/user/app`, { timeout: 10000 }); }); test('AM-010: 新增相对定位穴位-中心', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); const addBtn = page.getByRole('button', { name: '新增' }); if (await addBtn.isVisible()) { await addBtn.click(); await page.waitForTimeout(500); } }); test('AM-011: 新增相对定位穴位-双侧', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); test('AM-012: 新增绝对定位穴位', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); test('AM-013: 穴位名称必填验证', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); const addBtn = page.getByRole('button', { name: '新增' }); if (await addBtn.isVisible()) { await addBtn.click(); await page.waitForTimeout(500); await page.getByRole('button', { name: '确定' }).click(); await page.waitForTimeout(500); } }); test('AM-014: 功效必选验证', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); test('AM-015: 纵向偏移必填验证', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); test('AM-016: 双侧横向偏移必填验证', async ({ page }) => { await page.goto(`${BASE_URL}/#/acupoint`); await page.waitForLoadState('networkidle'); }); }); test.describe('2.3 艾灸手法管理', () => { test.beforeEach(async ({ page }) => { await page.goto(BASE_URL); await page.waitForLoadState('networkidle'); await page.getByPlaceholder('请输入用户名').fill(TEST_ADMIN.username); await page.getByPlaceholder('请输入密码').fill(TEST_ADMIN.password); await page.getByRole('button', { name: '登 录' }).click(); await page.waitForURL(`${BASE_URL}/#/user/app`, { timeout: 10000 }); }); test('AM-020: 查看手法列表', async ({ page }) => { await page.goto(`${BASE_URL}/#/technique`); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); }); test('AM-021: 温度范围验证', async ({ page }) => { await page.goto(`${BASE_URL}/#/technique`); await page.waitForLoadState('networkidle'); }); test('AM-022: 时间范围验证', async ({ page }) => { await page.goto(`${BASE_URL}/#/technique`); await page.waitForLoadState('networkidle'); }); test('AM-023: 禁用手法', async ({ page }) => { await page.goto(`${BASE_URL}/#/technique`); await page.waitForLoadState('networkidle'); }); });