chore: remove commented code from @tag.JS specs (#32957)
## Description Remove commented code for JS related spec ## Automation /ok-to-test tags="@tag.JS" ### 🔍 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/8920272253> > Commit: 8a853349e01ca60968172aeba09f0b389b8816e0 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8920272253&attempt=1" target="_blank">Click here!</a> <!-- 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 - **Refactor** - Improved test cases for navigation, API interactions, and Oracle datasource handling. - Streamlined test scripts by removing redundant code, comments, and unnecessary imports. - Simplified handling of JavaScript content and confirmation dialogs in the `JSEditor` class. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
24c7f68855
commit
ddd1d6671f
|
|
@ -1,30 +0,0 @@
|
|||
import {
|
||||
agHelper,
|
||||
deployMode,
|
||||
draggableWidgets,
|
||||
entityExplorer,
|
||||
propPane,
|
||||
} from "../../../../support/Objects/ObjectsCore";
|
||||
import EditorNavigation, {
|
||||
EntityType,
|
||||
} from "../../../../support/Pages/EditorNavigation";
|
||||
import PageList from "../../../../support/Pages/PageList";
|
||||
|
||||
describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
|
||||
it("2. Gives error message when invalid word is entered in the url tab of navigate to", () => {
|
||||
PageList.AddNewPage(); // page 2
|
||||
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300);
|
||||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
|
||||
propPane.SelectPlatformFunction("onClick", "Navigate to");
|
||||
agHelper.GetNClick(propPane._navigateToType("URL"));
|
||||
agHelper.TypeText(
|
||||
propPane._actionSelectorFieldByLabel("Enter URL"),
|
||||
"wrongPage",
|
||||
);
|
||||
deployMode.DeployApp();
|
||||
agHelper.ClickButton("Submit");
|
||||
agHelper.ValidateToastMessage("Enter a valid URL or page name");
|
||||
deployMode.NavigateBacktoEditor();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
import {
|
||||
agHelper,
|
||||
deployMode,
|
||||
draggableWidgets,
|
||||
entityExplorer,
|
||||
propPane,
|
||||
} from "../../../../support/Objects/ObjectsCore";
|
||||
import EditorNavigation, {
|
||||
EntityType,
|
||||
} from "../../../../support/Pages/EditorNavigation";
|
||||
import PageList from "../../../../support/Pages/PageList";
|
||||
|
||||
describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
|
||||
it("3. Navigates to url entered from the url tab of navigate to", () => {
|
||||
PageList.AddNewPage(); // page 2
|
||||
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300);
|
||||
propPane.SelectPlatformFunction("onClick", "Navigate to");
|
||||
agHelper.GetNClick(propPane._navigateToType("URL"));
|
||||
agHelper.TypeText(
|
||||
propPane._actionSelectorFieldByLabel("Enter URL"),
|
||||
"www.google.com",
|
||||
);
|
||||
deployMode.DeployApp();
|
||||
agHelper.ClickButton("Submit");
|
||||
cy.url().should("include", "google.com");
|
||||
// go back to appsmith
|
||||
//cy.go(-1);
|
||||
});
|
||||
});
|
||||
|
|
@ -11,6 +11,7 @@ import {
|
|||
import EditorNavigation, {
|
||||
EntityType,
|
||||
} from "../../../../support/Pages/EditorNavigation";
|
||||
import PageList from "../../../../support/Pages/PageList";
|
||||
|
||||
describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
|
||||
it("1. Navigates to page name clicked from the page name tab of navigate to", () => {
|
||||
|
|
@ -50,5 +51,35 @@ describe("Navigate To feature", { tags: ["@tag.JS"] }, () => {
|
|||
cy.log("deploy url is" + $url);
|
||||
expect($url).to.contain("test=123");
|
||||
});
|
||||
deployMode.NavigateBacktoEditor();
|
||||
propPane.DeleteWidgetFromPropertyPane("Button1");
|
||||
});
|
||||
|
||||
it("2. Gives error message when invalid word is entered in the url tab of navigate to", () => {
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300);
|
||||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
|
||||
propPane.SelectPlatformFunction("onClick", "Navigate to");
|
||||
agHelper.GetNClick(propPane._navigateToType("URL"));
|
||||
agHelper.TypeText(
|
||||
propPane._actionSelectorFieldByLabel("Enter URL"),
|
||||
"wrongPage",
|
||||
);
|
||||
agHelper.ClickButton("Submit");
|
||||
agHelper.ValidateToastMessage("Enter a valid URL or page name");
|
||||
propPane.DeleteWidgetFromPropertyPane("Button1");
|
||||
});
|
||||
|
||||
it("3. Navigates to url entered from the url tab of navigate to", () => {
|
||||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.BUTTON, 300, 300);
|
||||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
|
||||
propPane.SelectPlatformFunction("onClick", "Navigate to");
|
||||
agHelper.GetNClick(propPane._navigateToType("URL"));
|
||||
agHelper.TypeText(
|
||||
propPane._actionSelectorFieldByLabel("Enter URL"),
|
||||
"www.google.com",
|
||||
);
|
||||
deployMode.DeployApp();
|
||||
agHelper.ClickButton("Submit");
|
||||
cy.url().should("include", "google.com");
|
||||
});
|
||||
});
|
||||
|
|
@ -10,6 +10,7 @@ import {
|
|||
table,
|
||||
entityItems,
|
||||
apiPage,
|
||||
jsEditor,
|
||||
} from "../../../../support/Objects/ObjectsCore";
|
||||
import { Widgets } from "../../../../support/Pages/DataSources";
|
||||
import EditorNavigation, {
|
||||
|
|
@ -446,6 +447,7 @@ WHERE aircraft_type = 'Passenger Plane'`;
|
|||
propPane.EnterJSContext("onClick", `{{Query1.run()}}`);
|
||||
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
|
||||
agHelper.ClickButton("Submit");
|
||||
jsEditor.ConfirmationClick("No"); //Handling both No & Yes from confirmation dialog
|
||||
|
||||
table.WaitUntilTableLoad(0, 0, "v2");
|
||||
deployMode.NavigateBacktoEditor();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import {
|
|||
dataSources,
|
||||
debuggerHelper,
|
||||
deployMode,
|
||||
entityExplorer,
|
||||
homePage,
|
||||
jsEditor,
|
||||
} from "../../../../support/Objects/ObjectsCore";
|
||||
|
|
@ -11,8 +10,6 @@ import EditorNavigation, {
|
|||
EntityType,
|
||||
} from "../../../../support/Pages/EditorNavigation";
|
||||
|
||||
let datasourceName: any;
|
||||
|
||||
describe(
|
||||
"JSObjects OnLoad Actions tests",
|
||||
{ tags: ["@tag.PropertyPane", "@tag.JS"] },
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import EditorNavigation, {
|
|||
AppSidebar,
|
||||
} from "../../../../support/Pages/EditorNavigation";
|
||||
|
||||
let dsName: any, jsName: any;
|
||||
let jsName: any;
|
||||
|
||||
describe(
|
||||
"JSObjects OnLoad Actions tests",
|
||||
|
|
@ -34,9 +34,6 @@ describe(
|
|||
locators._widgetInCanvas("imagewidget"),
|
||||
);
|
||||
dataSources.CreateDataSource("Postgres");
|
||||
cy.get("@dsName").then(($dsName) => {
|
||||
dsName = $dsName;
|
||||
});
|
||||
cy.fixture("datasources").then((datasourceFormData: any) => {
|
||||
AppSidebar.navigate(AppSidebarButton.Editor);
|
||||
apiPage.CreateAndFillApi(
|
||||
|
|
@ -87,8 +84,6 @@ describe(
|
|||
.and("contain", jsName as string)
|
||||
.and("contain", "will be executed automatically on page load");
|
||||
|
||||
//agHelper.WaitUntilToastDisappear("Quotes");
|
||||
|
||||
EditorNavigation.SelectEntityByName("Input2", EntityType.Widget);
|
||||
propPane.UpdatePropertyFieldValue(
|
||||
"Default value",
|
||||
|
|
@ -105,9 +100,6 @@ describe(
|
|||
deployMode.DeployApp();
|
||||
|
||||
agHelper.RefreshPage("getConsolidatedData");
|
||||
// agHelper.AssertElementVisibility(
|
||||
// jsEditor._dialogBody((jsName as string) + ".callTrump"),
|
||||
// );
|
||||
|
||||
agHelper.Sleep(4000); //to let the api's call be finished & populate the text fields before validation!
|
||||
agHelper
|
||||
|
|
|
|||
|
|
@ -46,13 +46,11 @@ describe(
|
|||
dataManager.dsValues[dataManager.defaultEnviorment].flowerImageUrl1,
|
||||
"RandomFlora",
|
||||
);
|
||||
//apiPage.RunAPI();
|
||||
|
||||
apiPage.CreateAndFillApi(
|
||||
dataManager.dsValues[dataManager.defaultEnviorment].mockApiUrl,
|
||||
"RandomUser",
|
||||
);
|
||||
//apiPage.RunAPI();
|
||||
|
||||
apiPage.CreateAndFillApi(
|
||||
"https://favqs.com/api/qotd",
|
||||
|
|
@ -60,7 +58,6 @@ describe(
|
|||
30000,
|
||||
);
|
||||
apiPage.EnterHeader("dependency", "{{RandomUser.data}}"); //via Params tab
|
||||
//apiPage.RunAPI();
|
||||
|
||||
apiPage.CreateAndFillApi(
|
||||
"https://www.boredapi.com/api/activity",
|
||||
|
|
@ -68,11 +65,9 @@ describe(
|
|||
30000,
|
||||
);
|
||||
apiPage.EnterHeader("dependency", "{{InspiringQuotes.data}}");
|
||||
//apiPage.RunAPI();
|
||||
|
||||
apiPage.CreateAndFillApi("https://api.genderize.io", "Genderize", 30000);
|
||||
apiPage.EnterParams("name", "{{RandomUser.data.results[0].name.first}}"); //via Params tab
|
||||
//apiPage.RunAPI();
|
||||
|
||||
//Adding dependency in right order matters!
|
||||
EditorNavigation.SelectEntityByName("Image1", EntityType.Widget);
|
||||
|
|
@ -96,45 +91,6 @@ describe(
|
|||
`Hi, here is {{RandomUser.data.results[0].name.first}} & I'm {{RandomUser.data.results[0].dob.age}}'yo\nI live in {{RandomUser.data.results[0].location.country}}\nMy Suggestion : {{Suggestions.data.activity}}\n\nI'm {{Genderize.data.gender}}`,
|
||||
);
|
||||
|
||||
// cy.url().then((url) => {
|
||||
// const pageid = url.split("/")[4]?.split("-").pop();
|
||||
// cy.log(pageid + "page id");
|
||||
// cy.request("GET", "api/v1/pages/" + pageid).then((response) => {
|
||||
// const respBody = JSON.stringify(response.body);
|
||||
|
||||
// const _randomFlora = JSON.parse(respBody).data.layouts[0]
|
||||
// .layoutOnLoadActions[0];
|
||||
// const _randomUser = JSON.parse(respBody).data.layouts[0]
|
||||
// .layoutOnLoadActions[1];
|
||||
// const _genderize = JSON.parse(respBody).data.layouts[0]
|
||||
// .layoutOnLoadActions[2];
|
||||
// const _suggestions = JSON.parse(respBody).data.layouts[0]
|
||||
// .layoutOnLoadActions[3];
|
||||
// // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora))
|
||||
// // cy.log("_randomUser is: " + JSON.stringify(_randomUser))
|
||||
// // cy.log("_genderize is: " + JSON.stringify(_genderize))
|
||||
// // cy.log("_suggestions is: " + JSON.stringify(_suggestions))
|
||||
|
||||
// expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq(
|
||||
// "RandomFlora",
|
||||
// );
|
||||
// expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq(
|
||||
// "RandomUser",
|
||||
// );
|
||||
// expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([
|
||||
// "Genderize",
|
||||
// "InspiringQuotes",
|
||||
// ]);
|
||||
// expect(JSON.parse(JSON.stringify(_genderize))[1]["name"]).to.be.oneOf([
|
||||
// "Genderize",
|
||||
// "InspiringQuotes",
|
||||
// ]);
|
||||
// expect(JSON.parse(JSON.stringify(_suggestions))[0]["name"]).to.eq(
|
||||
// "Suggestions",
|
||||
// );
|
||||
// });
|
||||
// });
|
||||
|
||||
deployMode.DeployApp(locators._widgetInDeployed("textwidget"), false);
|
||||
agHelper.Sleep(5000); //for all api's to ccomplete call!
|
||||
assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
||||
|
|
@ -150,10 +106,6 @@ describe(
|
|||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[2];
|
||||
const _suggestions =
|
||||
pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[3];
|
||||
// cy.log("_randomFlora is: " + JSON.stringify(_randomFlora))
|
||||
// cy.log("_randomUser is: " + JSON.stringify(_randomUser))
|
||||
// cy.log("_genderize is: " + JSON.stringify(_genderize))
|
||||
// cy.log("_suggestions is: " + JSON.stringify(_suggestions))
|
||||
|
||||
expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq(
|
||||
"RandomFlora",
|
||||
|
|
|
|||
|
|
@ -36,60 +36,20 @@ export class JSEditor {
|
|||
_codeTab = "//span[text()='Code']/parent::button";
|
||||
private _jsObjectParseErrorCallout =
|
||||
"div.t--js-response-parse-error-call-out";
|
||||
private _jsFunctionExecutionParseErrorCallout =
|
||||
"div.t--function-execution-parse-error-call-out";
|
||||
private _onPageLoadRadioButton = (functionName: string, onLoad: boolean) =>
|
||||
`.${functionName}-on-page-load-setting label:contains(${
|
||||
onLoad ? "Yes" : "No"
|
||||
}) input`;
|
||||
|
||||
private _onPageLoadSwitch = (functionName: string) =>
|
||||
`.${functionName}-on-page-load-setting
|
||||
input[role="switch"]`;
|
||||
private _onPageLoadRadioButtonStatus = (
|
||||
functionName: string,
|
||||
onLoad: boolean,
|
||||
) =>
|
||||
`//div[contains(@class, '${functionName}-on-page-load-setting')]//label[text()='${
|
||||
onLoad ? "Yes" : "No"
|
||||
}']/parent::div`;
|
||||
private _onPageLoadSwitchStatus = (functionName: string) =>
|
||||
`//div[contains(@class, '${functionName}-on-page-load-setting')]//label/input`;
|
||||
private _confirmBeforeExecuteRadioButton = (
|
||||
functionName: string,
|
||||
shouldConfirm: boolean,
|
||||
) =>
|
||||
`.${functionName}-confirm-before-execute label:contains(${
|
||||
shouldConfirm ? "Yes" : "No"
|
||||
}) input`;
|
||||
private _confirmBeforeExecuteSwitch = (functionName: string) =>
|
||||
`.${functionName}-confirm-before-execute
|
||||
input[role="switch"]`;
|
||||
private _confirmBeforeExecuteRadioButtonStatus = (
|
||||
functionName: string,
|
||||
shouldConfirm: boolean,
|
||||
) =>
|
||||
`//div[contains(@class, '${functionName}-confirm-before-execute')]//label[text()='${
|
||||
shouldConfirm ? "Yes" : "No"
|
||||
}']/parent::div`;
|
||||
private _confirmBeforeExecuteSwitchStatus = (functionName: string) =>
|
||||
`//div[contains(@class, '${functionName}-confirm-before-execute')]//label/input`;
|
||||
private _outputConsole = ".CodeEditorTarget";
|
||||
|
||||
private _jsObjName = ".t--js-action-name-edit-field span";
|
||||
public _jsObjTxt = ".t--js-action-name-edit-field input";
|
||||
public _newJSobj = "span:contains('New JS object')";
|
||||
private _bindingsClose = ".t--entity-property-close";
|
||||
public _propertyList = ".binding";
|
||||
private _responseTabAction = (funName: string) =>
|
||||
"//div[@class='function-name'][text()='" +
|
||||
funName +
|
||||
"']/following-sibling::div//*[local-name()='svg']";
|
||||
private _functionSetting = (settingTxt: string) =>
|
||||
"//span[text()='" +
|
||||
settingTxt +
|
||||
"']/parent::div/following-sibling::input[@type='checkbox']";
|
||||
_dialog = (dialogHeader: string) =>
|
||||
"//div[@role='dialog']//h3[contains(text(), '" + dialogHeader + "')]";
|
||||
private _closeSettings = "span[icon='small-cross']";
|
||||
_dialogBody = (jsFuncName: string) =>
|
||||
"//div[@role='dialog']//*[contains(text(), '" +
|
||||
Cypress.env("MESSAGES")?.QUERY_CONFIRMATION_MODAL_MESSAGE() +
|
||||
|
|
@ -130,7 +90,6 @@ export class JSEditor {
|
|||
// Pastes or types content into field
|
||||
private HandleJsContentFilling(toPaste: boolean, JSCode: string, el: any) {
|
||||
if (toPaste) {
|
||||
//input.invoke("val", value);
|
||||
this.agHelper.Paste(el, JSCode);
|
||||
} else {
|
||||
cy.get(el).type(JSCode, {
|
||||
|
|
@ -153,12 +112,10 @@ export class JSEditor {
|
|||
this.assertHelper.AssertNetworkStatus("@jsCollections", 200);
|
||||
this.agHelper.AssertElementVisibility(this._jsObjTxt);
|
||||
// Assert that the name of the JS Object is focused when newly created
|
||||
//cy.get(this._jsObjTxt).should("be.focused").type("{enter}");
|
||||
this.agHelper.PressEnter();
|
||||
this.agHelper.PressEnter();
|
||||
// Assert that the name of the JS Object is no longer in the editable form after pressing "enter"
|
||||
this.agHelper.AssertElementAbsence(this._jsObjTxt);
|
||||
//cy.waitUntil(() => cy.get(this.locator._toastMsg).should('not.be.visible')) // fails sometimes
|
||||
|
||||
this.agHelper.Sleep();
|
||||
}
|
||||
|
|
@ -308,21 +265,7 @@ export class JSEditor {
|
|||
cy.get(this._bindingsClose).click({ force: true });
|
||||
}
|
||||
|
||||
// public EnableDisableOnPageLoad(funName: string, onLoad: 'enable' | 'disable' | '', bfrCalling: 'enable' | 'disable' | '') {
|
||||
// this.agHelper.GetNClick(this._responseTabAction(funName))
|
||||
// this.agHelper.AssertElementPresence(this._dialog('Function settings'))
|
||||
// if (onLoad)
|
||||
// this.agHelper.CheckUncheck(this._functionSetting(Cypress.env("MESSAGES").JS_SETTINGS_ONPAGELOAD()), onLoad == 'enable' ? true : false)
|
||||
// if (bfrCalling)
|
||||
// this.agHelper.CheckUncheck(this._functionSetting(Cypress.env("MESSAGES").JS_SETTINGS_CONFIRM_EXECUTION()), bfrCalling == 'enable' ? true : false)
|
||||
|
||||
// this.agHelper.GetNClick(this._closeSettings)
|
||||
// }
|
||||
|
||||
public VerifyAsyncFuncSettings(funName: string, onLoad = true) {
|
||||
// this.agHelper.AssertExistingToggleState(this._functionSetting(Cypress.env("MESSAGES").JS_SETTINGS_ONPAGELOAD()), onLoad)
|
||||
// this.agHelper.AssertExistingToggleState(this._functionSetting(Cypress.env("MESSAGES").JS_SETTINGS_CONFIRM_EXECUTION()), bfrCalling)
|
||||
|
||||
this.agHelper.GetNClick(this._settingsTab);
|
||||
this.agHelper.AssertExistingCheckedState(
|
||||
this._onPageLoadSwitchStatus(funName),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user