Skip to content

Commit 2162f32

Browse files
test(datagrid-web): enhance pagination tests with visibility checks and updated scrolling logic
1 parent e9a79d8 commit 2162f32

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/pluggableWidgets/datagrid-web/e2e/DataGrid.spec.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,25 @@ test.describe("pagination attribute synchronization", () => {
181181
test("buttons pagination updates page/pageSize/totalCount attributes", async ({ page }) => {
182182
await page.goto("/p/pagination-attributes");
183183
await page.waitForLoadState("networkidle");
184+
await page.locator(".mx-name-dataGrid1").waitFor({ state: "visible" });
184185
const pageInput = page.locator(".mx-name-PageTextBox input");
185186
const sizeInput = page.locator(".mx-name-PageSizeTextBox input");
187+
const totalInput = page.locator(".mx-name-TotalCountTextBox input");
186188

187189
// initial values should be populated
188190
await expect(pageInput).toHaveValue("1");
189191
await expect(sizeInput).toHaveValue("10");
192+
await expect(totalInput).not.toHaveValue("");
190193

191-
// navigate to next page via pagination control (adjust selector to match your layout)
194+
// navigate to next page via pagination control
192195
await page.locator(".mx-name-dataGrid1 .pagination-next").click();
193196
await expect(pageInput).toHaveValue("2");
194197
});
195198

196199
test("virtual scroll pagination updates totalCount and loadedRows attributes", async ({ page }) => {
197200
await page.goto("/p/virtual-scroll-attributes");
198201
await page.waitForLoadState("networkidle");
202+
await expect(page.locator(".mx-name-dataGrid21")).toBeVisible();
199203
const totalInput = page.locator(".mx-name-TotalCountTextBox input");
200204
const loadedInput = page.locator(".mx-name-LoadedRowsTextBox input");
201205

@@ -204,7 +208,10 @@ test.describe("pagination attribute synchronization", () => {
204208
await expect(loadedInput).toHaveValue("0");
205209

206210
// scroll down to trigger loading more rows
207-
await page.locator(".mx-name-dataGrid21").scrollTo(0, 1000);
211+
await page.evaluate(() => {
212+
const el = document.querySelector(".mx-name-dataGrid21");
213+
if (el) el.scrollTop = 1000;
214+
});
208215
await expect(loadedInput).not.toHaveValue("0");
209216
await expect(totalInput).not.toHaveValue("");
210217
});

0 commit comments

Comments
 (0)