Skip to content

Commit b0084fc

Browse files
committed
chore: fixups
1 parent 5f57459 commit b0084fc

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

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

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ describe('MongoDB Assistant', function () {
3838
const collectionName = 'entryPoints';
3939

4040
before(async function () {
41-
skipForWeb(this, 'ai assistant not yet available in compass-web');
42-
4341
process.env.COMPASS_E2E_SKIP_ATLAS_SIGNIN = 'true';
4442

4543
// Start a mock Atlas service for feature flag checks
@@ -55,7 +53,6 @@ describe('MongoDB Assistant', function () {
5553

5654
telemetry = await startTelemetryServer();
5755
compass = await init(this.test?.fullTitle());
58-
browser = compass.browser;
5956

6057
sendMessage = async (
6158
text: string,
@@ -75,34 +72,41 @@ describe('MongoDB Assistant', function () {
7572
await submitButton.click();
7673
};
7774

75+
const setup = async () => {
76+
browser = compass.browser;
77+
await browser.setupDefaultConnections();
78+
await browser.connectToDefaults();
79+
await browser.selectConnectionMenuItem(
80+
DEFAULT_CONNECTION_NAME_1,
81+
Selectors.CreateDatabaseButton,
82+
false
83+
);
84+
await browser.addDatabase(dbName, collectionName);
85+
86+
await browser.navigateToCollectionTab(
87+
DEFAULT_CONNECTION_NAME_1,
88+
dbName,
89+
collectionName,
90+
'Aggregations'
91+
);
92+
};
93+
7894
setAIOptIn = async (newValue: boolean) => {
7995
if (
8096
(await browser.getFeature('optInGenAIFeatures')) === true &&
8197
newValue === false
8298
) {
99+
await cleanup(compass);
83100
// Reseting the opt-in to false can be tricky so it's best to start over in this case.
84-
compass = await init(this.test?.fullTitle(), { firstRun: false });
101+
compass = await init(this.test?.fullTitle(), { firstRun: true });
102+
await setup();
85103
return;
86104
}
87105

88106
await browser.setFeature('optInGenAIFeatures', newValue);
89107
};
90108

91-
await browser.setupDefaultConnections();
92-
await browser.connectToDefaults();
93-
await browser.selectConnectionMenuItem(
94-
DEFAULT_CONNECTION_NAME_1,
95-
Selectors.CreateDatabaseButton,
96-
false
97-
);
98-
await browser.addDatabase(dbName, collectionName);
99-
100-
await browser.navigateToCollectionTab(
101-
DEFAULT_CONNECTION_NAME_1,
102-
dbName,
103-
collectionName,
104-
'Aggregations'
105-
);
109+
await setup();
106110
});
107111

108112
after(async function () {

0 commit comments

Comments
 (0)