2023-05-22 12:22:28 +00:00
|
|
|
import { fake } from "Fixtures/fake";
|
2023-02-09 05:18:20 +00:00
|
|
|
import { postgreSqlSelector } from "Selectors/postgreSql";
|
|
|
|
|
import { postgreSqlText } from "Texts/postgreSql";
|
2023-05-15 04:18:09 +00:00
|
|
|
import { commonWidgetText, commonText } from "Texts/common";
|
2023-02-09 05:18:20 +00:00
|
|
|
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
|
2023-05-22 12:22:28 +00:00
|
|
|
import { deleteDatasource, closeDSModal } from "Support/utils/dataSource";
|
2023-05-15 04:18:09 +00:00
|
|
|
|
2023-02-09 05:18:20 +00:00
|
|
|
import {
|
|
|
|
|
addQuery,
|
|
|
|
|
fillDataSourceTextField,
|
|
|
|
|
fillConnectionForm,
|
|
|
|
|
selectDataSource,
|
|
|
|
|
openQueryEditor,
|
|
|
|
|
selectQueryMode,
|
|
|
|
|
addGuiQuery,
|
|
|
|
|
addWidgetsToAddUser,
|
|
|
|
|
} from "Support/utils/postgreSql";
|
|
|
|
|
|
2023-05-22 12:22:28 +00:00
|
|
|
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", () => {
|
2023-05-15 04:18:09 +00:00
|
|
|
cy.get(commonSelectors.globalDataSourceIcon).click();
|
|
|
|
|
closeDSModal();
|
|
|
|
|
cy.get(commonSelectors.addNewDataSourceButton)
|
|
|
|
|
.verifyVisibleElement("have.text", commonText.addNewDataSourceButton)
|
2023-02-09 05:18:20 +00:00
|
|
|
.click();
|
|
|
|
|
|
|
|
|
|
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.allDataSources
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.allDatabase
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.apiLabelAndCount).should(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.allApis
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.allCloudStorage
|
|
|
|
|
);
|
|
|
|
|
|
2023-05-15 04:18:09 +00:00
|
|
|
cy.get(postgreSqlSelector.dataSourceSearchInputField).type("SQL Server");
|
|
|
|
|
cy.get("[data-cy*='data-source-']").eq(1).should("contain", "SQL Server");
|
2023-02-09 05:18:20 +00:00
|
|
|
cy.get('[data-cy="data-source-sql server"]').click();
|
|
|
|
|
|
|
|
|
|
cy.get(postgreSqlSelector.dataSourceNameInputField).should(
|
|
|
|
|
"have.value",
|
|
|
|
|
"SQL Server"
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.labelHost
|
|
|
|
|
);
|
|
|
|
|
cy.get('[data-cy="label-instance"]').verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
"Instance"
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.labelPort).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.labelPort
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.labelDbName).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.labelDbName
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.labelUserName
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.labelPassword).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
"Password"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
cy.get('[data-cy="label-azure"]').verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
"Azure"
|
|
|
|
|
);
|
|
|
|
|
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
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.buttonTextSave
|
|
|
|
|
);
|
2023-05-15 04:18:09 +00:00
|
|
|
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
|
2023-02-09 05:18:20 +00:00
|
|
|
"have.text",
|
2023-05-15 04:18:09 +00:00
|
|
|
"Failed to connect to localhost:1433 - Could not connect (sequence)"
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("Should verify the functionality of PostgreSQL connection form.", () => {
|
|
|
|
|
selectDataSource("SQL Server");
|
|
|
|
|
|
|
|
|
|
cy.clearAndType(
|
|
|
|
|
'[data-cy="data-source-name-input-filed"]',
|
2023-05-22 12:22:28 +00:00
|
|
|
`cypress-${data.lastName}-sqlserver`
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
fillDataSourceTextField(
|
|
|
|
|
postgreSqlText.labelHost,
|
|
|
|
|
postgreSqlText.placeholderEnterHost,
|
2023-03-06 06:43:47 +00:00
|
|
|
Cypress.env("sqlserver_host")
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
fillDataSourceTextField(
|
|
|
|
|
"Instance",
|
|
|
|
|
"Enter the name of the database instance",
|
2023-03-06 06:43:47 +00:00
|
|
|
Cypress.env("sqlserver_instance")
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
fillDataSourceTextField(
|
|
|
|
|
postgreSqlText.labelPort,
|
|
|
|
|
postgreSqlText.placeholderEnterPort,
|
2023-03-06 06:43:47 +00:00
|
|
|
"1433"
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
fillDataSourceTextField(
|
|
|
|
|
postgreSqlText.labelDbName,
|
|
|
|
|
postgreSqlText.placeholderNameOfDB,
|
2023-03-06 06:43:47 +00:00
|
|
|
Cypress.env("sqlserver_db")
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
fillDataSourceTextField(
|
|
|
|
|
postgreSqlText.labelUserName,
|
|
|
|
|
postgreSqlText.placeholderEnterUserName,
|
2023-03-06 06:43:47 +00:00
|
|
|
Cypress.env("sqlserver_user")
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
cy.get(postgreSqlSelector.passwordTextField).type(
|
2023-03-06 06:43:47 +00:00
|
|
|
Cypress.env("sqlserver_password")
|
2023-02-09 05:18:20 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
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.toastDSAdded
|
|
|
|
|
);
|
|
|
|
|
|
2023-05-22 12:22:28 +00:00
|
|
|
cy.get(commonSelectors.globalDataSourceIcon).click();
|
|
|
|
|
cy.get(
|
|
|
|
|
`[data-cy="cypress-${data.lastName}-sqlserver-button"]`
|
|
|
|
|
).verifyVisibleElement("have.text", `cypress-${data.lastName}-sqlserver`);
|
|
|
|
|
deleteDatasource(`cypress-${data.lastName}-sqlserver`);
|
2023-02-09 05:18:20 +00:00
|
|
|
});
|
|
|
|
|
});
|