@@ -124,11 +124,21 @@ export class SearchableListsPage extends PageWithNavbarPage {
124124 return ele ;
125125 }
126126
127+ // public async entitySearchEditBtn(i = 0): Promise<WebdriverIO.Element> {
128+ // const ele = await $$('#entitySearchUpdateBtn')[i];
129+ // await ele.waitForDisplayed({timeout: 400});
130+ // await ele.waitForClickable({timeout: 400});
131+ // return ele;
132+ // }
133+
127134 public async entitySearchEditBtn ( i = 0 ) : Promise < WebdriverIO . Element > {
128- const ele = await $$ ( '#entitySearchUpdateBtn' ) [ i ] ;
129- await ele . waitForDisplayed ( { timeout : 400 } ) ;
130- await ele . waitForClickable ( { timeout : 400 } ) ;
131- return ele ;
135+ await browser . pause ( 250 ) ;
136+ await this . openRowMenu ( i ) ;
137+ await browser . pause ( 250 ) ;
138+ const btn = await $ ( `#entitySearchUpdateBtn${ i } ` ) ;
139+ await btn . waitForDisplayed ( { timeout : 5000 } ) ;
140+ await btn . waitForClickable ( { timeout : 5000 } ) ;
141+ return btn ;
132142 }
133143
134144 public async entitySearchEditNameBox ( ) : Promise < WebdriverIO . Element > {
@@ -216,11 +226,12 @@ export class SearchableListsPage extends PageWithNavbarPage {
216226 return ele ;
217227 }
218228
219- public async entitySearchDeleteBtn ( ) : Promise < WebdriverIO . Element > {
220- const ele = await $ ( '#entitySearchDeleteBtn' ) ;
221- await ele . waitForDisplayed ( { timeout : 400 } ) ;
222- await ele . waitForClickable ( { timeout : 400 } ) ;
223- return ele ;
229+ public async entitySearchDeleteBtn ( i = 0 ) : Promise < WebdriverIO . Element > {
230+ // await this.openRowMenu(i);
231+ const btn = await $ ( `#entitySearchDeleteBtn${ i } ` ) ;
232+ await btn . waitForDisplayed ( { timeout : 5000 } ) ;
233+ await btn . waitForClickable ( { timeout : 5000 } ) ;
234+ return btn ;
224235 }
225236
226237 public async entitySearchDeleteDeleteBtn ( ) : Promise < WebdriverIO . Element > {
@@ -449,14 +460,29 @@ export class SearchableListsPage extends PageWithNavbarPage {
449460 }
450461
451462 public async deleteList ( ) {
452- const deleteList = await this . getFirstRowObject ( ) ;
453- if ( deleteList != null ) {
454- await deleteList . deleteBtn . click ( ) ;
455- await ( await this . entitySearchDeleteDeleteBtn ( ) ) . click ( ) ;
456- // browser.refresh();
457- }
463+ const row = await this . getFirstRowObject ( ) ;
464+ if ( ! row ?. index ) return ;
465+
466+ const index = row . index - 1 ;
467+
468+ await $ ( `#action-items${ index } ` ) . scrollIntoView ( ) ;
469+
470+ await browser . pause ( 250 ) ;
471+ await this . openRowMenu ( index ) ;
472+ await browser . pause ( 250 ) ;
473+
474+ const deleteBtn = await this . entitySearchDeleteBtn ( index ) ;
475+ await deleteBtn . waitForClickable ( { timeout : 5000 } ) ;
476+ await deleteBtn . click ( ) ;
477+
478+ const confirm = await this . entitySearchDeleteDeleteBtn ( ) ;
479+ await confirm . waitForClickable ( { timeout : 5000 } ) ;
480+ await confirm . click ( ) ;
481+
482+ await this . waitForSpinnerHide ( ) ;
458483 }
459484
485+
460486 public async editItemName ( newItemName ) {
461487 await ( await this . entitySearchItemEditBtn ( ) ) . click ( ) ;
462488 await ( await this . entitySearchEditItemNameBox ( ) ) . clearValue ( ) ;
@@ -479,18 +505,30 @@ export class SearchableListsPage extends PageWithNavbarPage {
479505 await ( await this . entitySearchItemDeleteBtn ( ) ) . click ( ) ;
480506 }
481507
508+ public async openRowMenu ( i = 0 ) {
509+ const menuBtn = await $ ( `#action-items${ i } #actionMenu` ) ;
510+ await menuBtn . waitForClickable ( { timeout : 1000 } ) ;
511+ await menuBtn . click ( ) ;
512+ await browser . pause ( 200 ) ;
513+ }
514+
482515 public async cleanup ( ) {
483- const deleteObject = await this . getFirstRowObject ( ) ;
484- if ( deleteObject != null ) {
485- await this . waitForSpinnerHide ( ) ;
486- await deleteObject . deleteBtn . click ( ) ;
487-
488- await this . waitForSpinnerHide ( ) ;
489- await ( await this . entitySearchDeleteDeleteBtn ( ) ) . click ( ) ;
490- await this . waitForSpinnerHide ( ) ;
491- // browser.refresh();
492- }
516+ const row = await this . getFirstRowObject ( ) ;
517+ if ( ! row ?. deleteBtn ) return ;
518+
519+ await this . openRowMenu ( row . index - 1 ) ;
520+
521+ await row . deleteBtn . waitForClickable ( { timeout : 5000 } ) ;
522+ await row . deleteBtn . click ( ) ;
523+
524+ const confirm = await this . entitySearchDeleteDeleteBtn ( ) ;
525+ await confirm . waitForClickable ( { timeout : 5000 } ) ;
526+ await confirm . click ( ) ;
527+
528+ await this . waitForSpinnerHide ( ) ;
493529 }
530+
531+
494532}
495533
496534export class SearchableListRowObject {
@@ -510,10 +548,10 @@ export class SearchableListRowObject {
510548 this . name = await ( await $$ ( '#entitySearchName' ) ) [ rowNum - 1 ] . getText ( ) ;
511549 } catch ( e ) { }
512550 try {
513- this . editBtn = ( await $$ ( ' #entitySearchUpdateBtn' ) ) [ rowNum - 1 ] ;
551+ this . editBtn = await $ ( ` #entitySearchUpdateBtn${ rowNum - 1 } ` ) ;
514552 } catch ( e ) { }
515553 try {
516- this . deleteBtn = ( await $$ ( ' #entitySearchDeleteBtn' ) ) [ rowNum - 1 ] ;
554+ this . deleteBtn = await $ ( ` #entitySearchDeleteBtn${ rowNum - 1 } ` ) ;
517555 // console.log('rowNum is ' + rowNum + ' - ' + this.deleteBtn);
518556 } catch ( e ) { }
519557 }
0 commit comments