mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Add telemetry for opening dacpac wizard (#14884)
* add telemetry for opening dacpac wizard * add wizard open telemetry to core * fix tests * remove WizardOpen
This commit is contained in:
@@ -141,13 +141,14 @@ suite('ExtHostModelViewDialog Tests', () => {
|
||||
});
|
||||
|
||||
test('Opening a wizard updates its pages and buttons on the main thread', () => {
|
||||
mockProxy.setup(x => x.$openWizard(It.isAny()));
|
||||
mockProxy.setup(x => x.$openWizard(It.isAny(), It.isAny()));
|
||||
mockProxy.setup(x => x.$setWizardDetails(It.isAny(), It.isAny()));
|
||||
mockProxy.setup(x => x.$setWizardPageDetails(It.isAny(), It.isAny()));
|
||||
mockProxy.setup(x => x.$setButtonDetails(It.isAny(), It.isAny()));
|
||||
|
||||
// Create a wizard with 2 pages and 2 custom buttons
|
||||
let wizardTitle = 'wizard_title';
|
||||
let source = 'command palette';
|
||||
let wizard = extHostModelViewDialog.createWizard(wizardTitle);
|
||||
let page1Title = 'page_1';
|
||||
let page1 = extHostModelViewDialog.createWizardPage(page1Title);
|
||||
@@ -162,7 +163,7 @@ suite('ExtHostModelViewDialog Tests', () => {
|
||||
wizard.customButtons = [button1, button2];
|
||||
|
||||
// Open the wizard and verify that the correct main thread methods were called
|
||||
extHostModelViewDialog.openWizard(wizard);
|
||||
extHostModelViewDialog.openWizard(wizard, source);
|
||||
mockProxy.verify(x => x.$setButtonDetails(It.isAny(), It.is(details => {
|
||||
return details.enabled === false && details.label === button1Label;
|
||||
})), Times.atLeastOnce());
|
||||
@@ -179,7 +180,7 @@ suite('ExtHostModelViewDialog Tests', () => {
|
||||
return details.title === wizardTitle && details.pages.length === 2 && details.customButtons.length === 2 &&
|
||||
details.displayPageTitles === true;
|
||||
})), Times.atLeastOnce());
|
||||
mockProxy.verify(x => x.$openWizard(It.isAny()), Times.once());
|
||||
mockProxy.verify(x => x.$openWizard(It.isAny(), It.isAny()), Times.once());
|
||||
});
|
||||
|
||||
test('Wizard page changed events are handled correctly', () => {
|
||||
|
||||
@@ -52,6 +52,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
let page2Handle = 12;
|
||||
let wizardHandle = 13;
|
||||
let page3Handle = 14;
|
||||
let source = 'command palette';
|
||||
|
||||
setup(() => {
|
||||
mockExtHostModelViewDialog = Mock.ofInstance(<ExtHostModelViewDialogShape>{
|
||||
@@ -73,7 +74,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
mockDialogService.setup(x => x.showDialog(It.isAny(), undefined, It.isAny())).callback((dialog) => {
|
||||
openedDialog = dialog;
|
||||
});
|
||||
mockDialogService.setup(x => x.showWizard(It.isAny(), It.isAny())).callback(wizard => {
|
||||
mockDialogService.setup(x => x.showWizard(It.isAny(), It.isAny(), It.isAny())).callback(wizard => {
|
||||
openedWizard = wizard;
|
||||
// The actual service will set the page to 0 when it opens the wizard
|
||||
openedWizard.setCurrentPage(0);
|
||||
@@ -247,10 +248,10 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
|
||||
test('Creating a wizard and calling open on it causes a wizard with correct pages and buttons to open', () => {
|
||||
// If I open the wizard
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle);
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle, source);
|
||||
|
||||
// Then the opened wizard's content and buttons match what was set
|
||||
mockDialogService.verify(x => x.showWizard(It.isAny(), It.isAny()), Times.once());
|
||||
mockDialogService.verify(x => x.showWizard(It.isAny(), It.isAny(), It.isAny()), Times.once());
|
||||
assert.notEqual(openedWizard, undefined);
|
||||
assert.equal(openedWizard.title, wizardDetails.title);
|
||||
assert.equal(openedWizard.doneButton.label, okButtonDetails.label);
|
||||
@@ -281,7 +282,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
mockExtHostModelViewDialog.setup(x => x.$onWizardPageChanged(It.isAny(), It.isAny()));
|
||||
|
||||
// If I open the wizard and change the page to index 1
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle);
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle, source);
|
||||
openedWizard.setCurrentPage(1);
|
||||
|
||||
// Then a page changed event gets sent to the extension host
|
||||
@@ -314,7 +315,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
};
|
||||
|
||||
// If I open the wizard and then add a page
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle);
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle, source);
|
||||
mainThreadModelViewDialog.$setWizardPageDetails(page3Handle, page3Details);
|
||||
mainThreadModelViewDialog.$addWizardPage(wizardHandle, page3Handle, 0);
|
||||
|
||||
@@ -329,7 +330,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
mockExtHostModelViewDialog.setup(x => x.$updateWizardPageInfo(It.isAny(), It.isAny(), It.isAny()));
|
||||
|
||||
// If I open the wizard and then remove a page
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle);
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle, source);
|
||||
mainThreadModelViewDialog.$removeWizardPage(wizardHandle, 0);
|
||||
|
||||
// Then the updated page info gets sent to the extension host
|
||||
@@ -343,7 +344,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
mockExtHostModelViewDialog.setup(x => x.$validateNavigation(It.isAny(), It.isAny()));
|
||||
|
||||
// If I call validateNavigation on the wizard that gets created
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle);
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle, source);
|
||||
openedWizard.validateNavigation(1);
|
||||
|
||||
// Then the call gets forwarded to the extension host
|
||||
@@ -351,7 +352,7 @@ suite('MainThreadModelViewDialog Tests', () => {
|
||||
});
|
||||
|
||||
test('Adding a message to a wizard fires events on the created wizard', () => {
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle);
|
||||
mainThreadModelViewDialog.$openWizard(wizardHandle, source);
|
||||
let newMessage: DialogMessage;
|
||||
openedWizard.onMessageChange(message => newMessage = message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user