Skip to content

Commit c9e66b8

Browse files
Merge remote-tracking branch 'origin/main' into beta-releases
2 parents dcd3243 + da32854 commit c9e66b8

File tree

11 files changed

+33
-34
lines changed

11 files changed

+33
-34
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **Mongodb Compass**.
2-
This document was automatically generated on Sun Jan 14 2024.
2+
This document was automatically generated on Mon Jan 15 2024.
33

44
## List of dependencies
55

packages/compass-e2e-tests/helpers/commands/add-collection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export async function addCollection(
7878
await menu.waitForDisplayed();
7979
const span = await menu.$(`span=${value.toString()}`);
8080
await span.waitForDisplayed();
81+
await span.scrollIntoView();
82+
await browser.screenshot(
83+
`custom-collation-${key}-${value.toString()}.png`
84+
);
8185
await span.click();
8286

8387
// make sure the menu disappears before moving on to the next thing

packages/compass-e2e-tests/helpers/commands/click-visible.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function clickVisible(
3030

3131
const clickElement = await getElement();
3232
if (options?.screenshot) {
33-
await browser.saveScreenshot(options.screenshot);
33+
await browser.screenshot(options.screenshot);
3434
}
3535
if (await clickElement.isEnabled()) {
3636
await clickElement.click();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import type { CompassBrowser } from '../compass-browser';
3-
import { LOG_PATH } from '../compass';
3+
import { SCREENSHOTS_PATH } from '../compass';
44

55
export async function screenshot(
66
browser: CompassBrowser,
@@ -9,5 +9,5 @@ export async function screenshot(
99
// Give animations a second. Hard to have a generic way to know if animations
1010
// are still in progress or not.
1111
await browser.pause(1000);
12-
await browser.saveScreenshot(path.join(LOG_PATH, 'screenshots', filename));
12+
await browser.saveScreenshot(path.join(SCREENSHOTS_PATH, filename));
1313
}

packages/compass-e2e-tests/helpers/compass.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const COMPASS_PATH = path.dirname(
3939
);
4040
export const LOG_PATH = path.resolve(__dirname, '..', '.log');
4141
const OUTPUT_PATH = path.join(LOG_PATH, 'output');
42-
const SCREENSHOTS_PATH = path.join(LOG_PATH, 'screenshots');
42+
export const SCREENSHOTS_PATH = path.join(LOG_PATH, 'screenshots');
4343
const COVERAGE_PATH = path.join(LOG_PATH, 'coverage');
4444

4545
let MONGODB_VERSION = '';
@@ -106,8 +106,6 @@ export const serverSatisfies = (
106106

107107
// For the user data dirs
108108
let i = 0;
109-
// For the screenshots
110-
let j = 0;
111109

112110
interface Coverage {
113111
main?: string;
@@ -377,18 +375,6 @@ export class Compass {
377375
await fs.writeFile(compassLogPath, compassLog.raw);
378376
this.logs = compassLog.structured;
379377
}
380-
381-
async capturePage(
382-
imgPathName = `screenshot-${formattedDate()}-${++j}.png`
383-
): Promise<boolean> {
384-
try {
385-
await this.browser.saveScreenshot(path.join(LOG_PATH, imgPathName));
386-
return true;
387-
} catch (err) {
388-
console.warn((err as Error).stack);
389-
return false;
390-
}
391-
}
392378
}
393379

394380
interface StartCompassOptions {
@@ -987,9 +973,11 @@ export async function screenshotIfFailed(
987973
if (test) {
988974
if (test.state === undefined) {
989975
// if there's no state, then it is probably because the before() hook failed
990-
await compass.capturePage(screenshotPathName(`${test.fullTitle()}-hook`));
976+
await compass.browser.screenshot(
977+
screenshotPathName(`${test.fullTitle()}-hook`)
978+
);
991979
} else if (test.state === 'failed') {
992-
await compass.capturePage(screenshotPathName(test.fullTitle()));
980+
await compass.browser.screenshot(screenshotPathName(test.fullTitle()));
993981
}
994982
}
995983
}

packages/compass-e2e-tests/tests/in-use-encryption.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ import type { Compass } from '../helpers/compass';
1010
import * as Selectors from '../helpers/selectors';
1111
import { getFirstListDocument } from '../helpers/read-first-document-content';
1212
import { MongoClient } from 'mongodb';
13-
import path from 'path';
1413

1514
import delay from '../helpers/delay';
1615

17-
import { LOG_PATH } from '../helpers/compass';
18-
1916
const CONNECTION_HOSTS = 'localhost:27091';
2017
const CONNECTION_STRING = `mongodb://${CONNECTION_HOSTS}/`;
2118

@@ -120,9 +117,7 @@ describe('CSFLE / QE', function () {
120117
}
121118

122119
await delay(10000);
123-
await browser.saveScreenshot(
124-
path.join(LOG_PATH, 'saved-connections-after-disconnect.png')
125-
);
120+
await browser.screenshot('saved-connections-after-disconnect.png');
126121

127122
await browser.clickVisible(Selectors.sidebarFavoriteButton(favoriteName));
128123
await browser.waitUntil(async () => {

packages/compass-e2e-tests/tests/instance-databases-tab.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { expect } from 'chai';
2-
import path from 'path';
32
import type { CompassBrowser } from '../helpers/compass-browser';
43
import { init, cleanup, screenshotIfFailed } from '../helpers/compass';
54
import type { Compass } from '../helpers/compass';
6-
import { LOG_PATH } from '../helpers/compass';
75
import * as Selectors from '../helpers/selectors';
86
import {
97
createDummyCollections,
@@ -64,7 +62,7 @@ describe('Instance databases tab', function () {
6462
// even after scrolling it into view.
6563
await browser.clickVisible(Selectors.databaseCardClickable('test'), {
6664
scroll: true,
67-
screenshot: path.join(LOG_PATH, 'database-card.png'),
65+
screenshot: 'database-card.png',
6866
});
6967

7068
const collectionSelectors = ['json-array', 'json-file', 'numbers'].map(

packages/compass-web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
"compass:exports": {
3232
".": "./src/index.tsx"
3333
},
34-
"types": "./dist/src/index.d.ts",
34+
"types": "./dist/index.d.ts",
3535
"scripts": {
3636
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3737
"compile": "npm run webpack -- --mode production",
3838
"webpack": "webpack-compass",
39-
"postcompile": "tsc --emitDeclarationOnly",
39+
"postcompile": "tsc -p tsconfig-build.json --emitDeclarationOnly",
4040
"start": "npm run webpack serve -- --mode development",
4141
"analyze": "npm run webpack -- --mode production --analyze",
4242
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// We include sandbox code in default tsconfig, but it affects emitted file
2+
// paths. This is a special tsconfig for postcompile task so that the
3+
// declarations emitted are only for files we actually want to publish
4+
{
5+
"extends": "./tsconfig.json",
6+
"include": ["src/**/*"],
7+
"exclude": ["./src/**/*.spec.*"]
8+
}

packages/compass-web/tsconfig.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"compilerOptions": {
44
"outDir": "dist"
55
},
6-
"include": ["src/**/*", "sandbox/**/*"],
6+
"include": [
7+
"src/**/*",
8+
// Including sandbox so that ts check and editor intellisense can provide
9+
// useful information when working in the sandbox. It needs to be in the
10+
// default tsconfig file
11+
"sandbox/**/*"
12+
],
713
"exclude": ["./src/**/*.spec.*"]
814
}

0 commit comments

Comments
 (0)