Skip to content
10 changes: 8 additions & 2 deletions e2e-test-app/e2e/infinite-one2many.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ test.describe("Infinite One2Many Component", () => {

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const firstRowCheckbox = page
.locator(".ag-row")
.first()
.locator('input[type="checkbox"]');

await firstRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);

await expect(firstRowCheckbox).toBeChecked();

Expand All @@ -178,6 +181,9 @@ test.describe("Infinite One2Many Component", () => {

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const rows = page.locator(".ag-row");
const firstRowCheckbox = rows.nth(0).locator('input[type="checkbox"]');
Expand All @@ -187,7 +193,7 @@ test.describe("Infinite One2Many Component", () => {
await firstRowCheckbox.click();
await secondRowCheckbox.click();
await thirdRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);

await expect(firstRowCheckbox).toBeChecked();
await expect(secondRowCheckbox).toBeChecked();
Expand Down
61 changes: 53 additions & 8 deletions e2e-test-app/e2e/infinite-tree-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,17 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const firstRowCheckbox = page
.locator(".ag-row")
.first()
.locator('input[type="checkbox"]');

await firstRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);

await expect(firstRowCheckbox).toBeChecked();

Expand All @@ -189,6 +192,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const rows = page.locator(".ag-row");
const firstRowCheckbox = rows.nth(0).locator('input[type="checkbox"]');
Expand All @@ -198,7 +204,7 @@
await firstRowCheckbox.click();
await secondRowCheckbox.click();
await thirdRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);

await expect(firstRowCheckbox).toBeChecked();
await expect(secondRowCheckbox).toBeChecked();
Expand Down Expand Up @@ -229,6 +235,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const headerCheckbox = page
.locator('.ag-header input[type="checkbox"]')
Expand Down Expand Up @@ -305,6 +314,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const headerCheckbox = page
.locator('.ag-header input[type="checkbox"]')
Expand Down Expand Up @@ -364,14 +376,17 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

// Test 1: Copy single row ID
const firstRowCheckbox = page
.locator(".ag-row")
.first()
.locator('input[type="checkbox"]');
await firstRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);

const copyButton = page.getByRole("button", { name: "Copy", exact: true });
await expect(copyButton).toBeVisible();
Expand Down Expand Up @@ -462,6 +477,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const statusBadges = page.locator(".ag-row .ag-cell .ant-badge");
const badgeCount = await statusBadges.count();
Expand Down Expand Up @@ -499,6 +517,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const statusDots = page.locator(
".ag-row .ag-cell .ant-badge .ant-badge-status-dot",
Expand Down Expand Up @@ -840,6 +861,9 @@
await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-header", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const rows = page.locator(".ag-row");
const rowCount = await rows.count();
Expand Down Expand Up @@ -936,6 +960,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

const totalSalaryElement = page.getByText(/Total.*[Ss]alary/);

Expand All @@ -949,7 +976,8 @@
.first()
.locator('input[type="checkbox"]');
await firstRowCheckbox.click();
await page.waitForTimeout(500);
// Wait longer for aggregate to update (increased from 1000ms to account for debounce + calculation)
await page.waitForTimeout(1500);

// Verify Total Salary equals first row salary
const afterFirstSelection = await totalSalaryElement.textContent();
Expand All @@ -962,7 +990,7 @@
.nth(1)
.locator('input[type="checkbox"]');
await secondRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1500);

// Verify Total Salary increased
const afterSecondSelection = await totalSalaryElement.textContent();
Expand All @@ -977,7 +1005,7 @@
.nth(2)
.locator('input[type="checkbox"]');
await thirdRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1500);

// Verify Total Salary increased again
const afterThirdSelection = await totalSalaryElement.textContent();
Expand All @@ -988,7 +1016,7 @@
await firstRowCheckbox.click();
await secondRowCheckbox.click();
await thirdRowCheckbox.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1500);

// Verify it returns to "-"
const afterDeselection = await totalSalaryElement.textContent();
Expand All @@ -1002,6 +1030,9 @@

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(800);

// Find the three dots menu button using the correct aria-label
const threeDotsMenu = page.getByRole("button", { name: "More options" });
Expand All @@ -1013,7 +1044,7 @@

// Click the three dots menu
await threeDotsMenu.click();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);

// Verify menu options appeared
const pageText = await page.textContent("body");
Expand Down Expand Up @@ -1160,7 +1191,7 @@
const orderAfterReload = await getColumnOrder();

// Verify persistence - the order should be the same as after drag
expect(orderAfterReload).toEqual(orderAfterDrag);

Check failure on line 1194 in e2e-test-app/e2e/infinite-tree-view.spec.ts

View workflow job for this annotation

GitHub Actions / build

[chromium] › e2e/infinite-tree-view.spec.ts:1057:7 › Infinite TreeActionView Component › should persist column order after drag and drop

1) [chromium] › e2e/infinite-tree-view.spec.ts:1057:7 › Infinite TreeActionView Component › should persist column order after drag and drop Error: expect(received).toEqual(expected) // deep equality - Expected - 3 + Received + 3 Array [ + "Name", "Email", - "Name", "Department", "Company", "Position", - "Status", - "Last Login", "Annual Bonus", + "Status", "Computed Rating", + "Last Login", "Salary", ] 1192 | 1193 | // Verify persistence - the order should be the same as after drag > 1194 | expect(orderAfterReload).toEqual(orderAfterDrag); | ^ 1195 | }); 1196 | 1197 | test("should persist column width changes after page reload", async ({ at /home/runner/work/react-ooui/react-ooui/e2e-test-app/e2e/infinite-tree-view.spec.ts:1194:30
});

test("should persist column width changes after page reload", async ({
Expand Down Expand Up @@ -1288,13 +1319,27 @@
test("should reset table view to original state when clicking Reset table view", async ({
page,
}) => {
test.setTimeout(60000); // Increase timeout to 60s for this complex test

await page.goto(
getStoryUrl(E2E_TEST_APP_CONFIG.STORIES.TREE_ACTION_VIEW.INFINITE),
);

await page.waitForSelector(".ag-root", { state: "visible" });
await page.waitForSelector(".ag-header", { state: "visible" });
await page.waitForSelector(".ag-row", { state: "visible" });
// Wait for data to be fully loaded (debounce is 500ms in v1.16.1)
await page.waitForLoadState("networkidle");
await page.waitForTimeout(1000);

// Wait for all columns to be rendered
await page.waitForFunction(
() => {
const headers = document.querySelectorAll(".ag-header-cell-text");
return headers.length >= 9; // Expect at least 9 columns
},
{ timeout: 5000 }
);

const getColumnOrder = async () => {
return await page.locator(".ag-header-cell-text").allTextContents();
Expand Down
12 changes: 8 additions & 4 deletions e2e-test-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/react-ooui",
"version": "2.105.3",
"version": "2.105.4",
"engines": {
"node": "20.5.0"
},
Expand Down Expand Up @@ -43,7 +43,7 @@
"@gisce/fiber-diagram": "2.1.1",
"@gisce/ooui": "2.36.0",
"@gisce/react-formiga-components": "1.18.0",
"@gisce/react-formiga-table": "1.16.0",
"@gisce/react-formiga-table": "1.16.1",
"@monaco-editor/react": "^4.4.5",
"@types/deep-equal": "^1.0.4",
"antd": "5.25.1",
Expand Down
7 changes: 6 additions & 1 deletion src/context/ActionViewContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ type ActionViewProviderProps = {
sorter: any;
setSorter: (sorter: any) => void;
totalItems?: number;
setTotalItems: (totalItems: number) => void;
setTotalItems: (
totalItems:
| number
| undefined
| ((prev: number | undefined) => number | undefined),
) => void;
selectedRowItems?: any[];
setSelectedRowItems: (value: any[] | ((prevValue: any[]) => any[])) => void;
setSearchTreeNameSearch: (searchString?: string) => void;
Expand Down
20 changes: 18 additions & 2 deletions src/hooks/useSearchTreeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export type SearchTreeState = {
searchQuery?: SearchQueryParams;
setSearchQuery: (value: SearchQueryParams) => void;
totalItems: number;
setTotalItems: (value: number) => void;
setTotalItems: (
value:
| number
| undefined
| ((prev: number | undefined) => number | undefined),
) => void;
isActive?: boolean;
order?: ColumnState[];
setOrder: (value: ColumnState[] | undefined) => void;
Expand Down Expand Up @@ -135,7 +140,18 @@ export function useSearchTreeState({
searchQuery: localSearchQuery,
setSearchQuery: setLocalSearchQuery,
totalItems: localTotalItems,
setTotalItems: setLocalTotalItems,
setTotalItems: (value) => {
if (value === undefined) {
setLocalTotalItems(0);
} else if (typeof value === "function") {
setLocalTotalItems((prev) => {
const result = value(prev);
return result ?? 0;
});
} else {
setLocalTotalItems(value);
}
},
isActive: undefined,
order: localOrder,
setOrder: setLocalOrder,
Expand Down
Loading
Loading