From 385b09920483a3f53edbf6860a04dfba93d45ba9 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Thu, 11 May 2023 14:53:16 +0530 Subject: [PATCH] chore: Action create option order: Maintain parity with EE repo (#23162) ## Description We had a few test cases failing on the EE repo because of different permissions and had to make some changes on that repo to get it pass the CI. This PR is copying the changes back to this repo for posterity https://github.com/appsmithorg/appsmith-ee/pull/1421 --- .../OtherUIFeatures/Omnibar_spec.js | 21 +++++-------------- .../GlobalSearch/GlobalSearchHooks.test.ts | 13 ++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js index 6f3e7e95b7..a719da93e9 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/OtherUIFeatures/Omnibar_spec.js @@ -81,35 +81,24 @@ describe("Omnibar functionality test cases", () => { cy.get(omnibar.categoryTitle).eq(1).click(); // create new api, js object and cURL import from omnibar - - cy.get(_.peekOverlay.locators._fileOperation("New JS Object")).should( - "be.visible", - ); - cy.get(_.peekOverlay.locators._fileOperation("New Blank API")).should( - "be.visible", - ); - cy.get(_.peekOverlay.locators._fileOperation("New cURL Import")).should( - "be.visible", - ); - - cy.get(omnibar.createNew).eq(0).click(); + cy.get(omnibar.createNew).contains("New JS Object").click(); cy.wait(1000); cy.wait("@createNewJSCollection"); cy.wait(1000); cy.get(".t--js-action-name-edit-field").type(jsObjectName).wait(1000); + cy.get(omnibar.globalSearch).click({ force: true }); cy.get(omnibar.categoryTitle).eq(1).click(); cy.wait(1000); - - cy.get(omnibar.createNew).eq(1).click(); + cy.get(omnibar.createNew).contains("New Blank API").click(); cy.wait(1000); cy.wait("@createNewApi"); cy.renameWithInPane(apiName); + cy.get(omnibar.globalSearch).click({ force: true }); cy.get(omnibar.categoryTitle).eq(1).click(); - + cy.get(omnibar.createNew).contains("New cURL Import").click(); cy.wait(1000); - cy.get(_.peekOverlay.locators._fileOperation("New cURL Import")).click(); cy.url().should("include", "curl-import?"); cy.get('p:contains("Import from CURL")').should("be.visible"); }); diff --git a/app/client/src/components/editorComponents/GlobalSearch/GlobalSearchHooks.test.ts b/app/client/src/components/editorComponents/GlobalSearch/GlobalSearchHooks.test.ts index 6a22227a48..a5b24a1a5e 100644 --- a/app/client/src/components/editorComponents/GlobalSearch/GlobalSearchHooks.test.ts +++ b/app/client/src/components/editorComponents/GlobalSearch/GlobalSearchHooks.test.ts @@ -1,6 +1,7 @@ import { getFilteredAndSortedFileOperations } from "./GlobalSearchHooks"; import type { Datasource } from "entities/Datasource"; import { SEARCH_ITEM_TYPES } from "./utils"; +import { PERMISSION_TYPE } from "@appsmith/utils/permissionHelpers"; describe("getFilteredAndSortedFileOperations", () => { it("works without any datasources", () => { @@ -83,6 +84,10 @@ describe("getFilteredAndSortedFileOperations", () => { {}, true, true, + [ + PERMISSION_TYPE.CREATE_ACTIONS, + PERMISSION_TYPE.CREATE_DATASOURCE_ACTIONS, + ], ); expect(fileOptions[0]).toEqual( @@ -141,6 +146,10 @@ describe("getFilteredAndSortedFileOperations", () => { { abc: 1, "123": 3 }, true, true, + [ + PERMISSION_TYPE.CREATE_ACTIONS, + PERMISSION_TYPE.CREATE_DATASOURCE_ACTIONS, + ], ); expect(fileOptions[0]).toEqual( @@ -199,6 +208,10 @@ describe("getFilteredAndSortedFileOperations", () => { {}, true, true, + [ + PERMISSION_TYPE.CREATE_ACTIONS, + PERMISSION_TYPE.CREATE_DATASOURCE_ACTIONS, + ], ); expect(fileOptions[0]).toEqual(