| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- const { test, expect } = require('@playwright/test');
- const BASE_URL = 'https://ajy.danclub.cn';
- const TEST_ADMIN = { username: 'admin', password: 'admin123' };
- test.describe('3.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('SM-001: 查看方案列表', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- await expect(page.locator('.el-table__body')).toBeVisible();
- });
- test('SM-002: 创作人显示-一键艾灸', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-003: 创作人显示-专业模式', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-004: 创作人显示-自定义模式', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-005: 创作人显示-延年圣手', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-006: 按方案名称搜索', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- await page.getByPlaceholder('请输入方案名称').first().fill('艾灸');
- await page.getByRole('button', { name: '查询' }).click();
- await page.waitForTimeout(1000);
- });
- test('SM-007: 按模式类型筛选', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-008: 按功效类型筛选', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-009: 按创作人搜索', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-010: 按状态筛选', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- });
- test.describe('3.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('SM-020: 查看方案详情', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- const viewBtn = page.locator('button:has-text("查看")').first();
- if (await viewBtn.isVisible()) {
- await viewBtn.click();
- await page.waitForTimeout(500);
- }
- });
- });
- test.describe('3.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('SM-030: 新增一键艾灸方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: '新增' }).click();
- await page.waitForTimeout(500);
- });
- test('SM-031: 新增专业模式方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: '新增' }).click();
- await page.waitForTimeout(500);
- });
- test('SM-032: 新增自定义模式方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: '新增' }).click();
- await page.waitForTimeout(500);
- });
- test('SM-034: 方案名称必填验证', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: '新增' }).click();
- await page.waitForTimeout(500);
- await page.getByRole('button', { name: '确定' }).click();
- await page.waitForTimeout(500);
- });
- test('SM-035: 功效类型必填验证', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-036: 适用症状必选验证', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-041: 保存为草稿', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-042: 发布方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- });
- test.describe('3.4 编辑方案', () => {
- 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('SM-050: 编辑草稿方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-051: 编辑已发布方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-052: 添加治疗步骤', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-053: 删除治疗步骤', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-054: 至少保留1个步骤', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- });
- test.describe('3.5 方案状态操作', () => {
- 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('SM-060: 下架方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- const downBtn = page.locator('button:has-text("下架")').first();
- if (await downBtn.isVisible()) {
- await downBtn.click();
- await page.waitForTimeout(500);
- }
- });
- test('SM-061: 批量发布草稿', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-062: 批量下架', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-063: 批量删除草稿', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- });
|