forked from hiqdev/hipanel-module-stock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPartCreateView.ts
44 lines (33 loc) · 1.44 KB
/
PartCreateView.ts
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
import {expect, Locator, Page} from "@playwright/test";
import Select2 from "@hipanel-core/input/Select2";
import SumWithCurrency from "@hipanel-core/input/SumWithCurrency";
export default class PartCreateView {
private page: Page;
public constructor(page: Page) {
this.page = page;
}
public async navigate() {
await this.page.goto('/stock/part/create');
}
public async fillPartFields(partData: any) {
await Select2.field(this.page, `select[id$=partno]`).setValue(partData.partno);
await Select2.field(this.page, `select[id$=src_id]`).setValue(partData.src_id);
await Select2.field(this.page, `select[id$=dst_ids]`).setValue(partData.dst_id);
await this.page.fill('input[id$=serials]', partData.serials);
await this.page.fill('input[id$=move_descr]', partData.move_descr);
await SumWithCurrency.field(this.page, "part", 0).setSumAndCurrency(partData.price, partData.currency);
await this.page.selectOption('select[id$=company_id]', partData.company_id);
}
public async save() {
await this.page.click('button:has-text("Save")');
}
public async addPart() {
await this.page.click("div.item:last-child button.add-item");
}
public async removePart() {
await this.page.click("div.item:last-child button.remove-item");
}
public async copyPart() {
await this.page.click("div.item:last-child button.copy");
}
}