Skip to content

Commit

Permalink
test: replace togglebarDisable with CheckUncheck (#34069)
Browse files Browse the repository at this point in the history
This replaces togglebarDisable with CheckUncheck from Ts helper

/ok-to-test tags="@tag.All"

EE PR: appsmithorg/appsmith-ee#4393

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Updated test scripts to use a new method for interacting with checkbox
elements, improving consistency and reliability.
- **Chores**
- Added new locators for client-side search and fixed footer input
fields for better test coverage.
<!-- end of auto-generated comment: release notes by coderabbit.ai
--><!-- This is an auto-generated comment: Cypress test results -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9438128926>
> Commit: dcdb3ab
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9438128926&attempt=2"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->
  • Loading branch information
NandanAnantharamu committed Jun 10, 2024
1 parent e0de1f7 commit 3a895f9
Show file tree
Hide file tree
Showing 31 changed files with 70 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ describe(
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget, {}, [
"Container3",
]);
cy.togglebarDisable(
".t--property-control-clientsidesearch input[type='checkbox']",
);
agHelper.CheckUncheck(commonlocators.clientSideSearch, false);
cy.get(".t--widget-tablewidgetv2 .t--search-input")
.first()
.type("Currey");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
const commonlocators = require("../../../../locators/commonlocators.json");

describe(
"Test Create Api and Bind to Table widget V2",
Expand Down Expand Up @@ -32,9 +33,7 @@ describe(
expect(tabData).to.eq("#2");
});
// Disable Client Search
cy.togglebarDisable(
".t--property-control-clientsidesearch input[type='checkbox']",
);
_.agHelper.CheckUncheck(commonlocators.clientSideSearch, false);
cy.wait(1000); //wait & then read the table value
// Verify Client Search doesnt work
cy.readTableV2dataPublish("0", "0").then((tabData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ describe(
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget, {}, [
"Container3",
]);
cy.togglebarDisable(
".t--property-control-enableclientsidesearch input[type='checkbox']",
);
agHelper.CheckUncheck(commonlocators.enableClientSideSearch, false);

cy.get(".t--widget-tablewidget .t--search-input").first().type("Currey");
cy.wait(3000);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
const commonlocators = require("../../../../locators/commonlocators.json");

describe(
"Test Create Api and Bind to Table widget",
Expand Down Expand Up @@ -33,9 +34,7 @@ describe(
expect(tabData).to.eq("#2");
});
// Disable Client Search
cy.togglebarDisable(
".t--property-control-enableclientsidesearch input[type='checkbox']",
);
_.agHelper.CheckUncheck(commonlocators.enableClientSideSearch, false);
cy.wait(1000); //wait & then read the table value
// Verify Client Search doesnt work
cy.readTabledataPublish("0", "0").then((tabData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ describe(
});
it("Checkbox Functionality To Check Enabled Widget", function () {
cy.openPropertyPane("checkboxwidget");
cy.togglebarDisable(commonlocators.Disablejs + " " + "input");
_.agHelper.CheckUncheck(commonlocators.Disablejs + " " + "input", false);
_.deployMode.DeployApp();
cy.get(publish.checkboxWidget + " " + "input").should("be.enabled");
});
it("Checkbox Functionality To Unchecked Visible Widget", function () {
cy.openPropertyPane("checkboxwidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();
cy.get(publish.checkboxWidget + " " + "input").should("not.exist");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ describe(
cy.moveToContentTab();

// Enable and publish
cy.togglebarDisable(commonlocators.disableCheckbox);
_.agHelper.CheckUncheck(
commonlocators.disableCheckbox,
false,
);
_.deployMode.DeployApp();

// Disabled icon should NOT be visible
Expand Down Expand Up @@ -109,7 +112,7 @@ describe(
cy.moveToContentTab();

// Visibilty OFF and publish
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();

// Video should NOT be streaming
Expand Down Expand Up @@ -206,7 +209,7 @@ describe(
cy.moveToContentTab();

// Enable and publish
cy.togglebarDisable(commonlocators.disableCheckbox);
_.agHelper.CheckUncheck(commonlocators.disableCheckbox, false);
_.deployMode.DeployApp();

// Button should be enabled
Expand All @@ -229,7 +232,7 @@ describe(
cy.moveToContentTab();

// Visibilty OFF and publish
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();

// Button should NOT be visible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe(
it("Dropdown Functionality To Check disabled Widget", function () {
cy.openPropertyPane("selectwidget");
// Disable the visible JS
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();
// Verify the disabled visible JS
cy.get(publish.selectwidget + " " + "input").should("not.exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe(
it("4. Form Widget Functionality To Unchecked Visible Widget", function () {
cy.openPropertyPane("formwidget");
// Uncheck the visble JS
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();
// Verify the unchecked visible JS
cy.get(publish.formWidget).should("not.exist");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe(
it("3. Image Widget Functionality To Check/Uncheck Visible Widget", function () {
deployMode.NavigateBacktoEditor();
cy.openPropertyPane("imagewidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
deployMode.DeployApp();
cy.get(publish.imageWidget).should("not.exist");
deployMode.NavigateBacktoEditor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe(

//isSpellCheck: false
cy.openPropertyPane("inputwidgetv2");
cy.togglebarDisable(commonlocators.spellCheck + " " + "input");
_.agHelper.CheckUncheck(commonlocators.spellCheck + " " + "input", false);
_.deployMode.DeployApp();
cy.get(publish.inputWidget + " " + "input")
.invoke("attr", "spellcheck")
Expand All @@ -108,14 +108,14 @@ describe(

//Input Widget Functionality To Check Enabled Widget
cy.openPropertyPane("inputwidgetv2");
cy.togglebarDisable(commonlocators.Disablejs + " " + "input");
_.agHelper.CheckUncheck(commonlocators.Disablejs + " " + "input", false);
_.deployMode.DeployApp();
cy.get(publish.inputWidget + " " + "input").should("be.enabled");
_.deployMode.NavigateBacktoEditor();
});
it("5. Input Functionality To Unchecked Visible Widget", function () {
cy.openPropertyPane("inputwidgetv2");
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();
cy.get(publish.inputWidget + " " + "input").should("not.exist");
_.deployMode.NavigateBacktoEditor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe(
deployMode.NavigateBacktoEditor();
EditorNavigation.SelectEntityByName("JSONForm1", EntityType.Widget);
cy.openFieldConfiguration("name");
cy.togglebarDisable(widgetsLocators.selectWidgetDisabled);
agHelper.CheckUncheck(widgetsLocators.selectWidgetDisabled, false);
validateAutocompleteAttributeInJSONForm();
});

Expand Down Expand Up @@ -175,7 +175,7 @@ describe(
cy.get(`${fieldPrefix}-check input`).should("be.checked");

// hides field when visible switched off
cy.togglebarDisable(widgetsLocators.visible);
agHelper.CheckUncheck(widgetsLocators.visible, false);
deployMode.DeployApp();
cy.get(`${fieldPrefix}-check`).should("not.exist");
deployMode.NavigateBacktoEditor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe(
cy.get(`${fieldPrefix}-radio input`).should("have.value", "Y");

// hides field when visible switched off"
cy.togglebarDisable(widgetsLocators.visible);
agHelper.CheckUncheck(widgetsLocators.visible, false);
cy.get(`${fieldPrefix}-radio`).should("not.exist");
cy.wait(500);
agHelper.CheckUncheck(widgetsLocators.visible);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _ from "../../../../../support/Objects/ObjectsCore";

const commonlocators = require("../../../../../locators/commonlocators.json");
describe(
"JSONForm Footer spec",
{ tags: ["@tag.Widget", "@tag.JSONForm"] },
Expand Down Expand Up @@ -42,7 +42,7 @@ describe(

it("2. sticks to the content when fixed footer is off", () => {
// Disable fixed footer
cy.togglebarDisable(".t--property-control-fixedfooter input");
_.agHelper.CheckUncheck(commonlocators.fixedFooterInput, false);

// Check if there is a gap between body and footer
cy.get(".t--jsonform-body").then(($body) => {
Expand Down Expand Up @@ -82,7 +82,7 @@ describe(

it("4. floats to the bottom when fixed footer is false and content overflows", () => {
// Disable fixed footer
cy.togglebarDisable(".t--property-control-fixedfooter input");
_.agHelper.CheckUncheck(commonlocators.fixedFooterInput, false);

// Check if footer is floating
cy.get(".t--draggable-jsonformwidget")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ describe(

// migrant.visible -> false
cy.openFieldConfiguration("migrant", false);
cy.togglebarDisable(`${propertyControlPrefix}-visible input`);
agHelper.CheckUncheck(`${propertyControlPrefix}-visible input`, false);
cy.get(backBtn).click({ force: true }).wait(500);

// address.street.required -> true
Expand All @@ -258,7 +258,7 @@ describe(
agHelper.CheckUncheck(`${propertyControlPrefix}-required input`);
cy.get(backBtn).click({ force: true }).wait(500);
cy.openFieldConfiguration("year", false);
cy.togglebarDisable(`${propertyControlPrefix}-visible input`);
agHelper.CheckUncheck(`${propertyControlPrefix}-visible input`, false);
cy.get(backBtn).click({ force: true }).wait(500);

cy.closePropertyPane();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe(
);

cy.openFieldConfiguration("age");
cy.togglebarDisable(`${propertyControlPrefix}-visible input`);
agHelper.CheckUncheck(`${propertyControlPrefix}-visible input`, false);

cy.openPropertyPane("textwidget");
cy.testJsontext("text", "{{JSON.stringify(JSONForm1.formData)}}");
Expand All @@ -216,10 +216,13 @@ describe(
cy.openPropertyPane("jsonformwidget");
propPane.EnterJSContext("Source data", JSON.stringify(schema), true);

cy.togglebarDisable(`${propertyControlPrefix}-hiddenfieldsindata input`);
agHelper.CheckUncheck(
`${propertyControlPrefix}-hiddenfieldsindata input`,
false,
);

cy.openFieldConfiguration("age");
cy.togglebarDisable(`${propertyControlPrefix}-visible input`);
agHelper.CheckUncheck(`${propertyControlPrefix}-visible input`, false);

cy.openPropertyPane("textwidget");
cy.testJsontext("text", "{{JSON.stringify(JSONForm1.formData)}}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ describe(

// hide education field
cy.openFieldConfiguration("education");
cy.togglebarDisable(widgetsPage.visible);
agHelper.CheckUncheck(widgetsPage.visible, false);
cy.get(backBtn).click({ force: true }).wait(500);
// hide name field
cy.openFieldConfiguration("name");
cy.togglebarDisable(widgetsPage.visible);
agHelper.CheckUncheck(widgetsPage.visible, false);

// publish the app
deployMode.DeployApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("List v2- Tabs Widget", { tags: ["@tag.Widget", "@tag.List"] }, () => {
cy.get(".t--page-switch-tab.is-active").contains("Tab 1");

// Disable Scroll Content
cy.togglebarDisable(commonlocators.scrollView);
_.agHelper.CheckUncheck(commonlocators.scrollView, false);
// Check if disabled
cy.get(commonlocators.scrollView).parent().should("not.be.checked");
// Check if Tab 1 still selected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ describe(
cy.get(commonlocators.listPaginateActivePage).should("have.text", "1"),
);

cy.togglebarDisable(commonlocators.serverSidePaginationCheckbox);
_.agHelper.CheckUncheck(
commonlocators.serverSidePaginationCheckbox,
false,
);
});
},
);
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="Cypress" />

const commonlocators = require("../../../../../locators/commonlocators.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
const formWidgetsPage = require("../../../../../locators/FormWidgets.json");
const publish = require("../../../../../locators/publishWidgetspage.json");
import data from "../../../../../fixtures/TestDataSet1.json";
Expand Down Expand Up @@ -103,9 +104,7 @@ describe(

it("4. Does not clear the search field when widget is closed and serverSideFiltering is on", () => {
// Turn on server side filtering for the widget
_.agHelper.CheckUncheck(
'.t--property-control-serversidefiltering input[type="checkbox"]',
);
_.agHelper.CheckUncheck(widgetsPage.serversideFilteringInput);
// open the widget
cy.get(formWidgetsPage.multiselectwidgetv2)
.find(".rc-select-selection-search-input")
Expand All @@ -131,11 +130,12 @@ describe(
.invoke("val")
.should("not.be.empty");
// Turn off the filterable property for the widget
cy.togglebarDisable(commonlocators.allowsearchingInputTypeCheckbox);
// Turn off server side filtering for the widget
cy.togglebarDisable(
'.t--property-control-serversidefiltering input[type="checkbox"]',
_.agHelper.CheckUncheck(
commonlocators.allowsearchingInputTypeCheckbox,
false,
);
// Turn off server side filtering for the widget
_.agHelper.CheckUncheck(widgetsPage.serversideFilteringInput, false);
});

it("5. Dropdown Functionality To Validate Options", function () {
Expand Down Expand Up @@ -299,7 +299,7 @@ describe(
});

it("8. Dropdown Functionality To Unchecked Visible Widget", function () {
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();
cy.get(publish.multiselectwidgetv2 + " " + ".rc-select-selector").should(
"not.exist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ describe(

it("4. multi Select widget selection is not cleared when the widget is server side filtered", () => {
// Turn off server side filtering for the widget
cy.togglebarDisable(
'.t--property-control-serversidefiltering input[type="checkbox"]',
);
_.agHelper.CheckUncheck(widgetsPage.serversideFilteringInput, false);

_.propPane.UpdatePropertyFieldValue("Source Data", "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe(
});

it("5. To Unchecked Visible Widget", function () {
cy.togglebarDisable(commonlocators.visibleCheckbox);
_.agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
_.deployMode.DeployApp();
cy.get(
publish.multiselecttreewidget + " " + ".rc-tree-select-multiple",
Expand Down
Loading

0 comments on commit 3a895f9

Please sign in to comment.