test: Added stub tests for MySQL, MsSQL, ArangoDB and Redshift (#6868)
* Added stub testcases for MySQL, MsSQL, ArangoDB and Redshift * Removed intercept for saveDatasource
This commit is contained in:
parent
e57755e426
commit
b8d9e68106
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
@ -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')",
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user