Skip to content
Merged
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
8 changes: 7 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

All notable changes to this project will be documented in this file.

## [2.1.0] - Current
## [2.1.1] - Current

### Changed

- **UI Helper clickButton method**: Uses role based locators instead of CSS selectors. As such is now compatible with both MUI and BUI based buttons.

## [2.1.0]

### Added

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@red-hat-developer-hub/e2e-test-utils",
"version": "2.1.0",
"version": "2.1.1",
"description": "Test utilities for RHDH E2E tests",
"license": "Apache-2.0",
"repository": {
Expand Down
5 changes: 0 additions & 5 deletions src/playwright/helpers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { authenticator } from "otplib";
import { test, expect } from "@playwright/test";
import type { Browser, Page, TestInfo } from "@playwright/test";
import { SETTINGS_PAGE_COMPONENTS } from "../page-objects/page-obj.js";
import { UI_HELPER_ELEMENTS } from "../page-objects/global-obj.js";
import * as path from "path";
import * as fs from "fs";
import { DEFAULT_USERS } from "../../deployment/keycloak/constants.js";
Expand Down Expand Up @@ -215,10 +214,6 @@ export class LoginHelper {
}
}

getButtonSelector(label: string): string {
return `${UI_HELPER_ELEMENTS.MuiButtonLabel}:has-text("${label}")`;
}

getLoginBtnSelector(): string {
return 'MuiListItem-root li.MuiListItem-root button.MuiButton-root:has(span.MuiButton-label:text("Log in"))';
}
Expand Down
10 changes: 2 additions & 8 deletions src/playwright/helpers/ui-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,11 @@ export class UIhelper {
force: false,
},
) {
const selector = `${UI_HELPER_ELEMENTS.MuiButtonLabel}`;
const button = this.page
.locator(selector)
.getByText(label, { exact: options.exact })
.getByRole("button", { name: label, exact: options.exact })
.first();
await button.click({ force: options.force });

if (options?.force) {
await button.click({ force: true });
} else {
await button.click();
}
return button;
}

Expand Down
2 changes: 0 additions & 2 deletions src/playwright/page-objects/global-obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ export const WAIT_OBJECTS = {
};

export const UI_HELPER_ELEMENTS = {
MuiButtonLabel:
'span[class^="MuiButton-label"],button[class*="MuiButton-root"]',
MuiToggleButtonLabel: 'span[class^="MuiToggleButton-label"]',
MuiBoxLabel: 'div[class*="MuiBox-root"] label',
MuiTableHead: 'th[class*="MuiTableCell-root"]',
Expand Down
Loading