consignmentOrder.spec.ts
3.14 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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()=>{
await consignmentPage.createConsignmentOrder(
batchAlias, // 批次别名
'娃娃菜', // 商品名称
'10', // 数量
'1' // 费用金额
);
await consignmentPage.attachScreenshot(testInfo,'代销入库成功截图');
})
// 使用页面对象创建代销入库
// await consignmentPage.createConsignmentOrder(
// batchAlias, // 批次别名
// '娃娃菜', // 商品名称
// '10', // 数量
// '1' // 费用金额
// );
});
// test('新增代销入库 - 简化流程(无费用)', async ({ consignmentPage }) => {
// // 生成唯一批次别名
// const batchAlias = generateOtherName('代卖');
// console.log('生成的批次别名:', batchAlias);
// // 使用简化流程创建代销入库
// await consignmentPage.createSimpleConsignmentOrder(
// batchAlias, // 批次别名
// '娃娃菜' // 商品名称
// );
// // 验证批次创建成功
// await consignmentPage.expectBatchCreated(batchAlias);
// });
// test('新增代销入库 - 分步操作示例', async ({ consignmentPage }) => {
// // 生成唯一批次别名
// const batchAlias = generateOtherName('代卖');
// console.log('生成的批次别名:', batchAlias);
// // 导航到新增页面
// await consignmentPage.navigateToNewConsignment();
// // 选择仓库
// await consignmentPage.selectWarehouse();
// await consignmentPage.selectSecondWarehouse();
// // 输入批次别名
// await consignmentPage.enterBatchAlias(batchAlias);
// // 选择商品并输入数量
// await consignmentPage.selectProductWithQuantity('娃娃菜', '10');
// // 添加费用
// await consignmentPage.addExpense(0, '1');
// await consignmentPage.selectPaymentMethod(0);
// // 点击创建
// await consignmentPage.clickCreate();
// await consignmentPage.waitForCreationComplete();
// // 验证
// await consignmentPage.expectBatchCreated(batchAlias);
// });
});