mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-24 23:17:38 +00:00
* Add apiCommands * Add test cases * Add command logs * Modify apiCommands with ds null value * Add utils * Add testcases as chaining of queries * Add duplication test cases
62 lines
1.9 KiB
JavaScript
62 lines
1.9 KiB
JavaScript
import { postgreSqlSelector } from "Selectors/postgreSql";
|
|
import { selectEvent } from "Support/utils/events";
|
|
|
|
export const selectQueryFromLandingPage = (dbName, label) => {
|
|
cy.get(
|
|
`[data-cy="${dbName.toLowerCase().replace(/\s+/g, "-")}-add-query-card"]`
|
|
)
|
|
.should("contain", label)
|
|
.click();
|
|
cy.waitForAutoSave();
|
|
};
|
|
|
|
export const deleteQuery = (queryName) => {
|
|
cy.get(`[data-cy="list-query-${queryName}"]`).realHover();
|
|
cy.get(`[data-cy="delete-query-${queryName}"]`).click();
|
|
};
|
|
|
|
export const query = (action) => {
|
|
cy.get(`[data-cy="query-${action}-button"]`).click();
|
|
};
|
|
|
|
export const changeQueryToggles = (option) => {
|
|
cy.get(`[data-cy="${option}-toggle-switch"]`).parent().click();
|
|
};
|
|
|
|
export const renameQueryFromEditor = (name) => {
|
|
cy.get('[data-cy="query-name-label"]').realHover();
|
|
cy.get('[class="breadcrum-rename-query-icon"]').click();
|
|
cy.get('[data-cy="query-rename-input"]').clear().type(`${name}{enter}`);
|
|
// cy.realType(`{selectAll}{backspace}${name}{enter}`);
|
|
};
|
|
|
|
export const addInputOnQueryField = (field, data) => {
|
|
cy.get(`[data-cy="${field}-input-field"]`)
|
|
.click()
|
|
.clearAndTypeOnCodeMirror(`{backSpace}`);
|
|
cy.get(`[data-cy="${field}-input-field"]`).clearAndTypeOnCodeMirror(data);
|
|
cy.forceClickOnCanvas();
|
|
};
|
|
|
|
export const waitForQueryAction = (action) => {
|
|
cy.get(`[data-cy="query-${action}-button"]`, { timeout: 20000 }).should(
|
|
"not.have.class",
|
|
"button-loading"
|
|
);
|
|
};
|
|
|
|
export const chainQuery = (currentQuery, trigger) => {
|
|
cy.get(`[data-cy="list-query-${currentQuery}"]`).click();
|
|
selectEvent("Query Success", "Run Query");
|
|
cy.get('[data-cy="query-selection-field"]')
|
|
.click()
|
|
.find("input")
|
|
.type(`{selectAll}{backspace}${trigger}{enter}`);
|
|
};
|
|
|
|
export const addSuccessNotification = (notification) => {
|
|
changeQueryToggles("notification-on-success");
|
|
cy.get('[data-cy="success-message-input-field"]').clearAndTypeOnCodeMirror(
|
|
notification
|
|
);
|
|
};
|