Skip to content

Commit 710ac3c

Browse files
committed
Assistant tests: Add option to useExplainPlanEntryPoint to avoid waiting for messages
1 parent f248792 commit 710ac3c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/compass-e2e-tests/tests/assistant.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ describe('MongoDB Assistant', function () {
258258
});
259259

260260
it('should display opt-in modal for explain plan entry point', async function () {
261-
await useExplainPlanEntryPoint(browser);
261+
await useExplainPlanEntryPoint(browser, { waitForMessages: false });
262262

263263
const optInModal = browser.$(Selectors.AIOptInModal);
264264
await optInModal.waitForDisplayed();
@@ -268,7 +268,9 @@ describe('MongoDB Assistant', function () {
268268

269269
await optInModal.waitForDisplayed({ reverse: true });
270270

271-
expect(await getDisplayedMessages(browser)).to.deep.equal([]);
271+
expect(
272+
await browser.$(Selectors.AssistantChatMessages).isDisplayed()
273+
).to.equal(false);
272274
});
273275
});
274276
});
@@ -601,7 +603,10 @@ async function waitForMessages(
601603
}
602604
}
603605

604-
async function useExplainPlanEntryPoint(browser: CompassBrowser) {
606+
async function useExplainPlanEntryPoint(
607+
browser: CompassBrowser,
608+
{ waitForMessages = true } = {}
609+
) {
605610
await browser.clickVisible(Selectors.AggregationExplainButton);
606611

607612
await browser.clickVisible(Selectors.ExplainPlanInterpretButton);
@@ -610,5 +615,7 @@ async function useExplainPlanEntryPoint(browser: CompassBrowser) {
610615
reverse: true,
611616
});
612617

613-
await browser.$(Selectors.AssistantChatMessages).waitForDisplayed();
618+
if (waitForMessages) {
619+
await browser.$(Selectors.AssistantChatMessages).waitForDisplayed();
620+
}
614621
}

0 commit comments

Comments
 (0)