| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- const { test, expect } = require('@playwright/test');
- const BASE_URL = 'https://ajy.danclub.cn';
- const TEST_ADMIN = { username: 'admin', password: 'admin123' };
- test.describe('方案专业模式功效测试', () => {
- 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-040: 专业模式-驱寒功效筛选', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- const effectSelect = page.locator('.el-select').first();
- if (await effectSelect.isVisible()) {
- await effectSelect.click();
- await page.waitForTimeout(300);
- }
- });
- 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('SM-043: 专业模式-补气功效', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-044: 专业模式-养血功效', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-045: 专业模式-活血功效', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-046: 专业模式-安神功效', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-047: 专业模式-理气功效', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- test('SM-050: 自定义模式-选择穴位', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- const addBtn = page.getByRole('button', { name: '新增' });
- if (await addBtn.isVisible()) {
- await addBtn.click();
- await page.waitForTimeout(500);
- }
- });
- 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');
- 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.describe('方案边界与异常', () => {
- 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');
- });
- test('SM-061: 未选择穴位保存', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- 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('SM-062: 删除有用户使用的方案', async ({ page }) => {
- await page.goto(`${BASE_URL}/#/plan`);
- await page.waitForLoadState('networkidle');
- });
- });
|