Skip to content

Commit 1c90eba

Browse files
committed
check the text in the toasts
1 parent a897d93 commit 1c90eba

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

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

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ describe('Auto-update', function () {
3333
const restartButton = browser.$(Selectors.AutoUpdateRestartButton);
3434
await restartButton.waitForDisplayed();
3535

36+
if (process.env.EXPECTED_UPDATE_VERSION) {
37+
expect(
38+
await browser.$(Selectors.AutoUpdateToast).getText()
39+
).to.contain(
40+
`Compass is ready to update to ${process.env.EXPECTED_UPDATE_VERSION}!`
41+
);
42+
}
43+
3644
// We could click the restart button to apply the update and restart the
3745
// app, but restarting the app confuses webdriverio or at least our test
3846
// helpers. So we're going to just restart the app manually.
@@ -46,8 +54,13 @@ describe('Auto-update', function () {
4654
'https://www.mongodb.com/try/download/compass?utm_source=compass&utm_medium=product'
4755
);
4856

49-
// TODO: when updating to a known version we know the version, so
50-
// check for the text
57+
if (process.env.EXPECTED_UPDATE_VERSION) {
58+
expect(
59+
await browser.$(Selectors.AutoUpdateToast).getText()
60+
).to.contain(
61+
`Compass ${process.env.EXPECTED_UPDATE_VERSION} is available`
62+
);
63+
}
5164
}
5265
} finally {
5366
await browser.screenshot(screenshotPathName(testName));
@@ -68,11 +81,21 @@ describe('Auto-update', function () {
6881
const { browser } = compass;
6982
try {
7083
await browser.$(Selectors.AutoUpdateToast).waitForDisplayed();
71-
await browser
72-
.$(Selectors.AutoUpdateReleaseNotesLink)
73-
.waitForDisplayed();
74-
// TODO: when updating to a known version we know the version, so
75-
// check for the text
84+
const releaseNotesLink = browser.$(
85+
Selectors.AutoUpdateReleaseNotesLink
86+
);
87+
await releaseNotesLink.waitForDisplayed();
88+
// for now we only know the new version in the auto-update-to case
89+
if (process.env.EXPECTED_UPDATE_VERSION) {
90+
expect(
91+
await browser.$(Selectors.AutoUpdateToast).getText()
92+
).to.contain(
93+
`Compass ${process.env.EXPECTED_UPDATE_VERSION} installed successfully`
94+
);
95+
expect(await releaseNotesLink.getAttribute('href')).to.equal(
96+
`https://github.com/mongodb-js/compass/releases/tag/v${process.env.EXPECTED_UPDATE_VERSION}`
97+
);
98+
}
7699
} finally {
77100
await browser.screenshot(screenshotPathName(`${testName}-restart`));
78101
await cleanup(compass);

packages/compass-smoke-tests/src/tests/auto-update-to.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export async function testAutoUpdateTo({
6363
HADRON_AUTO_UPDATE_ENDPOINT_OVERRIDE,
6464
AUTO_UPDATE_UPDATABLE: (!!autoUpdatable).toString(),
6565
TEST_NAME: 'auto-update-to',
66+
EXPECTED_UPDATE_VERSION: version,
6667
COMPASS_APP_NAME: appName,
6768
COMPASS_APP_PATH: appPath,
6869
},

0 commit comments

Comments
 (0)