ci: Fixing cypress tests that are failing due to the change from executeOnLoad to runBehavior (#40489)
## Description Fixing cypress tests that are failing due to the change from executeOnLoad to runBehavior Fixes [#39833](https://github.com/appsmithorg/appsmith/issues/39833) ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Tests have not run on the HEAD d9d2419226a0de412d650b04dcde0483d7fedcfb yet > <hr>Wed, 30 Apr 2025 14:37:22 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a "Run behavior" dropdown for APIs, queries, and JS functions, allowing users to select between "On page load" and "Manual" execution modes. - Enhanced settings UI with descriptive labels and subtexts for run behavior options. - **Improvements** - Replaced the simple "Run on page load" switch with a flexible dropdown across the platform for better control and clarity. - Updated terminology and UI across app settings, plugin configurations, and test suites to reflect the new run behavior model. - **Bug Fixes** - Adjusted automated tests and UI interactions to align with the new run behavior selection, ensuring consistent behavior and reliability. - **Documentation** - Updated labels, tooltips, and instructional text to guide users on the new run behavior options. - **Refactor** - Unified internal logic and configuration to support the new run behavior property, replacing legacy boolean flags. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
0c8bd0bd2f
commit
62ccf0352a
|
|
@ -46,7 +46,7 @@ describe(
|
||||||
cy.wrap(jsObjectName).as("jsObjectName");
|
cy.wrap(jsObjectName).as("jsObjectName");
|
||||||
});
|
});
|
||||||
|
|
||||||
apiPage.clickSettingIcon(true);
|
apiPage.clickSettingIcon("On page load");
|
||||||
|
|
||||||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
|
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget);
|
||||||
propPane.ToggleJSMode("onClick", true);
|
propPane.ToggleJSMode("onClick", true);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ describe(
|
||||||
pluginActionForm.toolbar.toggleSettings();
|
pluginActionForm.toolbar.toggleSettings();
|
||||||
|
|
||||||
cy.get(".label-icon-wrapper")
|
cy.get(".label-icon-wrapper")
|
||||||
.contains("Run the query on page load")
|
.contains("Run behavior")
|
||||||
.parent()
|
.parent()
|
||||||
.then(($el) => {
|
.then(($el) => {
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ describe(
|
||||||
prettify: false,
|
prettify: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1", true);
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "On page load");
|
||||||
|
|
||||||
ee.DragDropWidgetNVerify(WIDGET.TEXT, 200, 600);
|
ee.DragDropWidgetNVerify(WIDGET.TEXT, 200, 600);
|
||||||
EditorNavigation.SelectEntityByName("Text1", EntityType.Widget);
|
EditorNavigation.SelectEntityByName("Text1", EntityType.Widget);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ describe("Validate JSObj", {}, () => {
|
||||||
shouldCreateNewJSObj: true,
|
shouldCreateNewJSObj: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1");
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "On page load");
|
||||||
|
|
||||||
// Add new JSObject
|
// Add new JSObject
|
||||||
PageList.AddNewPage("New blank page");
|
PageList.AddNewPage("New blank page");
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,14 @@ describe.skip(
|
||||||
_.dataManager.dsValues[_.dataManager.defaultEnviorment].mockApiUrl,
|
_.dataManager.dsValues[_.dataManager.defaultEnviorment].mockApiUrl,
|
||||||
"Correct_users",
|
"Correct_users",
|
||||||
);
|
);
|
||||||
_.apiPage.ToggleOnPageLoadRun(true);
|
_.apiPage.ToggleOnPageLoadRun("On page load");
|
||||||
_.apiPage.CreateAndFillApi(
|
_.apiPage.CreateAndFillApi(
|
||||||
_.dataManager.dsValues[
|
_.dataManager.dsValues[
|
||||||
_.dataManager.defaultEnviorment
|
_.dataManager.defaultEnviorment
|
||||||
].mockApiUrl.replace("mock-api", "mock-api2err"),
|
].mockApiUrl.replace("mock-api", "mock-api2err"),
|
||||||
"Incorrect_users",
|
"Incorrect_users",
|
||||||
);
|
);
|
||||||
_.apiPage.ToggleOnPageLoadRun(true);
|
_.apiPage.ToggleOnPageLoadRun("On page load");
|
||||||
_.jsEditor.CreateJSObject(
|
_.jsEditor.CreateJSObject(
|
||||||
`export default {
|
`export default {
|
||||||
async myFun1 () {
|
async myFun1 () {
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ describe(
|
||||||
|
|
||||||
it("3. Update 'setOptions' property - during onPage load", () => {
|
it("3. Update 'setOptions' property - during onPage load", () => {
|
||||||
EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);
|
EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1", true); //for on page load execution
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "On page load"); //for on page load execution
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
agHelper
|
agHelper
|
||||||
.GetText(
|
.GetText(
|
||||||
|
|
@ -268,7 +268,7 @@ describe(
|
||||||
])}, () => {showAlert('unable to run API')});
|
])}, () => {showAlert('unable to run API')});
|
||||||
}
|
}
|
||||||
}`);
|
}`);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFunc1", true); //for on page load execution, since sync function is updated to async
|
jsEditor.EnableDisableAsyncFuncSettings("myFunc1", "On page load"); //for on page load execution, since sync function is updated to async
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
agHelper.WaitForCondition(
|
agHelper.WaitForCondition(
|
||||||
agHelper
|
agHelper
|
||||||
|
|
@ -313,7 +313,7 @@ describe(
|
||||||
Select3.setOptions(Select1.options.concat(Select2.options));
|
Select3.setOptions(Select1.options.concat(Select2.options));
|
||||||
}
|
}
|
||||||
}`);
|
}`);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFunc1", true); //for on page load execution, since sync function is updated to async
|
jsEditor.EnableDisableAsyncFuncSettings("myFunc1", "On page load"); //for on page load execution, since sync function is updated to async
|
||||||
EditorNavigation.SelectEntityByName("Input1", EntityType.Widget);
|
EditorNavigation.SelectEntityByName("Input1", EntityType.Widget);
|
||||||
propPane.UpdatePropertyFieldValue("Default value", "{{Select3.options}}");
|
propPane.UpdatePropertyFieldValue("Default value", "{{Select3.options}}");
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
|
|
@ -355,7 +355,7 @@ describe(
|
||||||
setTimeout(() => {Select1.setOptions(localValue)}, 1000);
|
setTimeout(() => {Select1.setOptions(localValue)}, 1000);
|
||||||
}
|
}
|
||||||
}`);
|
}`);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1", false); //for on page load execution
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "Manual"); //for on page load execution
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
agHelper
|
agHelper
|
||||||
.GetText(
|
.GetText(
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ describe(
|
||||||
}`,
|
}`,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1", true);
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "On page load");
|
||||||
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON)); //Asserting before setTimeout JS function execution, button is visible
|
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.BUTTON)); //Asserting before setTimeout JS function execution, button is visible
|
||||||
agHelper.Sleep(2000); //waiting for settimeout to execute
|
agHelper.Sleep(2000); //waiting for settimeout to execute
|
||||||
agHelper.AssertElementAbsence(
|
agHelper.AssertElementAbsence(
|
||||||
|
|
@ -236,7 +236,7 @@ describe(
|
||||||
}`,
|
}`,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1", false);
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "Manual");
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
agHelper.AssertElementVisibility(
|
agHelper.AssertElementVisibility(
|
||||||
locators._widgetInDeployed(draggableWidgets.INPUT_V2), //Asserting before setTimeout JS function execution, Input is visible
|
locators._widgetInDeployed(draggableWidgets.INPUT_V2), //Asserting before setTimeout JS function execution, Input is visible
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ describe(
|
||||||
|
|
||||||
EditorNavigation.SelectEntityByName("MultipartAPI", EntityType.Api);
|
EditorNavigation.SelectEntityByName("MultipartAPI", EntityType.Api);
|
||||||
|
|
||||||
apiPage.ToggleOnPageLoadRun(false); //Bug 12476
|
apiPage.ToggleOnPageLoadRun("Manual"); //Bug 12476
|
||||||
EditorNavigation.SelectEntityByName("Page2", EntityType.Page);
|
EditorNavigation.SelectEntityByName("Page2", EntityType.Page);
|
||||||
deployMode.DeployApp(locators._buttonByText("Select Files"));
|
deployMode.DeployApp(locators._buttonByText("Select Files"));
|
||||||
agHelper.ClickButton("Select Files");
|
agHelper.ClickButton("Select Files");
|
||||||
|
|
|
||||||
|
|
@ -467,7 +467,7 @@ describe(
|
||||||
});
|
});
|
||||||
|
|
||||||
it("7. Tc #2365 - Query settings tab validations", () => {
|
it("7. Tc #2365 - Query settings tab validations", () => {
|
||||||
apiPage.ToggleOnPageLoadRun(false); // All above cases validated for onpage load run with confirmation dialog set to false
|
apiPage.ToggleOnPageLoadRun("Manual"); // All above cases validated for onpage load run with confirmation dialog set to false
|
||||||
pluginActionForm.toolbar.toggleSettings();
|
pluginActionForm.toolbar.toggleSettings();
|
||||||
apiPage.ToggleConfirmBeforeRunning(true);
|
apiPage.ToggleConfirmBeforeRunning(true);
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ describe.skip(
|
||||||
"Select",
|
"Select",
|
||||||
);
|
);
|
||||||
agHelper.RenameQuery("TemplateSelectQuery");
|
agHelper.RenameQuery("TemplateSelectQuery");
|
||||||
apiPage.ToggleOnPageLoadRun(true);
|
apiPage.ToggleOnPageLoadRun("On page load");
|
||||||
pluginActionForm.toolbar.toggleSettings();
|
pluginActionForm.toolbar.toggleSettings();
|
||||||
apiPage.ToggleConfirmBeforeRunning(true);
|
apiPage.ToggleConfirmBeforeRunning(true);
|
||||||
agHelper.RefreshPage();
|
agHelper.RefreshPage();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import PageList from "../../../../support/Pages/PageList";
|
||||||
|
|
||||||
interface IFunctionSettingData {
|
interface IFunctionSettingData {
|
||||||
name: string;
|
name: string;
|
||||||
onPageLoad: boolean;
|
runBehavior: "On page load" | "Manual";
|
||||||
confirmBeforeExecute: boolean;
|
confirmBeforeExecute: boolean;
|
||||||
// uses the "async" keyword
|
// uses the "async" keyword
|
||||||
isMarkedAsync: boolean;
|
isMarkedAsync: boolean;
|
||||||
|
|
@ -35,31 +35,31 @@ describe(
|
||||||
const FUNCTIONS_SETTINGS_DEFAULT_DATA: IFunctionSettingData[] = [
|
const FUNCTIONS_SETTINGS_DEFAULT_DATA: IFunctionSettingData[] = [
|
||||||
{
|
{
|
||||||
name: "getId",
|
name: "getId",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: false,
|
confirmBeforeExecute: false,
|
||||||
isMarkedAsync: true,
|
isMarkedAsync: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zip",
|
name: "zip",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: true,
|
confirmBeforeExecute: true,
|
||||||
isMarkedAsync: false,
|
isMarkedAsync: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "base",
|
name: "base",
|
||||||
onPageLoad: false,
|
runBehavior: "Manual",
|
||||||
confirmBeforeExecute: false,
|
confirmBeforeExecute: false,
|
||||||
isMarkedAsync: true,
|
isMarkedAsync: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "assert",
|
name: "assert",
|
||||||
onPageLoad: false,
|
runBehavior: "Manual",
|
||||||
confirmBeforeExecute: false,
|
confirmBeforeExecute: false,
|
||||||
isMarkedAsync: false,
|
isMarkedAsync: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test",
|
name: "test",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: true,
|
confirmBeforeExecute: true,
|
||||||
isMarkedAsync: true,
|
isMarkedAsync: true,
|
||||||
},
|
},
|
||||||
|
|
@ -359,7 +359,7 @@ describe(
|
||||||
// Number of functions set to run on page load and should also confirm before execute
|
// Number of functions set to run on page load and should also confirm before execute
|
||||||
onPageLoadAndConfirmExecuteFunctionsLength =
|
onPageLoadAndConfirmExecuteFunctionsLength =
|
||||||
FUNCTIONS_SETTINGS_DEFAULT_DATA.filter(
|
FUNCTIONS_SETTINGS_DEFAULT_DATA.filter(
|
||||||
(func) => func.onPageLoad && func.confirmBeforeExecute,
|
(func) => func.runBehavior && func.confirmBeforeExecute,
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
getJSObject = (data: IFunctionSettingData[]) => {
|
getJSObject = (data: IFunctionSettingData[]) => {
|
||||||
|
|
@ -404,7 +404,7 @@ describe(
|
||||||
(functionSetting) => {
|
(functionSetting) => {
|
||||||
jsEditor.EnableDisableAsyncFuncSettings(
|
jsEditor.EnableDisableAsyncFuncSettings(
|
||||||
functionSetting.name,
|
functionSetting.name,
|
||||||
functionSetting.onPageLoad,
|
functionSetting.runBehavior,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -425,31 +425,31 @@ describe(
|
||||||
const FUNCTIONS_SETTINGS_RENAMED_DATA: IFunctionSettingData[] = [
|
const FUNCTIONS_SETTINGS_RENAMED_DATA: IFunctionSettingData[] = [
|
||||||
{
|
{
|
||||||
name: "newGetId",
|
name: "newGetId",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: false,
|
confirmBeforeExecute: false,
|
||||||
isMarkedAsync: false,
|
isMarkedAsync: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zip1",
|
name: "zip1",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: true,
|
confirmBeforeExecute: true,
|
||||||
isMarkedAsync: true,
|
isMarkedAsync: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "base",
|
name: "base",
|
||||||
onPageLoad: false,
|
runBehavior: "Manual",
|
||||||
confirmBeforeExecute: false,
|
confirmBeforeExecute: false,
|
||||||
isMarkedAsync: true,
|
isMarkedAsync: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "newAssert",
|
name: "newAssert",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: false,
|
confirmBeforeExecute: false,
|
||||||
isMarkedAsync: false,
|
isMarkedAsync: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test",
|
name: "test",
|
||||||
onPageLoad: true,
|
runBehavior: "On page load",
|
||||||
confirmBeforeExecute: true,
|
confirmBeforeExecute: true,
|
||||||
isMarkedAsync: true,
|
isMarkedAsync: true,
|
||||||
},
|
},
|
||||||
|
|
@ -500,12 +500,12 @@ return "yes";`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enable all settings
|
// Enable all settings
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("asyncToSync", true);
|
jsEditor.EnableDisableAsyncFuncSettings("asyncToSync", "On page load");
|
||||||
|
|
||||||
// Modify js object
|
// Modify js object
|
||||||
jsEditor.EditJSObj(syncJSCode, false);
|
jsEditor.EditJSObj(syncJSCode, false);
|
||||||
agHelper.RefreshPage();
|
agHelper.RefreshPage();
|
||||||
jsEditor.VerifyAsyncFuncSettings("asyncToSync", true);
|
jsEditor.VerifyAsyncFuncSettings("asyncToSync", "On page load");
|
||||||
agHelper.ActionContextMenuWithInPane({
|
agHelper.ActionContextMenuWithInPane({
|
||||||
action: "Delete",
|
action: "Delete",
|
||||||
entityType: entityItems.JSObject,
|
entityType: entityItems.JSObject,
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ describe(
|
||||||
prettify: true,
|
prettify: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("myFun1", true);
|
jsEditor.EnableDisableAsyncFuncSettings("myFun1", "On page load");
|
||||||
deployMode.DeployApp();
|
deployMode.DeployApp();
|
||||||
agHelper.Sleep(1000); //DeployApp already waiting 2000ms hence reducing it here to equate to 3000 timeout
|
agHelper.Sleep(1000); //DeployApp already waiting 2000ms hence reducing it here to equate to 3000 timeout
|
||||||
agHelper.AssertContains("Success!");
|
agHelper.AssertContains("Success!");
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ describe(
|
||||||
"PageLoadApi2",
|
"PageLoadApi2",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
apiPage.ToggleOnPageLoadRun(true);
|
apiPage.ToggleOnPageLoadRun("On page load");
|
||||||
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget, {}, [
|
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget, {}, [
|
||||||
"Container3",
|
"Container3",
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ describe(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
jsEditor.EnableDisableAsyncFuncSettings("astros", true);
|
jsEditor.EnableDisableAsyncFuncSettings("astros", "On page load");
|
||||||
|
|
||||||
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
|
EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
|
||||||
agHelper.RefreshPage();
|
agHelper.RefreshPage();
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ describe(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
jsEditor.VerifyAsyncFuncSettings("myFun1", false);
|
jsEditor.VerifyAsyncFuncSettings("myFun1", "Manual");
|
||||||
jsEditor.VerifyAsyncFuncSettings("myFun2", false);
|
jsEditor.VerifyAsyncFuncSettings("myFun2", "Manual");
|
||||||
jsEditor.VerifyAsyncFuncSettings("myFun3", false);
|
jsEditor.VerifyAsyncFuncSettings("myFun3", "Manual");
|
||||||
jsEditor.VerifyAsyncFuncSettings("myFun4", false);
|
jsEditor.VerifyAsyncFuncSettings("myFun4", "Manual");
|
||||||
jsEditor.VerifyAsyncFuncSettings("myFun5", false);
|
jsEditor.VerifyAsyncFuncSettings("myFun5", "Manual");
|
||||||
jsEditor.VerifyAsyncFuncSettings("myFun6", false);
|
jsEditor.VerifyAsyncFuncSettings("myFun6", "Manual");
|
||||||
|
|
||||||
VerifyFunctionDropdown([
|
VerifyFunctionDropdown([
|
||||||
"myFun1",
|
"myFun1",
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ describe(
|
||||||
propPane.EnterJSContext("Table data", "{{ParamsTest.data}}");
|
propPane.EnterJSContext("Table data", "{{ParamsTest.data}}");
|
||||||
|
|
||||||
EditorNavigation.SelectEntityByName("ParamsTest", EntityType.Query);
|
EditorNavigation.SelectEntityByName("ParamsTest", EntityType.Query);
|
||||||
apiPage.ToggleOnPageLoadRun(false); //Bug 12476
|
apiPage.ToggleOnPageLoadRun("Manual"); //Bug 12476
|
||||||
|
|
||||||
deployMode.DeployApp(locators._buttonByText("Submit"));
|
deployMode.DeployApp(locators._buttonByText("Submit"));
|
||||||
agHelper.SelectDropDown("7");
|
agHelper.SelectDropDown("7");
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ export class ApiPage {
|
||||||
_noBodyMessage = "This request does not have a body";
|
_noBodyMessage = "This request does not have a body";
|
||||||
_imageSrc = "//img/parent::div";
|
_imageSrc = "//img/parent::div";
|
||||||
private _trashDelete = "[data-testid=t--trash-icon]";
|
private _trashDelete = "[data-testid=t--trash-icon]";
|
||||||
private _onPageLoad = "input[name='executeOnLoad'][type='checkbox']";
|
|
||||||
private _confirmBeforeRunning =
|
private _confirmBeforeRunning =
|
||||||
"input[name='confirmBeforeExecute'][type='checkbox']";
|
"input[name='confirmBeforeExecute'][type='checkbox']";
|
||||||
private _paginationTypeLabels = ".t--apiFormPaginationType label";
|
private _paginationTypeLabels = ".t--apiFormPaginationType label";
|
||||||
|
|
@ -100,13 +99,13 @@ export class ApiPage {
|
||||||
private curlImport = ".t--datasoucre-create-option-new_curl_import";
|
private curlImport = ".t--datasoucre-create-option-new_curl_import";
|
||||||
private _curlTextArea =
|
private _curlTextArea =
|
||||||
"//label[text()='Paste CURL Code Here']/parent::form/div";
|
"//label[text()='Paste CURL Code Here']/parent::form/div";
|
||||||
private runOnPageLoadJSObject =
|
|
||||||
"input[name^='execute-on-page-load'][type='checkbox']";
|
|
||||||
public settingsTriggerLocator = "[data-testid='t--js-settings-trigger']";
|
public settingsTriggerLocator = "[data-testid='t--js-settings-trigger']";
|
||||||
public splitPaneContextMenuTrigger = ".entity-context-menu";
|
public splitPaneContextMenuTrigger = ".entity-context-menu";
|
||||||
public moreActionsTrigger = "[data-testid='t--more-action-trigger']";
|
public moreActionsTrigger = "[data-testid='t--more-action-trigger']";
|
||||||
private apiNameInput = this.locator._activeEntityTabInput;
|
private apiNameInput = this.locator._activeEntityTabInput;
|
||||||
public pageList = ".ads-v2-sub-menu > .ads-v2-menu__menu-item";
|
public pageList = ".ads-v2-sub-menu > .ads-v2-menu__menu-item";
|
||||||
|
public _runBehaviorDropdown = "[data-testid='t--dropdown-runBehavior']";
|
||||||
|
public _runBehaviorOption = ".rc-select-item-option-content";
|
||||||
|
|
||||||
CreateApi(
|
CreateApi(
|
||||||
apiName = "",
|
apiName = "",
|
||||||
|
|
@ -275,10 +274,17 @@ export class ApiPage {
|
||||||
this.SelectPaneTab("Headers");
|
this.SelectPaneTab("Headers");
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleOnPageLoadRun(enable = true || false) {
|
ToggleOnPageLoadRun(runBehavior: "On page load" | "Manual") {
|
||||||
|
// Navigate to Settings tab
|
||||||
this.pluginActionForm.toolbar.toggleSettings();
|
this.pluginActionForm.toolbar.toggleSettings();
|
||||||
if (enable) this.agHelper.CheckUncheck(this._onPageLoad, true);
|
// Set runBehavior to On page load
|
||||||
else this.agHelper.CheckUncheck(this._onPageLoad, false);
|
this.agHelper.GetNClick(this._runBehaviorDropdown);
|
||||||
|
this.agHelper.GetNClickByContains(
|
||||||
|
this._runBehaviorOption,
|
||||||
|
runBehavior,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleConfirmBeforeRunning(enable = true || false) {
|
ToggleConfirmBeforeRunning(enable = true || false) {
|
||||||
|
|
@ -503,16 +509,29 @@ export class ApiPage {
|
||||||
this.RunAPI();
|
this.RunAPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleOnPageLoadRunJsObject(enable = true || false) {
|
ToggleOnPageLoadRunJsObject(runBehavior: "On page load" | "Manual") {
|
||||||
|
// Navigate to Settings tab
|
||||||
this.SelectPaneTab("Settings");
|
this.SelectPaneTab("Settings");
|
||||||
if (enable) this.agHelper.CheckUncheck(this.runOnPageLoadJSObject, true);
|
// Set runBehavior to On page load
|
||||||
else this.agHelper.CheckUncheck(this.runOnPageLoadJSObject, false);
|
this.agHelper.GetNClick(this._runBehaviorDropdown);
|
||||||
|
this.agHelper.GetNClickByContains(
|
||||||
|
this._runBehaviorOption,
|
||||||
|
runBehavior,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public clickSettingIcon(enable: boolean) {
|
public clickSettingIcon(runBehavior: "On page load" | "Manual") {
|
||||||
this.agHelper.GetNClick(this.settingsTriggerLocator);
|
this.agHelper.GetNClick(this.settingsTriggerLocator);
|
||||||
if (enable) this.agHelper.CheckUncheck(this.runOnPageLoadJSObject, true);
|
// Set runBehavior to On page load
|
||||||
else this.agHelper.CheckUncheck(this.runOnPageLoadJSObject, false);
|
this.agHelper.GetNClick(this._runBehaviorDropdown);
|
||||||
|
this.agHelper.GetNClickByContains(
|
||||||
|
this._runBehaviorOption,
|
||||||
|
runBehavior,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public renameFromEditor(renameVal: string) {
|
public renameFromEditor(renameVal: string) {
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,13 @@ export class JSEditor {
|
||||||
private _jsObjectParseErrorCallout =
|
private _jsObjectParseErrorCallout =
|
||||||
"div.t--js-response-parse-error-call-out";
|
"div.t--js-response-parse-error-call-out";
|
||||||
|
|
||||||
private _onPageLoadSwitch = (functionName: string) =>
|
private _runBehaviourSwitch = (functionName: string) =>
|
||||||
`.${functionName}-run-behavior
|
`.${functionName}-run-behavior-setting
|
||||||
input[role="combobox"]`;
|
input[role="combobox"]`;
|
||||||
private _onPageLoadSwitchStatus = (functionName: string) =>
|
private __runBehaviourSwitchStatus = (functionName: string) =>
|
||||||
`//div[contains(@class, '${functionName}-run-behavior-setting')]//label/input`;
|
`.${functionName}-run-behavior-setting .rc-select-selection-item`;
|
||||||
|
|
||||||
private _jsObjName = this.locator._activeEntityTab;
|
public _jsObjName = this.locator._activeEntityTab;
|
||||||
public _jsObjTxt = this.locator._activeEntityTabInput;
|
public _jsObjTxt = this.locator._activeEntityTabInput;
|
||||||
public _newJSobj = "span:contains('New JS object')";
|
public _newJSobj = "span:contains('New JS object')";
|
||||||
private _bindingsClose = ".t--entity-property-close";
|
private _bindingsClose = ".t--entity-property-close";
|
||||||
|
|
@ -95,6 +95,7 @@ export class JSEditor {
|
||||||
_addJSObj = '[data-testid="t--ide-tabs-add-button"]';
|
_addJSObj = '[data-testid="t--ide-tabs-add-button"]';
|
||||||
_jsPageActions = ".entity-context-menu";
|
_jsPageActions = ".entity-context-menu";
|
||||||
_moreActions = '[data-testid="t--more-action-trigger"]';
|
_moreActions = '[data-testid="t--more-action-trigger"]';
|
||||||
|
_dropdownOption = ".rc-select-item-option-content";
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region constants
|
//#region constants
|
||||||
|
|
@ -296,20 +297,32 @@ export class JSEditor {
|
||||||
cy.get(this._bindingsClose).click({ force: true });
|
cy.get(this._bindingsClose).click({ force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
public VerifyAsyncFuncSettings(funName: string, onLoad = true) {
|
public VerifyAsyncFuncSettings(
|
||||||
|
funName: string,
|
||||||
|
runBehavior: "On page load" | "Manual",
|
||||||
|
) {
|
||||||
this.toolbar.toggleSettings();
|
this.toolbar.toggleSettings();
|
||||||
this.agHelper.AssertExistingCheckedState(
|
this.agHelper.GetNAssertContains(
|
||||||
this._onPageLoadSwitchStatus(funName),
|
this.__runBehaviourSwitchStatus(funName),
|
||||||
onLoad.toString(),
|
runBehavior,
|
||||||
);
|
);
|
||||||
this.toolbar.toggleSettings();
|
this.toolbar.toggleSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnableDisableAsyncFuncSettings(funName: string, onLoad = true) {
|
public EnableDisableAsyncFuncSettings(
|
||||||
|
funName: string,
|
||||||
|
runBehavior: "On page load" | "Manual",
|
||||||
|
) {
|
||||||
// Navigate to Settings tab
|
// Navigate to Settings tab
|
||||||
this.toolbar.toggleSettings();
|
this.toolbar.toggleSettings();
|
||||||
// Set onPageLoad
|
// Set runBehavior to On page load
|
||||||
this.agHelper.CheckUncheck(this._onPageLoadSwitch(funName), onLoad);
|
this.agHelper.GetNClick(this._runBehaviourSwitch(funName));
|
||||||
|
this.agHelper.GetNClickByContains(
|
||||||
|
this._dropdownOption,
|
||||||
|
runBehavior,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
);
|
||||||
// Return to code tab
|
// Return to code tab
|
||||||
this.toolbar.toggleSettings();
|
this.toolbar.toggleSettings();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ export const getConfigInitialValues = (
|
||||||
// TODO: Fix this the next time the file is edited
|
// TODO: Fix this the next time the file is edited
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const parseConfig = (section: any): any => {
|
const parseConfig = (section: any): any => {
|
||||||
if ("initialValue" in section) {
|
if ("initialValue" in section && section.configProperty !== "runBehavior") {
|
||||||
if (section.controlType === "KEYVALUE_ARRAY") {
|
if (section.controlType === "KEYVALUE_ARRAY") {
|
||||||
section.initialValue.forEach(
|
section.initialValue.forEach(
|
||||||
(initialValue: string | number, index: number) => {
|
(initialValue: string | number, index: number) => {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => {
|
||||||
{props.action.name}
|
{props.action.name}
|
||||||
</Text>
|
</Text>
|
||||||
<StyledSelect
|
<StyledSelect
|
||||||
data-testid={`execute-on-page-load-${props.action.id}`}
|
data-testid={`t--dropdown-runBehavior`}
|
||||||
defaultValue={selectedValue}
|
defaultValue={selectedValue}
|
||||||
id={props.action.id}
|
id={props.action.id}
|
||||||
isDisabled={props.disabled}
|
isDisabled={props.disabled}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user