File tree Expand file tree Collapse file tree 6 files changed +67
-14
lines changed
compass-e2e-tests/helpers/commands Expand file tree Collapse file tree 6 files changed +67
-14
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,7 @@ async function resetForDisconnect(
48
48
closeToasts ?: boolean ;
49
49
} = { }
50
50
) {
51
- if ( await browser . $ ( Selectors . LGModal ) . isDisplayed ( ) ) {
52
- // close any modals that might be in the way
53
- await browser . clickVisible ( Selectors . LGModalClose ) ;
54
- await browser . $ ( Selectors . LGModal ) . waitForDisplayed ( { reverse : true } ) ;
55
- }
51
+ await browser . hideVisibleModal ( ) ;
56
52
57
53
// Collapse all the connections so that they will all hopefully fit on screen
58
54
// and therefore be rendered.
Original file line number Diff line number Diff line change
1
+ import type { CompassBrowser } from '../compass-browser' ;
2
+ import * as Selectors from '../selectors' ;
3
+
4
+ import Debug from 'debug' ;
5
+
6
+ const debug = Debug ( 'compass-e2e-tests' ) ;
7
+
8
+ export async function hideVisibleModal ( browser : CompassBrowser ) : Promise < void > {
9
+ // If there's some race condition where something else is closing the modal at
10
+ // the same time we're trying to close the modal, then make it error out
11
+ // quickly so it can be ignored and we move on.
12
+
13
+ if ( await browser . $ ( Selectors . LGModal ) . isDisplayed ( ) ) {
14
+ // close any modals that might be in the way
15
+ const waitOptions = { timeout : 2_000 } ;
16
+ try {
17
+ await browser . clickVisible ( Selectors . LGModalClose , waitOptions ) ;
18
+ await browser . $ ( Selectors . LGModal ) . waitForDisplayed ( { reverse : true } ) ;
19
+ } catch ( err ) {
20
+ // if the modal disappears by itself in the meantime, that's fine
21
+ debug ( 'ignoring' , err ) ;
22
+ }
23
+ }
24
+ }
Original file line number Diff line number Diff line change @@ -59,5 +59,6 @@ export * from './create-index';
59
59
export * from './drop-index' ;
60
60
export * from './hide-index' ;
61
61
export * from './unhide-index' ;
62
+ export * from './hide-visible-modal' ;
62
63
export * from './hide-visible-toasts' ;
63
64
export * from './sidebar-collection' ;
Original file line number Diff line number Diff line change @@ -3,11 +3,7 @@ import type { CompassBrowser } from '../compass-browser';
3
3
import * as Selectors from '../selectors' ;
4
4
5
5
async function resetForRemove ( browser : CompassBrowser ) {
6
- if ( await browser . $ ( Selectors . LGModal ) . isDisplayed ( ) ) {
7
- // close any modals that might be in the way
8
- await browser . clickVisible ( Selectors . LGModalClose ) ;
9
- await browser . $ ( Selectors . LGModal ) . waitForDisplayed ( { reverse : true } ) ;
10
- }
6
+ await browser . hideVisibleModal ( ) ;
11
7
12
8
// Collapse all the connections so that they will all hopefully fit on screen
13
9
// and therefore be rendered.
Original file line number Diff line number Diff line change 46
46
"lodash" : " ^4.17.21" ,
47
47
"moment" : " ^2.29.4" ,
48
48
"mongodb-js-cli" : " ^0.0.3" ,
49
- "node-abi" : " ^3.65 .0" ,
49
+ "node-abi" : " ^3.67 .0" ,
50
50
"normalize-package-data" : " ^2.3.5" ,
51
51
"parse-github-repo-url" : " ^1.3.0" ,
52
52
"semver" : " ^7.6.2" ,
You can’t perform that action at this time.
0 commit comments