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
4 changes: 4 additions & 0 deletions src/components/Navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ class Navbar extends BasePageModel {
get inventory() {
return this.getNavItem('Inventory');
}

get performCycleCount() {
return this.getNavItem('Perform Cycle Count');
}
}

export default Navbar;
1 change: 1 addition & 0 deletions src/constants/applicationUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const INVENTORY_URL = {

const CYCLE_COUNT_URL = {
base: './inventory/cycleCount',
performCycleCount: () => `${CYCLE_COUNT_URL.base}?tab=TO_COUNT`,
};

const INVENTORY_ITEM_URL = {
Expand Down
34 changes: 33 additions & 1 deletion src/pages/manageCycleCount/ManageCycleCountPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ import ToCountTable from '@/pages/manageCycleCount/components/ToCountTable';
class ManageCycleCountPage extends BasePageModel {
allProductsTable: AllProductsTable;
toCountTable: ToCountTable;
toResolveTable: ToCountTable;

constructor(page: Page) {
super(page);
this.allProductsTable = new AllProductsTable(page);
this.toCountTable = new ToCountTable(page);
this.toResolveTable = new ToCountTable(page);
}

async goToPage() {
await this.page.goto(CYCLE_COUNT_URL.base);
}

async goToPerformCycleCount() {
await this.page.goto(CYCLE_COUNT_URL.performCycleCount());
}

Comment thread
kkrawczyk123 marked this conversation as resolved.
async isLoaded() {
await expect(this.allProductsTab).toBeVisible();
}
Expand Down Expand Up @@ -64,10 +70,32 @@ class ManageCycleCountPage extends BasePageModel {
}

async searchProduct(productName: string) {
await this.searchInput.fill(productName);
await this.searchInput.click();
// select any existing text first, so pressSequentially replaces it
// instead of appending to it
await this.page.keyboard.press('ControlOrMeta+A');
Comment thread
kkrawczyk123 marked this conversation as resolved.
await this.searchInput.pressSequentially(productName, { delay: 20 });
await expect(this.searchInput).toHaveValue(productName);
await this.filterButton.click();
}

get negativeQuantityFilterGroup() {
return this.page.locator('.filter-group', {
has: this.page.locator('label[for="negativeQuantity"]'),
});
}

get negativeQuantityCheckbox() {
return this.negativeQuantityFilterGroup.getByRole('checkbox');
}

async openNegativeQuantityTooltip() {
const trigger = this.negativeQuantityFilterGroup.locator('[data-tooltipped]');
await trigger.hover();
const describedBy = await trigger.getAttribute('aria-describedby');
return this.page.locator(`#${describedBy}`);
}

Comment thread
kkrawczyk123 marked this conversation as resolved.
// ACTIONS
get markAsToCountButton() {
return this.page.getByRole('button', { name: 'Mark as To Count' });
Expand All @@ -76,6 +104,10 @@ class ManageCycleCountPage extends BasePageModel {
get startCountButton() {
return this.page.getByRole('button', { name: 'Start Count' });
}

get startResolutionButton() {
return this.page.getByRole('button', { name: 'Start resolution' });
}
}

export default ManageCycleCountPage;
5 changes: 5 additions & 0 deletions src/pages/manageCycleCount/components/CountStepTable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, Locator, Page } from '@playwright/test';

import BasePageModel from '@/pages/BasePageModel';
import { findRowIndexByText } from '@/utils/tableUtils';

class CountStepTable extends BasePageModel {
get table() {
Expand All @@ -14,6 +15,10 @@ class CountStepTable extends BasePageModel {
row(index: number) {
return new Row(this.page, this.rows.nth(index));
}

getRowIndexByBinLocation(binLocationName: string) {
return findRowIndexByText(this.rows, binLocationName);
}
}

class Row extends BasePageModel {
Expand Down
5 changes: 5 additions & 0 deletions src/pages/manageCycleCount/components/RecountStepTable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, Locator, Page } from '@playwright/test';

import BasePageModel from '@/pages/BasePageModel';
import { findRowIndexByText } from '@/utils/tableUtils';

class RecountStepTable extends BasePageModel {
get table() {
Expand All @@ -14,6 +15,10 @@ class RecountStepTable extends BasePageModel {
row(index: number) {
return new Row(this.page, this.rows.nth(index));
}

getRowIndexByBinLocation(binLocationName: string) {
return findRowIndexByText(this.rows, binLocationName);
}
}

class Row extends BasePageModel {
Expand Down
5 changes: 5 additions & 0 deletions src/pages/product/productShow/tabs/InStockTabSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { expect, Locator, Page } from '@playwright/test';
import BasePageModel from '@/pages/BasePageModel';
import EditItemDialog from '@/pages/product/productShow/sections/components/EditItemDialog';
import StockTransferDialog from '@/pages/product/productShow/sections/components/StockTransferDialog';
import { findRowIndexByText } from '@/utils/tableUtils';

class InStockTabSection extends BasePageModel {
stockTransferDialog: StockTransferDialog;
Expand Down Expand Up @@ -32,6 +33,10 @@ class InStockTabSection extends BasePageModel {
return new Row(this.page, this.rows.nth(index));
}

getRowIndexByBinLocation(binLocationName: string) {
return findRowIndexByText(this.rows, binLocationName);
}

get stockTransferButton() {
return this.page.getByRole('link', { name: 'Transfer Stock' });
}
Expand Down
1 change: 1 addition & 0 deletions src/setup/dataImport/cycleCountInventory.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Product code,Product,Lot number,Expiration date,Bin location,Quantity,Comment
7,CC-product-one,,,CC-BIN-1,100,
9,CC-product-three,,,CC-BIN-2,10,
2 changes: 1 addition & 1 deletion src/setup/dataImport/products.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Id,Active,ProductCode,ProductType,Name,ProductFamily,Category,GLAccount,Descript
,true,6,Default,E2E-product-six,,ARVS,,,,,,,,,,,,,,,,,,,,,
,true,7,Default,CC-product-one,,Anesteshia,,,,,,,,,,,,,,,,,,,,,
,true,8,Default,CC-product-two,,Anesteshia,,,,,,,,,,,,,,,,,,,,,

,true,9,Default,CC-product-three,,ARVS,,,,,,,,,,,,,,,,,,,,,

14 changes: 12 additions & 2 deletions src/tests/cycleCount/performCC.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ test.describe('Perform cycle count for item', () => {
confirmToRecountStepPage,
productShowPage,
}) => {
// openAllProductsTab()'s own internal retry can take up to 45s on a slow
// tab load, and the search/filter step has its own 30s retry on top of
// that - comfortably over the default 60s test timeout in the worst case
test.setTimeout(120_000);
Comment thread
kkrawczyk123 marked this conversation as resolved.

const USER = await mainUserService.getUser();

await test.step('Assert content of inventory menu', async () => {
Expand All @@ -69,8 +74,13 @@ test.describe('Perform cycle count for item', () => {

await test.step('Search for product on All Products tab', async () => {
await manageCycleCountPage.openAllProductsTab();
await manageCycleCountPage.searchProduct(productName);
await expect(manageCycleCountPage.allProductsTable.rows).toHaveCount(1);

await expect(async () => {
await manageCycleCountPage.searchProduct(productName);
await expect(manageCycleCountPage.allProductsTable.rows).toHaveCount(
1
);
}).toPass({ timeout: 30_000, intervals: [2000, 3000, 5000] });
});

await test.step('Assert Last Counted date on All Products tab matches stock card', async () => {
Expand Down
Loading
Loading