Skip to content

Commit f5ee729

Browse files
authored
Merge pull request #65 from openboxes/OBPIH-7533
OBPIH-7533: add create putaway test for shipment with more than 1 item
2 parents 8539d86 + 4942150 commit f5ee729

File tree

8 files changed

+489
-11
lines changed

8 files changed

+489
-11
lines changed

src/components/NewAlertPopup.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Page } from '@playwright/test';
2+
3+
import BasePageModel from '@/pages/BasePageModel';
4+
5+
class NewAlertPopup extends BasePageModel {
6+
constructor(page: Page) {
7+
super(page);
8+
}
9+
10+
get tableDialog() {
11+
return this.page.getByTestId('modal-with-table');
12+
}
13+
14+
get yesButton() {
15+
return this.tableDialog.getByRole('button', { name: 'Yes' });
16+
}
17+
18+
get noButton() {
19+
return this.tableDialog.getByRole('button', { name: 'No' });
20+
}
21+
}
22+
23+
export default NewAlertPopup;

src/pages/putaway/CreatePutawayPage.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,32 @@ class CreatePutawayPage extends BasePageModel {
3030
).toBeVisible();
3131
}
3232

33+
async goToPage() {
34+
await this.page.goto('./putAway/create');
35+
}
36+
3337
get startPutawayButton() {
3438
return this.page.getByTestId('start-putaway').nth(0);
3539
}
40+
41+
get showByStockMovementFilter() {
42+
return this.page.getByTestId('show-by-button');
43+
}
44+
45+
get linesInPendingPutawayFilter() {
46+
return this.page
47+
.locator('#select-id_1 div')
48+
.filter({ hasText: 'Exclude' })
49+
.nth(1);
50+
}
51+
52+
get includeLinesInPendingPutawayFilter() {
53+
return this.page.getByRole('listitem').filter({ hasText: 'Include' });
54+
}
55+
56+
get emptyCreatePageInformation() {
57+
return this.page.locator('.rt-noData').getByText('No rows found');
58+
}
3659
}
3760

3861
export default CreatePutawayPage;

src/pages/putaway/components/CreatePutawayTable.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ class Row extends BasePageModel {
3131
get checkbox() {
3232
return this.row.getByRole('checkbox');
3333
}
34+
35+
getExpandBinLocation(binLocation: string) {
36+
return this.row
37+
.getByTestId('cell-undefined-undefined')
38+
.getByText(binLocation);
39+
}
40+
41+
getProductName(name: string) {
42+
return this.row.getByTestId('table-cell').getByText(name);
43+
}
3444
}
3545

3646
export default CreatePutawayTable;

src/pages/putaway/components/StartPutawayTable.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class Row extends BasePageModel {
5454
.getByRole('listitem')
5555
.getByText(putawayBin, { exact: true });
5656
}
57+
58+
getCurrentBin(currentBin: string) {
59+
return this.row.getByTestId('cell-0-currentBin').getByText(currentBin);
60+
}
5761
}
5862

5963
export default StartPutawayTable;

src/pages/receiving/steps/ReceivingStep.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect, Page } from '@playwright/test';
22

3-
import AlertPopup from '@/components/AlertPopup';
43
import FileHandler from '@/components/FileHandler';
4+
import NewAlertPopup from '@/components/NewAlertPopup';
55
import BasePageModel from '@/pages/BasePageModel';
66
import EditModal from '@/pages/receiving/components/EditModal';
77
import ReceivingTable from '@/pages/receiving/components/ReceivingTable';
@@ -11,14 +11,14 @@ class ReceivingStep extends BasePageModel {
1111

1212
editModal: EditModal;
1313

14-
updateExpiryDatePopup: AlertPopup;
14+
updateExpiryDatePopup: NewAlertPopup;
1515
fileHandler: FileHandler;
1616

1717
constructor(page: Page) {
1818
super(page);
1919
this.table = new ReceivingTable(page);
2020
this.editModal = new EditModal(page);
21-
this.updateExpiryDatePopup = new AlertPopup(page, 'Yes', 'No');
21+
this.updateExpiryDatePopup = new NewAlertPopup(page);
2222
this.fileHandler = new FileHandler(page);
2323
}
2424

src/pages/transactions/TransactionListPage.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Page } from '@playwright/test';
1+
import { expect, Page } from '@playwright/test';
22

33
import BasePageModel from '@/pages/BasePageModel';
44

@@ -14,6 +14,12 @@ class TransactionListPage extends BasePageModel {
1414
get successMessage() {
1515
return this.page.locator('.message');
1616
}
17+
18+
async deleteTransaction(n: number) {
19+
await this.table.row(n).actionsButton.click();
20+
await this.table.deleteButton.click();
21+
await expect(this.page.locator('.message')).toBeVisible();
22+
}
1723
}
1824

1925
export default TransactionListPage;

0 commit comments

Comments
 (0)