@@ -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 ) ;
0 commit comments