File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33All notable changes to this project will be documented in this file.
44
5- ## [ 2.1.0] - Current
5+ ## [ 2.1.1] - Current
6+
7+ ### Changed
8+
9+ - ** UI Helper clickButton method** : Uses role based locators instead of CSS selectors. As such is now compatible with both MUI and BUI based buttons.
10+
11+ ## [ 2.1.0]
612
713### Added
814
Original file line number Diff line number Diff line change 11{
22 "name" : " @red-hat-developer-hub/e2e-test-utils" ,
3- "version" : " 2.1.0 " ,
3+ "version" : " 2.1.1 " ,
44 "description" : " Test utilities for RHDH E2E tests" ,
55 "license" : " Apache-2.0" ,
66 "repository" : {
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { authenticator } from "otplib";
33import { test , expect } from "@playwright/test" ;
44import type { Browser , Page , TestInfo } from "@playwright/test" ;
55import { SETTINGS_PAGE_COMPONENTS } from "../page-objects/page-obj.js" ;
6- import { UI_HELPER_ELEMENTS } from "../page-objects/global-obj.js" ;
76import * as path from "path" ;
87import * as fs from "fs" ;
98import { DEFAULT_USERS } from "../../deployment/keycloak/constants.js" ;
@@ -215,10 +214,6 @@ export class LoginHelper {
215214 }
216215 }
217216
218- getButtonSelector ( label : string ) : string {
219- return `${ UI_HELPER_ELEMENTS . MuiButtonLabel } :has-text("${ label } ")` ;
220- }
221-
222217 getLoginBtnSelector ( ) : string {
223218 return 'MuiListItem-root li.MuiListItem-root button.MuiButton-root:has(span.MuiButton-label:text("Log in"))' ;
224219 }
Original file line number Diff line number Diff line change @@ -94,17 +94,11 @@ export class UIhelper {
9494 force : false ,
9595 } ,
9696 ) {
97- const selector = `${ UI_HELPER_ELEMENTS . MuiButtonLabel } ` ;
9897 const button = this . page
99- . locator ( selector )
100- . getByText ( label , { exact : options . exact } )
98+ . getByRole ( "button" , { name : label , exact : options . exact } )
10199 . first ( ) ;
100+ await button . click ( { force : options . force } ) ;
102101
103- if ( options ?. force ) {
104- await button . click ( { force : true } ) ;
105- } else {
106- await button . click ( ) ;
107- }
108102 return button ;
109103 }
110104
Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ export const WAIT_OBJECTS = {
44} ;
55
66export const UI_HELPER_ELEMENTS = {
7- MuiButtonLabel :
8- 'span[class^="MuiButton-label"],button[class*="MuiButton-root"]' ,
97 MuiToggleButtonLabel : 'span[class^="MuiToggleButton-label"]' ,
108 MuiBoxLabel : 'div[class*="MuiBox-root"] label' ,
119 MuiTableHead : 'th[class*="MuiTableCell-root"]' ,
You can’t perform that action at this time.
0 commit comments