Skip to content

Commit ded47b9

Browse files
committed
actually auto-update
1 parent f2dc6cf commit ded47b9

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ async function processCommonOpts({
548548
// Ensure that the user data dir exists
549549
await fs.mkdir(defaultUserDataDir, { recursive: true });
550550

551+
console.log({ defaultUserDataDir });
552+
551553
// Chromedriver will fail if log path doesn't exist, webdriver doesn't care,
552554
// for consistency let's mkdir for both of them just in case
553555
await fs.mkdir(path.dirname(chromedriverLogPath), { recursive: true });

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ async function run() {
209209
appName: buildInfo.productName,
210210
packageFilepath: path.join(compassDir, 'dist', match.filename),
211211
updatable: match.updatable,
212-
// TODO: releaseFilepath once we download the most recent released version too
212+
// TODO(COMPASS-8532): releaseFilepath once we download the most recent
213+
// released version too
213214
installer: match.installer,
214215
};
215216

@@ -223,7 +224,8 @@ async function run() {
223224
console.log(url);
224225
await downloadFile(url, pkg.packageFilepath);
225226

226-
// TODO: we need to also download releaseFilepath once we have that
227+
// TODO(COMPASS-8532): we need to also download releaseFilepath once we
228+
// have that
227229
}
228230

229231
if (!existsSync(pkg.packageFilepath)) {
@@ -232,20 +234,8 @@ async function run() {
232234
);
233235
}
234236

235-
// TODO: installing either the packaged file or the released file is better
236-
// done as part of tests so we can also clean up and install one after the
237-
// other, but that's for a separate PR.
238-
/*
239-
console.log('installing', pkg.packageFilepath);
240-
const installedInfo = await pkg.installer({
241-
appName: pkg.appName,
242-
filepath: pkg.packageFilepath,
243-
});
244-
console.log('testing', installedInfo.appPath);
245-
await testInstalledApp(pkg, installedInfo);
246-
*/
247237
await testAutoUpdateFrom(pkg);
248-
// TODO:
238+
// TODO(COMPASS-8535)
249239
//await testAutoUpdateTo(pkg);
250240
} else {
251241
throw new Error(`${context.package} not implemented`);

packages/compass-e2e-tests/smoketests/auto-update-from.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { execute } from '../installers/helpers';
22
import type { Package } from '../installers/types';
33

4+
// TODO: move this since we'll use the same for testing TO
45
function testInstalledApp(
56
pkg: Package,
67
appPath: string,

packages/compass-e2e-tests/tests/auto-update.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ describe('Auto-update', function () {
2323
await browser.$(Selectors.AutoUpdateToast).waitForDisplayed();
2424

2525
if (process.env.AUTO_UPDATE_UPDATABLE === 'true') {
26-
await browser.$(Selectors.AutoUpdateRestartButton).waitForDisplayed();
26+
const restartButton = browser.$(Selectors.AutoUpdateRestartButton);
27+
await restartButton.waitForDisplayed();
28+
29+
// We could click the restart button to apply the update and restart the
30+
// app, but restarting the app confuses webdriverio or at least our test
31+
// helpers. So we're going to just restart the app manually.
2732
} else {
28-
// When auto-update is not supported the toast contains a link to down
33+
// When auto-update is not supported the toast contains a link to
34+
// download
2935
const linkElement = browser.$(Selectors.AutoUpdateDownloadLink);
30-
await browser.$(linkElement).waitForDisplayed();
36+
await linkElement.waitForDisplayed();
3137
expect(await linkElement.getAttribute('href')).to.equal(
3238
'https://www.mongodb.com/try/download/compass'
3339
);

packages/compass/src/app/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ const app = {
380380
}
381381

382382
if (
383-
semver.gt(APP_VERSION, state.previousVersion) &&
384-
state.previousVersion !== DEFAULT_APP_VERSION
383+
state.previousVersion !== DEFAULT_APP_VERSION &&
384+
APP_VERSION !== state.previousVErsion
385385
) {
386386
// Wait a bit before showing the update toast.
387387
setTimeout(() => {

0 commit comments

Comments
 (0)