ToolJet/cypress-tests/cypress/e2e/editor/data-source/fireStoreHappyPath.cy.js
Ajith KV c2891eea71
Modified the datasource cypress test cases (#7234)
* initial: flow setup

* [BugFix] Fix dynamic form breaking in case "react-component-headers" form type outside of the editor

* fixes: initial creation of datasource with default options

* resolve: local ds issues and cleanup

* cleanup

* fix: equality check

* revamp: gds flow

* fix: local ds not updating

* fix: minor bugs

* remove datasource confirmation modal

* bug fixes

* Modify the datasource cypress test cases

* Add data-cy for new datasource components

* rename to data sources

* rename: data sources

* fix: local ds wrapper css

* Add new commands file

* Add new commands file

* fix: datasource route

* Modify data source test cases

* Modify cypress config

* Modify data source icon tooltip text

---------

Co-authored-by: Vijaykant Yadav <[email protected]>
Co-authored-by: Nakul Nagargade <[email protected]>
Co-authored-by: emidhun <[email protected]>
2023-08-28 17:53:11 +05:30

131 lines
4 KiB
JavaScript

import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { firestoreText } from "Texts/firestore";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
verifyCouldnotConnectWithAlert,
deleteDatasource,
closeDSModal,
} from "Support/utils/dataSource";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
const data = {};
data.lastName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
describe("Data source Firestore", () => {
beforeEach(() => {
cy.appUILogin();
});
it("Should verify elements on Firestore connection form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(commonSelectors.addNewDataSourceButton)
.verifyVisibleElement("have.text", commonText.addNewDataSourceButton)
.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
);
cy.get(postgreSqlSelector.dataSourceSearchInputField).type(
firestoreText.firestore
);
cy.get("[data-cy*='data-source-']")
.eq(1)
.should("contain", firestoreText.firestore);
cy.get('[data-cy="data-source-firestore"]').click();
cy.get(postgreSqlSelector.dataSourceNameInputField).should(
"have.value",
firestoreText.firestore
);
cy.get('[data-cy="label-private-key"]').verifyVisibleElement(
"have.text",
firestoreText.labelPrivateKey
);
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
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
"have.text",
firestoreText.errorGcpKeyCouldNotBeParsed
);
});
it("Should verify the functionality of Firestore connection form.", () => {
selectAndAddDataSource(firestoreText.firestore);
cy.clearAndType(
'[data-cy="data-source-name-input-filed"]',
`cypress-${data.lastName}-firestore`
);
fillDataSourceTextField(
firestoreText.privateKey,
firestoreText.placeholderPrivateKey,
`${JSON.stringify(Cypress.env("firestore_pvt_key"))}`,
"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,
postgreSqlText.toastDSAdded
);
cy.get(
`[data-cy="cypress-${data.lastName}-firestore-button"]`
).verifyVisibleElement("have.text", `cypress-${data.lastName}-firestore`);
deleteDatasource(`cypress-${data.lastName}-firestore`);
});
});