@@ -41,6 +41,12 @@ const INDEX_DEFINITION = JSON.stringify({
4141 } ,
4242} ) ;
4343
44+ // The current timeout (2mins) is not enough for the search indexes to be created
45+ // and be queryable on Atlas. So we are increasing the timeout to 4mins.
46+ // This can not be more than mocha timeout.
47+ const WAIT_TIMEOUT = 240_000 ;
48+ const MOCHA_TIMEOUT = 360_000 ;
49+
4450function getRandomNumber ( ) {
4551 return Math . floor ( Math . random ( ) * 2 ** 20 ) ;
4652}
@@ -113,8 +119,9 @@ async function dropSearchIndex(browser: CompassBrowser, indexName: string) {
113119 await browser . clickVisible ( Selectors . ConfirmationModalConfirmButton ( ) ) ;
114120 await modal . waitForDisplayed ( { reverse : true } ) ;
115121
116- await browser . waitUntil ( async ( ) => {
117- return await indexRow . waitForExist ( { reverse : true } ) ;
122+ await indexRow . waitForExist ( {
123+ reverse : true ,
124+ timeout : WAIT_TIMEOUT ,
118125 } ) ;
119126}
120127
@@ -125,7 +132,7 @@ async function verifyIndexDetails(
125132) {
126133 const indexRowSelector = Selectors . searchIndexRow ( indexName ) ;
127134 const indexRow = await browser . $ ( indexRowSelector ) ;
128- await indexRow . waitForDisplayed ( ) ;
135+ await indexRow . waitForDisplayed ( { timeout : WAIT_TIMEOUT } ) ;
129136 await browser . hover ( indexRowSelector ) ;
130137 await browser . clickVisible ( Selectors . searchIndexExpandButton ( indexName ) ) ;
131138
@@ -228,6 +235,8 @@ describe('Search Indexes', function () {
228235
229236 for ( const { name, connectionString } of connectionsWithSearchSupport ) {
230237 context ( `supports search indexes in ${ name } ` , function ( ) {
238+ // Set the mocha timeout to 6mins to accomodate the 4mins wait timeout
239+ this . timeout ( MOCHA_TIMEOUT ) ;
231240 before ( function ( ) {
232241 if ( ! connectionString ) {
233242 return this . skip ( ) ;
@@ -303,7 +312,7 @@ describe('Search Indexes', function () {
303312
304313 const indexRowSelector = Selectors . searchIndexRow ( indexName ) ;
305314 const indexRow = await browser . $ ( indexRowSelector ) ;
306- await indexRow . waitForDisplayed ( ) ;
315+ await indexRow . waitForDisplayed ( { timeout : WAIT_TIMEOUT } ) ;
307316
308317 await browser . hover ( indexRowSelector ) ;
309318
0 commit comments