@@ -24,9 +24,8 @@ export class RancherUI {
2424
2525 // Button
2626 button ( name : string | RegExp ) {
27- return this . page . getByRole ( 'button' , { name, exact : true } ) . or (
28- this . page . locator ( 'a.btn' ) . filter ( { has : this . page . getByText ( name , { exact : true } ) } )
29- )
27+ return this . page . getByRole ( 'button' , { name, exact : true } )
28+ . or ( this . page . locator ( 'a.btn,button' , { has : this . page . getByText ( name , { exact : true } ) } ) )
3029 }
3130
3231 // Labeled Input
@@ -72,6 +71,18 @@ export class RancherUI {
7271 return base . getByRole ( 'combobox' , { name : 'Search for option' } )
7372 }
7473
74+ // Slide-in drawer or old config
75+ async showConfiguration ( ) {
76+ const configBtn = RancherUI . isVersion ( '>=2.12' ) ? 'Show Configuration' : 'Config'
77+ await this . button ( configBtn ) . click ( )
78+ }
79+
80+ // Handling for second "Close" button on policy readme
81+ async hideConfiguration ( ) {
82+ if ( RancherUI . isVersion ( '>=2.12' ) )
83+ await this . button ( / ^ C l o s e .* C o n f i g u r a t i o n d r a w e r $ / ) . last ( ) . click ( )
84+ }
85+
7586 // Select option from (un)labeled Select
7687 async selectOption ( label : string | Locator , option : string | RegExp | number ) {
7788 const select = ( typeof label === 'string' )
@@ -162,8 +173,8 @@ export class RancherUI {
162173 }
163174
164175 /**
165- * Call await ui.retry(async()=> { <code> }, 'Reason')
166- */
176+ * Call await ui.retry(async()=> { <code> }, 'Reason')
177+ */
167178 async retry ( code : ( ) => Promise < void > , message : string , options ?: { reload ?: boolean } ) {
168179 const optReload = options ?. reload || true
169180 try {
0 commit comments