@@ -51,6 +51,23 @@ export const test = base.extend<TestFixtures>({
5151 const projectDir = path . join ( tmpDir , projectName ) ;
5252 fs . copySync ( path . join ( TEST_DATA_ROOT , testProjectDir ) , projectDir ) ;
5353
54+ // Write VS Code settings to suppress telemetry prompts and notification noise
55+ const vscodeDir = path . join ( projectDir , ".vscode" ) ;
56+ fs . ensureDirSync ( vscodeDir ) ;
57+ const settingsPath = path . join ( vscodeDir , "settings.json" ) ;
58+ const existingSettings = fs . existsSync ( settingsPath )
59+ ? JSON . parse ( fs . readFileSync ( settingsPath , "utf-8" ) )
60+ : { } ;
61+ const mergedSettings = {
62+ ...existingSettings ,
63+ "telemetry.telemetryLevel" : "off" ,
64+ "redhat.telemetry.enabled" : false ,
65+ "workbench.colorTheme" : "Default Dark Modern" ,
66+ "update.mode" : "none" ,
67+ "extensions.ignoreRecommendations" : true ,
68+ } ;
69+ fs . writeFileSync ( settingsPath , JSON . stringify ( mergedSettings , null , 4 ) ) ;
70+
5471 // 2. Resolve VS Code executable.
5572 const vscodePath = await downloadAndUnzipVSCode ( vscodeVersion ) ;
5673 const [ , ...cliArgs ] = resolveCliArgsFromVSCodeExecutablePath ( vscodePath ) ;
@@ -67,6 +84,8 @@ export const test = base.extend<TestFixtures>({
6784 "--skip-release-notes" ,
6885 "--disable-workspace-trust" ,
6986 "--password-store=basic" ,
87+ // Suppress notifications that block UI interactions
88+ "--disable-telemetry" ,
7089 ...cliArgs ,
7190 `--extensionDevelopmentPath=${ EXTENSION_ROOT } ` ,
7291 projectDir ,
@@ -75,6 +94,10 @@ export const test = base.extend<TestFixtures>({
7594
7695 const page = await electronApp . firstWindow ( ) ;
7796
97+ // Dismiss any startup notifications/dialogs before handing off to tests
98+ await page . waitForTimeout ( 3_000 ) ;
99+ await dismissAllNotifications ( page ) ;
100+
78101 // 4. Optional tracing
79102 if ( testInfo . retry > 0 || ! process . env . CI ) {
80103 await page . context ( ) . tracing . start ( { screenshots : true , snapshots : true , title : testInfo . title } ) ;
@@ -105,3 +128,36 @@ export const test = base.extend<TestFixtures>({
105128 }
106129 } ,
107130} ) ;
131+
132+ /**
133+ * Dismiss all VS Code notification toasts (telemetry prompts, theme suggestions, etc.).
134+ * These notifications can steal focus and block Quick Open / Command Palette interactions.
135+ */
136+ async function dismissAllNotifications ( page : Page ) : Promise < void > {
137+ try {
138+ // Click "Clear All Notifications" if the notification center button is visible
139+ const clearAll = page . locator ( ".notifications-toasts .codicon-notifications-clear-all, .notification-toast .codicon-close" ) ;
140+ let count = await clearAll . count ( ) . catch ( ( ) => 0 ) ;
141+ while ( count > 0 ) {
142+ await clearAll . first ( ) . click ( ) ;
143+ await page . waitForTimeout ( 500 ) ;
144+ count = await clearAll . count ( ) . catch ( ( ) => 0 ) ;
145+ }
146+
147+ // Also try the command palette approach as a fallback
148+ const notificationToasts = page . locator ( ".notification-toast" ) ;
149+ if ( await notificationToasts . count ( ) . catch ( ( ) => 0 ) > 0 ) {
150+ // Use keyboard shortcut to clear all notifications
151+ await page . keyboard . press ( "Control+Shift+P" ) ;
152+ const input = page . locator ( ".quick-input-widget input.input" ) ;
153+ if ( await input . isVisible ( { timeout : 3_000 } ) . catch ( ( ) => false ) ) {
154+ await input . fill ( "Notifications: Clear All Notifications" ) ;
155+ await page . waitForTimeout ( 500 ) ;
156+ await input . press ( "Enter" ) ;
157+ await page . waitForTimeout ( 500 ) ;
158+ }
159+ }
160+ } catch {
161+ // Best effort
162+ }
163+ }
0 commit comments