Skip to content
Open
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;
32 changes: 31 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.base}?tab=TO_COUNT`);
}

Comment on lines +24 to +27

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That URL with the tab should be placed in the URL files

async isLoaded() {
await expect(this.allProductsTab).toBeVisible();
}
Expand Down Expand Up @@ -64,10 +70,30 @@ class ManageCycleCountPage extends BasePageModel {
}

async searchProduct(productName: string) {
await this.searchInput.fill(productName);
await this.searchInput.click();
await this.page.keyboard.press('ControlOrMeta+A');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment about the 'ControlOrMeta+A'

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 on lines +80 to +96

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what's going on with the negative here?

// ACTIONS
get markAsToCountButton() {
return this.page.getByRole('button', { name: 'Mark as To Count' });
Expand All @@ -76,6 +102,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
Expand Up @@ -14,6 +14,10 @@
row(index: number) {
return new Row(this.page, this.rows.nth(index));
}

rowByBinLocation(binLocationName: string) {
return new Row(this.page, this.rows.filter({ hasText: binLocationName }).first());
}
}

class Row extends BasePageModel {
Expand Down Expand Up @@ -59,6 +63,7 @@
await this.quantityCountedInput.pressSequentially(value, {
delay: 100,
});
await this.page.waitForTimeout(300);

Check warning on line 66 in src/pages/manageCycleCount/components/CountStepTable.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected use of page.waitForTimeout()
Comment thread
kkrawczyk123 marked this conversation as resolved.
await this.page.keyboard.press('Tab');
await expect(this.quantityCountedInput).toHaveValue(value, {
timeout: 2000,
Expand Down
4 changes: 4 additions & 0 deletions src/pages/manageCycleCount/components/RecountStepTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class RecountStepTable extends BasePageModel {
row(index: number) {
return new Row(this.page, this.rows.nth(index));
}

rowByBinLocation(binLocationName: string) {
return new Row(this.page, this.rows.filter({ hasText: binLocationName }).first());
Comment on lines +18 to +19

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have getRowsByBinLocation and then in the test call .first

}
}

class Row extends BasePageModel {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/product/productShow/tabs/InStockTabSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class InStockTabSection extends BasePageModel {
return new Row(this.page, this.rows.nth(index));
}

rowByBinLocation(binLocationName: string) {
return new Row(this.page, this.rows.filter({ hasText: binLocationName }).first());
}

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,
3 changes: 2 additions & 1 deletion src/setup/dataImport/products.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ Id,Active,ProductCode,ProductType,Name,ProductFamily,Category,GLAccount,Descript
,true,5,Default,E2E-product-five,,ARVS,,,,,,,,,,,,,,,,,,,,,
,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,,,,,,,,,,,,,,,,,,,,,

11 changes: 9 additions & 2 deletions src/tests/cycleCount/performCC.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ test.describe('Perform cycle count for item', () => {
confirmToRecountStepPage,
productShowPage,
}) => {
test.setTimeout(120_000);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about what is taking so long to execute


const USER = await mainUserService.getUser();

await test.step('Assert content of inventory menu', async () => {
Expand All @@ -69,8 +71,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