@@ -115,7 +115,7 @@ define(function (require, exports, module) {
115115 expect ( dialogText ) . toContain ( '30 days' ) ;
116116
117117 // Close the dialog
118- testWindow . $ ( '.modal .btn' ) . first ( ) . click ( ) ;
118+ testWindow . __PR . clickDialogButtonID ( testWindow . __PR . Dialogs . DIALOG_BTN_OK ) ;
119119 await testWindow . __PR . waitForModalDialogClosed ( ".modal" ) ;
120120 } ) ;
121121
@@ -155,7 +155,7 @@ define(function (require, exports, module) {
155155 expect ( dialogText ) . toContain ( '7 days' ) ;
156156
157157 // Close the dialog
158- testWindow . $ ( '.modal .btn' ) . first ( ) . click ( ) ;
158+ testWindow . __PR . clickDialogButtonID ( testWindow . __PR . Dialogs . DIALOG_BTN_OK ) ;
159159 await testWindow . __PR . waitForModalDialogClosed ( ".modal" ) ;
160160 } ) ;
161161
@@ -180,17 +180,16 @@ define(function (require, exports, module) {
180180 expect ( updatedTrialData . proVersion ) . toBe ( "3.1.0" ) ;
181181 expect ( updatedTrialData . endDate ) . toBe ( futureEndDate ) ;
182182
183- // Skip dialog testing
184- try {
185- await testWindow . __PR . waitForModalDialog ( ".modal" ) ;
186- const modalContent = testWindow . $ ( '.modal' ) ;
187- if ( modalContent . length > 0 ) {
188- testWindow . $ ( '.modal .btn' ) . first ( ) . click ( ) ;
189- await testWindow . __PR . waitForModalDialogClosed ( ".modal" ) ;
190- }
191- } catch ( e ) {
192- console . log ( 'Dialog test skipped:' , e . message ) ;
193- }
183+ await testWindow . __PR . waitForModalDialog ( ".modal" ) ;
184+ // Check dialog content
185+ const modalContent = testWindow . $ ( '.modal' ) ;
186+ const dialogText = modalContent . text ( ) ;
187+ expect ( dialogText . toLowerCase ( ) ) . toContain ( 'you’ve been upgraded to' ) ;
188+ expect ( dialogText ) . toContain ( 'Phoenix Pro' ) ;
189+ expect ( dialogText ) . toContain ( '10 days' ) ;
190+
191+ testWindow . __PR . clickDialogButtonID ( testWindow . __PR . Dialogs . DIALOG_BTN_OK ) ;
192+ await testWindow . __PR . waitForModalDialogClosed ( ".modal" ) ;
194193 } ) ;
195194
196195 // Note: Cannot easily test pro user scenarios in integration tests
@@ -280,8 +279,20 @@ define(function (require, exports, module) {
280279 expect ( dialogText ) . toContain ( 'Phoenix Pro' ) ;
281280 expect ( dialogText ) . toContain ( 'Trial has ended' ) ;
282281
283- // Close the dialog
284- testWindow . $ ( '.modal .btn' ) . first ( ) . click ( ) ;
282+ // Close the dialog, so here trial expiration has 2 dialogs, either an offline dialog or online depends
283+ // on config. we just close em blindly. depending on config of
284+ // `${brackets.config.promotions_url}app/config.json`. here we just close both blindly;
285+ try {
286+ //
287+ testWindow . __PR . clickDialogButtonID ( "secondaryButton" ) ;
288+ } catch ( e ) {
289+ // ignored
290+ }
291+ try {
292+ testWindow . __PR . clickDialogButtonID ( testWindow . __PR . Dialogs . DIALOG_BTN_CANCEL ) ;
293+ } catch ( e ) {
294+ // ignored
295+ }
285296 await testWindow . __PR . waitForModalDialogClosed ( ".modal" ) ;
286297 } ) ;
287298
@@ -319,7 +330,7 @@ define(function (require, exports, module) {
319330 expect ( dialogText ) . toContain ( '7 days' ) ;
320331
321332 // Close the dialog
322- testWindow . $ ( '.modal .btn' ) . first ( ) . click ( ) ;
333+ testWindow . __PR . clickDialogButtonID ( testWindow . __PR . Dialogs . DIALOG_BTN_OK ) ;
323334 await testWindow . __PR . waitForModalDialogClosed ( ".modal" ) ;
324335 } ) ;
325336
0 commit comments