Commit 275431cd04bc276947c201ab04f8cbe41f6d06e0

Authored by 赵旭婷
1 parent 42894307

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

pages/purchasePage.ts
... ... @@ -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 379 await this.page.waitForLoadState('networkidle', { timeout: 30000 });
381 380 await this.page.waitForTimeout(1000);
382 381 }
... ...
tests/purchase.spec.ts
... ... @@ -34,7 +34,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
34 34 // 步骤2:随机选择商品
35 35 await allure.step('随机选择商品', async () => {
36 36 productName = await purchasePage.selectRandomProduct();
37   - console.log('商品:', productName);
  37 + // console.log('商品:', productName);
38 38 });
39 39  
40 40 // 步骤3:输入数量
... ... @@ -55,13 +55,13 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
55 55 // 步骤7:随机选择供应商
56 56 await allure.step('随机选择供应商', async () => {
57 57 supplierName = await purchasePage.getRandomSupplier();
58   - console.log('供应商:', supplierName);
  58 + // console.log('供应商:', supplierName);
59 59 });
60 60  
61 61 // 步骤8:随机选择仓库
62 62 await allure.step('随机选择仓库', async () => {
63 63 warehouseName = await purchasePage.getRandomWarehouse();
64   - console.log('仓库:', warehouseName);
  64 + // console.log('仓库:', warehouseName);
65 65 });
66 66  
67 67 // 步骤9:存入草稿
... ... @@ -106,7 +106,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
106 106 // 步骤2:随机选择商品
107 107 await allure.step('随机选择商品', async () => {
108 108 productName = await purchasePage.selectRandomProduct();
109   - console.log('商品:', productName);
  109 + // console.log('商品:', productName);
110 110 });
111 111  
112 112 // 步骤3:输入数量
... ... @@ -132,13 +132,13 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
132 132 // 步骤7:随机选择供应商
133 133 await allure.step('随机选择供应商', async () => {
134 134 supplierName = await purchasePage.getRandomSupplier();
135   - console.log('供应商:', supplierName);
  135 + // console.log('供应商:', supplierName);
136 136 });
137 137  
138 138 // 步骤8:随机选择仓库
139 139 await allure.step('随机选择仓库', async () => {
140 140 warehouseName = await purchasePage.getRandomWarehouse();
141   - console.log('仓库:', warehouseName);
  141 + // console.log('仓库:', warehouseName);
142 142 });
143 143  
144 144 // 步骤9:选择采购员
... ... @@ -148,7 +148,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
148 148  
149 149 // 步骤10:输入车牌号
150 150 await allure.step('输入车牌号', async () => {
151   - await purchasePage.enterLicensePlate('渝A99999');
  151 + await purchasePage.enterLicensePlate('渝YUNI99');
152 152 });
153 153  
154 154 // 步骤11:输入备注
... ... @@ -213,7 +213,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
213 213 // 步骤2:随机选择商品
214 214 await allure.step('随机选择商品', async () => {
215 215 productName = await purchasePage.selectRandomProduct();
216   - console.log('商品:', productName);
  216 + // console.log('商品:', productName);
217 217 });
218 218  
219 219 // 步骤3:输入数量
... ... @@ -234,18 +234,19 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
234 234 // 步骤6:随机选择供应商
235 235 await allure.step('随机选择供应商', async () => {
236 236 supplierName = await purchasePage.getRandomSupplier();
237   - console.log('供应商:', supplierName);
  237 + // console.log('供应商:', supplierName);
238 238 });
239 239  
240 240 // 步骤7:随机选择仓库
241 241 await allure.step('随机选择仓库', async () => {
242 242 warehouseName = await purchasePage.getRandomWarehouse();
243   - console.log('仓库:', warehouseName);
  243 + // console.log('仓库:', warehouseName);
244 244 });
245 245  
246 246 // 步骤8:存入草稿
247 247 await allure.step('存入草稿', async () => {
248 248 await purchasePage.clickSaveDraft();
  249 + await page.waitForTimeout(1000);
249 250 });
250 251  
251 252 // 步骤9:打开草稿单列表
... ... @@ -260,7 +261,7 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
260 261  
261 262 // 步骤11:点击草稿单商品进入编辑页
262 263 await allure.step('点击草稿单商品进入编辑页', async () => {
263   - await purchasePage.clickDraftProduct(productName);
  264 + await purchasePage.clickDraftProduct();
264 265 });
265 266  
266 267 // 步骤12:选择采购员
... ... @@ -268,19 +269,39 @@ test.describe(&#39;采购入库&#39;, () =&gt; {
268 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 298 await allure.step('搜索商品', async () => {
278 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 308 \ No newline at end of file
... ...