Commit 275431cd04bc276947c201ab04f8cbe41f6d06e0

Authored by 赵旭婷
1 parent 42894307

采购入库保存,草稿箱编辑付款

pages/purchasePage.ts
@@ -372,11 +372,10 @@ export class PurchasePage extends BasePage { @@ -372,11 +372,10 @@ export class PurchasePage extends BasePage {
372 } 372 }
373 373
374 /** 374 /**
375 - * 点击草稿单中的商品名称进入编辑页  
376 - * @param productName 商品名称 375 + * 点击草稿单列表第一个草稿进入编辑页
377 */ 376 */
378 - async clickDraftProduct(productName: string): Promise<void> {  
379 - await this.page.locator('span').filter({ hasText: productName }).first().click(); 377 + async clickDraftProduct(): Promise<void> {
  378 + await this.page.locator('.draft-card-list > uni-view').first().click();
380 await this.page.waitForLoadState('networkidle', { timeout: 30000 }); 379 await this.page.waitForLoadState('networkidle', { timeout: 30000 });
381 await this.page.waitForTimeout(1000); 380 await this.page.waitForTimeout(1000);
382 } 381 }
tests/purchase.spec.ts
@@ -34,7 +34,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -34,7 +34,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
34 // 步骤2:随机选择商品 34 // 步骤2:随机选择商品
35 await allure.step('随机选择商品', async () => { 35 await allure.step('随机选择商品', async () => {
36 productName = await purchasePage.selectRandomProduct(); 36 productName = await purchasePage.selectRandomProduct();
37 - console.log('商品:', productName); 37 + // console.log('商品:', productName);
38 }); 38 });
39 39
40 // 步骤3:输入数量 40 // 步骤3:输入数量
@@ -55,13 +55,13 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -55,13 +55,13 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
55 // 步骤7:随机选择供应商 55 // 步骤7:随机选择供应商
56 await allure.step('随机选择供应商', async () => { 56 await allure.step('随机选择供应商', async () => {
57 supplierName = await purchasePage.getRandomSupplier(); 57 supplierName = await purchasePage.getRandomSupplier();
58 - console.log('供应商:', supplierName); 58 + // console.log('供应商:', supplierName);
59 }); 59 });
60 60
61 // 步骤8:随机选择仓库 61 // 步骤8:随机选择仓库
62 await allure.step('随机选择仓库', async () => { 62 await allure.step('随机选择仓库', async () => {
63 warehouseName = await purchasePage.getRandomWarehouse(); 63 warehouseName = await purchasePage.getRandomWarehouse();
64 - console.log('仓库:', warehouseName); 64 + // console.log('仓库:', warehouseName);
65 }); 65 });
66 66
67 // 步骤9:存入草稿 67 // 步骤9:存入草稿
@@ -106,7 +106,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -106,7 +106,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
106 // 步骤2:随机选择商品 106 // 步骤2:随机选择商品
107 await allure.step('随机选择商品', async () => { 107 await allure.step('随机选择商品', async () => {
108 productName = await purchasePage.selectRandomProduct(); 108 productName = await purchasePage.selectRandomProduct();
109 - console.log('商品:', productName); 109 + // console.log('商品:', productName);
110 }); 110 });
111 111
112 // 步骤3:输入数量 112 // 步骤3:输入数量
@@ -132,13 +132,13 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -132,13 +132,13 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
132 // 步骤7:随机选择供应商 132 // 步骤7:随机选择供应商
133 await allure.step('随机选择供应商', async () => { 133 await allure.step('随机选择供应商', async () => {
134 supplierName = await purchasePage.getRandomSupplier(); 134 supplierName = await purchasePage.getRandomSupplier();
135 - console.log('供应商:', supplierName); 135 + // console.log('供应商:', supplierName);
136 }); 136 });
137 137
138 // 步骤8:随机选择仓库 138 // 步骤8:随机选择仓库
139 await allure.step('随机选择仓库', async () => { 139 await allure.step('随机选择仓库', async () => {
140 warehouseName = await purchasePage.getRandomWarehouse(); 140 warehouseName = await purchasePage.getRandomWarehouse();
141 - console.log('仓库:', warehouseName); 141 + // console.log('仓库:', warehouseName);
142 }); 142 });
143 143
144 // 步骤9:选择采购员 144 // 步骤9:选择采购员
@@ -148,7 +148,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -148,7 +148,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
148 148
149 // 步骤10:输入车牌号 149 // 步骤10:输入车牌号
150 await allure.step('输入车牌号', async () => { 150 await allure.step('输入车牌号', async () => {
151 - await purchasePage.enterLicensePlate('渝A99999'); 151 + await purchasePage.enterLicensePlate('渝YUNI99');
152 }); 152 });
153 153
154 // 步骤11:输入备注 154 // 步骤11:输入备注
@@ -213,7 +213,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -213,7 +213,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
213 // 步骤2:随机选择商品 213 // 步骤2:随机选择商品
214 await allure.step('随机选择商品', async () => { 214 await allure.step('随机选择商品', async () => {
215 productName = await purchasePage.selectRandomProduct(); 215 productName = await purchasePage.selectRandomProduct();
216 - console.log('商品:', productName); 216 + // console.log('商品:', productName);
217 }); 217 });
218 218
219 // 步骤3:输入数量 219 // 步骤3:输入数量
@@ -234,18 +234,19 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -234,18 +234,19 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
234 // 步骤6:随机选择供应商 234 // 步骤6:随机选择供应商
235 await allure.step('随机选择供应商', async () => { 235 await allure.step('随机选择供应商', async () => {
236 supplierName = await purchasePage.getRandomSupplier(); 236 supplierName = await purchasePage.getRandomSupplier();
237 - console.log('供应商:', supplierName); 237 + // console.log('供应商:', supplierName);
238 }); 238 });
239 239
240 // 步骤7:随机选择仓库 240 // 步骤7:随机选择仓库
241 await allure.step('随机选择仓库', async () => { 241 await allure.step('随机选择仓库', async () => {
242 warehouseName = await purchasePage.getRandomWarehouse(); 242 warehouseName = await purchasePage.getRandomWarehouse();
243 - console.log('仓库:', warehouseName); 243 + // console.log('仓库:', warehouseName);
244 }); 244 });
245 245
246 // 步骤8:存入草稿 246 // 步骤8:存入草稿
247 await allure.step('存入草稿', async () => { 247 await allure.step('存入草稿', async () => {
248 await purchasePage.clickSaveDraft(); 248 await purchasePage.clickSaveDraft();
  249 + await page.waitForTimeout(1000);
249 }); 250 });
250 251
251 // 步骤9:打开草稿单列表 252 // 步骤9:打开草稿单列表
@@ -260,7 +261,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -260,7 +261,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
260 261
261 // 步骤11:点击草稿单商品进入编辑页 262 // 步骤11:点击草稿单商品进入编辑页
262 await allure.step('点击草稿单商品进入编辑页', async () => { 263 await allure.step('点击草稿单商品进入编辑页', async () => {
263 - await purchasePage.clickDraftProduct(productName); 264 + await purchasePage.clickDraftProduct();
264 }); 265 });
265 266
266 // 步骤12:选择采购员 267 // 步骤12:选择采购员
@@ -268,19 +269,39 @@ test.describe(&#39;采购入库&#39;, () =&gt; { @@ -268,19 +269,39 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
268 await purchasePage.selectPurchaser(); 269 await purchasePage.selectPurchaser();
269 }); 270 });
270 271
271 - // 步骤13:点击保存  
272 - await allure.step('点击保存', async () => {  
273 - await purchasePage.clickSave(); 272 + // 步骤13:添加入库费用
  273 + await allure.step('添加入库费用', async () => {
  274 + await purchasePage.addExpense(0, '1');
  275 + });
  276 +
  277 + // 步骤14:点击付款
  278 + await allure.step('点击付款', async () => {
  279 + await purchasePage.clickPay();
  280 + });
  281 +
  282 + // 步骤15:选择结算账户
  283 + await allure.step('选择结算账户', async () => {
  284 + await purchasePage.selectSettlementAccount('微信支付');
274 }); 285 });
275 286
276 - // 步骤14:搜索商品(采购列表自动跳转后) 287 + // 步骤16:确认付款
  288 + await allure.step('确认付款', async () => {
  289 + await purchasePage.confirmPayment();
  290 + });
  291 +
  292 + // 步骤17:进入采购列表
  293 + await allure.step('进入采购列表', async () => {
  294 + await purchasePage.goToPurchaseList();
  295 + });
  296 +
  297 + // 步骤18:搜索商品
277 await allure.step('搜索商品', async () => { 298 await allure.step('搜索商品', async () => {
278 await purchasePage.searchInPurchaseList(productName); 299 await purchasePage.searchInPurchaseList(productName);
279 }); 300 });
280 301
281 - // 步骤15:验证采购单状态为待支付  
282 - await allure.step('验证采购单状态为待支付', async () => {  
283 - await purchasePage.expectPurchaseOrderStatusPending(productName); 302 + // 步骤19:验证采购列表中存在该商品
  303 + await allure.step('验证采购列表中存在该商品', async () => {
  304 + await purchasePage.expectPurchaseListContainsProduct(productName);
284 }); 305 });
285 }); 306 });
286 }); 307 });
287 \ No newline at end of file 308 \ No newline at end of file