Commit e1ff86661fe3d5c18efd7aae12d44b27b41053e1
1 parent
e066ca9c
feat: add clickSave, clickDraftProduct, expectPurchaseOrderStatusPending to PurchasePage
Showing
1 changed file
with
36 additions
and
2 deletions
pages/purchasePage.ts
| ... | ... | @@ -102,7 +102,10 @@ export class PurchasePage extends BasePage { |
| 102 | 102 | |
| 103 | 103 | // 图片上传 |
| 104 | 104 | readonly uploadImageButton: Locator; |
| 105 | - | |
| 105 | + | |
| 106 | + // 保存 | |
| 107 | + readonly saveButton: Locator; | |
| 108 | + | |
| 106 | 109 | // 付款 |
| 107 | 110 | readonly payButton: Locator; |
| 108 | 111 | readonly settlementAccount: Locator; |
| ... | ... | @@ -155,7 +158,10 @@ export class PurchasePage extends BasePage { |
| 155 | 158 | |
| 156 | 159 | // 图片上传 |
| 157 | 160 | this.uploadImageButton = page.getByText('图片(最多上传9张)'); |
| 158 | - | |
| 161 | + | |
| 162 | + // 保存 | |
| 163 | + this.saveButton = page.getByText('保存', { exact: true }); | |
| 164 | + | |
| 159 | 165 | // 付款 |
| 160 | 166 | this.payButton = page.getByText('付款', { exact: true }); |
| 161 | 167 | this.settlementAccount = page.locator('uni-view').filter({ hasText: /^微信支付$/ }).first(); |
| ... | ... | @@ -357,6 +363,34 @@ export class PurchasePage extends BasePage { |
| 357 | 363 | } |
| 358 | 364 | |
| 359 | 365 | /** |
| 366 | + * 点击保存按钮 | |
| 367 | + */ | |
| 368 | + async clickSave(): Promise<void> { | |
| 369 | + await this.saveButton.click(); | |
| 370 | + await this.page.waitForLoadState('networkidle', { timeout: 30000 }); | |
| 371 | + await this.page.waitForTimeout(2000); | |
| 372 | + } | |
| 373 | + | |
| 374 | + /** | |
| 375 | + * 点击草稿单中的商品名称进入编辑页 | |
| 376 | + * @param productName 商品名称 | |
| 377 | + */ | |
| 378 | + async clickDraftProduct(productName: string): Promise<void> { | |
| 379 | + await this.page.locator('span').filter({ hasText: productName }).first().click(); | |
| 380 | + await this.page.waitForLoadState('networkidle', { timeout: 30000 }); | |
| 381 | + await this.page.waitForTimeout(1000); | |
| 382 | + } | |
| 383 | + | |
| 384 | + /** | |
| 385 | + * 验证采购单状态为待支付 | |
| 386 | + * @param productName 商品名称 | |
| 387 | + */ | |
| 388 | + async expectPurchaseOrderStatusPending(productName: string): Promise<void> { | |
| 389 | + const statusLabel = this.page.getByText('待支付').nth(1); | |
| 390 | + await expect(statusLabel).toBeVisible({ timeout: 10000 }); | |
| 391 | + } | |
| 392 | + | |
| 393 | + /** | |
| 360 | 394 | * 创建采购入库草稿(完整流程) |
| 361 | 395 | * @param productName 商品名称 |
| 362 | 396 | * @param supplierName 供应商名称 | ... | ... |