diff --git a/src/vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.ts b/src/vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.ts index d53404bbc851..8220ef609f09 100644 --- a/src/vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.ts +++ b/src/vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.ts @@ -17,6 +17,7 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common import { CancellationToken } from 'vs/base/common/cancellation'; import { IProductService } from 'vs/platform/product/common/productService'; import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { IEnvironmentService } from 'vs/platform/environment/common/environment'; export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution { @@ -33,10 +34,11 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution @IConfigurationService private readonly configurationService: IConfigurationService, @IExtensionGalleryService private readonly galleryService: IExtensionGalleryService, @IProductService private readonly productService: IProductService, + @IEnvironmentService private readonly environmentService: IEnvironmentService // {{SQL CARBON EDIT}} add service ) { } protected async handleTelemetryOptOut(): Promise { - if (this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) { + if (!this.environmentService.disableTelemetry && this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) { // {{SQL CARBON EDIT}} add disableTelemetry check const experimentId = 'telemetryOptOut'; const [count, experimentState] = await Promise.all([this.getWindowCount(), this.experimentService.getExperimentById(experimentId)]); @@ -164,9 +166,10 @@ export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut { @IExperimentService experimentService: IExperimentService, @IConfigurationService configurationService: IConfigurationService, @IExtensionGalleryService galleryService: IExtensionGalleryService, - @IProductService productService: IProductService + @IProductService productService: IProductService, + @IEnvironmentService environmentService: IEnvironmentService // {{SQL CARBON EDIT}} add service ) { - super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService); + super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService); this.handleTelemetryOptOut(); } diff --git a/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts b/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts index eb8fbf2d210a..d54d95643ea5 100644 --- a/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts +++ b/src/vs/workbench/contrib/welcome/telemetryOptOut/electron-sandbox/telemetryOptOut.ts @@ -14,6 +14,7 @@ import { IProductService } from 'vs/platform/product/common/productService'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut'; import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; +import { IEnvironmentService } from 'vs/platform/environment/common/environment'; export class NativeTelemetryOptOut extends AbstractTelemetryOptOut { @@ -27,9 +28,10 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut { @IConfigurationService configurationService: IConfigurationService, @IExtensionGalleryService galleryService: IExtensionGalleryService, @IProductService productService: IProductService, - @IElectronService private readonly electronService: IElectronService + @IEnvironmentService environmentService: IEnvironmentService, // {{SQL CARBON EDIT}} add service + @IElectronService private readonly electronService: IElectronService, ) { - super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService); + super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService); this.handleTelemetryOptOut(); } diff --git a/test/automation/src/sql/queryEditor.ts b/test/automation/src/sql/queryEditor.ts index ef1c34333a96..72c5d4a2c0e5 100644 --- a/test/automation/src/sql/queryEditor.ts +++ b/test/automation/src/sql/queryEditor.ts @@ -9,10 +9,14 @@ export class QueryEditor { public readonly commandBar: CommandBar; - constructor(code: Code) { + constructor(private code: Code) { this.commandBar = new CommandBar(code); } + private static readonly RESULT_SELECTOR = '.query-editor-view .monaco-table'; + public async waitForResults(): Promise { + await this.code.waitForElement(QueryEditor.RESULT_SELECTOR); + } } export class CommandBar { diff --git a/test/automation/src/sql/queryEditors.ts b/test/automation/src/sql/queryEditors.ts index 74c423de64cf..2bf367af48d3 100644 --- a/test/automation/src/sql/queryEditors.ts +++ b/test/automation/src/sql/queryEditors.ts @@ -6,32 +6,21 @@ import { Editors } from '../editors'; import { Code } from '../code'; -export class QueryEditors extends Editors { +export class QueryEditors { constructor( - private vsCode: Code + private readonly code: Code, + private readonly editors: Editors ) { - super(vsCode); } - /** - * Waits for an active SQL Query Editor tab for the specified file. This is a modification of the editors.waitForActiveTab that - * takes into account the connected status displayed in the title of Query Editors. - * @param fileName The name of the file opened in the editor - * @param isDirty Whether the file is dirty or not - */ - async waitForActiveTab(fileName: string, isDirty: boolean = false): Promise { - // For now assume all opened tabs are disconnected until we have a need to open connected tabs - await this.vsCode.waitForElement(`.tabs-container div.tab.active${isDirty ? '.dirty' : ''}[aria-selected="true"][aria-label="${fileName} - disconnected, tab"]`); - } + async newUntitledQuery(): Promise { + if (process.platform === 'darwin') { + await this.code.dispatchKeybinding('cmd+n'); + } else { + await this.code.dispatchKeybinding('ctrl+n'); + } - /** - * Waits for an active Query Editor for the specified file to have focus. This is a modification of the editors.waitForEditorFocus - * that takes into account the connected status displayed in the title of Query Editors. - * @param fileName The name of the file opened in the editor - */ - async waitForEditorFocus(fileName: string): Promise { - await this.waitForActiveTab(fileName); - await super.waitForActiveEditor(fileName); + await this.editors.waitForEditorFocus('SQLQuery_1'); } } diff --git a/test/automation/src/workbench.ts b/test/automation/src/workbench.ts index 5fac34e8ccc0..abf7855b2b2a 100644 --- a/test/automation/src/workbench.ts +++ b/test/automation/src/workbench.ts @@ -77,7 +77,7 @@ export class Workbench { // {{SQL CARBON EDIT}} this.connectionDialog = new ConnectionDialog(code); this.profiler = new Profiler(code, this.quickaccess); - this.queryEditors = new QueryEditors(code); + this.queryEditors = new QueryEditors(code, this.editors); this.queryEditor = new QueryEditor(code); // {{END}} this.notebook = new Notebook(this.quickaccess, code); diff --git a/test/smoke/src/sql/areas/queryEditor/queryEditor.test.ts b/test/smoke/src/sql/areas/queryEditor/queryEditor.test.ts index 138795b6ab39..49aa901a9c15 100644 --- a/test/smoke/src/sql/areas/queryEditor/queryEditor.test.ts +++ b/test/smoke/src/sql/areas/queryEditor/queryEditor.test.ts @@ -17,7 +17,23 @@ export function setup() { await app.workbench.connectionDialog.setTarget('File', 'chinook.db'); await app.workbench.connectionDialog.connect(); await app.workbench.queryEditor.commandBar.clickButton(1); - await app.code.waitForElement('.query-editor-view .monaco-table'); + await app.workbench.queryEditor.waitForResults(); + await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); + }); + + it('can new file, connect and execute', async function () { + const app = this.app as Application; + await app.workbench.queryEditors.newUntitledQuery(); + const untitled = 'SQLQuery_1'; + await app.workbench.editor.waitForTypeInEditor(untitled, 'select * from employees'); + await app.workbench.queryEditor.commandBar.clickButton(3); + await app.workbench.connectionDialog.waitForConnectionDialog(); + await app.workbench.connectionDialog.setProvider('Sqlite'); + await app.workbench.connectionDialog.setTarget('File', 'chinook.db'); + await app.workbench.connectionDialog.connect(); + await app.workbench.queryEditor.commandBar.clickButton(1); + await app.workbench.queryEditor.waitForResults(); + await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); }); }); }