@@ -22,8 +22,22 @@ export class UIhelper {
22
22
await this . page . getByLabel ( label ) . fill ( text ) ;
23
23
}
24
24
25
+ /**
26
+ * Fills the search input with the provided text and waits for at least one
27
+ * search result containing the text to become visible.
28
+ *
29
+ * @param searchText - The text to be entered into the search input field.
30
+ */
25
31
async searchInputPlaceholder ( searchText : string ) {
26
- await this . page . fill ( 'input[placeholder="Search"]' , searchText ) ;
32
+ // Wait for the search input to be visible
33
+ const searchInput = this . page . locator ( 'input[placeholder="Search"]' ) ;
34
+ await expect ( searchInput ) . toBeVisible ( ) ;
35
+
36
+ await searchInput . fill ( searchText ) ;
37
+
38
+ // Wait for at least one search result to become visible
39
+ const resultLocator = this . page . locator ( `text=${ searchText } ` ) ;
40
+ await expect ( resultLocator . first ( ) ) . toBeVisible ( ) ;
27
41
}
28
42
29
43
async filterInputPlaceholder ( searchText : string ) {
@@ -98,7 +112,6 @@ export class UIhelper {
98
112
if ( options ?. notVisible ) {
99
113
await expect ( linkLocator ) . not . toBeVisible ( ) ;
100
114
} else {
101
- await linkLocator . scrollIntoViewIfNeeded ( ) ;
102
115
await expect ( linkLocator ) . toBeVisible ( ) ;
103
116
}
104
117
}
@@ -277,6 +290,16 @@ export class UIhelper {
277
290
return `${ UI_HELPER_ELEMENTS . MuiButtonLabel } :has-text("${ label } ")` ;
278
291
}
279
292
293
+ getLoginBtnSelector ( ) : string {
294
+ return 'MuiListItem-root li.MuiListItem-root button.MuiButton-root:has(span.MuiButton-label:text("Log in"))' ;
295
+ }
296
+
297
+ async waitForLoginBtnDisappear ( ) {
298
+ await this . page . waitForSelector ( await this . getLoginBtnSelector ( ) , {
299
+ state : "detached" ,
300
+ } ) ;
301
+ }
302
+
280
303
async verifyButtonURL ( label : string | RegExp , url : string | RegExp ) {
281
304
const buttonUrl = await this . page
282
305
. getByRole ( "button" , { name : label } )
@@ -494,4 +517,28 @@ export class UIhelper {
494
517
await deleteButton . waitFor ( { state : "attached" } ) ;
495
518
await deleteButton . click ( ) ;
496
519
}
520
+
521
+ /**
522
+ * Verifies the values of the Enabled and Preinstalled columns for a specific row.
523
+ *
524
+ * @param text - Text to locate the specific row (based on the Name column).
525
+ * @param expectedEnabled - Expected value for the Enabled column ("Yes" or "No").
526
+ * @param expectedPreinstalled - Expected value for the Preinstalled column ("Yes" or "No").
527
+ */
528
+ async verifyPluginRow (
529
+ text : string ,
530
+ expectedEnabled : string ,
531
+ expectedPreinstalled : string ,
532
+ ) {
533
+ // Locate the row based on the text in the Name column
534
+ const rowSelector = `tr:has(td:text-is("${ text } "))` ;
535
+ const row = this . page . locator ( rowSelector ) ;
536
+
537
+ // Locate the "Enabled" (3rd column) and "Preinstalled" (4th column) cells by their index
538
+ const enabledColumn = row . locator ( "td" ) . nth ( 2 ) ; // Index 2 for "Enabled"
539
+ const preinstalledColumn = row . locator ( "td" ) . nth ( 3 ) ; // Index 3 for "Preinstalled"
540
+
541
+ await expect ( enabledColumn ) . toHaveText ( expectedEnabled ) ;
542
+ await expect ( preinstalledColumn ) . toHaveText ( expectedPreinstalled ) ;
543
+ }
497
544
}
0 commit comments