Skip to content

Commit

Permalink
use timeout for wait condition as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit committed Nov 4, 2024
1 parent 86c73ee commit ee2ee6d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/compass-e2e-tests/tests/atlas-cloud/global-writes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 () {
Expand All @@ -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();
Expand Down

0 comments on commit ee2ee6d

Please sign in to comment.