ToolJet/cypress-tests/cypress/e2e/editor/data-source/rethinkDbHappyPath.cy.skip.js

148 lines
4.2 KiB
JavaScript
Raw Normal View History

import { fake } from "Fixtures/fake";
2023-02-09 05:18:20 +00:00
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText, commonText } from "Texts/common";
2023-02-09 05:18:20 +00:00
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addQuery,
fillDataSourceTextField,
fillConnectionForm,
selectAndAddDataSource,
2023-02-09 05:18:20 +00:00
openQueryEditor,
selectQueryMode,
addGuiQuery,
addWidgetsToAddUser,
} from "Support/utils/postgreSql";
const data = {};
data.lastName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
2023-02-09 05:18:20 +00:00
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
});
it("Should verify elements on connection form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.reload();
2023-02-09 05:18:20 +00:00
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
2023-02-09 05:18:20 +00:00
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
2023-02-09 05:18:20 +00:00
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", "RethinkDB", data.lastName);
2023-02-09 05:18:20 +00:00
cy.get('[data-cy="label-database"]').verifyVisibleElement(
"have.text",
"Database"
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
postgreSqlText.labelHost
);
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
"have.text",
postgreSqlText.labelUserName
);
cy.get(postgreSqlSelector.labelPassword).verifyVisibleElement(
"have.text",
"Password"
);
cy.get(postgreSqlSelector.labelPort).verifyVisibleElement(
"have.text",
postgreSqlText.labelPort
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText).verifyVisibleElement(
"have.text",
postgreSqlText.couldNotConnect
);
2023-02-09 05:18:20 +00:00
cy.get(postgreSqlSelector.dangerAlertNotSupportSSL).verifyVisibleElement(
"have.text",
"Could not connect to localhost:28015.connect ECONNREFUSED ::1:28015"
2023-02-09 05:18:20 +00:00
);
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextSave
);
2023-02-09 05:18:20 +00:00
});
it("Should verify the functionality of RethinkDB connection form.", () => {
selectAndAddDataSource("databases", "RethinkDB", data.lastName);
2023-02-09 05:18:20 +00:00
fillDataSourceTextField(
postgreSqlText.labelHost,
postgreSqlText.placeholderEnterHost,
Cypress.env("pg_host")
);
fillDataSourceTextField(
postgreSqlText.labelPort,
postgreSqlText.placeholderEnterPort,
"5432"
);
fillDataSourceTextField(
postgreSqlText.labelDbName,
postgreSqlText.placeholderNameOfDB,
"postgres"
);
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,
"postgres"
);
cy.get(postgreSqlSelector.passwordTextField).type(
Cypress.env("pg_password")
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
2023-02-09 05:18:20 +00:00
);
cy.get(postgreSqlSelector.datasourceLabelOnList)
.should("have.text", postgreSqlText.psqlName)
.find("button")
.should("be.visible");
});
});