Skip to content

Commit ae52071

Browse files
authored
Merge pull request #73 from openboxes/OBPIH-7534
OBPIH-7534 Putaway when preferred bin assigned to inventory level
2 parents abc6b8e + 57144be commit ae52071

9 files changed

Lines changed: 450 additions & 6 deletions

File tree

src/fixtures/fixtures.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import StockMovementService from '@/api/StockMovementService';
88
import ImpersonateBanner from '@/components/ImpersonateBanner';
99
import LocationChooser from '@/components/LocationChooser';
1010
import Navbar from '@/components/Navbar';
11-
import AppConfig, {
12-
LOCATION_KEY,
13-
USER_KEY,
14-
} from '@/config/AppConfig';
11+
import AppConfig, { LOCATION_KEY, USER_KEY } from '@/config/AppConfig';
1512
import CreateInbound from '@/pages/inbound/create/CreateInboundPage';
1613
import InboundListPage from '@/pages/inbound/list/InboundListPage';
1714
import CreateInvoicePage from '@/pages/invoice/CreateInvoicePage';
@@ -28,6 +25,7 @@ import OrganizationListPage from '@/pages/oranization/OrganizationListPage';
2825
import CreatePersonPage from '@/pages/people/CreatePersonPage';
2926
import PersonsListPage from '@/pages/people/PersonsListPage';
3027
import CreateProductPage from '@/pages/product/CreateProductPage';
28+
import ProductEditPage from '@/pages/product/productEdit/ProductEditPage';
3129
import ProductShowPage from '@/pages/product/productShow/ProductShowPage';
3230
import CreatePutawayPage from '@/pages/putaway/CreatePutawayPage';
3331
import PutawayListPage from '@/pages/putaway/list/PutawayListPage';
@@ -72,6 +70,7 @@ type Fixtures = {
7270
transactionListPage: TransactionListPage;
7371
oldViewShipmentPage: OldViewShipmentPage;
7472
putawayListPage: PutawayListPage;
73+
productEditPage: ProductEditPage;
7574
// COMPONENTS
7675
navbar: Navbar;
7776
locationChooser: LocationChooser;
@@ -145,6 +144,7 @@ export const test = baseTest.extend<Fixtures>({
145144
oldViewShipmentPage: async ({ page }, use) =>
146145
use(new OldViewShipmentPage(page)),
147146
putawayListPage: async ({ page }, use) => use(new PutawayListPage(page)),
147+
productEditPage: async ({ page }, use) => use(new ProductEditPage(page)),
148148
// COMPONENTS
149149
navbar: async ({ page }, use) => use(new Navbar(page)),
150150
locationChooser: async ({ page }, use) => use(new LocationChooser(page)),
@@ -179,8 +179,7 @@ export const test = baseTest.extend<Fixtures>({
179179
internalLocation2Service: async ({ page }, use) =>
180180
use(new LocationData(LOCATION_KEY.BIN_LOCATION2, page.request)),
181181
// PRODUCTS
182-
productService: async ({ page }, use) =>
183-
use(new ProductData(page.request)),
182+
productService: async ({ page }, use) => use(new ProductData(page.request)),
184183
// USERS
185184
mainUserService: async ({ page }, use) =>
186185
use(new UserData(USER_KEY.MAIN, page.request)),
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Page } from '@playwright/test';
2+
3+
import BasePageModel from '@/pages/BasePageModel';
4+
import InventoryLevelsTabSection from '@/pages/product/productEdit/tabs/InventoryLevelsTabSection';
5+
6+
class ProductEditPage extends BasePageModel {
7+
inventoryLevelsTabSection: InventoryLevelsTabSection;
8+
9+
constructor(page: Page) {
10+
super(page);
11+
this.inventoryLevelsTabSection = new InventoryLevelsTabSection(page);
12+
}
13+
14+
async goToPage(id: string) {
15+
await this.page.goto(`./product/edit/${id}`);
16+
}
17+
18+
get detailskTab() {
19+
return this.page.getByRole('link', { name: 'Details' });
20+
}
21+
22+
get inventoryLevelsTab() {
23+
return this.page.getByRole('link', { name: 'Inventory Levels' });
24+
}
25+
}
26+
27+
export default ProductEditPage;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Page } from '@playwright/test';
2+
3+
import BasePageModel from '@/pages/BasePageModel';
4+
5+
class CreateStockLevelModal extends BasePageModel {
6+
constructor(page: Page) {
7+
super(page);
8+
}
9+
10+
get modal() {
11+
return this.page.getByRole('dialog');
12+
}
13+
14+
get receivingTab() {
15+
return this.page.getByRole('link', { name: 'Receiving' });
16+
}
17+
18+
get defaultPutawayLocation() {
19+
return this.modal.locator(
20+
'select[name="preferredBinLocation"] + .chosen-container'
21+
);
22+
}
23+
24+
getDefaultPutawayLocation(putawayLocation: string) {
25+
return this.defaultPutawayLocation
26+
.locator('.chosen-results')
27+
.getByRole('listitem')
28+
.getByText(putawayLocation, { exact: true });
29+
}
30+
31+
get createButton() {
32+
return this.modal.getByRole('button', { name: 'Create' });
33+
}
34+
35+
get deleteInventoryLevelButton() {
36+
return this.modal.getByRole('link', { name: 'Delete' });
37+
}
38+
39+
async clickDeleteInventoryLevel() {
40+
this.page.once('dialog', (dialog) => dialog.accept());
41+
await this.deleteInventoryLevelButton.click();
42+
}
43+
}
44+
45+
export default CreateStockLevelModal;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Locator, Page } from '@playwright/test';
2+
3+
import BasePageModel from '@/pages/BasePageModel';
4+
import CreateStockLevelModal from '@/pages/product/productEdit/components/createStockLevelModal';
5+
6+
class InventoryLevelsTabSection extends BasePageModel {
7+
createStockLevelModal: CreateStockLevelModal;
8+
9+
constructor(page: Page) {
10+
super(page);
11+
this.createStockLevelModal = new CreateStockLevelModal(page);
12+
}
13+
14+
get createStockLevelButton() {
15+
return this.page.getByRole('link', { name: 'Create stock level' });
16+
}
17+
18+
get table() {
19+
return this.page.locator('#ui-tabs-3').getByRole('table');
20+
}
21+
22+
get rows() {
23+
return this.table.getByRole('row');
24+
}
25+
26+
row(index: number) {
27+
return new Row(this.page, this.rows.nth(index));
28+
}
29+
}
30+
31+
class Row extends BasePageModel {
32+
row: Locator;
33+
constructor(page: Page, row: Locator) {
34+
super(page);
35+
this.row = row;
36+
}
37+
38+
get editInventoryLevelButton() {
39+
return this.row
40+
.getByRole('cell')
41+
.locator('a.btn-show-dialog', { hasText: 'Edit' });
42+
}
43+
}
44+
45+
export default InventoryLevelsTabSection;

src/pages/product/productShow/ProductShowPage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ class ProductShowPage extends BasePageModel {
3434
get stockHistoryTab() {
3535
return this.page.getByRole('link', { name: 'Stock History' });
3636
}
37+
38+
get editProductkButton() {
39+
return this.page.getByRole('link', { name: 'Edit Product' });
40+
}
3741
}
3842

3943
export default ProductShowPage;

src/pages/product/productShow/tabs/InStockTabSection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ class Row extends BasePageModel {
4444
.getByRole('link');
4545
}
4646

47+
get defaultBinLocation() {
48+
return this.row.locator('.line').getByText('Default');
49+
}
50+
4751
get zoneLocation() {
4852
return this.row.locator('.line').locator('.line-base').getByRole('link');
4953
}

src/pages/putaway/components/StartPutawayTable.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class Row extends BasePageModel {
5959
return this.row.getByTestId('cell-0-currentBin').getByText(currentBin);
6060
}
6161

62+
getPreferredBin(rowIndex: number) {
63+
return this.row.getByTestId(`cell-${rowIndex}-preferredBin`);
64+
}
65+
6266
get quantityField() {
6367
return this.row.getByTestId('cell-0-quantity').getByRole('spinbutton');
6468
}

src/pages/putaway/steps/CompleteStep.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ class CompleteStep extends BasePageModel {
1919
get completePutawayButton() {
2020
return this.page.getByTestId('complete-putaway-button').nth(1);
2121
}
22+
23+
get confirmPutawayDialog() {
24+
return this.page.locator('.react-confirm-alert');
25+
}
26+
27+
get yesButtonOnConfirmPutawayDialog() {
28+
return this.confirmPutawayDialog.getByRole('button', { name: 'Yes' });
29+
}
30+
31+
get noButtonOnConfirmPutawayDialog() {
32+
return this.confirmPutawayDialog.getByRole('button', { name: 'No' });
33+
}
2234
}
2335

2436
export default CompleteStep;

0 commit comments

Comments
 (0)