Skip to content
Draft
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
5 changes: 4 additions & 1 deletion e2e-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ junit-results.xml
# auth-providers local runs files
**/app-config.test.yaml
**/dynamic-plugins.test.yaml
**/rbac.test.csv
**/rbac.test.csv

# local-run.sh deployment artifacts
.local-test
7 changes: 6 additions & 1 deletion e2e-tests/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
40 changes: 29 additions & 11 deletions e2e-tests/playwright/e2e/catalog-timestamp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
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,
Expand Down Expand Up @@ -62,16 +61,35 @@
});

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()) {

Check warning on line 66 in e2e-tests/playwright/e2e/catalog-timestamp.spec.ts

View workflow job for this annotation

GitHub Actions / TSC, ESLint and Prettier

Avoid having conditionals in tests
await clearButton.click();
}

Comment on lines +64 to +69
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Filter clear not verified 🐞 Bug ☼ Reliability

catalog-timestamp.spec.ts attempts to clear the previous test’s catalog search via an optional
“clear search” button click but never asserts the filter is actually removed, so the sort test can
run against a single filtered row and stop validating sort behavior reliably. This can yield false
positives or flakiness depending on whether the clear affordance exists/works in that UI variant.
Agent Prompt
### Issue description
`catalog-timestamp.spec.ts` relies on an optional click of a "clear search" control to reset state from the prior test, but never verifies that the search field is actually cleared. If the control is absent or the click doesn’t clear the input (UI variant/accessibility name differences), the sorting test may run with the old filter still applied.

### Issue Context
The previous test sets a search filter via `uiHelper.searchInputPlaceholder(...)`, and the suite reuses the same `page` across tests; `beforeEach` does not clear the field.

### Fix Focus Areas
- e2e-tests/playwright/e2e/catalog-timestamp.spec.ts[48-93]
- e2e-tests/playwright/support/page-objects/page-obj.ts[14-17]

### Suggested change
After attempting to clear, explicitly clear the known search input (using `SEARCH_OBJECTS_COMPONENTS.placeholderSearch`/`ariaLabelSearch`) and assert it is empty (e.g., `await expect(page.locator(SEARCH_OBJECTS_COMPONENTS.placeholderSearch)).toHaveValue('')`) before proceeding to row/sort assertions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

// 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 () => {
Expand Down
15 changes: 11 additions & 4 deletions e2e-tests/playwright/e2e/default-global-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a> 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(
Expand Down
12 changes: 7 additions & 5 deletions e2e-tests/playwright/utils/ui-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a> link
const settingsItem = this.page.getByRole("menuitem", {
name: "Settings",
});
await expect(settingsItem).toBeVisible();
await settingsItem.click();
}

async goToSelfServicePage() {
Expand Down
Loading