supplier_delete.spec.ts 1.36 KB
import { test, expect } from '../fixtures';
import * as allure from 'allure-js-commons';

/**
 * 供应商管理测试 - 删除供应商
 */
test.describe('供应商管理-删除', () => {
  // 使用已保存的认证状态
  test.use({ storageState: 'auth.json' });
  
  // 强制测试串行执行
  test.describe.configure({ mode: 'serial' });

  test('删除供应商(金额都为0)', async ({ supplierPage }, testInfo) => {
    // 添加allure元素
    await allure.epic('供应商管理');
    await allure.feature('供应商信息');
    await allure.story('删除供应商');

    // 步骤1:进入供应商管理页面
    await allure.step('进入供应商管理页面', async () => {
      await supplierPage.navigateToSupplierManagement();
    });

    // 步骤2:查找并点击金额都为0的供应商
    await allure.step('查找并点击金额都为0的供应商', async () => {
      const found = await supplierPage.clickSupplierWithZeroAmounts();
      expect(found).toBeTruthy();
    });

    // 步骤3:点击删除按钮
    await allure.step('点击删除按钮', async () => {
      await supplierPage.clickDeleteButton();
    });

    // 步骤4:确认删除
    await allure.step('确认删除', async () => {
      await supplierPage.confirmDelete();
      await supplierPage.attachScreenshot(testInfo, '删除供应商成功截图');
    });
  });
});