diff --git a/e2e-tests/.gitignore b/e2e-tests/.gitignore index 8b26a2fa9d..030426df74 100644 --- a/e2e-tests/.gitignore +++ b/e2e-tests/.gitignore @@ -72,4 +72,7 @@ junit-results.xml # auth-providers local runs files **/app-config.test.yaml **/dynamic-plugins.test.yaml -**/rbac.test.csv \ No newline at end of file +**/rbac.test.csv + +# local-run.sh deployment artifacts +.local-test \ No newline at end of file diff --git a/e2e-tests/eslint.config.js b/e2e-tests/eslint.config.js index f4e9cfebaf..962085643a 100644 --- a/e2e-tests/eslint.config.js +++ b/e2e-tests/eslint.config.js @@ -87,7 +87,12 @@ export default [ }, }, { - ignores: ["node_modules/**", "playwright-report/**", "test-results/**"], + ignores: [ + "node_modules/**", + "playwright-report/**", + "test-results/**", + ".local-test/**", + ], }, // Playwright recommended rules for test files { diff --git a/e2e-tests/playwright/e2e/catalog-timestamp.spec.ts b/e2e-tests/playwright/e2e/catalog-timestamp.spec.ts index c70b8c39d0..c23bf310ee 100644 --- a/e2e-tests/playwright/e2e/catalog-timestamp.spec.ts +++ b/e2e-tests/playwright/e2e/catalog-timestamp.spec.ts @@ -2,7 +2,6 @@ import { Page, expect, test } from "@playwright/test"; import { UIhelper } from "../utils/ui-helper"; import { Common, setupBrowser } from "../utils/common"; import { CatalogImport } from "../support/pages/catalog-import"; -import { UI_HELPER_ELEMENTS } from "../support/page-objects/global-obj"; import { getTranslations, getCurrentLanguage, @@ -62,16 +61,35 @@ test.describe("Test timestamp column on Catalog", () => { }); test("Toggle ‘CREATED AT’ to see if the component list can be sorted in ascending/decending order", async () => { - const createdAtFirstRow = - "table > tbody > tr:nth-child(1) > td:nth-child(8)"; - //Verify by default Rows are in ascending - await expect(page.locator(createdAtFirstRow)).toBeEmpty(); - - const column = page - .locator(`${UI_HELPER_ELEMENTS.MuiTableHead}`) - .getByText("Created At", { exact: true }); - await column.dblclick(); // Double click to Toggle into decending order. - await expect(page.locator(createdAtFirstRow)).not.toBeEmpty(); + // Clear search filter from previous test to show all components + const clearButton = page.getByRole("button", { name: "clear search" }); + if (await clearButton.isVisible()) { + await clearButton.click(); + } + + // Wait for the table to have data rows + await expect( + page.getByRole("row").filter({ has: page.getByRole("cell") }), + ).not.toHaveCount(0); + + // Get the first data row’s "Created At" cell using semantic selectors + const firstRow = page + .getByRole("row") + .filter({ has: page.getByRole("cell") }) + .first(); + const createdAtCell = firstRow.getByRole("cell").nth(7); // 0-indexed, 8th column = index 7 + + const column = page.getByRole("columnheader", { + name: "Created At", + exact: true, + }); + + // Click twice to sort descending — newest entries first + await column.click(); + await column.click(); + + // After sorting descending, the first row should have a non-empty "Created At" + await expect(createdAtCell).not.toBeEmpty(); }); test.afterAll(async () => { diff --git a/e2e-tests/playwright/e2e/default-global-header.spec.ts b/e2e-tests/playwright/e2e/default-global-header.spec.ts index 4b7900fc42..3fb05b8295 100644 --- a/e2e-tests/playwright/e2e/default-global-header.spec.ts +++ b/e2e-tests/playwright/e2e/default-global-header.spec.ts @@ -115,16 +115,23 @@ test.describe("Default Global Header", () => { test("Verify Profile Dropdown behaves as expected", async ({ page }) => { await uiHelper.openProfileDropdown(); - await uiHelper.verifyLinkVisible( - t["user-settings"][lang]["settingsLayout.title"], - ); + // Settings is rendered as a menuitem in the profile dropdown, not an link + await expect( + page.getByRole("menuitem", { + // TODO: RHDHBUGS-2552 - Strings not getting translated + // t["plugin.global-header"][lang]["profile.settings"], + name: "Settings", + }), + ).toBeVisible(); await uiHelper.verifyTextVisible( t["plugin.global-header"][lang]["profile.signOut"], ); await page .getByRole("menuitem", { - name: t["user-settings"][lang]["settingsLayout.title"], + // TODO: RHDHBUGS-2552 - Strings not getting translated + // t["plugin.global-header"][lang]["profile.settings"], + name: "Settings", }) .click(); await uiHelper.verifyHeading( diff --git a/e2e-tests/playwright/utils/ui-helper.ts b/e2e-tests/playwright/utils/ui-helper.ts index 327920b841..a8d31062b4 100644 --- a/e2e-tests/playwright/utils/ui-helper.ts +++ b/e2e-tests/playwright/utils/ui-helper.ts @@ -251,11 +251,13 @@ export class UIhelper { async goToSettingsPage() { await expect(this.page.locator("nav[id='global-header']")).toBeVisible(); await this.openProfileDropdown(); - await this.clickLink( - // TODO: RHDHBUGS-2552 - Strings not getting translated - // t["plugin.global-header"][lang]["profile.settings"], - "Settings", - ); + // TODO: RHDHBUGS-2552 - Strings not getting translated + // The profile dropdown renders Settings as a menuitem, not an link + const settingsItem = this.page.getByRole("menuitem", { + name: "Settings", + }); + await expect(settingsItem).toBeVisible(); + await settingsItem.click(); } async goToSelfServicePage() {