test: added new case (#38308)
## Description Added new test case for the template module. Fixes [Issue URL](https://app.zenhub.com/workspaces/stability-pod-6690c4814e31602e25cab7fd/issues/gh/appsmithorg/appsmith/38309) ## Automation /ok-to-test tags="@tag.Templates" ### 🔍 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/12463337741> > Commit: d7d11f85cb88224c18c270e17398f5b1a405b219 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12463337741&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Templates` > Spec: > <hr>Mon, 23 Dec 2024 08:19:52 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 - **New Features** - Introduced a new test suite for validating template functionality in the client-side application. - Added comprehensive test cases to verify data bindings and button actions within templates. - **Tests** - Enhanced the testing framework with checks for data source connections and user interactions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
2eac19379b
commit
c5238ffd03
|
|
@ -0,0 +1,76 @@
|
||||||
|
import template from "../../../../locators/TemplatesLocators.json";
|
||||||
|
import {
|
||||||
|
agHelper,
|
||||||
|
assertHelper,
|
||||||
|
dataSources,
|
||||||
|
debuggerHelper,
|
||||||
|
locators,
|
||||||
|
} from "../../../../support/Objects/ObjectsCore";
|
||||||
|
import EditorNavigation, {
|
||||||
|
EntityType,
|
||||||
|
PageLeftPane,
|
||||||
|
} from "../../../../support/Pages/EditorNavigation";
|
||||||
|
import PageList from "../../../../support/Pages/PageList";
|
||||||
|
|
||||||
|
describe(
|
||||||
|
"Fork a template to the current app",
|
||||||
|
{
|
||||||
|
tags: ["@tag.Templates", "@tag.excludeForAirgap"],
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
it("1. Verify that all data bindings in the template are correctly connected to the corresponding data sources (e.g., APIs, databases) No errors should be seen", () => {
|
||||||
|
PageList.AddNewPage("Add page from template");
|
||||||
|
agHelper.AssertElementVisibility(template.templateDialogBox);
|
||||||
|
agHelper.ContainsNClick("Vehicle Maintenance App");
|
||||||
|
agHelper.FailIfErrorToast("INTERNAL_SERVER_ERROR");
|
||||||
|
agHelper.GetNClick(template.templateViewForkButton);
|
||||||
|
agHelper.WaitUntilToastDisappear("template added successfully");
|
||||||
|
assertHelper.AssertNetworkStatus("updateLayout");
|
||||||
|
agHelper.WaitUntilAllToastsDisappear();
|
||||||
|
EditorNavigation.SelectEntityByName("Home page", EntityType.Page);
|
||||||
|
EditorNavigation.SelectEntityByName(
|
||||||
|
"Container2CopyCopy",
|
||||||
|
EntityType.Widget,
|
||||||
|
);
|
||||||
|
debuggerHelper.OpenDebugger();
|
||||||
|
debuggerHelper.ClickLogsTab();
|
||||||
|
debuggerHelper.AssertVisibleErrorMessagesCount(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("2. Verify button actions, such as submitting forms, navigating to other pages, or calling APIs, and verify the responses", () => {
|
||||||
|
PageList.AddNewPage("Add page from template");
|
||||||
|
agHelper.AssertElementVisibility(template.templateDialogBox);
|
||||||
|
agHelper.ContainsNClick("Vehicle Maintenance App");
|
||||||
|
agHelper.FailIfErrorToast("INTERNAL_SERVER_ERROR");
|
||||||
|
agHelper.GetNClick(template.templateViewForkButton);
|
||||||
|
agHelper.WaitUntilToastDisappear("template added successfully");
|
||||||
|
assertHelper.AssertNetworkStatus("updateLayout");
|
||||||
|
|
||||||
|
agHelper.WaitUntilAllToastsDisappear();
|
||||||
|
agHelper.RefreshPage();
|
||||||
|
EditorNavigation.SelectEntityByName("Container5", EntityType.Widget);
|
||||||
|
PageLeftPane.expandCollapseItem("Container1");
|
||||||
|
agHelper.ClickButton("Open Menu");
|
||||||
|
agHelper.AssertText(locators._menuItem, "text", "Home page", 0);
|
||||||
|
agHelper.AssertText(locators._menuItem, "text", "New vehicle", 1);
|
||||||
|
agHelper.GetNClick(locators._menuItem, 1);
|
||||||
|
agHelper.AssertContains("New vehicle registration");
|
||||||
|
EditorNavigation.SelectEntityByName("Home page", EntityType.Page);
|
||||||
|
EditorNavigation.SelectEntityByName(
|
||||||
|
"Container2CopyCopy",
|
||||||
|
EntityType.Widget,
|
||||||
|
);
|
||||||
|
PageLeftPane.expandCollapseItem("Container2CopyCopy");
|
||||||
|
agHelper.ClickButton("Register service");
|
||||||
|
agHelper.AssertElementVisibility(locators._modalWrapper);
|
||||||
|
debuggerHelper.OpenDebugger();
|
||||||
|
debuggerHelper.ClickLogsTab();
|
||||||
|
debuggerHelper.AssertVisibleErrorMessagesCount(0);
|
||||||
|
|
||||||
|
EditorNavigation.SelectEntityByName("select_cars", EntityType.Query);
|
||||||
|
dataSources.RunQuery();
|
||||||
|
dataSources.AssertQueryResponseHeaders(["vin"]);
|
||||||
|
dataSources.AssertQueryResponseHeaders(["make"]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
Loading…
Reference in New Issue
Block a user