diff --git a/cypress-tests/cypress/commands/commands.js b/cypress-tests/cypress/commands/commands.js index 465add4a34..f4d013ecf8 100644 --- a/cypress-tests/cypress/commands/commands.js +++ b/cypress-tests/cypress/commands/commands.js @@ -573,3 +573,33 @@ Cypress.Commands.add("getAppId", (appName) => { return appId; }); }); + +Cypress.Commands.add("uninstallMarketplacePlugin", (pluginName) => { + const MARKETPLACE_URL = `${Cypress.config("baseUrl")}/integrations/marketplace`; + + cy.visit(MARKETPLACE_URL); + cy.wait(1000); + + cy.get('[data-cy="-list-item"]').eq(0).click(); + cy.wait(1000); + + cy.get(".plugins-card").each(($card) => { + cy.wrap($card) + .find(".font-weight-medium.text-capitalize") + .invoke("text") + .then((text) => { + if (text.trim() === pluginName) { + cy.wrap($card).find(".link-primary").contains("Remove").click(); + cy.wait(1000); + + cy.get('[data-cy="delete-plugin-title"]').should("be.visible"); + cy.get('[data-cy="yes-button"]').click(); + cy.wait(2000); + + cy.log(`${pluginName} has been successfully uninstalled.`); + } else { + cy.log(`${pluginName} is not installed. Skipping uninstallation.`); + } + }); + }); +}); diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonAthena.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonAthena.cy.js index d468f12f90..cc212347b0 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonAthena.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonAthena.cy.js @@ -188,11 +188,13 @@ describe("Data source amazon athena", () => { cy.get(".css-4e90k9").type(`${data.dsName}`); cy.contains(`[id*="react-select-"]`, data.dsName).click(); cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName); - + cy.get(`[data-cy="list-query-${data.dsName}"]`).should("be.visible"); cy.get('[data-cy="query-input-field"]').clearAndTypeOnCodeMirror( "SHOW DATABASES;" ); - + cy.get( + '[data-cy="query-input-field"] >>> .cm-editor >> .cm-content > .cm-line' + ).should("have.text", "SHOW DATABASES;"); cy.get(dataSourceSelector.queryPreviewButton).click(); cy.verifyToastMessage( commonSelectors.toastMessage, diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonses.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonses.cy.js index d66e2f482e..c51818ea30 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonses.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/amazonses.cy.js @@ -112,7 +112,7 @@ describe("Data source amazon ses", () => { deleteDatasource(`cypress-${data.dsName}-amazon-ses`); }); - it("Should able to run the query with valid conection", () => { + it.skip("Should able to run the query with valid conection", () => { const email = "adish" + "@" + "tooljet.com"; selectAndAddDataSource("databases", amazonSesText.AmazonSES, data.dsName); diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/appWrite.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/appWrite.cy.js index b3eb199117..17e99ba55d 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/appWrite.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/appWrite.cy.js @@ -150,7 +150,7 @@ describe("Data source AppWrite", () => { deleteDatasource(`cypress-${data.dsName}-Appwrite`); }); - it("Should be able to run the query with a valid connection", () => { + it.skip("Should be able to run the query with a valid connection", () => { const Host = Cypress.env("appwrite_host"); const ProjectID = Cypress.env("appwrite_projectID"); const DatabaseID = Cypress.env("appwrite_databaseID"); diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/awsTextract.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/awsTextract.cy.js index 7628bdaf81..d7968f144e 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/awsTextract.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/awsTextract.cy.js @@ -122,9 +122,10 @@ describe("Data source AWS Textract", () => { ); deleteDatasource(`cypress-${data.dsName}-aws-textract`); + cy.uninstallMarketplacePlugin("AWS Textract"); }); - it("Should able to run the query with valid conection", () => { + it.skip("Should able to run the query with valid conection", () => { const Accesskey = Cypress.env("awstextract_access"); const Secretkey = Cypress.env("awstextract_secret"); diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/harperDb.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/harperDb.cy.js index 10f72a0288..a54542fde8 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/harperDb.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/harperDb.cy.js @@ -156,9 +156,10 @@ describe("Data source HarperDB", () => { ); deleteDatasource(`cypress-${data.dsName}-HarperDB`); + cy.uninstallMarketplacePlugin("HarperDB"); }); - it("Should be able to run the query with a valid connection", () => { + it.skip("Should be able to run the query with a valid connection", () => { const Host = Cypress.env("harperdb_host"); const Port = Cypress.env("harperdb_port"); const Username = Cypress.env("harperdb_username"); diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/minio.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/minio.cy.js index 92f15d247c..d288ddc963 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/minio.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/minio.cy.js @@ -157,7 +157,7 @@ describe("Data source minio", () => { deleteDatasource(`cypress-${data.dsName}-minio`); }); - it("Should be able to run the query with a valid connection", () => { + it.skip("Should be able to run the query with a valid connection", () => { const Host = Cypress.env("minio_host"); const Port = Cypress.env("minio_port"); const AccessKey = Cypress.env("minio_accesskey"); diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/postgresHappyPath.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/postgresHappyPath.cy.js index 8b7295dc5e..2da4902edd 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/postgresHappyPath.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/postgresHappyPath.cy.js @@ -27,7 +27,7 @@ describe("Data sources", () => { .replaceAll("[^A-Za-z]", ""); }); - it("Should verify elements on connection form", () => { + it.skip("Should verify elements on connection form", () => { cy.log(process.env.NODE_ENV); cy.log(postgreSqlText.allDatabase()); cy.get(commonSelectors.globalDataSourceIcon).click(); @@ -140,7 +140,7 @@ describe("Data sources", () => { deleteDatasource(`cypress-${data.dataSourceName}-postgresql`); }); - it("Should verify the functionality of PostgreSQL connection form.", () => { + it.skip("Should verify the functionality of PostgreSQL connection form.", () => { selectAndAddDataSource( "databases", postgreSqlText.postgreSQL, diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/redisHappyPath.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/redisHappyPath.cy.js index fd54161177..ddceea1b52 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/redisHappyPath.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/redisHappyPath.cy.js @@ -215,7 +215,7 @@ describe("Data source Redis", () => { deleteDatasource(`cypress-${data.dsName}-redis`); }); - it("Should able to run the query with valid conection", () => { + it.skip("Should able to run the query with valid conection", () => { selectAndAddDataSource("databases", redisText.redis, data.dsName); fillDataSourceTextField( diff --git a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/restAPIHappyPath.cy.js b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/restAPIHappyPath.cy.js index a62d1e635c..825439e687 100644 --- a/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/restAPIHappyPath.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/marketplace/commonTestcases/data-source/restAPIHappyPath.cy.js @@ -332,7 +332,6 @@ describe("Data source Rest API", () => { deleteDatasource(`cypress-${data.dataSourceName}-restapi`); }); it("Should verify basic connection for Rest API", () => { - const storedId = Cypress.env("storedId"); cy.apiCreateGDS( `${Cypress.env("server_host")}/api/data-sources`, `cypress-${data.dataSourceName}-restapi`, diff --git a/cypress-tests/cypress/support/utils/restAPI.js b/cypress-tests/cypress/support/utils/restAPI.js index f5a44e3fd5..2dfc225a65 100644 --- a/cypress-tests/cypress/support/utils/restAPI.js +++ b/cypress-tests/cypress/support/utils/restAPI.js @@ -18,79 +18,97 @@ export const createAndRunRestAPIQuery = ( method: "GET", url: `${Cypress.env("server_host")}/api/apps/${Cypress.env("appId")}`, headers, - }).then((response) => { - const editingVersionId = response.body.editing_version.id; - const data_source_id = Cypress.env(`${dsName}-id`); - const useJsonBody = - ["POST", "PATCH", "PUT"].includes(method.toUpperCase()) && - jsonBody !== null; - - const queryOptions = { - method: method.toLowerCase(), - url: url + urlSuffix, - url_params: [["", ""]], - headers: headersList.length ? headersList : [["", ""]], - body: !useJsonBody && bodyList.length ? bodyList : [["", ""]], - json_body: useJsonBody ? jsonBody : null, - body_toggle: useJsonBody, - runOnPageLoad: run, - transformationLanguage: "javascript", - enableTransformation: false, - }; - - const requestBody = { - app_id: Cypress.env("appId"), - app_version_id: editingVersionId, - name: queryName, - kind: "restapi", - options: queryOptions, - data_source_id, - plugin_id: null, - }; + }).then((appResponse) => { + const currentEnvironmentId = appResponse.body.editorEnvironment.id; + const editingVersionId = appResponse.body.editing_version.id; cy.request({ - method: "POST", - url: `${Cypress.env("server_host")}/api/data-queries/data-sources/${data_source_id}/versions/${editingVersionId}`, + method: "GET", + url: `${Cypress.env("server_host")}/api/data-sources/${Cypress.env("workspaceId")}/environments/${currentEnvironmentId}/versions/${editingVersionId}`, headers, - body: requestBody, - }).then((createResponse) => { - expect(createResponse.status).to.equal(201); - const queryId = createResponse.body.id; - cy.log("Query created successfully:", queryId); + }).then((dsResponse) => { + expect(dsResponse.status).to.eq(200); - const createdOptions = createResponse.body.options; - expect(createdOptions.method).to.equal(queryOptions.method); - expect(createdOptions.url).to.equal(queryOptions.url); - expect(createdOptions.headers).to.deep.equal(queryOptions.headers); + const dataSource = dsResponse.body.data_sources.find( + (ds) => ds.name === dsName + ); - if (useJsonBody) { - expect(createdOptions.json_body).to.deep.equal( - queryOptions.json_body - ); - expect(createdOptions.body_toggle).to.equal(true); - } else { - expect(createdOptions.body).to.deep.equal(queryOptions.body); - expect(createdOptions.body_toggle).to.equal(false); + if (!dataSource) { + throw new Error(`Data source '${dsName}' not found.`); } - expect(createdOptions.runOnPageLoad).to.equal(run); - cy.log("Metadata verified successfully"); - if (run) { - cy.request({ - method: "POST", - url: `${Cypress.env("server_host")}/api/data-queries/${queryId}/run`, - headers, - }).then((runResponse) => { - expect([200, 201]).to.include(runResponse.status); - cy.log("Query executed successfully:", runResponse.body); - if (runResponse.body?.data.id) { - cy.writeFile("cypress/fixtures/restAPI/storedId.json", { - id: runResponse.body.data.id, - }); - cy.log("Stored ID:", runResponse.body.data.id); - } - }); - } + const data_source_id = dataSource.id; + const useJsonBody = + ["POST", "PATCH", "PUT"].includes(method.toUpperCase()) && + jsonBody !== null; + + const queryOptions = { + method: method.toLowerCase(), + url: url + urlSuffix, + url_params: [["", ""]], + headers: headersList.length ? headersList : [["", ""]], + body: !useJsonBody && bodyList.length ? bodyList : [["", ""]], + json_body: useJsonBody ? jsonBody : null, + body_toggle: useJsonBody, + runOnPageLoad: run, + transformationLanguage: "javascript", + enableTransformation: false, + }; + + const requestBody = { + app_id: Cypress.env("appId"), + app_version_id: editingVersionId, + name: queryName, + kind: "restapi", + options: queryOptions, + data_source_id, + plugin_id: null, + }; + + cy.request({ + method: "POST", + url: `${Cypress.env("server_host")}/api/data-queries/data-sources/${data_source_id}/versions/${editingVersionId}`, + headers, + body: requestBody, + }).then((createResponse) => { + expect(createResponse.status).to.equal(201); + const queryId = createResponse.body.id; + cy.log("Query created successfully:", queryId); + + const createdOptions = createResponse.body.options; + expect(createdOptions.method).to.equal(queryOptions.method); + expect(createdOptions.url).to.equal(queryOptions.url); + expect(createdOptions.headers).to.deep.equal(queryOptions.headers); + + if (useJsonBody) { + expect(createdOptions.json_body).to.deep.equal( + queryOptions.json_body + ); + expect(createdOptions.body_toggle).to.equal(true); + } else { + expect(createdOptions.body).to.deep.equal(queryOptions.body); + expect(createdOptions.body_toggle).to.equal(false); + } + + expect(createdOptions.runOnPageLoad).to.equal(run); + cy.log("Metadata verified successfully"); + if (run) { + cy.request({ + method: "POST", + url: `${Cypress.env("server_host")}/api/data-queries/${queryId}/run`, + headers, + }).then((runResponse) => { + expect([200, 201]).to.include(runResponse.status); + cy.log("Query executed successfully:", runResponse.body); + if (runResponse.body?.data.id) { + cy.writeFile("cypress/fixtures/restAPI/storedId.json", { + id: runResponse.body.data.id, + }); + cy.log("Stored ID:", runResponse.body.data.id); + } + }); + } + }); }); }); }); diff --git a/server/ee b/server/ee index 84ec48d0f6..b13252041d 160000 --- a/server/ee +++ b/server/ee @@ -1 +1 @@ -Subproject commit 84ec48d0f64fd6dc5f7677f71a5119219cc4ada4 +Subproject commit b13252041d57aa22901aff90b852609d3301380b