Skip to content

Commit

Permalink
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
Browse files Browse the repository at this point in the history
…o feat/custom-connection-name-oidc-saml
  • Loading branch information
ankitakinger committed May 10, 2024
2 parents c9a48a1 + d88b431 commit f8c0454
Show file tree
Hide file tree
Showing 85 changed files with 2,488 additions and 1,666 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import EditorNavigation, {
EntityType,
PageLeftPane,
PagePaneSegment,
AppSidebar,
AppSidebarButton,
} from "../../../../../support/Pages/EditorNavigation";

const generatePage = require("../../../../../locators/GeneratePage.json");
Expand All @@ -10,6 +12,7 @@ const dynamicInputLocators = require("../../../../../locators/DynamicInput.json"
import gitSyncLocators from "../../../../../locators/gitSyncLocators";
import homePageLocators from "../../../../../locators/HomePage";
import datasource from "../../../../../locators/DatasourcesEditor.json";
import widgetsPage from "../../../../../locators/Widgets.json";

import {
agHelper,
Expand Down Expand Up @@ -99,7 +102,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
cy.get("@gitRepoName").then((repName) => {
repoName = repName;
});
table.ReadTableRowColumnData(0, 1).then((cellData) => {
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
// rename page to crud_page
Expand All @@ -109,31 +112,21 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
false,
EntityItems.Page,
);
EditorNavigation.SelectEntityByName(pageName, EntityType.Page);
// create a clone of page
cy.get(`.t--entity-item:contains(${pageName})`).within(() => {
cy.get(".t--context-menu").click({ force: true });
});
cy.selectAction("Clone");
PageList.ClonePage(pageName);

cy.wait("@clonePage").should(
"have.nested.property",
"response.body.responseMeta.status",
201,
);
PageList.ShowList();
PageLeftPane.assertPresence(`${pageName} Copy`);
table.ReadTableRowColumnData(0, 1).then((cellData) => {
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
});

it("2. Create api queries from api pane and cURL import , bind it to widget and clone page from page settings", () => {
cy.fixture("datasources").then((datasourceFormData) => {
cy.Createpage(newPage);
cy.get(`.t--entity-item:contains(${newPage})`).click();
cy.wait("@getConsolidatedData");
// create a get api call
EditorNavigation.SelectEntityByName(newPage, EntityType.Page);

// create a get api call
apiPage.CreateAndFillApi(datasourceFormData["echoApiUrl"], "get_data");
apiPage.EnterHeader("info", "This is a test");
apiPage.RunAPI();
Expand Down Expand Up @@ -172,89 +165,77 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
"will be executed automatically on page load",
);
// clone the page from page settings
cy.get(`.t--entity-item:contains(${newPage})`).within(() => {
cy.get(".t--context-menu").click({ force: true });
});
cy.selectAction("Clone");
cy.wait("@clonePage").should(
"have.nested.property",
"response.body.responseMeta.status",
201,
);
cy.get(`.t--entity-item:contains(${newPage} Copy)`).click();
cy.wait("@getConsolidatedData");
PageList.ClonePage(newPage);
EditorNavigation.SelectEntityByName(newPage, EntityType.Page);
});
});

it("3. Commit and push changes, validate data binding on all pages in edit and deploy mode on master", () => {
// verfiy data binding on all pages in edit mode
cy.get(".t--draggable-inputwidgetv2").should("be.visible");
cy.get(".t--draggable-inputwidgetv2")
cy.get(widgetsPage.inputWidget).should("be.visible");
cy.get(widgetsPage.inputWidget)
.first()
.find(".bp3-input")
.find(widgetsPage.dataclass)
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".t--draggable-inputwidgetv2")
cy.get(widgetsPage.inputWidget)
.last()
.find(".bp3-input")
.find(widgetsPage.dataclass)
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(`.t--entity-item:contains(${newPage})`).first().click();
cy.wait("@getConsolidatedData");
cy.get(".t--draggable-inputwidgetv2")

PageList.ShowList();
EditorNavigation.SelectEntityByName(newPage, EntityType.Page);
cy.get(widgetsPage.inputWidget)
.first()
.find(".bp3-input")
.find(widgetsPage.dataclass)
.should("have.value", "morpheus");
cy.get(".t--draggable-inputwidgetv2")
cy.get(widgetsPage.inputWidget)
.last()
.find(".bp3-input")
.find(widgetsPage.dataclass)
.should("have.value", "This is a test");

cy.get(`.t--entity-item:contains(${pageName})`).first().click();
cy.wait("@getConsolidatedData");
cy.readTabledataPublish("0", "1").then((cellData) => {
PageList.ShowList();
EditorNavigation.SelectEntityByName(pageName, EntityType.Page);
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});

cy.get(`.t--entity-item:contains(${pageName} Copy)`).click();
cy.wait("@getConsolidatedData");
cy.readTabledataPublish("0", "1").then((cellData) => {
PageList.ShowList();
EditorNavigation.SelectEntityByName(`${pageName} Copy`, EntityType.Page);
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
// commit and push the changes
gitSync.CommitAndPush(true);
// verify data binding on all pages in deploy mode
cy.latestDeployPreview();
cy.get(".t--page-switch-tab")
.contains(`${pageName}`)
.click({ force: true });
cy.readTabledataPublish("0", "1").then((cellData) => {
agHelper.GetNClickByContains(locators._deployedPage, pageName);
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
cy.get(".t--page-switch-tab")
.contains(`${pageName} Copy`)
.click({ force: true });
cy.readTabledataPublish("0", "1").then((cellData) => {
agHelper.GetNClickByContains(locators._deployedPage, `${pageName} Copy`);
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
cy.get(".t--page-switch-tab").contains(`${newPage}`).click({ force: true });
agHelper.GetNClickByContains(locators._deployedPage, `${newPage}`);
agHelper.RefreshPage("getConsolidatedData");
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.first()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.last()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".t--page-switch-tab")
.contains(`${newPage} Copy`)
.click({ force: true });
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.first()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.last()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
Expand All @@ -266,7 +247,6 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
});

it("4. Create a new branch tempBranch, add jsObject and datasource query, move them to new page i.e. Child_Page and bind to widgets", () => {
//cy.createGitBranch(tempBranch);
gitSync.CreateGitBranch(tempBranch, true);
cy.get("@gitbranchName").then((branName) => {
tempBranch = branName;
Expand Down Expand Up @@ -329,90 +309,43 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
cy.get(gitSyncLocators.closeGitSyncModal).click();
// verfiy data binding on all pages in deploy mode
cy.latestDeployPreview();
cy.get(".bp3-input").should("be.visible");
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass).should("be.visible");
cy.get(widgetsPage.dataclass)
.first()
.invoke("val")
.should("be.oneOf", ["Success", "Test user 7"]);
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.last()
.invoke("val")
.should("be.oneOf", ["Success", "Test user 7"]);
cy.get(".t--page-switch-tab")
.contains(`${pageName}`)
.click({ force: true });
table.WaitUntilTableLoad();
cy.readTabledataPublish("0", "1").then((cellData) => {
agHelper.GetNClickByContains(locators._deployedPage, `${pageName}`);
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
cy.get(".t--page-switch-tab")
.contains(`${pageName} Copy`)
.click({ force: true });
table.WaitUntilTableLoad();
cy.readTabledataPublish("0", "1").then((cellData) => {
agHelper.GetNClickByContains(locators._deployedPage, `${pageName} Copy`);
table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
cy.get(".t--page-switch-tab").contains(`${newPage}`).click({ force: true });
cy.get(".bp3-input")
agHelper.GetNClickByContains(locators._deployedPage, `${newPage}`);
cy.get(widgetsPage.dataclass)
.first()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.last()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".t--page-switch-tab")
.contains(`${newPage} Copy`)
.click({ force: true });
cy.get(".bp3-input")

agHelper.GetNClickByContains(locators._deployedPage, `${newPage} Copy`);
cy.get(widgetsPage.dataclass)
.first()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
cy.get(".bp3-input")
cy.get(widgetsPage.dataclass)
.last()
.invoke("val")
.should("be.oneOf", ["morpheus", "This is a test"]);
deployMode.NavigateBacktoEditor();
// verfiy data binding on all pages in edit mode
/* cy.get(".t--draggable-inputwidgetv2").first().find(".bp3-input").should("have.value", "morpheus");
cy.get(".t--draggable-inputwidgetv2")
.last()
.find(".bp3-input")
.should("have.value", "This is a test");
cy.get(`.t--entity-item:contains(Child_Page)`)
.first()
.click();
cy.wait("@getPage");
cy.reload();
cy.wait(3000);
cy.get(".bp3-input")
.first()
.should("have.value", "Success");
cy.get(".bp3-input")
.last()
.should("have.value", "Test user 7");
cy.get(`.t--entity-item:contains(${newPage})`)
.first()
.click();
cy.wait("@getPage");
cy.get(".t--draggable-inputwidgetv2").first().find(".bp3-input").should("have.value", "morpheus");
cy.get(".t--draggable-inputwidgetv2")
.last()
.find(".bp3-input")
.should("have.value", "This is a test");
cy.get(`.t--entity-item:contains(${pageName} Copy)`).click();
cy.wait("@getPage");
cy.readTabledataPublish("0", "1").then((cellData) => {
expect(cellData).to.be.equal("New Config");
});
cy.get(`.t--entity-item:contains(${pageName})`)
.first()
.click();
cy.wait("@getPage");
cy.readTabledataPublish("0", "1").then((cellData) => {
expect(cellData).to.be.equal("New Config");
}); */
});

it("6. Switch to master and verify no uncommitted changes should be shown on master", () => {
Expand All @@ -432,19 +365,17 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () {
PageList.ClonePage("Child_Page");
// change cloned page visiblity to hidden
EditorNavigation.SelectEntityByName("Child_Page Copy", EntityType.Page);
entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: "Child_Page",
action: "Hide",
});
PageList.HidePage("Child_Page");

EditorNavigation.SelectEntityByName("Child_Page", EntityType.Page);
cy.wait("@getConsolidatedData");
cy.get(homePageLocators.publishButton).click();
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
cy.get(gitSyncLocators.commitButton).click();
cy.get(gitSyncLocators.closeGitSyncModal).click();
cy.merge(mainBranch);
cy.get(gitSyncLocators.closeGitSyncModal).click();

gitSync.MergeToMaster();

cy.latestDeployPreview();
// verify page is hidden on deploy mode
agHelper.AssertContains("Child_Page Copy", "not.exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe(
locators._widgetInDeployed(draggableWidgets.BUTTON),
0,
);
agHelper.AssertElementLength(locators._selectedWidget, 1);
agHelper.AssertElementLength(locators._autoLayoutSelectedWidget, 1);

//copying first button in first layer, which is center aligned
agHelper.GetElement("body").type(`{${modifierKey}}{c}`);
Expand All @@ -49,7 +49,7 @@ describe(
locators._widgetInDeployed(draggableWidgets.BUTTON),
1,
);
agHelper.AssertElementLength(locators._selectedWidget, 1);
agHelper.AssertElementLength(locators._autoLayoutSelectedWidget, 1);

//copying second button in first layer, which is end aligned
agHelper.GetElement("body").type(`{${modifierKey}}{c}`);
Expand Down Expand Up @@ -81,7 +81,7 @@ describe(
locators._widgetInDeployed(draggableWidgets.BUTTON),
0,
);
agHelper.AssertElementLength(locators._selectedWidget, 1);
agHelper.AssertElementLength(locators._autoLayoutSelectedWidget, 1);

//copying first button in first layer, which is center aligned
agHelper.GetElement("body").type(`{${modifierKey}}{c}`);
Expand All @@ -90,7 +90,7 @@ describe(
//unselect all widgets
agHelper.GetNClick(locators._selectionCanvas("0"), 0, true);

agHelper.AssertElementLength(locators._selectedWidget, 0);
agHelper.AssertElementLength(locators._autoLayoutSelectedWidget, 0);
cy.focused().blur();
//paste
agHelper.GetElement("body").type(`{${modifierKey}}{v}`);
Expand Down Expand Up @@ -142,15 +142,15 @@ describe(
500,
true,
);
agHelper.AssertElementLength(locators._selectedWidget, 4);
agHelper.AssertElementLength(locators._autoLayoutSelectedWidget, 4);
agHelper.GetElement("body").type(`{${modifierKey}}{c}`);
agHelper.GetElement(locators._toastMsg).contains("Copied");

//unselect all widgets
agHelper.GetNClick(locators._selectionCanvas("0"), 0, true);
cy.focused().blur();

agHelper.AssertElementLength(locators._selectedWidget, 0);
agHelper.AssertElementLength(locators._autoLayoutSelectedWidget, 0);

//paste
agHelper.GetElement("body").type(`{${modifierKey}}{v}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
import { PageType } from "../../../../support/Pages/DebuggerHelper";
import EditorNavigation, {
EditorViewMode,
} from "../../../../support/Pages/EditorNavigation";

describe("Api Error Debugger", { tags: ["@tag.IDE"] }, () => {
before(() => {
// Create api that causes an error
_.apiPage.CreateAndFillApi("https://fakeapi/user");
});
it("it shows error message", () => {
_.apiPage.RunAPI(false);
_.debuggerHelper.AssertOpen(PageType.API);
_.apiPage.ResponseStatusCheck("PE-RST-5000");
});
it("it shows debug button and navigates", () => {
_.apiPage.DebugError();
_.debuggerHelper.AssertSelectedTab("Error");
_.debuggerHelper.AssertErrorCount(1);
EditorNavigation.SwitchScreenMode(EditorViewMode.SplitScreen);
_.apiPage.DebugError();
_.debuggerHelper.AssertSelectedTab("Error");
_.debuggerHelper.AssertErrorCount(1);
});
});

0 comments on commit f8c0454

Please sign in to comment.