consignmentOrder.spec.ts
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { test, expect } from '../fixtures';
import { generateOtherName } from '../utils/dataGenerator';
import * as allure from 'allure-js-commons';
/**
* 代销入库测试
*/
test.describe('代销入库', () => {
// 使用已保存的认证状态
test.use({ storageState: 'auth.json' });
test('新增代销入库 - 完整流程', async ({ consignmentPage },testInfo) => {
// 添加allure元素
await allure.epic('代销管理');
await allure.feature('代销入库');
await allure.story('创建代销入库订单');
// 步骤1,生成批次别名
const batchAlias = await allure.step('生成唯一批次别名',async(step)=>{
const alias = generateOtherName('代卖');
console.log('生成的批次别名:', alias);
return alias;
});
// 生成唯一批次别名
// const batchAlias = generateOtherName('代卖');
// console.log('生成的批次别名:', batchAlias);
// 步骤2.执行代销入库(商品名称不传,随机选择有库存的商品)
await allure.step('填写并提交代销入库表单',async()=>{
const selectedProduct = await consignmentPage.createConsignmentOrder(batchAlias, {
quantity: '10', // 数量
amount: '1', // 费用金额
// productName 不传,随机选择
licensePlate: '渝ZY0706', // 车牌号
// imagePath: 'test-data/img/苹果.jpg' // 图片路径
});
console.log('随机选择的商品:', selectedProduct);
await consignmentPage.attachScreenshot(testInfo,'代销入库成功截图');
})
});
});