From ee2ee6dc3a4b16b442750c1d3944cdb3cdc70dbb Mon Sep 17 00:00:00 2001 From: Basit Chonka Date: Mon, 4 Nov 2024 14:28:11 +0100 Subject: [PATCH] use timeout for wait condition as well --- .../tests/atlas-cloud/global-writes.test.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/compass-e2e-tests/tests/atlas-cloud/global-writes.test.ts b/packages/compass-e2e-tests/tests/atlas-cloud/global-writes.test.ts index ba5543e9942..7e9a29e90cc 100644 --- a/packages/compass-e2e-tests/tests/atlas-cloud/global-writes.test.ts +++ b/packages/compass-e2e-tests/tests/atlas-cloud/global-writes.test.ts @@ -15,6 +15,9 @@ type GeoShardingFormData = { type GeoShardingStatus = 'UNSHARDED' | 'SHARDING' | 'SHARD_KEY_CORRECT'; +const WEBDRIVER_TIMEOUT = 1000 * 60 * 20; +const MOCHA_TIMEOUT = WEBDRIVER_TIMEOUT * 1.2; + async function createGeoShardKey( browser: CompassBrowser, formData: GeoShardingFormData @@ -39,12 +42,15 @@ async function waitForGlobalWritesStatus( browser: CompassBrowser, nextStatus: GeoShardingStatus ) { - await browser.waitUntil(async () => { - const content = await browser.$( - Selectors.GlobalWrites.tabStatus(nextStatus) - ); - return await content.isDisplayed(); - }); + await browser.waitUntil( + async () => { + const content = await browser.$( + Selectors.GlobalWrites.tabStatus(nextStatus) + ); + return await content.isDisplayed(); + }, + { timeout: WEBDRIVER_TIMEOUT } + ); } describe('Global writes', function () { @@ -53,7 +59,7 @@ describe('Global writes', function () { beforeEach(async function () { // Sharding a collection takes a bit longer - this.timeout(1000 * 60 * 20); + this.timeout(MOCHA_TIMEOUT); compass = await init(this.test?.fullTitle()); browser = compass.browser; await browser.setupDefaultConnections();