Tests for datasource pane
This commit is contained in:
parent
2e7c569997
commit
00bcaf2022
|
|
@ -0,0 +1,49 @@
|
|||
describe("Create, test, save then delete a mongo datasource", function() {
|
||||
it("Create, test, save then delete a mongo datasource", function() {
|
||||
cy.NavigateToDatasourceEditor();
|
||||
cy.get("@getPlugins").then(httpResponse => {
|
||||
// console.log(response, "response");
|
||||
const pluginName = httpResponse.response.body.data.find(
|
||||
plugin => plugin.packageName === "mongo-plugin",
|
||||
).name;
|
||||
|
||||
cy.get(".t--plugin-name")
|
||||
.contains(pluginName)
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.getPluginFormsAndCreateDatasource();
|
||||
|
||||
cy.get(`input[name="datasourceConfiguration.endpoints[0].host"]`).type(
|
||||
"ds119422.mlab.com",
|
||||
);
|
||||
cy.get(`input[name="datasourceConfiguration.endpoints[0].port"]`).type(
|
||||
19422,
|
||||
);
|
||||
cy.get(`input[name="datasourceConfiguration.authentication.databaseName"]`)
|
||||
.clear()
|
||||
.type("heroku_bcmprc4k");
|
||||
cy.get(
|
||||
`input[name="datasourceConfiguration.authentication.username"]`,
|
||||
).type("akash");
|
||||
cy.get(
|
||||
`input[name="datasourceConfiguration.authentication.password"]`,
|
||||
).type("123wheel");
|
||||
|
||||
cy.get(
|
||||
"[data-cy=datasourceConfiguration\\.authentication\\.authType]",
|
||||
).click();
|
||||
cy.contains("SCRAM-SHA-256").click({
|
||||
force: true,
|
||||
});
|
||||
|
||||
cy.get(
|
||||
"[data-cy=datasourceConfiguration\\.connection\\.ssl\\.authType]",
|
||||
).click();
|
||||
cy.contains("No SSL").click({
|
||||
force: true,
|
||||
});
|
||||
|
||||
cy.testSaveDeleteDatasource();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
describe("Create, test, save then delete a postgres datasource", function() {
|
||||
it("Create, test, save then delete a postgres datasource", function() {
|
||||
cy.NavigateToDatasourceEditor();
|
||||
cy.get("@getPlugins").then(httpResponse => {
|
||||
// console.log(response, "response");
|
||||
const pluginName = httpResponse.response.body.data.find(
|
||||
plugin => plugin.packageName === "postgres-plugin",
|
||||
).name;
|
||||
|
||||
cy.get(".t--plugin-name")
|
||||
.contains(pluginName)
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.getPluginFormsAndCreateDatasource();
|
||||
|
||||
cy.get(`input[name="datasourceConfiguration.endpoints[0].host"]`).type(
|
||||
"appsmith-test-db.cgg2px8dsrli.ap-south-1.rds.amazonaws.com",
|
||||
);
|
||||
cy.get(`input[name="datasourceConfiguration.endpoints[0].port"]`).type(
|
||||
5432,
|
||||
);
|
||||
cy.get(`input[name="datasourceConfiguration.authentication.databaseName"]`)
|
||||
.clear()
|
||||
.type("postgres");
|
||||
cy.get(
|
||||
`input[name="datasourceConfiguration.authentication.username"]`,
|
||||
).type("postgres");
|
||||
cy.get(
|
||||
`input[name="datasourceConfiguration.authentication.password"]`,
|
||||
).type("qwerty1234");
|
||||
|
||||
cy.testSaveDeleteDatasource();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
describe("Create, test, save then delete a restapi datasource", function() {
|
||||
it("Create, test, save then delete a restapi datasource", function() {
|
||||
cy.NavigateToDatasourceEditor();
|
||||
cy.get("@getPlugins").then(httpResponse => {
|
||||
// console.log(response, "response");
|
||||
const pluginName = httpResponse.response.body.data.find(
|
||||
plugin => plugin.packageName === "restapi-plugin",
|
||||
).name;
|
||||
|
||||
cy.get(".t--plugin-name")
|
||||
.contains(pluginName)
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.getPluginFormsAndCreateDatasource();
|
||||
|
||||
cy.get(`input[name="datasourceConfiguration.url"]`).type(
|
||||
"https://my-json-server.typicode.com/typicode/demo/posts",
|
||||
);
|
||||
|
||||
cy.testSaveDeleteDatasource();
|
||||
});
|
||||
});
|
||||
3
app/client/cypress/locators/DatasourcesEditor.json
Normal file
3
app/client/cypress/locators/DatasourcesEditor.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"datasourceEditorIcon": ".t--nav-link-datasource-editor"
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
const loginPage = require("../locators/LoginPage.json");
|
||||
const homePage = require("../locators/HomePage.json");
|
||||
const pages = require("../locators/Pages.json");
|
||||
const datasourceEditor = require("../locators/DatasourcesEditor.json");
|
||||
const commonlocators = require("../locators/commonlocators.json");
|
||||
const modalWidgetPage = require("../locators/ModalWidget.json");
|
||||
const widgetsPage = require("../locators/Widgets.json");
|
||||
|
|
@ -228,6 +229,24 @@ Cypress.Commands.add("addDsl", dsl => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToDatasourceEditor", () => {
|
||||
cy.get(datasourceEditor.datasourceEditorIcon).click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("getPluginFormsAndCreateDatasource", () => {
|
||||
cy.wait("@getPluginForm").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
cy.wait("@createDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("NavigateToApiEditor", () => {
|
||||
cy.get(pages.apiEditorIcon).click({ force: true });
|
||||
});
|
||||
|
|
@ -241,6 +260,29 @@ Cypress.Commands.add("testCreateApiButton", () => {
|
|||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("testSaveDeleteDatasource", () => {
|
||||
cy.get(".t--test-datasource").click();
|
||||
cy.wait("@testDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.data.success",
|
||||
true,
|
||||
);
|
||||
|
||||
cy.get(".t--save-datasource").click();
|
||||
cy.wait("@saveDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
|
||||
cy.get(".t--delete-datasource").click();
|
||||
cy.wait("@deleteDatasource").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("testDeleteApi", () => {
|
||||
cy.get(ApiEditor.createBlankApiCard).click({ force: true });
|
||||
cy.wait("@deleteApi").should(
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ before(function() {
|
|||
cy.route("GET", "/api/v1/pages/*").as("getPage");
|
||||
cy.route("GET", "/api/v1/actions*").as("getActions");
|
||||
|
||||
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
||||
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
||||
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
||||
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
||||
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
||||
|
||||
cy.route("GET", "/api/v1/organizations").as("organizations");
|
||||
cy.route("POST", "/api/v1/actions/execute").as("executeAction");
|
||||
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class DropDownControl extends BaseControl<DropDownControlProps> {
|
|||
const { configProperty, options } = this.props;
|
||||
|
||||
return (
|
||||
<DropdownSelect>
|
||||
<DropdownSelect data-cy={configProperty}>
|
||||
<DropdownField
|
||||
placeholder=""
|
||||
name={configProperty}
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ class DatasourceDBEditor extends React.Component<
|
|||
: undefined}
|
||||
<SaveButtonContainer>
|
||||
<ActionButton
|
||||
className="t--delete-datasource"
|
||||
text="Delete"
|
||||
accent="error"
|
||||
loading={isDeleting}
|
||||
|
|
@ -356,12 +357,14 @@ class DatasourceDBEditor extends React.Component<
|
|||
/>
|
||||
|
||||
<ActionButton
|
||||
className="t--test-datasource"
|
||||
text="Test"
|
||||
loading={isTesting}
|
||||
accent="secondary"
|
||||
onClick={this.test}
|
||||
/>
|
||||
<StyledButton
|
||||
className="t--save-datasource"
|
||||
onClick={this.save}
|
||||
text="Save"
|
||||
disabled={this.validate()}
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ class DatasourceHomeScreen extends React.Component<Props> {
|
|||
className="dataSourceImage"
|
||||
alt="Datasource"
|
||||
></img>
|
||||
<p className="textBtn">{plugin.name}</p>
|
||||
<p className="t--plugin-name textBtn">{plugin.name}</p>
|
||||
</Card>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user