-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: 88c823d > <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” <“[email protected]”>
- Loading branch information
1 parent
86bddaa
commit fd72197
Showing
3 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
139 changes: 139 additions & 0 deletions
139
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters