Commit e99c0de3601cd944903406e249fe662ee6220625

Authored by 赵旭婷
1 parent 99ac3e2d

feat: add copyCreate, subtotal, storageTemp, clearSearch methods

Showing 1 changed file with 64 additions and 0 deletions
pages/purchasePage.ts
@@ -115,6 +115,15 @@ export class PurchasePage extends BasePage { @@ -115,6 +115,15 @@ export class PurchasePage extends BasePage {
115 readonly purchaseListMenu: Locator; 115 readonly purchaseListMenu: Locator;
116 readonly purchaseSearchInput: Locator; 116 readonly purchaseSearchInput: Locator;
117 117
  118 + // 复制创建
  119 + readonly copyCreateButton: Locator;
  120 +
  121 + // 货款小计
  122 + readonly subtotalField: Locator;
  123 +
  124 + // 存储温度
  125 + readonly storageTemperatureInput: Locator;
  126 +
118 constructor(page: Page) { 127 constructor(page: Page) {
119 super(page); 128 super(page);
120 129
@@ -170,6 +179,15 @@ export class PurchasePage extends BasePage { @@ -170,6 +179,15 @@ export class PurchasePage extends BasePage {
170 // 采购列表 179 // 采购列表
171 this.purchaseListMenu = page.getByText('采购列表'); 180 this.purchaseListMenu = page.getByText('采购列表');
172 this.purchaseSearchInput = page.getByRole('textbox'); 181 this.purchaseSearchInput = page.getByRole('textbox');
  182 +
  183 + // 复制创建
  184 + this.copyCreateButton = page.getByText('复制创建');
  185 +
  186 + // 货款小计
  187 + this.subtotalField = page.locator('uni-view:nth-child(2) > .nut-cell__value > .nut-form-item__body__slots > .nut-input > .nut-input__value > .nut-input__mask');
  188 +
  189 + // 存储温度
  190 + this.storageTemperatureInput = page.locator('uni-view:nth-child(9) > .nut-cell__value > .nut-form-item__body__slots > .nut-input > .nut-input__value > .nut-input__input > .uni-input-wrapper > .uni-input-input');
173 } 191 }
174 192
175 /** 193 /**
@@ -567,6 +585,43 @@ export class PurchasePage extends BasePage { @@ -567,6 +585,43 @@ export class PurchasePage extends BasePage {
567 } 585 }
568 586
569 /** 587 /**
  588 + * 点击复制创建按钮
  589 + */
  590 + async clickCopyCreate(): Promise<void> {
  591 + await this.copyCreateButton.click();
  592 + await this.page.waitForLoadState('networkidle', { timeout: 30000 });
  593 + await this.page.waitForTimeout(1000);
  594 + }
  595 +
  596 + /**
  597 + * 点击货款小计输入框(触发键盘)
  598 + */
  599 + async clickSubtotal(): Promise<void> {
  600 + await this.subtotalField.click();
  601 + await this.page.waitForTimeout(500);
  602 + }
  603 +
  604 + /**
  605 + * 输入货款小计金额(通过数字键盘)
  606 + * @param amount 金额
  607 + */
  608 + async enterSubtotalAmount(amount: string): Promise<void> {
  609 + await this.page.locator(`.number-keyboard uni-view[data-key="${amount}"]`).click();
  610 + await this.page.waitForTimeout(300);
  611 + await this.page.getByText('完成').click();
  612 + await this.page.waitForTimeout(500);
  613 + }
  614 +
  615 + /**
  616 + * 输入存储温度
  617 + * @param value 温度值
  618 + */
  619 + async enterStorageTemperature(value: string): Promise<void> {
  620 + await this.storageTemperatureInput.click();
  621 + await this.storageTemperatureInput.fill(value);
  622 + }
  623 +
  624 + /**
570 * 在采购列表搜索商品 625 * 在采购列表搜索商品
571 * @param productName 商品名称 626 * @param productName 商品名称
572 */ 627 */
@@ -583,6 +638,15 @@ export class PurchasePage extends BasePage { @@ -583,6 +638,15 @@ export class PurchasePage extends BasePage {
583 } 638 }
584 639
585 /** 640 /**
  641 + * 清除采购列表搜索框内容
  642 + */
  643 + async clearSearchInPurchaseList(): Promise<void> {
  644 + const searchInput = this.page.locator('uni-input').filter({ hasText: '供应商/商品名称' }).locator('input[type="text"]');
  645 + await searchInput.clear();
  646 + await this.page.waitForTimeout(500);
  647 + }
  648 +
  649 + /**
586 * 验证采购列表中存在商品 650 * 验证采购列表中存在商品
587 * @param productName 商品名称 651 * @param productName 商品名称
588 */ 652 */