2023-05-22 12:22:28 +00:00
|
|
|
import { fake } from "Fixtures/fake";
|
2023-01-17 09:09:38 +00:00
|
|
|
import { postgreSqlSelector } from "Selectors/postgreSql";
|
|
|
|
|
import { postgreSqlText } from "Texts/postgreSql";
|
|
|
|
|
import { bigqueryText } from "Texts/bigquery";
|
|
|
|
|
import { firestoreText } from "Texts/firestore";
|
|
|
|
|
import { commonSelectors } from "Selectors/common";
|
2023-05-22 12:22:28 +00:00
|
|
|
import {
|
|
|
|
|
fillDataSourceTextField,
|
2023-08-28 12:23:11 +00:00
|
|
|
selectAndAddDataSource,
|
2023-05-22 12:22:28 +00:00
|
|
|
} from "Support/utils/postgreSql";
|
2023-05-15 04:18:09 +00:00
|
|
|
import { commonText } from "Texts/common";
|
2023-05-22 12:22:28 +00:00
|
|
|
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
|
|
|
|
|
|
|
|
|
|
const data = {};
|
|
|
|
|
data.lastName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
|
2023-01-17 09:09:38 +00:00
|
|
|
|
|
|
|
|
describe("Data source BigQuery", () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.appUILogin();
|
2023-05-15 04:18:09 +00:00
|
|
|
cy.intercept("GET", "/api/v2/data_sources");
|
2023-01-17 09:09:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("Should verify elements on BigQuery connection form", () => {
|
2023-05-15 04:18:09 +00:00
|
|
|
cy.get(commonSelectors.globalDataSourceIcon).click();
|
2023-05-22 12:22:28 +00:00
|
|
|
closeDSModal();
|
2023-09-04 08:23:22 +00:00
|
|
|
// cy.get(commonSelectors.addNewDataSourceButton)
|
|
|
|
|
// .verifyVisibleElement("have.text", commonText.addNewDataSourceButton)
|
|
|
|
|
// .click();
|
2023-01-17 09:09:38 +00:00
|
|
|
|
|
|
|
|
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
|
|
|
|
|
"have.text",
|
2023-12-28 09:46:16 +00:00
|
|
|
postgreSqlText.allDataSources()
|
2023-01-17 09:09:38 +00:00
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
|
|
|
|
|
"have.text",
|
2023-12-28 09:46:16 +00:00
|
|
|
postgreSqlText.allDatabase()
|
2023-01-17 09:09:38 +00:00
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.apiLabelAndCount).should(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.allApis
|
|
|
|
|
);
|
|
|
|
|
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
|
|
|
|
|
"have.text",
|
|
|
|
|
postgreSqlText.allCloudStorage
|
|
|
|
|
);
|
|
|
|
|
|
2023-09-04 08:23:22 +00:00
|
|
|
selectAndAddDataSource("databases", bigqueryText.bigQuery, data.lastName);
|
2023-01-17 09:09:38 +00:00
|
|
|
|
|
|
|
|
cy.get('[data-cy="label-private-key"]').verifyVisibleElement(
|
|
|
|
|
"have.text",
|
|
|
|
|
firestoreText.labelPrivateKey
|
|
|
|
|
);
|
2023-09-04 08:23:22 +00:00
|
|
|
cy.get(".datasource-edit-btn").should("be.visible");
|
2023-01-17 09:09:38 +00:00
|
|
|
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-01-17 09:09:38 +00:00
|
|
|
"have.text",
|
|
|
|
|
bigqueryText.errorInvalidEmailId
|
|
|
|
|
);
|
2023-09-04 08:23:22 +00:00
|
|
|
deleteDatasource(
|
|
|
|
|
`cypress-${String(data.lastName).toLowerCase()}-${String(
|
|
|
|
|
bigqueryText.bigQuery
|
|
|
|
|
).toLowerCase()}`
|
|
|
|
|
);
|
2023-01-17 09:09:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("Should verify the functionality of BigQuery connection form.", () => {
|
2023-09-04 08:23:22 +00:00
|
|
|
selectAndAddDataSource("databases", bigqueryText.bigQuery, data.lastName);
|
2023-01-17 09:09:38 +00:00
|
|
|
|
|
|
|
|
fillDataSourceTextField(
|
|
|
|
|
firestoreText.privateKey,
|
|
|
|
|
bigqueryText.placehlderPrivateKey,
|
2023-03-06 06:43:47 +00:00
|
|
|
`${JSON.stringify(Cypress.env("bigquery_pvt_key"))}`,
|
2023-01-17 09:09:38 +00:00
|
|
|
"contain",
|
|
|
|
|
{ parseSpecialCharSequences: false, delay: 0 }
|
|
|
|
|
);
|
|
|
|
|
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,
|
2023-09-04 08:23:22 +00:00
|
|
|
postgreSqlText.toastDSSaved
|
2023-01-17 09:09:38 +00:00
|
|
|
);
|
|
|
|
|
|
2023-05-15 04:18:09 +00:00
|
|
|
cy.get(commonSelectors.globalDataSourceIcon).click();
|
2023-05-22 12:22:28 +00:00
|
|
|
cy.get(
|
|
|
|
|
`[data-cy="cypress-${data.lastName}-bigquery-button"]`
|
|
|
|
|
).verifyVisibleElement("have.text", `cypress-${data.lastName}-bigquery`);
|
2023-05-15 04:18:09 +00:00
|
|
|
|
2023-05-22 12:22:28 +00:00
|
|
|
deleteDatasource(`cypress-${data.lastName}-bigquery`);
|
2023-01-17 09:09:38 +00:00
|
|
|
});
|
|
|
|
|
});
|