diff --git a/app/client/cypress/fixtures/datasources.json b/app/client/cypress/fixtures/datasources.json index a8597fa6c4..487f2b6ffb 100644 --- a/app/client/cypress/fixtures/datasources.json +++ b/app/client/cypress/fixtures/datasources.json @@ -15,6 +15,21 @@ "mysql-databaseName": "fakeapi", "mysql-username": "root", "mysql-password": "root123", + "mssql-host": "localhost", + "mssql-port": 1433, + "mssql-databaseName": "fakeapi", + "mssql-username": "SA", + "mssql-password": "Root$123", + "arango-host": "localhost", + "arango-port": 8529, + "arango-databaseName": "fakeapi", + "arango-username": "root", + "arango-password": "Arango$123", + "redshift-host": "localhost", + "redshift-port": 5439, + "redshift-databaseName": "fakeapi", + "redshift-username": "root", + "redshift-password": "Redshift$123", "restapi-url": "https://my-json-server.typicode.com/typicode/demo/posts", "mongo-defaultDatabaseName": "sample_airbnb", "connection-type": "Replica set", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/ArangoDataSourceStub_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/ArangoDataSourceStub_spec.js new file mode 100644 index 0000000000..c2613abf8d --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/ArangoDataSourceStub_spec.js @@ -0,0 +1,68 @@ +const datasource = require("../../../../locators/DatasourcesEditor.json"); +const queryEditor = require("../../../../locators/QueryEditor.json"); +const datasourceEditor = require("../../../../locators/DatasourcesEditor.json"); + +let datasourceName; + +describe("Arango datasource test cases", function() { + beforeEach(() => { + cy.startRoutesForDatasource(); + }); + + it("Create, test, save then delete a Arango datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.ArangoDB).click(); + cy.getPluginFormsAndCreateDatasource(); + + cy.fillArangoDBDatasourceForm(); + cy.generateUUID().then((UUID) => { + datasourceName = `Arango MOCKDS ${UUID}`; + cy.renameDatasource(datasourceName); + }); + + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create with trailing white spaces in host address and database name, test, save then delete a Arango datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.ArangoDB).click(); + cy.getPluginFormsAndCreateDatasource(); + cy.fillArangoDBDatasourceForm(true); + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create a new query from the datasource editor", function() { + cy.saveDatasource(); + // cy.get(datasource.createQuerty).click(); + cy.get(`${datasourceEditor.datasourceCard} ${datasource.createQuerty}`) + .last() + .click(); + cy.wait("@createNewApi").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + + cy.get(queryEditor.queryMoreAction).click(); + cy.get(queryEditor.deleteUsingContext).click(); + cy.wait("@deleteAction").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + + cy.deleteDatasource(datasourceName); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MsSQLDataSourceStub_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MsSQLDataSourceStub_spec.js new file mode 100644 index 0000000000..67d54195cc --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MsSQLDataSourceStub_spec.js @@ -0,0 +1,68 @@ +const datasource = require("../../../../locators/DatasourcesEditor.json"); +const queryEditor = require("../../../../locators/QueryEditor.json"); +const datasourceEditor = require("../../../../locators/DatasourcesEditor.json"); + +let datasourceName; + +describe("MsSQL datasource test cases", function() { + beforeEach(() => { + cy.startRoutesForDatasource(); + }); + + it("Create, test, save then delete a MsSQL datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.MsSQL).click(); + cy.getPluginFormsAndCreateDatasource(); + + cy.fillMsSQLDatasourceForm(); + cy.generateUUID().then((UUID) => { + datasourceName = `MsSQL MOCKDS ${UUID}`; + cy.renameDatasource(datasourceName); + }); + + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create with trailing white spaces in host address and database name, test, save then delete a MsSQL datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.MsSQL).click(); + cy.getPluginFormsAndCreateDatasource(); + cy.fillMsSQLDatasourceForm(true); + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create a new query from the datasource editor", function() { + cy.saveDatasource(); + // cy.get(datasource.createQuerty).click(); + cy.get(`${datasourceEditor.datasourceCard} ${datasource.createQuerty}`) + .last() + .click(); + cy.wait("@createNewApi").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + + cy.get(queryEditor.queryMoreAction).click(); + cy.get(queryEditor.deleteUsingContext).click(); + cy.wait("@deleteAction").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + + cy.deleteDatasource(datasourceName); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLDataSourceStub_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLDataSourceStub_spec.js new file mode 100644 index 0000000000..c5f6368e74 --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLDataSourceStub_spec.js @@ -0,0 +1,68 @@ +const datasource = require("../../../../locators/DatasourcesEditor.json"); +const queryEditor = require("../../../../locators/QueryEditor.json"); +const datasourceEditor = require("../../../../locators/DatasourcesEditor.json"); + +let datasourceName; + +describe("MySQL datasource test cases", function() { + beforeEach(() => { + cy.startRoutesForDatasource(); + }); + + it("Create, test, save then delete a MySQL datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.MySQL).click(); + cy.getPluginFormsAndCreateDatasource(); + + cy.fillMySQLDatasourceForm(); + cy.generateUUID().then((UUID) => { + datasourceName = `MySQL MOCKDS ${UUID}`; + cy.renameDatasource(datasourceName); + }); + + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create with trailing white spaces in host address and database name, test, save then delete a MySQL datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.MySQL).click(); + cy.getPluginFormsAndCreateDatasource(); + cy.fillMySQLDatasourceForm(true); + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create a new query from the datasource editor", function() { + cy.saveDatasource(); + // cy.get(datasource.createQuerty).click(); + cy.get(`${datasourceEditor.datasourceCard} ${datasource.createQuerty}`) + .last() + .click(); + cy.wait("@createNewApi").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + + cy.get(queryEditor.queryMoreAction).click(); + cy.get(queryEditor.deleteUsingContext).click(); + cy.wait("@deleteAction").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + + cy.deleteDatasource(datasourceName); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/RedshiftDataSourceStub_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/RedshiftDataSourceStub_spec.js new file mode 100644 index 0000000000..a4f037050e --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/RedshiftDataSourceStub_spec.js @@ -0,0 +1,68 @@ +const datasource = require("../../../../locators/DatasourcesEditor.json"); +const queryEditor = require("../../../../locators/QueryEditor.json"); +const datasourceEditor = require("../../../../locators/DatasourcesEditor.json"); + +let datasourceName; + +describe("Redshift datasource test cases", function() { + beforeEach(() => { + cy.startRoutesForDatasource(); + }); + + it("Create, test, save then delete a Redshift datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.Redshift).click(); + cy.getPluginFormsAndCreateDatasource(); + + cy.fillRedshiftDatasourceForm(); + cy.generateUUID().then((UUID) => { + datasourceName = `Redshift MOCKDS ${UUID}`; + cy.renameDatasource(datasourceName); + }); + + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create with trailing white spaces in host address and database name, test, save then delete a Redshift datasource", function() { + cy.NavigateToDatasourceEditor(); + cy.get(datasource.Redshift).click(); + cy.getPluginFormsAndCreateDatasource(); + cy.fillRedshiftDatasourceForm(true); + cy.get("@createDatasource").then((httpResponse) => { + datasourceName = httpResponse.response.body.data.name; + }); + cy.intercept("POST", "/api/v1/datasources/test", { + fixture: "testAction.json", + }).as("testDatasource"); + cy.testSaveDatasource(); + }); + + it("Create a new query from the datasource editor", function() { + cy.saveDatasource(); + // cy.get(datasource.createQuerty).click(); + cy.get(`${datasourceEditor.datasourceCard} ${datasource.createQuerty}`) + .last() + .click(); + cy.wait("@createNewApi").should( + "have.nested.property", + "response.body.responseMeta.status", + 201, + ); + + cy.get(queryEditor.queryMoreAction).click(); + cy.get(queryEditor.deleteUsingContext).click(); + cy.wait("@deleteAction").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + + cy.deleteDatasource(datasourceName); + }); +}); diff --git a/app/client/cypress/locators/DatasourcesEditor.json b/app/client/cypress/locators/DatasourcesEditor.json index 54476e1426..1398eafb66 100644 --- a/app/client/cypress/locators/DatasourcesEditor.json +++ b/app/client/cypress/locators/DatasourcesEditor.json @@ -31,6 +31,7 @@ "DynamoDB": ".t--plugin-name:contains('DynamoDB')", "Redis": ".t--plugin-name:contains('Redis')", "MsSQL": ".t--plugin-name:contains('MsSQL')", + "ArangoDB": ".t--plugin-name:contains('ArangoDB')", "Firestore": ".t--plugin-name:contains('Firestore')", "Redshift": ".t--plugin-name:contains('Redshift')", "AmazonS3": ".t--plugin-name:contains('S3')", diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index f0e91871ae..01c7b45620 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -2078,6 +2078,84 @@ Cypress.Commands.add( }, ); +Cypress.Commands.add( + "fillMsSQLDatasourceForm", + (shouldAddTrailingSpaces = false) => { + const hostAddress = shouldAddTrailingSpaces + ? datasourceFormData["mssql-host"] + " " + : datasourceFormData["mssql-host"]; + const databaseName = shouldAddTrailingSpaces + ? datasourceFormData["mssql-databaseName"] + " " + : datasourceFormData["mssql-databaseName"]; + + cy.get(datasourceEditor.host).type(hostAddress); + cy.get(datasourceEditor.port).type(datasourceFormData["mssql-port"]); + cy.get(datasourceEditor.databaseName) + .clear() + .type(databaseName); + + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.get(datasourceEditor.username).type( + datasourceFormData["mssql-username"], + ); + cy.get(datasourceEditor.password).type( + datasourceFormData["mssql-password"], + ); + }, +); + +Cypress.Commands.add( + "fillArangoDBDatasourceForm", + (shouldAddTrailingSpaces = false) => { + const hostAddress = shouldAddTrailingSpaces + ? datasourceFormData["arango-host"] + " " + : datasourceFormData["arango-host"]; + const databaseName = shouldAddTrailingSpaces + ? datasourceFormData["arango-databaseName"] + " " + : datasourceFormData["arango-databaseName"]; + + cy.get(datasourceEditor.host).type(hostAddress); + cy.get(datasourceEditor.port).type(datasourceFormData["arango-port"]); + cy.get(datasourceEditor.databaseName) + .clear() + .type(databaseName); + + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.get(datasourceEditor.username).type( + datasourceFormData["arango-username"], + ); + cy.get(datasourceEditor.password).type( + datasourceFormData["arango-password"], + ); + }, +); + +Cypress.Commands.add( + "fillRedshiftDatasourceForm", + (shouldAddTrailingSpaces = false) => { + const hostAddress = shouldAddTrailingSpaces + ? datasourceFormData["redshift-host"] + " " + : datasourceFormData["redshift-host"]; + const databaseName = shouldAddTrailingSpaces + ? datasourceFormData["redshift-databaseName"] + " " + : datasourceFormData["redshift-databaseName"]; + + cy.get(datasourceEditor.host).type(hostAddress); + cy.get(datasourceEditor.port).type(datasourceFormData["redshift-port"]); + cy.get(datasourceEditor.databaseName) + .clear() + .type(databaseName); + + cy.get(datasourceEditor.sectionAuthentication).click(); + cy.get(datasourceEditor.username).type( + datasourceFormData["redshift-username"], + ); + cy.get(datasourceEditor.password).type( + datasourceFormData["redshift-password"], + ); + }, +); + Cypress.Commands.add( "fillUsersMockDatasourceForm", (shouldAddTrailingSpaces = false) => {