Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/Navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class Navbar extends BasePageModel {
return this.navbar.getByRole('menuitem', { name: name, exact: true });
}

getSectionTitle(name: string) {
return this.navbar
.locator('.subsection-section-title')
.filter({ hasText: name })
.filter({ visible: true });
}

get editProfileButton() {
return this.navbar.getByRole('menuitem', { name: 'Edit Profile' });
}
Expand Down Expand Up @@ -99,6 +106,10 @@ class Navbar extends BasePageModel {
get transactions() {
return this.getNavItem('Transactions');
}

get inventory() {
return this.getNavItem('Inventory');
}
}

export default Navbar;
4 changes: 4 additions & 0 deletions src/pages/putaway/list/PutawayListTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ class Row extends BasePageModel {
get lineItems() {
return this.row.getByTestId('line-items');
}

get generatePdf() {
return this.row.getByTestId('generate-pdf-item');
}
}
export default PutawayListTable;
14 changes: 14 additions & 0 deletions src/tests/putaway/assertPutawayDetailsPage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,19 @@ test.describe('Assert putaway details page', () => {
'Completed'
);
});

await test.step('Download putaway pdf from putaway list', async () => {
const row = putawayListPage.table.row(1);
await row.actionsButton.click();
await row.generatePdf.click();
const generatePutawayPdfFileName =
'Putaway ' + `${putawayOrderIdentifier}`.toString().trim() + '.pdf';
await putawayDetailsPage.generatePutawayListButton.click();
const downloadPromise = page.waitForEvent('download');
const download = await downloadPromise;
await expect(download.suggestedFilename()).toBe(
generatePutawayPdfFileName
);
});
});
});
68 changes: 68 additions & 0 deletions src/tests/putaway/assertPutawayInMenu.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import AppConfig from '@/config/AppConfig';
import { expect, test } from '@/fixtures/fixtures';

test.describe('Assert Putaway exist in menu', () => {
test('Assert menu content without pick and putaway stock added for location', async ({
authService,
page,
navbar,
}) => {
await test.step('Open dashboard', async () => {
await authService.changeLocation(
AppConfig.instance.locations.noPickAndPutawayStockDepot.id
);
await page.goto('./dashboard');
});

await test.step('Assert content of inbound menu in location with pick and putaway stock', async () => {
await navbar.inbound.click();
await expect(navbar.getSectionTitle('Putaways')).toBeHidden();
await expect(navbar.getNavItem('Create Putaway')).toBeHidden();
await expect(navbar.getNavItem('List Putaways')).toBeHidden();
});

await test.step('Assert content of inventory menu in location with pick and putaway stock', async () => {
await navbar.inventory.click();
await expect(
navbar.getSectionTitle('Inventory Transactions')
).toBeVisible();
await expect(navbar.getNavItem('Transfer stock internally')).toBeHidden();
await expect(navbar.getNavItem('Replenish picking bins')).toBeHidden();
await expect(navbar.getNavItem('List Stock Transfers ')).toBeHidden();
});

await test.step('Return to main location', async () => {
await authService.changeLocation(AppConfig.instance.locations.main.id);
});
});

test('Assert menu content when pick and putaway stock added for location', async ({
authService,
page,
navbar,
}) => {
await test.step('Open dashboard', async () => {
await authService.changeLocation(AppConfig.instance.locations.main.id);
await page.goto('./dashboard');
});

await test.step('Assert content of inbound menu in location with pick and putaway stock', async () => {
await navbar.inbound.click();
await expect(navbar.getSectionTitle('Putaways')).toBeVisible();
await expect(navbar.getNavItem('Create Putaway')).toBeVisible();
await expect(navbar.getNavItem('List Putaways')).toBeVisible();
});

await test.step('Assert content of inventory menu in location with pick and putaway stock', async () => {
await navbar.inventory.click();
await expect(
navbar.getSectionTitle('Inventory Transactions')
).toBeVisible();
await expect(
navbar.getNavItem('Transfer stock internally')
).toBeVisible();
await expect(navbar.getNavItem('Replenish picking bins')).toBeVisible();
await expect(navbar.getNavItem('List Stock Transfers ')).toBeVisible();
});
});
});
Loading