-
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: Editor tests for renaming, copying, moving, and deleting APIs (#…
…38896) ## Description This PR adds set of tests for API-related operations in the editor, including renaming, copying, moving, and validating tab behaviors triggered from debugger logs. ## Automation /ok-to-test tags="@tag.Datasource, @tag.Git, @tag.Sanity" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13047527270> > Commit: 09e3929 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13047527270&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Datasource, @tag.Git, @tag.Sanity` > Spec: > <hr>Thu, 30 Jan 2025 08:38:58 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Enhanced API management testing capabilities - Added support for renaming, copying, and moving APIs - Improved log-based tab navigation and reopening functionality - **Tests** - Introduced comprehensive test suite for API operations - Added test cases for API renaming, copying, moving, and deletion - Implemented log-based tab interaction tests These updates improve the testing infrastructure and validate key API management features in the application. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
1 parent
01cda23
commit 213db55
Showing
3 changed files
with
183 additions
and
1 deletion.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_Additional_Tests_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,82 @@ | ||
import { | ||
agHelper, | ||
debuggerHelper, | ||
homePage, | ||
} from "../../../../support/Objects/ObjectsCore"; | ||
import { apiPage } from "../../../../support/Objects/ObjectsCore"; | ||
import { | ||
PageLeftPane, | ||
PagePaneSegment, | ||
} from "../../../../support/Pages/EditorNavigation"; | ||
import FileTabs from "../../../../support/Pages/IDE/FileTabs"; | ||
import PageList from "../../../../support/Pages/PageList"; | ||
|
||
describe( | ||
"Additional API tests", | ||
{ tags: ["@tag.Datasource", "@tag.Git"] }, | ||
() => { | ||
it("1. Validate renaming & copying API from editor", () => { | ||
// Create first API | ||
apiPage.CreateApi(); | ||
// Rename the API | ||
apiPage.renameFromEditor("changedName"); | ||
// Create second API | ||
apiPage.CreateApi("secondApi", "GET"); | ||
// Add a new blank page to the application | ||
PageList.AddNewPage("New blank page"); | ||
// Copy the API to the same page | ||
apiPage.performActionFromEditor("copy", "changedName", "Page1", "Page1"); | ||
// Copy the API to a different page | ||
apiPage.performActionFromEditor("copy", "secondApi", "Page1", "Page2"); | ||
}); | ||
|
||
it("2. Validate moving & deleting API from editor", () => { | ||
// Create a new application | ||
homePage.NavigateToHome(); | ||
homePage.CreateNewApplication(); | ||
// Create first API | ||
apiPage.CreateApi("ApiToBeMoved", "GET"); | ||
apiPage.CreateApi("ApiNotToBeMoved", "GET"); | ||
// Having only one page in the app, check if the API is moved to the same page | ||
apiPage.performActionFromEditor("move", "ApiToBeMoved", "Page1", "Page1"); | ||
// Add a new blank page to the application | ||
PageList.AddNewPage("New blank page"); | ||
// Move the API to a different page & check if the source page does not have the API anymore | ||
apiPage.performActionFromEditor("move", "ApiToBeMoved", "Page1", "Page2"); | ||
apiPage.performActionFromEditor("move", "ApiToBeMoved", "Page2", "Page1"); | ||
apiPage.deleteAPIFromEditor("ApiToBeMoved", "Page1"); | ||
}); | ||
|
||
it("3. Validate whether correct tab opens up after clicking on link from logs", () => { | ||
// Create a new application | ||
homePage.NavigateToHome(); | ||
homePage.CreateNewApplication(); | ||
for (let i = 0; i < 4; i++) { | ||
apiPage.CreateApi(``, "GET"); | ||
} | ||
debuggerHelper.OpenDebugger(); | ||
//Navigate to the "Logs" tab in the debugger | ||
debuggerHelper.ClickLogsTab(); | ||
// Click on the entity link in the log entry at index 2 | ||
debuggerHelper.ClicklogEntityLink(false, 2); | ||
// Assert that the correct tab ("Api3") opens | ||
agHelper.AssertClassExists(FileTabs.locators.tabName("Api3"), "active"); | ||
}); | ||
|
||
it("4. Validate whether closed tab opens up after clicking on link from logs", () => { | ||
// Close all the tabs (Api1 to Api4) | ||
for (let i = 1; i < 5; i++) { | ||
FileTabs.closeTab(`Api${i}`); | ||
} | ||
// Switch to the "UI" segment in the page left pane | ||
PageLeftPane.switchSegment(PagePaneSegment.UI); | ||
debuggerHelper.OpenDebugger(); | ||
// Navigate to the "Logs" tab in the debugger | ||
debuggerHelper.ClickLogsTab(); | ||
// Click on the entity link in the log entry at index 1 | ||
debuggerHelper.ClicklogEntityLink(false, 1); | ||
// Assert that the correct tab ("Api2") reopens | ||
agHelper.AssertClassExists(FileTabs.locators.tabName("Api2"), "active"); | ||
}); | ||
}, | ||
); |
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