test: adding test for page functionality (#38538)
/ok-to-test tags="@tag.Sanity" <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12745705423> > Commit: 88c823df3032a7fdf492e3a086d8be9daf03b062 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12745705423&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Mon, 13 Jan 2025 11:37:45 UTC <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added comprehensive end-to-end tests for page actions functionality. - Introduced new test coverage for page management operations like renaming, cloning, hiding, and setting home pages. - **Tests** - Created Cypress tests to verify page actions under different scenarios. - Updated test specifications to focus on partial import/export functionality. - **Improvements** - Enhanced modal opening methods with dynamic entity name support. - Added home icon locator for improved test reliability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: “NandanAnantharamu” <“nandan@thinkify.io”>
This commit is contained in:
parent
86bddaaa43
commit
fd7219706f
|
|
@ -0,0 +1,139 @@
|
|||
import EditorNavigation, {
|
||||
EntityType,
|
||||
PageLeftPane,
|
||||
} from "../../../../support/Pages/EditorNavigation";
|
||||
import {
|
||||
agHelper,
|
||||
draggableWidgets,
|
||||
entityExplorer,
|
||||
entityItems,
|
||||
homePage,
|
||||
locators,
|
||||
partialImportExport,
|
||||
propPane,
|
||||
} from "../../../../support/Objects/ObjectsCore";
|
||||
import PageList from "../../../../support/Pages/PageList";
|
||||
|
||||
describe("Check Page Actions Menu", {}, function () {
|
||||
it("1. Verify Page Actions when a page is selected", function () {
|
||||
homePage.RenameApplication("PageActions");
|
||||
PageList.AddNewPage("New blank page");
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 100);
|
||||
PageList.ShowList();
|
||||
agHelper.GetNClick(entityExplorer._contextMenu("Page2"), 0, true);
|
||||
agHelper.GetNClick(locators._contextMenuItem("Rename"));
|
||||
agHelper.TypeText(propPane._placeholderName, `NewPage{enter}`, {
|
||||
parseSpecialCharSeq: true,
|
||||
});
|
||||
|
||||
PageList.ClonePage("NewPage");
|
||||
PageList.HidePage("NewPage Copy");
|
||||
PageList.ShowList();
|
||||
agHelper.AssertAttribute(
|
||||
locators._entityTestId("NewPage Copy"),
|
||||
"disabled",
|
||||
"disabled",
|
||||
);
|
||||
PageList.DeletePage("NewPage Copy");
|
||||
PageList.assertAbsence("NewPage Copy");
|
||||
|
||||
EditorNavigation.NavigateToPage("NewPage", true);
|
||||
|
||||
entityExplorer.ActionContextMenuByEntityName({
|
||||
entityNameinLeftSidebar: "NewPage",
|
||||
action: "Set as home page",
|
||||
entityType: entityItems.Page,
|
||||
});
|
||||
PageList.ShowList();
|
||||
agHelper.GetElement(locators._entityTestId("NewPage")).within(() => {
|
||||
agHelper.AssertElementExist(locators._homeIcon);
|
||||
});
|
||||
|
||||
entityExplorer.ActionContextMenuByEntityName({
|
||||
entityNameinLeftSidebar: "Page1",
|
||||
action: "Set as home page",
|
||||
entityType: entityItems.Page,
|
||||
});
|
||||
PageList.ShowList();
|
||||
agHelper.GetElement(locators._entityTestId("Page1")).within(() => {
|
||||
agHelper.AssertElementExist(locators._homeIcon);
|
||||
});
|
||||
|
||||
EditorNavigation.NavigateToPage("NewPage", true);
|
||||
partialImportExport.OpenExportModal("NewPage");
|
||||
partialImportExport.PartiallyExportFile(
|
||||
4,
|
||||
partialImportExport.locators.export.modelContents.widgetsSection,
|
||||
["Text1"],
|
||||
);
|
||||
|
||||
//Import the exported App
|
||||
partialImportExport.OpenImportModal("NewPage");
|
||||
partialImportExport.ImportPartiallyExportedFile(
|
||||
"PageActions.json",
|
||||
"Widgets",
|
||||
["Text1"],
|
||||
"downloads",
|
||||
);
|
||||
});
|
||||
|
||||
it("2. Verify Page Actions when a page is not selected", function () {
|
||||
EditorNavigation.NavigateToPage("Page1", true);
|
||||
PageList.ShowList();
|
||||
agHelper.GetNClick(entityExplorer._contextMenu("NewPage"), 0, true);
|
||||
agHelper.GetNClick(locators._contextMenuItem("Rename"));
|
||||
agHelper.TypeText(propPane._placeholderName, `Page2{enter}`, {
|
||||
parseSpecialCharSeq: true,
|
||||
});
|
||||
|
||||
PageList.ClonePage("Page2");
|
||||
EditorNavigation.NavigateToPage("Page1", true);
|
||||
PageList.HidePage("Page2 Copy");
|
||||
PageList.ShowList();
|
||||
agHelper.AssertAttribute(
|
||||
locators._entityTestId("Page2 Copy"),
|
||||
"disabled",
|
||||
"disabled",
|
||||
);
|
||||
PageList.DeletePage("Page2 Copy");
|
||||
PageList.assertAbsence("Page2 Copy");
|
||||
});
|
||||
|
||||
it("3. Verify Page Actions when a home page is selected", function () {
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 100);
|
||||
PageList.ShowList();
|
||||
agHelper.GetNClick(entityExplorer._contextMenu("Page1"), 0, true);
|
||||
agHelper.GetNClick(locators._contextMenuItem("Rename"));
|
||||
agHelper.TypeText(propPane._placeholderName, `HomePage{enter}`, {
|
||||
parseSpecialCharSeq: true,
|
||||
});
|
||||
|
||||
PageList.ClonePage("HomePage");
|
||||
PageList.HidePage("HomePage Copy");
|
||||
PageList.ShowList();
|
||||
agHelper.AssertAttribute(
|
||||
locators._entityTestId("HomePage Copy"),
|
||||
"disabled",
|
||||
"disabled",
|
||||
);
|
||||
PageList.DeletePage("HomePage Copy");
|
||||
PageList.assertAbsence("HomePage Copy");
|
||||
|
||||
EditorNavigation.NavigateToPage("HomePage", true);
|
||||
partialImportExport.OpenExportModal("HomePage");
|
||||
partialImportExport.PartiallyExportFile(
|
||||
4,
|
||||
partialImportExport.locators.export.modelContents.widgetsSection,
|
||||
["Text1"],
|
||||
);
|
||||
|
||||
//Import the exported App
|
||||
partialImportExport.OpenImportModal("HomePage");
|
||||
partialImportExport.ImportPartiallyExportedFile(
|
||||
"PageActions.json",
|
||||
"Widgets",
|
||||
["Text1"],
|
||||
"downloads",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -353,4 +353,5 @@ export class CommonLocators {
|
|||
_listItemTitle = ".ads-v2-listitem__title";
|
||||
_dropdownOption = ".rc-select-item-option-content";
|
||||
_dropdownActiveOption = ".rc-select-dropdown .rc-select-item-option-active";
|
||||
_homeIcon = "[data-testid='t--default-home-icon']";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ export default class PartialImportExport {
|
|||
},
|
||||
};
|
||||
|
||||
OpenExportModal() {
|
||||
OpenExportModal(entityName = "Home") {
|
||||
this.entityExplorer.ActionContextMenuByEntityName({
|
||||
entityNameinLeftSidebar: "Home",
|
||||
entityNameinLeftSidebar: entityName,
|
||||
action: "Export",
|
||||
entityType: EntityItems.Page,
|
||||
});
|
||||
|
|
@ -49,18 +49,17 @@ export default class PartialImportExport {
|
|||
);
|
||||
}
|
||||
|
||||
OpenImportModal() {
|
||||
OpenImportModal(entityName = "Page1") {
|
||||
AppSidebar.navigate(AppSidebarButton.Editor);
|
||||
|
||||
this.entityExplorer.ActionContextMenuByEntityName({
|
||||
entityNameinLeftSidebar: "Page1",
|
||||
entityNameinLeftSidebar: entityName,
|
||||
action: "Import",
|
||||
entityType: EntityItems.Page,
|
||||
});
|
||||
|
||||
this.agHelper.AssertElementVisibility(this.locators.import.importModal);
|
||||
}
|
||||
|
||||
ExportAndCompareDownloadedFile(
|
||||
sectionName: keyof typeof exportedPropertiesToUIEntitiesMap,
|
||||
sectionIndex: number,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user