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
This commit is contained in:
Hetu Nandu 2023-05-11 14:53:16 +05:30 committed by GitHub
parent 55dae97956
commit 385b099204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 16 deletions

View File

@ -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");
});

View File

@ -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(