scheme-edge.spec.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. const { test, expect } = require('@playwright/test');
  2. const BASE_URL = 'https://ajy.danclub.cn';
  3. const TEST_ADMIN = { username: 'admin', password: 'admin123' };
  4. test.describe('方案专业模式功效测试', () => {
  5. test.beforeEach(async ({ page }) => {
  6. await page.goto(BASE_URL);
  7. await page.waitForLoadState('networkidle');
  8. await page.getByPlaceholder('请输入用户名').fill(TEST_ADMIN.username);
  9. await page.getByPlaceholder('请输入密码').fill(TEST_ADMIN.password);
  10. await page.getByRole('button', { name: '登 录' }).click();
  11. await page.waitForURL(`${BASE_URL}/#/user/app`, { timeout: 10000 });
  12. });
  13. test('SM-040: 专业模式-驱寒功效筛选', async ({ page }) => {
  14. await page.goto(`${BASE_URL}/#/plan`);
  15. await page.waitForLoadState('networkidle');
  16. const effectSelect = page.locator('.el-select').first();
  17. if (await effectSelect.isVisible()) {
  18. await effectSelect.click();
  19. await page.waitForTimeout(300);
  20. }
  21. });
  22. test('SM-041: 专业模式-祛湿功效', async ({ page }) => {
  23. await page.goto(`${BASE_URL}/#/plan`);
  24. await page.waitForLoadState('networkidle');
  25. });
  26. test('SM-042: 专业模式-清热功效', async ({ page }) => {
  27. await page.goto(`${BASE_URL}/#/plan`);
  28. await page.waitForLoadState('networkidle');
  29. });
  30. test('SM-043: 专业模式-补气功效', async ({ page }) => {
  31. await page.goto(`${BASE_URL}/#/plan`);
  32. await page.waitForLoadState('networkidle');
  33. });
  34. test('SM-044: 专业模式-养血功效', async ({ page }) => {
  35. await page.goto(`${BASE_URL}/#/plan`);
  36. await page.waitForLoadState('networkidle');
  37. });
  38. test('SM-045: 专业模式-活血功效', async ({ page }) => {
  39. await page.goto(`${BASE_URL}/#/plan`);
  40. await page.waitForLoadState('networkidle');
  41. });
  42. test('SM-046: 专业模式-安神功效', async ({ page }) => {
  43. await page.goto(`${BASE_URL}/#/plan`);
  44. await page.waitForLoadState('networkidle');
  45. });
  46. test('SM-047: 专业模式-理气功效', async ({ page }) => {
  47. await page.goto(`${BASE_URL}/#/plan`);
  48. await page.waitForLoadState('networkidle');
  49. });
  50. test('SM-050: 自定义模式-选择穴位', async ({ page }) => {
  51. await page.goto(`${BASE_URL}/#/plan`);
  52. await page.waitForLoadState('networkidle');
  53. const addBtn = page.getByRole('button', { name: '新增' });
  54. if (await addBtn.isVisible()) {
  55. await addBtn.click();
  56. await page.waitForTimeout(500);
  57. }
  58. });
  59. test('SM-051: 自定义模式-保存穴位组合', async ({ page }) => {
  60. await page.goto(`${BASE_URL}/#/plan`);
  61. await page.waitForLoadState('networkidle');
  62. });
  63. test('SM-052: 延年圣手模式-查看专家方案', async ({ page }) => {
  64. await page.goto(`${BASE_URL}/#/plan`);
  65. await page.waitForLoadState('networkidle');
  66. });
  67. test('SM-053: 方案名称重复验证', async ({ page }) => {
  68. await page.goto(`${BASE_URL}/#/plan`);
  69. await page.waitForLoadState('networkidle');
  70. const addBtn = page.getByRole('button', { name: '新增' });
  71. if (await addBtn.isVisible()) {
  72. await addBtn.click();
  73. await page.waitForTimeout(500);
  74. await page.getByRole('button', { name: '保存' }).click();
  75. await page.waitForTimeout(500);
  76. }
  77. });
  78. });
  79. test.describe('方案边界与异常', () => {
  80. test.beforeEach(async ({ page }) => {
  81. await page.goto(BASE_URL);
  82. await page.waitForLoadState('networkidle');
  83. await page.getByPlaceholder('请输入用户名').fill(TEST_ADMIN.username);
  84. await page.getByPlaceholder('请输入密码').fill(TEST_ADMIN.password);
  85. await page.getByRole('button', { name: '登 录' }).click();
  86. await page.waitForURL(`${BASE_URL}/#/user/app`, { timeout: 10000 });
  87. });
  88. test('SM-060: 方案名称超长验证', async ({ page }) => {
  89. await page.goto(`${BASE_URL}/#/plan`);
  90. await page.waitForLoadState('networkidle');
  91. });
  92. test('SM-061: 未选择穴位保存', async ({ page }) => {
  93. await page.goto(`${BASE_URL}/#/plan`);
  94. await page.waitForLoadState('networkidle');
  95. const addBtn = page.getByRole('button', { name: '新增' });
  96. if (await addBtn.isVisible()) {
  97. await addBtn.click();
  98. await page.waitForTimeout(500);
  99. await page.getByRole('button', { name: '保存' }).click();
  100. await page.waitForTimeout(500);
  101. }
  102. });
  103. test('SM-062: 删除有用户使用的方案', async ({ page }) => {
  104. await page.goto(`${BASE_URL}/#/plan`);
  105. await page.waitForLoadState('networkidle');
  106. });
  107. });