Skip to content

Commit e2b4f3a

Browse files
committed
add edit transaction page and components
1 parent f251e26 commit e2b4f3a

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Page } from '@playwright/test';
2+
3+
import BasePageModel from '@/pages/BasePageModel';
4+
import TransactionDetailsHeaderTab from '@/pages/transactions/components/TransactionDetailsHeaderTab';
5+
6+
class EditTransactionPage extends BasePageModel {
7+
transactionDetailsHeaderTab: TransactionDetailsHeaderTab;
8+
9+
constructor(page: Page) {
10+
super(page);
11+
this.transactionDetailsHeaderTab = new TransactionDetailsHeaderTab(page);
12+
}
13+
14+
get saveButton() {
15+
return this.page.getByRole('button', { name: 'Save' });
16+
}
17+
}
18+
19+
export default EditTransactionPage;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { Locator, Page } from '@playwright/test';
2+
3+
import BasePageModel from '@/pages/BasePageModel';
4+
5+
class TransactionDetailsHeaderTab extends BasePageModel {
6+
constructor(page: Page) {
7+
super(page);
8+
}
9+
10+
get section() {
11+
return this.page.locator('#transaction-header');
12+
}
13+
14+
get table() {
15+
return this.section.getByRole('table');
16+
}
17+
18+
get rows() {
19+
return this.table.getByRole('row');
20+
}
21+
22+
row(index: number) {
23+
return new Row(this.page, this.rows.nth(index));
24+
}
25+
}
26+
27+
class Row extends BasePageModel {
28+
row: Locator;
29+
constructor(page: Page, row: Locator) {
30+
super(page);
31+
this.row = row;
32+
}
33+
34+
get transactionDateMinuteSelect() {
35+
return this.row.locator('select[name="transactionDate_minute"]');
36+
}
37+
38+
async decreaseMinute() {
39+
const currentValue = await this.transactionDateMinuteSelect.inputValue();
40+
const current = parseInt(currentValue || '0', 10);
41+
const next = (current - 1 + 60) % 60;
42+
const formatted = String(next).padStart(2, '0');
43+
await this.transactionDateMinuteSelect.selectOption(formatted);
44+
}
45+
}
46+
47+
export default TransactionDetailsHeaderTab;

0 commit comments

Comments
 (0)