ToolJet/cypress-tests/cypress/support/utils/mongoDB.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

51 lines
1.6 KiB
JavaScript

import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import { mongoDbText } from "Texts/mongoDb";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
export const connectMongo = () => {
selectAndAddDataSource(mongoDbText.mongoDb);
cy.clearAndType(
'[data-cy="data-source-name-input-filed"]',
mongoDbText.cypressMongoDb
);
cy.get('[data-cy="query-select-dropdown"]').type(
mongoDbText.optionConnectUsingConnectionString
);
fillDataSourceTextField(
mongoDbText.labelConnectionString,
mongoDbText.connectionStringPlaceholder,
Cypress.env("mongodb_connString"),
"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.get(postgreSqlSelector.leftSidebarDatasourceButton).click();
cy.get(postgreSqlSelector.datasourceLabelOnList)
.should("have.text", mongoDbText.cypressMongoDb)
.find("button")
.invoke("show")
.should("be.visible");
};
export const openMongoQueryEditor = (dbName = mongoDbText.cypressMongoDb) => {
cy.get(postgreSqlSelector.buttonAddNewQueries).click();
cy.get(`[data-cy="${dbName}-add-query-card"]`)
.should("contain", dbName)
.click();
};
export const selectQueryType = (type) => {
cy.get('[data-cy="query-select-dropdown"]').click().type(`${type}{enter}`);
};