From 48a6157efb24172c874f2fcdc9d1f949800ae460 Mon Sep 17 00:00:00 2001 From: udeeshagautam <46980425+udeeshagautam@users.noreply.github.com> Date: Tue, 21 May 2019 19:56:44 -0700 Subject: [PATCH] Test fixes based on recent changes (#5570) * Test fixes based on recent changes and allowing toolbar to stay at top * removing scroll changes to be in seperate PR --- .../src/objectExplorer.test.ts | 8 +++++++- extensions/schema-compare/package.json | 3 ++- .../schema-compare/src/schemaCompareResult.ts | 3 +-- .../src/test/schemaCompare.test.ts | 17 +++++++++-------- scripts/test-extensions-unit.bat | 1 + scripts/test-extensions-unit.sh | 1 + 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/extensions/integration-tests/src/objectExplorer.test.ts b/extensions/integration-tests/src/objectExplorer.test.ts index 5811f6a672..6891c4bd71 100644 --- a/extensions/integration-tests/src/objectExplorer.test.ts +++ b/extensions/integration-tests/src/objectExplorer.test.ts @@ -72,7 +72,13 @@ if (context.RunTest) { test('Stand alone database context menu test', async function () { let server = await getStandaloneServer(); - let expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard', 'Generate Scripts...', 'Properties']; + let expectedActions: string[] = []; + if (process.platform === 'win32') { + expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard', 'Generate Scripts...', 'Properties']; + } + else { + expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard']; + } await VerifyDBContextMenu(server, 3000, expectedActions); }); }); diff --git a/extensions/schema-compare/package.json b/extensions/schema-compare/package.json index 4a51518e10..c865625712 100644 --- a/extensions/schema-compare/package.json +++ b/extensions/schema-compare/package.json @@ -53,6 +53,7 @@ "@types/node": "^8.0.24", "mocha": "^5.2.0", "should": "^13.2.1", - "typemoq": "^2.1.0" + "typemoq": "^2.1.0", + "vscode": "1.1.26" } } diff --git a/extensions/schema-compare/src/schemaCompareResult.ts b/extensions/schema-compare/src/schemaCompareResult.ts index a13e09e89b..15a15ceef8 100644 --- a/extensions/schema-compare/src/schemaCompareResult.ts +++ b/extensions/schema-compare/src/schemaCompareResult.ts @@ -160,7 +160,6 @@ export class SchemaCompareResult { await view.initializeModel(this.flexModel); }); - this.editor.openEditor(); } public start(): void { @@ -172,7 +171,7 @@ export class SchemaCompareResult { return this.comparisonResult; } - private async execute(): Promise { + public async execute(): Promise { if (this.schemaCompareOptionDialog && this.schemaCompareOptionDialog.deploymentOptions) { // take updates if any this.deploymentOptions = this.schemaCompareOptionDialog.deploymentOptions; diff --git a/extensions/schema-compare/src/test/schemaCompare.test.ts b/extensions/schema-compare/src/test/schemaCompare.test.ts index 75bd9eb73d..7807a2e202 100644 --- a/extensions/schema-compare/src/test/schemaCompare.test.ts +++ b/extensions/schema-compare/src/test/schemaCompare.test.ts @@ -6,8 +6,6 @@ 'use strict'; import * as should from 'should'; -import * as TypeMoq from 'typemoq'; -import * as vscode from 'vscode'; import * as azdata from 'azdata'; import 'mocha'; import { SchemaCompareDialog } from './../dialogs/schemaCompareDialog'; @@ -51,13 +49,13 @@ const mockTargetEndpoint: azdata.SchemaCompareEndpointInfo = { }; describe('SchemaCompareDialog.openDialog', function(): void { - it('Should be correct when created.', function(): void { + it('Should be correct when created.', async function(): Promise { let dialog = new SchemaCompareDialog(); - dialog.openDialog(mockConnectionProfile); + await dialog.openDialog(mockConnectionProfile); should(dialog.dialog.title).equal('Schema Compare'); - should(dialog.dialog.okButton.label).equal('Compare'); - should(dialog.dialog.okButton.enabled).equal(true); + should(dialog.dialog.okButton.label).equal('Ok'); + should(dialog.dialog.okButton.enabled).equal(false); // Should be false when open }); }); @@ -71,7 +69,10 @@ describe('SchemaCompareResult.start', function(): void { await promise; await result.start(); - should(result.getComparisionResult().success).equal(true); - should(result.getComparisionResult().operationId).equal(sc.testOperationId); + should(result.getComparisionResult() === undefined); + await result.execute(); + + should(result.getComparisionResult() !== undefined); + should(result.getComparisionResult().operationId !== undefined); }); }); diff --git a/scripts/test-extensions-unit.bat b/scripts/test-extensions-unit.bat index 8952929e0d..e712da7b71 100644 --- a/scripts/test-extensions-unit.bat +++ b/scripts/test-extensions-unit.bat @@ -14,6 +14,7 @@ call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\admin-too call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\agent --extensionTestsPath=%~dp0\..\extensions\agent\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\cms --extensionTestsPath=%~dp0\..\extensions\cms\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\dacpac --extensionTestsPath=%~dp0\..\extensions\dacpac\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 +call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\schema-compare --extensionTestsPath=%~dp0\..\extensions\schema-compare\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\notebook --extensionTestsPath=%~dp0\..\extensions\notebook\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\resource-deployment --extensionTestsPath=%~dp0\..\extensions\resource-deployment\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 diff --git a/scripts/test-extensions-unit.sh b/scripts/test-extensions-unit.sh index b080f05b9c..74e6311131 100644 --- a/scripts/test-extensions-unit.sh +++ b/scripts/test-extensions-unit.sh @@ -22,6 +22,7 @@ echo $VSCODEEXTDIR ./scripts/code.sh --extensionDevelopmentPath=$ROOT/extensions/agent --extensionTestsPath=$ROOT/extensions/agent/out/test --user-data-dir=$VSCODEUSERDATADIR --extensions-dir=$VSCODEEXTDIR ./scripts/code.sh --extensionDevelopmentPath=$ROOT/extensions/cms --extensionTestsPath=$ROOT/extensions/cms/out/test --user-data-dir=$VSCODEUSERDATADIR --extensions-dir=$VSCODEEXTDIR ./scripts/code.sh --extensionDevelopmentPath=$ROOT/extensions/dacpac --extensionTestsPath=$ROOT/extensions/dacpac/out/test --user-data-dir=$VSCODEUSERDATADIR --extensions-dir=$VSCODEEXTDIR +./scripts/code.sh --extensionDevelopmentPath=$ROOT/extensions/schema-compare --extensionTestsPath=$ROOT/extensions/schema-compare/out/test --user-data-dir=$VSCODEUSERDATADIR --extensions-dir=$VSCODEEXTDIR ./scripts/code.sh --extensionDevelopmentPath=$ROOT/extensions/notebook --extensionTestsPath=$ROOT/extensions/notebook/out/test --user-data-dir=$VSCODEUSERDATADIR --extensions-dir=$VSCODEEXTDIR ./scripts/code.sh --extensionDevelopmentPath=$ROOT/extensions/resource-deployment --extensionTestsPath=$ROOT/extensions/resource-deployment/out/test --user-data-dir=$VSCODEUSERDATADIR --extensions-dir=$VSCODEEXTDIR