test: updated tests with aghelper table methods (#33737)

updated isSelectedRow() with table_SelectedRow()

/ok-to-test tags="@tag.All"<!-- This is an auto-generated comment:
Cypress test results -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9312024901>
> Commit: c308cbbf4bde7038466a7c93a0e07f12404a9f36
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9312024901&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->
This commit is contained in:
NandanAnantharamu 2024-05-31 14:01:06 +05:30 committed by GitHub
parent 845a04c052
commit 7945d7ef9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 67 additions and 64 deletions

View File

@ -10,7 +10,11 @@ const widgetsPage = require("../../../../locators/Widgets.json");
const publish = require("../../../../locators/publishWidgetspage.json");
const testdata = require("../../../../fixtures/testdata.json");
const pageid = "MyPage";
import { agHelper, propPane } from "../../../../support/Objects/ObjectsCore";
import {
agHelper,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";
import PageList from "../../../../support/Pages/PageList";
describe(
@ -52,7 +56,7 @@ describe(
it("3. Validate NavigateTo Page functionality ", function () {
cy.wait(4000);
cy.isSelectRow(1);
table.SelectTableRow(1);
cy.readTabledataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");

View File

@ -38,7 +38,7 @@ describe(
_.jsEditor.CreateJSObject("return Query1.data;");
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
_.propPane.EnterJSContext("Table data", "{{JSObject1.myFun1()}}");
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
let tabValue = tabData;
cy.log("the value is" + tabValue);
@ -83,7 +83,7 @@ describe(
},
).then(() => cy.wait(500));
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
let tabValue = tabData;
cy.log("Value in public viewing: " + tabValue);

View File

@ -10,6 +10,7 @@ import {
entityExplorer,
agHelper,
deployMode,
table,
} from "../../../../support/Objects/ObjectsCore";
describe(
@ -43,7 +44,7 @@ describe(
cy.readTabledataPublish("1", "0").then((tabDataP) => {
const tabValueP = tabDataP;
cy.log(tabValueP);
cy.isSelectRow(1);
table.SelectTableRow(1);
cy.get("input").should("be.visible");
cy.get(publish.inputWidget + " " + "input")
.first()

View File

@ -11,6 +11,7 @@ import {
agHelper,
propPane,
deployMode,
table,
} from "../../../../support/Objects/ObjectsCore";
import PageList from "../../../../support/Pages/PageList";
@ -61,7 +62,7 @@ describe(
cy.wait(2000);
deployMode.DeployApp();
cy.get(widgetsPage.chartWidget).should("not.exist");
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.get(widgetsPage.chartWidget).should("be.visible");
});
},

View File

@ -31,7 +31,8 @@ describe(
force: true,
});
cy.testJsontext("defaultsearchtext", "2736212");
cy.wait("@updateLayout").isSelectRow(0);
cy.wait("@updateLayout");
_.table.SelectTableRow(0, 0, true, "v2");
cy.readTableV2dataPublish("0", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");

View File

@ -11,6 +11,7 @@ import {
agHelper,
propPane,
deployMode,
table,
} from "../../../../support/Objects/ObjectsCore";
describe(
@ -55,7 +56,7 @@ describe(
cy.wait(2000);
deployMode.DeployApp();
cy.get(widgetsPage.chartWidget).should("not.exist");
cy.isSelectRow(1);
table.SelectTableRow(1);
cy.get(widgetsPage.chartWidget).should("be.visible");
});
},

View File

@ -29,7 +29,8 @@ describe(
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
cy.testJsontext("defaultsearchtext", "2736212");
cy.wait("@updateLayout").isSelectRow(0);
cy.wait("@updateLayout");
_.table.SelectTableRow(0);
cy.readTabledataPublish("0", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");

View File

@ -9,6 +9,7 @@ import {
agHelper,
deployMode,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";
describe(
@ -35,7 +36,7 @@ describe(
/**
* @param(Index) Provide index value to select the row.
*/
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
EditorNavigation.SelectEntityByName("Text4", EntityType.Widget, {}, [
"Container1",
]);
@ -51,7 +52,7 @@ describe(
cy.EvaluateDataType("string");
cy.validateEvaluatedValue(tabValue);
deployMode.DeployApp();
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabDataP) => {
const tabValueP = tabDataP;
cy.get(commonlocators.TextInside).should("have.text", tabValueP);
@ -60,7 +61,7 @@ describe(
});
it("2. Text-Table Binding Functionality For Email", function () {
cy.isSelectRow(2);
table.SelectTableRow(2, 0, true, "v2");
EditorNavigation.SelectEntityByName("Text4", EntityType.Widget, {}, [
"Container1",
]);
@ -76,7 +77,7 @@ describe(
cy.EvaluateDataType("string");
cy.validateEvaluatedValue(tabValue);
deployMode.DeployApp();
cy.isSelectRow(2);
table.SelectTableRow(2, 0, true, "v2");
cy.readTableV2dataPublish("2", "1").then((tabDataP) => {
const tabValueP = tabDataP;
cy.get(commonlocators.TextInside).should("have.text", tabValueP);
@ -135,7 +136,7 @@ describe(
/**
* @param(Index) Provide index value to select the row.
*/
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
EditorNavigation.SelectEntityByName("Text4", EntityType.Widget, {}, [
"Container1",
]);
@ -154,7 +155,7 @@ describe(
cy.EvaluateDataType("string");
cy.validateEvaluatedValue(tabValue);
deployMode.DeployApp();
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "2").then((tabDataP) => {
const tabValueP = `\"${tabDataP}\"`;
cy.get(commonlocators.TextInside).contains(tabValueP);

View File

@ -9,6 +9,7 @@ import {
agHelper,
deployMode,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";
describe(
@ -31,7 +32,7 @@ describe(
/**
* @param(Index) Provide index value to select the row.
*/
cy.isSelectRow(1);
table.SelectTableRow(1);
EditorNavigation.SelectEntityByName("Text4", EntityType.Widget, {}, [
"Container1",
]);
@ -47,7 +48,7 @@ describe(
cy.EvaluateDataType("string");
cy.validateEvaluatedValue(tabValue);
deployMode.DeployApp();
cy.isSelectRow(1);
table.SelectTableRow(1);
cy.readTabledataPublish("1", "0").then((tabDataP) => {
const tabValueP = tabDataP;
cy.get(commonlocators.TextInside).should("have.text", tabValueP);
@ -57,7 +58,7 @@ describe(
});
it("2. Text-Table Binding Functionality For Email", function () {
cy.isSelectRow(2);
table.SelectTableRow(2);
EditorNavigation.SelectEntityByName("Text4", EntityType.Widget, {}, [
"Container1",
]);
@ -73,7 +74,7 @@ describe(
cy.EvaluateDataType("string");
cy.validateEvaluatedValue(tabValue);
deployMode.DeployApp();
cy.isSelectRow(2);
table.SelectTableRow(2);
cy.readTabledataPublish("2", "1").then((tabDataP) => {
const tabValueP = tabDataP;
cy.get(commonlocators.TextInside).should("have.text", tabValueP);
@ -134,7 +135,7 @@ describe(
/**
* @param(Index) Provide index value to select the row.
*/
cy.isSelectRow(1);
table.SelectTableRow(1);
EditorNavigation.SelectEntityByName("Text4", EntityType.Widget, {}, [
"Container1",
]);
@ -154,7 +155,7 @@ describe(
cy.EvaluateDataType("string");
cy.validateEvaluatedValue(tabValue);
deployMode.DeployApp();
cy.isSelectRow(1);
table.SelectTableRow(1);
cy.readTabledataPublish("1", "2").then((tabDataP) => {
const tabValueP = `\"${tabDataP}\"`;
cy.get(commonlocators.TextInside).contains(tabValueP);

View File

@ -9,6 +9,7 @@ import {
entityExplorer,
agHelper,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";
describe(
@ -35,7 +36,7 @@ describe(
});
it("2. validation of default data displayed in all widgets based on row selected", function () {
cy.isSelectRow(1);
table.SelectTableRow(1);
cy.readTabledataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");

View File

@ -27,7 +27,7 @@ describe(
200,
);
// Validation of data displayed in all widgets based on row selected
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");

View File

@ -28,7 +28,7 @@ describe(
200,
);
// Validation of data displayed in all widgets based on row selected
cy.isSelectRow(1);
_.table.SelectTableRow(1);
cy.readTabledataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");
@ -38,10 +38,6 @@ describe(
.first()
.invoke("attr", "value")
.should("contain", tabValue);
// cy.get(publish.inputWidget + " " + "input")
// .last()
// .invoke("attr", "value")
// .should("contain", tabValue);
});
});
},

View File

@ -28,7 +28,7 @@ describe(
cy.WaitAutoSave();
cy.runQuery();
_.dataSources.AddSuggestedWidget(Widgets.Table);
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
cy.log("the value is " + tabData);
expect(tabData).to.be.equal("5");

View File

@ -12,13 +12,12 @@ describe("Trigger errors in the debugger", function () {
cy.EnableAllCodeEditors();
cy.testJsontext("onrowselected", "{{console.logs('test')}}");
// Click on a row of the table widget
cy.isSelectRow(1);
cy.wait(5000);
_.table.SelectTableRow(1);
//should be 2 if we decide to show trigger errors in the debugger.
_.debuggerHelper.AssertErrorCount(1);
// Fix code
cy.testJsontext("onrowselected", "{{console.log('test')}}");
cy.isSelectRow(1);
_.table.SelectTableRow(1);
_.debuggerHelper.AssertErrorCount(1);
});
});

View File

@ -9,6 +9,7 @@ import homePage from "../../../../locators/HomePage";
import {
agHelper,
homePage as homePageHelpers,
table,
} from "../../../../support/Objects/ObjectsCore";
describe("Migration Validate", { tags: ["@tag.ImportExport"] }, function () {
@ -119,7 +120,7 @@ describe("Migration Validate", { tags: ["@tag.ImportExport"] }, function () {
});
//Card Number mapping to text widget!
cy.isSelectRow(2);
table.SelectTableRow(2);
cy.wait(2500); //time for table row select to reflect!
cy.readTabledataPublish("2", "0").then((cardNumber) => {
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
@ -206,7 +207,7 @@ describe("Migration Validate", { tags: ["@tag.ImportExport"] }, function () {
interval: 2000,
}).then(() => cy.wait(1000)); //wait for page load!
cy.isSelectRow(2); //as aft refresh row selection is also gone
table.SelectTableRow(2);
cy.getTableDataSelector("2", "18").then((selector) => {
cy.get(selector + " button")
.click()

View File

@ -21,9 +21,9 @@ describe(
widgetsPage.widgetNameSpan,
);
cy.createModal("Modal", "onRowSelected");
cy.isSelectRow(1);
_.table.SelectTableRow(1);
cy.get(".bp3-overlay-backdrop").click({ force: true });
cy.isSelectRow(2);
_.table.SelectTableRow(2);
cy.get(".bp3-overlay-backdrop").click({ force: true });
});

View File

@ -26,7 +26,7 @@ describe(
deployMode.DeployApp(locators._widgetInDeployed("tablewidget"));
table.WaitUntilTableLoad(0, 0, "v1");
// Select 1st row
cy.isSelectRow(2);
table.SelectTableRow(1);
// Verify Row is selected by showing the message
agHelper.ValidateToastMessage("Row is selected");
deployMode.NavigateBacktoEditor();

View File

@ -84,7 +84,7 @@ describe(
it("4. Check Selected Row(s) Resets When Table data Changes", function () {
// Select 1st row
cy.isSelectRow(1);
_.table.SelectTableRow(1);
cy.openPropertyPane("tablewidget");
// Empty first row
cy.testJsontext("tabledata", "[]");

View File

@ -55,7 +55,7 @@ describe(
cy.openPropertyPane("tablewidget");
cy.editColumn("image");
cy.changeColumnType("Image", false);
cy.isSelectRow(1);
_.table.SelectTableRow(1);
const index = 1;
const imageVal = this.dataSet.TableInput[index].image;
@ -134,7 +134,7 @@ describe(
it("Table Widget Functionality To Verify The Visiblity mode functionality", function() {
_.deployMode.NavigateBacktoEditor();
cy.isSelectRow(1);
_.table.SelectTableRow(1);
cy.readTabledataPublish("1", "3").then(tabData => {
const tabValue = tabData;
expect(tabValue).to.be.equal("Lindsay Ferguson");

View File

@ -34,9 +34,9 @@ describe(
);
//Select the 1st, 2nd and 3rd row
cy.isSelectRow("0");
cy.isSelectRow("1");
cy.isSelectRow("2");
_.table.SelectTableRow(0);
_.table.SelectTableRow(1);
_.table.SelectTableRow(2);
//Check the value present in the textfield which is selectedRowIndices is [0,1,2]
cy.get(`${widgetsPage.textWidget} .bp3-ui-text`).should(

View File

@ -46,7 +46,7 @@ describe(
"contain",
`{ "普通话 [普通話] ": "", "français": "", "español": "", "日本語": "", "हिन्दी": "", "columnAlias": ""}`,
);
cy.isSelectRow(0);
_.table.SelectTableRow(0, 0, true, "v2");
cy.get(".t--widget-textwidget .bp3-ui-text").should(
"contain",
`{ "普通话 [普通話] ": "mandarin", "français": "french", "español": "spanish", "日本語": "japnese", "हिन्दी": "hindi", "columnAlias": ""}`,

View File

@ -22,9 +22,9 @@ describe(
);
//cy.createModal("Modal", this.dataSet.ModalName);
cy.createModal("Modal", "onRowSelected");
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
cy.get(".bp3-overlay-backdrop").last().click({ force: true });
cy.isSelectRow(2);
_.table.SelectTableRow(2, 0, true, "v2");
cy.get(".bp3-overlay-backdrop").last().click({ force: true });
});

View File

@ -68,7 +68,7 @@ describe(
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
table.WaitUntilTableLoad(0, 0, "v2");
// Select 1st row
cy.isSelectRow(2);
table.SelectTableRow(2, 0, true, "v2");
// Verify Row is selected by showing the message
agHelper.ValidateToastMessage("Row is selected");
deployMode.NavigateBacktoEditor();

View File

@ -84,7 +84,7 @@ describe(
it("4. Check Selected Row(s) Resets When Table data Changes", function () {
// Select 1st row
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
cy.openPropertyPane("tablewidgetv2");
// Empty first row
cy.testJsontext("tabledata", "[]");

View File

@ -40,7 +40,7 @@ describe(
cy.openPropertyPane("tablewidgetv2");
cy.editColumn("image");
cy.changeColumnType("Image");
cy.isSelectRow(1);
_.table.SelectTableRow(1, 0, true, "v2");
const index = 1;
const imageVal = this.dataSet.TableInput[index].image;

View File

@ -38,7 +38,7 @@ describe(
"contain",
`{ "普通话 [普通話] ": "", "français": "", "español": "", "日本語": "", "हिन्दी": ""}`,
);
cy.isSelectRow(0);
_.table.SelectTableRow(0, 0, true, "v2");
cy.get(".t--widget-textwidget .bp3-ui-text").should(
"contain",
`{ "普通话 [普通話] ": "mandarin", "français": "french", "español": "spanish", "日本語": "japnese", "हिन्दी": "hindi"}`,

View File

@ -10,6 +10,7 @@ import {
entityExplorer,
agHelper,
dataSources,
table,
} from "../../../../support/Objects/ObjectsCore";
import { Widgets } from "../../../../support/Pages/DataSources";
@ -42,7 +43,7 @@ describe(
const tableRowTxt = text;
dataSources.AddSuggestedWidget(Widgets.Table);
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
cy.log("the value is" + tabValue);
@ -61,12 +62,12 @@ describe(
200,
);
//validation of data displayed in input widget based on row data selected
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
cy.log("the value is" + tabValue);
expect(tabValue).to.be.equal("5");
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")

View File

@ -1,7 +1,7 @@
import EditorNavigation, {
EntityType,
} from "../../../../support/Pages/EditorNavigation";
import { dataSources } from "../../../../support/Objects/ObjectsCore";
import { dataSources, table } from "../../../../support/Objects/ObjectsCore";
import { Widgets } from "../../../../support/Pages/DataSources";
let datasourceName;
@ -27,7 +27,7 @@ describe(
cy.runQuery();
dataSources.AddSuggestedWidget(Widgets.Table);
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
cy.isSelectRow(1);
table.SelectTableRow(1, 0, true, "v2");
cy.readTableV2dataPublish("1", "0").then((tabData) => {
cy.log("the value is " + tabData);
expect(tabData).to.be.equal("5");

View File

@ -48,6 +48,7 @@ const apiPage = ObjectsRegistry.ApiPage;
const deployMode = ObjectsRegistry.DeployMode;
const assertHelper = ObjectsRegistry.AssertHelper;
const homePageTS = ObjectsRegistry.HomePage;
const table = ObjectsRegistry.Table;
let pageidcopy = " ";
const chainStart = Symbol();
@ -576,13 +577,6 @@ Cypress.Commands.add(
},
);
Cypress.Commands.add("isSelectRow", (index) => {
cy.get('.tbody .td[data-rowindex="' + index + '"][data-colindex="' + 0 + '"]')
.first()
.click({ force: true });
cy.wait(500); //for selection to show!
});
Cypress.Commands.add("getDate", (date, dateFormate) => {
const eDate = dayjs().add(date, "days").format(dateFormate);
return eDate;
@ -877,7 +871,7 @@ Cypress.Commands.add("ValidatePaginateResponseUrlData", (runTestCss) => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
cy.isSelectRow(0);
table.SelectTableRow(0);
cy.readTabledata("0", "5").then((tabData) => {
const tableData = tabData;
expect(valueToTest).contains(tableData);
@ -903,7 +897,7 @@ Cypress.Commands.add("ValidatePaginateResponseUrlDataV2", (runTestCss) => {
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
cy.wait(2000);
cy.isSelectRow(0);
table.SelectTableRow(0, 0, true, "v2");
cy.readTableV2data("0", "5").then((tabData) => {
const tableData = tabData;
cy.log(valueToTest);