From 15d80964139d767b4d21786abc72464a65ae8ec0 Mon Sep 17 00:00:00 2001 From: Shreya Khajanchi Date: Tue, 26 Sep 2023 17:50:46 +0530 Subject: [PATCH 01/11] unit tests fixed and created selenium test framework --- ui/dev/docker-compose.yml | 11 + ui/dev/dump.sql | 80 ++++ ui/dev/test.js | 97 +++++ ui/package-lock.json | 369 ++++++++++++++++++ .../add-index-form.component.spec.ts | 13 +- .../add-new-column.component.spec.ts | 27 +- .../add-new-column.component.ts | 6 +- ...add-shard-id-primary-key.component.spec.ts | 8 +- ...rop-restore-table-dialog.component.spec.ts | 41 +- .../connection-profile-form.component.spec.ts | 24 +- .../database-loader.component.spec.ts | 7 +- .../dataflow-form.component.spec.ts | 16 +- .../direct-connection.component.html | 18 +- .../direct-connection.component.spec.ts | 9 +- ...op-index-or-table-dialog.component.spec.ts | 14 + .../edit-column-max-length.component.spec.ts | 9 +- ...dit-global-datatype-form.component.spec.ts | 9 +- .../end-migration.component.spec.ts | 19 +- .../header/header.component.spec.ts | 3 +- .../app/components/home/home.component.html | 1 + .../components/home/home.component.spec.ts | 19 +- .../load-dump/load-dump.component.spec.ts | 7 +- .../load-session.component.spec.ts | 3 + .../object-detail.component.spec.ts | 15 +- .../object-explorer.component.spec.ts | 16 +- .../prepare-migration.component.spec.ts | 6 +- .../components/rule/rule.component.spec.ts | 24 +- .../session-listing.component.spec.ts | 3 +- ...bulk-source-details-form.component.spec.ts | 19 +- ...w-migration-details-form.component.spec.ts | 26 +- .../sidenav-review-changes.component.spec.ts | 3 + .../sidenav-rule.component.spec.ts | 5 +- .../sidenav-save-session.component.spec.ts | 3 + .../sidenav-view-assessment.component.spec.ts | 6 +- .../source-details-form.component.spec.ts | 19 +- .../summary/summary.component.spec.ts | 11 +- .../target-details-form.component.spec.ts | 19 +- .../workspace/workspace.component.spec.ts | 6 +- .../conversion/conversion.service.spec.ts | 6 +- ui/src/app/services/data/data.service.spec.ts | 3 +- 40 files changed, 925 insertions(+), 75 deletions(-) create mode 100644 ui/dev/docker-compose.yml create mode 100644 ui/dev/dump.sql create mode 100644 ui/dev/test.js diff --git a/ui/dev/docker-compose.yml b/ui/dev/docker-compose.yml new file mode 100644 index 000000000..7e2015a4b --- /dev/null +++ b/ui/dev/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' +services: + mysql: + image: mysql:latest + container_name: my-mysql-container + environment: + MYSQL_ROOT_PASSWORD: pass123 + ports: + - "3307:3306" + volumes: + - ./dump.sql:/docker-entrypoint-initdb.d/dump.sql \ No newline at end of file diff --git a/ui/dev/dump.sql b/ui/dev/dump.sql new file mode 100644 index 000000000..9240a9856 --- /dev/null +++ b/ui/dev/dump.sql @@ -0,0 +1,80 @@ +-- MySQL dump 10.13 Distrib 8.0.27, for macos11 (x86_64) +-- +-- Host: 127.0.0.1 Database: test_interleave_table_data +-- ------------------------------------------------------ +-- Server version 8.0.27 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `cart` +-- + +CREATE DATABASE test_interleave_table_data; +USE test_interleave_table_data; + +DROP TABLE IF EXISTS `cart`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cart` ( + `user_id` varchar(20) NOT NULL, + `product_id` varchar(20) NOT NULL, + `quantity` bigint DEFAULT NULL, + PRIMARY KEY (`user_id`,`product_id`), + CONSTRAINT `user_cart` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cart` +-- + +LOCK TABLES `cart` WRITE; +/*!40000 ALTER TABLE `cart` DISABLE KEYS */; +INSERT INTO `cart` VALUES ('901e-a6cfc2b502dc','abc-123',1); +/*!40000 ALTER TABLE `cart` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `user_id` varchar(20) NOT NULL, + `user_name` char(128) NOT NULL, + PRIMARY KEY (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES ('901e-a6cfc2b502dc','xyz-1'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-11-29 21:37:03 diff --git a/ui/dev/test.js b/ui/dev/test.js new file mode 100644 index 000000000..12be9ad79 --- /dev/null +++ b/ui/dev/test.js @@ -0,0 +1,97 @@ +// Require modules used in the logic below +const { Builder, By, Key, until, Select } = require('selenium-webdriver'); + +// You can use a remote Selenium Hub, but we are not doing that here +require('chromedriver'); +const driver = new Builder() + .forBrowser('chrome') + .build(); + +// Setting variables for our testcase +const baseUrl = 'http://localhost:4200' + +// function to check for home screen elements +var homeScreenLoadtest = async function () { + + let connectButton = By.xpath('//button'); + + // navigate to the login page + await driver.get(baseUrl); + + // wait for home page to be loaded + await driver.wait(until.elementLocated(connectButton), 10 * 1000); + console.log('Home screen loaded.') +} + +//to set jasmine default timeout +jasmine.DEFAULT_TIMEOUT_INTERVAL = 20 * 1000; + +// Start to write the first test case +describe("Selenium test case for login page", function () { + it("verify page elements", async function () { + console.log('<----- Starting to execute test case ----->'); + + await homeScreenLoadtest(); + + var welcomeMessage = By.xpath('//*[@class="primary-header"]'); + + //verify welcome message on login page + expect(await driver.findElement(welcomeMessage).getText()).toBe('Get started with Spanner migration tool'); + + const connectButton = await driver.wait( + until.elementLocated(By.id('connect-to-database-btn')), + 10000 // Adjust the timeout as needed + ); + + await connectButton.click() + + // Wait for the connection to complete (you may need to adjust the wait time) + await driver.wait(until.elementLocated(By.id('direct-connection-component')), 10000); + + // Assuming there are input fields for database type, hostname, username, and password + const databaseTypeInput = await driver.findElement(By.id('dbengine-input')); + const hostnameInput = await driver.findElement(By.id('hostname-input')); + const usernameInput = await driver.findElement(By.id('username-input')); + const passwordInput = await driver.findElement(By.id('password-input')); + const portInput = await driver.findElement(By.id('port-input')); + const dbnameInput = await driver.findElement(By.id('dbname-input')); + const testConnectionButton = await driver.findElement(By.id('test-connect-btn')); + const spannerDialectInput = await driver.findElement(By.id('spanner-dialect-input')); + + // Fill in the form with your desired values + await hostnameInput.sendKeys('localhost'); + await usernameInput.sendKeys('root'); + await passwordInput.sendKeys('pass123'); + await portInput.sendKeys('3307'); + await dbnameInput.sendKeys('test_interleave_table_data'); + + await databaseTypeInput.click(); + optionElement = await driver.wait( + until.elementLocated(By.xpath("//span[@class='mat-option-text'][contains(text(),'MySQL')]")), + 10000 // Adjust the timeout as needed + ); + await optionElement.click(); + + await spannerDialectInput.click(); + optionElement = await driver.wait( + until.elementLocated(By.xpath("//span[@class='mat-option-text'][contains(text(),'Google Standard SQL Dialect')]")), + 10000 // Adjust the timeout as needed + ); + await optionElement.click(); + + // Check if the button is enabled + const isButtonEnabled = await testConnectionButton.isEnabled(); + + // Output the result (true if enabled, false if disabled) + console.log('Is button enabled:', isButtonEnabled); + + // Submit the form + await testConnectionButton.click(); + + //to quit the web driver at end of test case execution + + await driver.quit(); + + console.log('<----- Test case execution completed ----->'); + }); +}); \ No newline at end of file diff --git a/ui/package-lock.json b/ui/package-lock.json index 935fed531..a8c45fa55 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -4088,6 +4088,12 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "node_modules/@testim/chrome-version": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.1.4.tgz", + "integrity": "sha512-kIhULpw9TrGYnHp/8VfdcneIcxKnLixmADtukQRtJUmsVlMg0niMkwV0xZmi8hqa57xqilIHjWFA0GKvEjVU5g==", + "dev": true + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -4349,6 +4355,16 @@ "@types/node": "*" } }, + "node_modules/@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "dev": true, + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -4897,6 +4913,17 @@ "postcss": "^8.1.0" } }, + "node_modules/axios": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", + "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-loader": { "version": "9.1.3", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", @@ -5187,6 +5214,15 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -5539,6 +5575,12 @@ "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==" }, + "node_modules/compare-versions": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.0.tgz", + "integrity": "sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==", + "dev": true + }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", @@ -6042,6 +6084,12 @@ "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", "dev": true }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/default-gateway": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", @@ -6084,6 +6132,15 @@ "node": ">=0.4.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -6303,6 +6360,15 @@ "node": ">=0.10.0" } }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/engine.io": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.3.tgz", @@ -6774,6 +6840,41 @@ "node": ">=4" } }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -6821,6 +6922,15 @@ "node": ">=0.8.0" } }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "dependencies": { + "pend": "~1.2.0" + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -7818,6 +7928,15 @@ "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", "dev": true }, + "node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/ipaddr.js": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz", @@ -7980,6 +8099,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-url": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", + "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", + "dev": true + }, "node_modules/is-what": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", @@ -7998,6 +8123,20 @@ "node": ">=8" } }, + "node_modules/is2": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/is2/-/is2-2.0.9.tgz", + "integrity": "sha512-rZkHeBn9Zzq52sd9IUIV3a5mfwBY+o2HePMh0wkGBM4z4qjvy2GwVxQ6nNXSfw6MmVP6gf1QIlWjiOavhM3x5g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "ip-regex": "^4.1.0", + "is-url": "^1.2.4" + }, + "engines": { + "node": ">=v0.10.0" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -10147,6 +10286,12 @@ "node": ">=8" } }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -10506,6 +10651,12 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -11132,6 +11283,53 @@ "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", "dev": true }, + "node_modules/selenium-webdriver": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.12.0.tgz", + "integrity": "sha512-zvPzmTsky6WfO6+BGMj2mCJsw7qKnfQONur2b+pGn8jeTiC+WAUOthZOnaK+HkX5wiU6L4uoMF+JIcOVstp25A==", + "dev": true, + "dependencies": { + "jszip": "^3.10.1", + "tmp": "^0.2.1", + "ws": ">=8.13.0" + }, + "engines": { + "node": ">= 14.20.0" + } + }, + "node_modules/selenium-webdriver/node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, + "node_modules/selenium-webdriver/node_modules/ws": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz", + "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/selfsigned": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", @@ -15887,6 +16085,12 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "@testim/chrome-version": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.1.4.tgz", + "integrity": "sha512-kIhULpw9TrGYnHp/8VfdcneIcxKnLixmADtukQRtJUmsVlMg0niMkwV0xZmi8hqa57xqilIHjWFA0GKvEjVU5g==", + "dev": true + }, "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -16135,6 +16339,16 @@ "@types/node": "*" } }, + "@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "dev": true, + "optional": true, + "requires": { + "@types/node": "*" + } + }, "@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -16562,6 +16776,17 @@ "postcss-value-parser": "^4.2.0" } }, + "axios": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", + "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "dev": true, + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "babel-loader": { "version": "9.1.3", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", @@ -16770,6 +16995,12 @@ "ieee754": "^1.1.13" } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true + }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -17024,6 +17255,12 @@ "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==" }, + "compare-versions": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.0.tgz", + "integrity": "sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==", + "dev": true + }, "compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", @@ -17438,6 +17675,12 @@ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -17615,6 +17858,15 @@ } } }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "engine.io": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.3.tgz", @@ -17974,6 +18226,29 @@ "tmp": "^0.0.33" } }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -18015,6 +18290,15 @@ "websocket-driver": ">=0.5.1" } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -18757,6 +19041,12 @@ "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", "dev": true }, + "ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "dev": true + }, "ipaddr.js": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz", @@ -18865,6 +19155,12 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "is-url": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", + "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", + "dev": true + }, "is-what": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", @@ -18880,6 +19176,17 @@ "is-docker": "^2.0.0" } }, + "is2": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/is2/-/is2-2.0.9.tgz", + "integrity": "sha512-rZkHeBn9Zzq52sd9IUIV3a5mfwBY+o2HePMh0wkGBM4z4qjvy2GwVxQ6nNXSfw6MmVP6gf1QIlWjiOavhM3x5g==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "ip-regex": "^4.1.0", + "is-url": "^1.2.4" + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -20505,6 +20812,12 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true + }, "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -20737,6 +21050,12 @@ } } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -21183,6 +21502,35 @@ "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", "dev": true }, + "selenium-webdriver": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.12.0.tgz", + "integrity": "sha512-zvPzmTsky6WfO6+BGMj2mCJsw7qKnfQONur2b+pGn8jeTiC+WAUOthZOnaK+HkX5wiU6L4uoMF+JIcOVstp25A==", + "dev": true, + "requires": { + "jszip": "^3.10.1", + "tmp": "^0.2.1", + "ws": ">=8.13.0" + }, + "dependencies": { + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + } + }, + "ws": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz", + "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==", + "dev": true, + "requires": {} + } + } + }, "selfsigned": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", @@ -21769,6 +22117,27 @@ } } }, + "tcp-port-used": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tcp-port-used/-/tcp-port-used-1.0.2.tgz", + "integrity": "sha512-l7ar8lLUD3XS1V2lfoJlCBaeoaWo/2xfYt81hM7VlvR4RrMVFqfmzfhLVk40hAb368uitje5gPtBRL1m/DGvLA==", + "dev": true, + "requires": { + "debug": "4.3.1", + "is2": "^2.0.6" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + } + } + }, "terser": { "version": "5.22.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz", diff --git a/ui/src/app/components/add-index-form/add-index-form.component.spec.ts b/ui/src/app/components/add-index-form/add-index-form.component.spec.ts index 6828502c8..ca5e8ef6f 100644 --- a/ui/src/app/components/add-index-form/add-index-form.component.spec.ts +++ b/ui/src/app/components/add-index-form/add-index-form.component.spec.ts @@ -1,4 +1,14 @@ +import { HttpClientModule } from '@angular/common/http'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AddIndexFormComponent } from './add-index-form.component'; @@ -8,7 +18,8 @@ describe('AddIndexFormComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ AddIndexFormComponent ] + declarations: [ AddIndexFormComponent ], + imports: [ReactiveFormsModule, HttpClientModule, MatSnackBarModule, MatSelectModule, BrowserAnimationsModule, MatFormFieldModule, MatInputModule] }) .compileComponents(); }); diff --git a/ui/src/app/components/add-new-column/add-new-column.component.spec.ts b/ui/src/app/components/add-new-column/add-new-column.component.spec.ts index 5e658ca23..e1306d86f 100644 --- a/ui/src/app/components/add-new-column/add-new-column.component.spec.ts +++ b/ui/src/app/components/add-new-column/add-new-column.component.spec.ts @@ -1,4 +1,12 @@ +import { HttpClientModule } from '@angular/common/http'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { Dialect } from 'src/app/app.constants'; import { AddNewColumnComponent } from './add-new-column.component'; @@ -8,14 +16,29 @@ describe('AddNewColumnComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ AddNewColumnComponent ] + declarations: [AddNewColumnComponent], + imports: [ReactiveFormsModule, HttpClientModule, MatSnackBarModule, MatDialogModule, MatSelectModule, MatInputModule, BrowserAnimationsModule], + providers: [ + { + provide: MatDialogRef, + useValue: { + close: () => { }, + }, + }, + { + provide: MAT_DIALOG_DATA, + useValue: {} + } + ], }) - .compileComponents(); + .compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(AddNewColumnComponent); component = fixture.componentInstance; + component.dialect = Dialect.GoogleStandardSQLDialect; + console.log(component.datatypes) fixture.detectChanges(); }); diff --git a/ui/src/app/components/add-new-column/add-new-column.component.ts b/ui/src/app/components/add-new-column/add-new-column.component.ts index 66035a703..5c3904444 100644 --- a/ui/src/app/components/add-new-column/add-new-column.component.ts +++ b/ui/src/app/components/add-new-column/add-new-column.component.ts @@ -2,11 +2,9 @@ import { Component, Inject, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { ColLength, DataTypes, Dialect } from 'src/app/app.constants'; -import { IColumn, ISpannerDetails } from 'src/app/model/conv'; import { IAddColumnProps } from 'src/app/model/edit-table'; import { IAddColumn } from 'src/app/model/update-table'; import { DataService } from 'src/app/services/data/data.service'; -import { TargetDetailsFormComponent } from '../target-details-form/target-details-form.component'; @Component({ selector: 'app-add-new-column', templateUrl: './add-new-column.component.html', @@ -24,13 +22,13 @@ export class AddNewColumnComponent implements OnInit { constructor( private formBuilder: FormBuilder, private dataService: DataService, - private dialogRef: MatDialogRef, + private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: IAddColumnProps) { this.dialect = data.dialect this.tableId = data.tableId this.addNewColumnForm = this.formBuilder.group({ name: ['', [Validators.required, Validators.minLength(1), Validators.maxLength(128), Validators.pattern('^[a-zA-Z][a-zA-Z0-9_]*$')]], - datatype: [], + datatype: ['', Validators.required], length: ['',Validators.pattern('^[0-9]+$')], isNullable: [], }) diff --git a/ui/src/app/components/add-shard-id-primary-key/add-shard-id-primary-key.component.spec.ts b/ui/src/app/components/add-shard-id-primary-key/add-shard-id-primary-key.component.spec.ts index 39c17263a..719c97564 100644 --- a/ui/src/app/components/add-shard-id-primary-key/add-shard-id-primary-key.component.spec.ts +++ b/ui/src/app/components/add-shard-id-primary-key/add-shard-id-primary-key.component.spec.ts @@ -1,4 +1,9 @@ +import { HttpClientModule } from '@angular/common/http'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AddShardIdPrimaryKeyComponent } from './add-shard-id-primary-key.component'; @@ -8,7 +13,8 @@ describe('AddShardIdPrimaryKeyComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ AddShardIdPrimaryKeyComponent ] + declarations: [ AddShardIdPrimaryKeyComponent ], + imports: [ReactiveFormsModule, HttpClientModule, MatSnackBarModule, MatSelectModule, BrowserAnimationsModule] }) .compileComponents(); }); diff --git a/ui/src/app/components/bulk-drop-restore-table-dialog/bulk-drop-restore-table-dialog.component.spec.ts b/ui/src/app/components/bulk-drop-restore-table-dialog/bulk-drop-restore-table-dialog.component.spec.ts index 9ac79bf15..a36a594a2 100644 --- a/ui/src/app/components/bulk-drop-restore-table-dialog/bulk-drop-restore-table-dialog.component.spec.ts +++ b/ui/src/app/components/bulk-drop-restore-table-dialog/bulk-drop-restore-table-dialog.component.spec.ts @@ -1,4 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; +import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { BulkDropRestoreTableDialogComponent } from './bulk-drop-restore-table-dialog.component'; @@ -8,7 +10,26 @@ describe('BulkDropRestoreTableDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ BulkDropRestoreTableDialogComponent ] + declarations: [ BulkDropRestoreTableDialogComponent ], + imports: [MatDialogModule, ReactiveFormsModule], + providers: [ + { + provide: MatDialogRef, + useValue: { + close: () => {}, + }, + }, + { + provide: MAT_DIALOG_DATA, + useValue: { + tables: [ + { TableName: 'Table1', isDeleted: false }, + { TableName: 'Table2', isDeleted: true }, + ], + operation: 'SKIP' + } + } + ], }) .compileComponents(); }); @@ -22,4 +43,22 @@ describe('BulkDropRestoreTableDialogComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should create a confirmation input control with the correct pattern', () => { + // Test the confirmationInput control creation + expect(component.confirmationInput instanceof FormControl).toBe(true); + expect(component.confirmationInput.valid).toBe(false); // Confirm it's invalid initially + expect(component.confirmationInput.hasError('required')).toBe(true); // Confirm it requires a value + // Test the pattern validation + component.confirmationInput.setValue('SKIP'); + expect(component.confirmationInput.valid).toBe(true); // Confirm it's valid with 'SKIP' + component.confirmationInput.setValue('INVALID_VALUE'); + expect(component.confirmationInput.valid).toBe(false); // Confirm it's invalid with an invalid value + }); + + it('should initialize eligible and ineligible tables based on the provided data', () => { + // Test the initialization of eligible and ineligible tables + expect(component.eligibleTables).toEqual(['Table1']); + expect(component.ineligibleTables).toEqual(['Table2']); + }); }); diff --git a/ui/src/app/components/connection-profile-form/connection-profile-form.component.spec.ts b/ui/src/app/components/connection-profile-form/connection-profile-form.component.spec.ts index 61b384483..42d693f89 100644 --- a/ui/src/app/components/connection-profile-form/connection-profile-form.component.spec.ts +++ b/ui/src/app/components/connection-profile-form/connection-profile-form.component.spec.ts @@ -1,4 +1,11 @@ +import { HttpClientModule } from '@angular/common/http'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatInputModule } from '@angular/material/input'; +import { MatRadioModule } from '@angular/material/radio'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ConnectionProfileFormComponent } from './connection-profile-form.component'; @@ -8,7 +15,21 @@ describe('ConnectionProfileFormComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ ConnectionProfileFormComponent ] + declarations: [ ConnectionProfileFormComponent ], + imports: [HttpClientModule, MatSnackBarModule, ReactiveFormsModule, MatRadioModule, MatInputModule, BrowserAnimationsModule], + providers: [ + { + provide: MatDialogRef, + useValue: { + close: () => {}, + }, + }, + { + provide: MAT_DIALOG_DATA, + useValue: { + } + } + ], }) .compileComponents(); }); @@ -16,6 +37,7 @@ describe('ConnectionProfileFormComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(ConnectionProfileFormComponent); component = fixture.componentInstance; + component.isSource = true fixture.detectChanges(); }); diff --git a/ui/src/app/components/database-loader/database-loader.component.spec.ts b/ui/src/app/components/database-loader/database-loader.component.spec.ts index 935c5c26e..1cb2cf5c9 100644 --- a/ui/src/app/components/database-loader/database-loader.component.spec.ts +++ b/ui/src/app/components/database-loader/database-loader.component.spec.ts @@ -1,6 +1,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; - +import { RouterModule, Routes } from '@angular/router'; +import { WorkspaceComponent } from '../workspace/workspace.component'; import { DatabaseLoaderComponent } from './database-loader.component'; +const appRoutes: Routes = [{ path: 'workspace', component: WorkspaceComponent }] describe('DatabaseLoaderComponent', () => { let component: DatabaseLoaderComponent; @@ -8,7 +10,8 @@ describe('DatabaseLoaderComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ DatabaseLoaderComponent ] + declarations: [ DatabaseLoaderComponent ], + imports: [RouterModule.forRoot(appRoutes),] }) .compileComponents(); }); diff --git a/ui/src/app/components/dataflow-form/dataflow-form.component.spec.ts b/ui/src/app/components/dataflow-form/dataflow-form.component.spec.ts index 6216df122..92869e167 100644 --- a/ui/src/app/components/dataflow-form/dataflow-form.component.spec.ts +++ b/ui/src/app/components/dataflow-form/dataflow-form.component.spec.ts @@ -1,4 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { DataflowFormComponent } from './dataflow-form.component'; @@ -8,7 +9,20 @@ describe('DataflowFormComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ DataflowFormComponent ] + declarations: [ DataflowFormComponent ], + providers: [ + { + provide: MatDialogRef, + useValue: { + close: () => {}, + }, + }, + { + provide: MAT_DIALOG_DATA, + useValue: { + } + } + ], }) .compileComponents(); }); diff --git a/ui/src/app/components/direct-connection/direct-connection.component.html b/ui/src/app/components/direct-connection/direct-connection.component.html index 0f14a4584..598ff6cac 100644 --- a/ui/src/app/components/direct-connection/direct-connection.component.html +++ b/ui/src/app/components/direct-connection/direct-connection.component.html @@ -1,11 +1,11 @@ -
+

Connect to Source Database

Database Engine - + {{ element.displayName }} @@ -38,34 +38,34 @@

Connection Detail

Hostname - + Port - + Only numbers are allowed.
User name - + Password - +
Database Name - +

Spanner Dialect

Select a spanner dialect - + {{ element.displayName }} @@ -76,7 +76,7 @@

Spanner Dialect

matTooltipPosition="above"> check_circle -