From 8c553691f4780a6e1e6d4daa6ce5ad6cc43ca65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rocha?= Date: Tue, 24 Mar 2026 22:26:34 +0000 Subject: [PATCH 1/2] Fix duplicated resource on current and next page in Auth Resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Authorization Resources table was incorrectly duplicating the last element of the current page as the first element of the next page. This occurred because the fetching logic requests 'max + 1' items to detect if a subsequent page exists. However, the UI was rendering the entire array instead of limiting the display to the 'max' value. Fixed by applying a .slice(0, max) before mapping the resources to table rows. Added a Playwright E2E regression test to ensure unique resource distribution across pages and prevent future regressions. Closes #46088 Signed-off-by: André Rocha --- .../src/clients/authorization/Resources.tsx | 2 +- .../test/clients/authorization.spec.ts | 47 ++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/js/apps/admin-ui/src/clients/authorization/Resources.tsx b/js/apps/admin-ui/src/clients/authorization/Resources.tsx index 22adff39fb1..323591f4c4c 100644 --- a/js/apps/admin-ui/src/clients/authorization/Resources.tsx +++ b/js/apps/admin-ui/src/clients/authorization/Resources.tsx @@ -207,7 +207,7 @@ export const AuthorizationResources = ({ )} - {resources.map((resource, rowIndex) => ( + {resources.slice(0, max).map((resource, rowIndex) => ( { await assertAxeViolations(page); }); }); + +test.describe.serial("Client authorization resources pagination", () => { + const clientId = `client-authz-pagination-${crypto.randomUUID()}`; + + test.beforeAll(async () => { + await adminClient.createClient({ + protocol: "openid-connect", + clientId, + publicClient: false, + authorizationServicesEnabled: true, + serviceAccountsEnabled: true, + standardFlowEnabled: true, + }); + + for (let i = 1; i <= 11; i++) { + await adminClient.createResource(clientId, { + name: `Resource-${i.toString().padStart(2, "0")}`, + displayName: `Display Resource ${i}`, + type: "urn:pagination:test", + }); + } + }); + + test.afterAll(async () => { + await adminClient.deleteClient(clientId); + }); + + test.beforeEach(async ({ page }) => { + await login(page); + await goToClients(page); + await searchItem(page, "Search for client", clientId); + await clickTableRowItem(page, clientId); + await goToAuthorizationTab(page); + await goToResourcesSubTab(page); + }); + + test("Should not duplicate the 10th item on the 2nd page", async ({ page }) => { + await page.waitForSelector('table'); + await expect(page.getByText('Resource-10', { exact: true })).toBeVisible(); + await expect(page.getByText('Resource-11', { exact: true })).not.toBeVisible(); + await page.locator('[aria-label="Go to next page"]').first().click(); + await expect(page.getByText('Resource-11', { exact: true })).toBeVisible(); + await expect(page.getByText('Resource-10', { exact: true })).not.toBeVisible(); + }); +}); From aa1094c77915a35981794f99a3412ecb6b39a177 Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Fri, 17 Apr 2026 14:16:34 +0200 Subject: [PATCH 2/2] fixing linting Signed-off-by: Alexander Schwartz --- .../admin-ui/test/clients/authorization.spec.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/apps/admin-ui/test/clients/authorization.spec.ts b/js/apps/admin-ui/test/clients/authorization.spec.ts index 775266bff97..e6694c0c341 100644 --- a/js/apps/admin-ui/test/clients/authorization.spec.ts +++ b/js/apps/admin-ui/test/clients/authorization.spec.ts @@ -296,12 +296,14 @@ test.describe.serial("Client authorization resources pagination", () => { await goToResourcesSubTab(page); }); - test("Should not duplicate the 10th item on the 2nd page", async ({ page }) => { - await page.waitForSelector('table'); - await expect(page.getByText('Resource-10', { exact: true })).toBeVisible(); - await expect(page.getByText('Resource-11', { exact: true })).not.toBeVisible(); + test("Should not duplicate the 10th item on the 2nd page", async ({ + page, + }) => { + await page.waitForSelector("table"); + await expect(page.getByText("Resource-10", { exact: true })).toBeVisible(); + await expect(page.getByText("Resource-11", { exact: true })).toBeHidden(); await page.locator('[aria-label="Go to next page"]').first().click(); - await expect(page.getByText('Resource-11', { exact: true })).toBeVisible(); - await expect(page.getByText('Resource-10', { exact: true })).not.toBeVisible(); + await expect(page.getByText("Resource-11", { exact: true })).toBeVisible(); + await expect(page.getByText("Resource-10", { exact: true })).toBeHidden(); }); });