Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: updated tests with aghelper table methods #33737

Merged
merged 7 commits into from
May 31, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
entityExplorer,
agHelper,
deployMode,
table,
} from "../../../../support/Objects/ObjectsCore";

describe(
Expand Down Expand Up @@ -43,7 +44,7 @@ describe(
cy.readTabledataPublish("1", "0").then((tabDataP) => {
const tabValueP = tabDataP;
cy.log(tabValueP);
cy.isSelectRow(1);
table.SelectTableRow(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use arrow functions for consistency and modern JavaScript practices.

-    it("2. Validate NavigateTo Page functionality ", function () {
+    it("2. Validate NavigateTo Page functionality ", () => {

Committable suggestion was skipped due low confidence.

cy.get("input").should("be.visible");
cy.get(publish.inputWidget + " " + "input")
.first()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
agHelper,
propPane,
deployMode,
table
} from "../../../../support/Objects/ObjectsCore";
import PageList from "../../../../support/Pages/PageList";

Expand Down Expand Up @@ -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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use arrow functions for consistency and modern JavaScript practices.

-    it("2. Validate NavigateTo Page functionality ", function () {
+    it("2. Validate NavigateTo Page functionality ", () => {

Committable suggestion was skipped due low confidence.

cy.get(widgetsPage.chartWidget).should("be.visible");
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use arrow functions for consistency and modern JavaScript practices.

-    it("1. Input widget test with default value from table widget", function () {
+    it("1. Input widget test with default value from table widget", () => {

Committable suggestion was skipped due low confidence.

cy.readTableV2dataPublish("0", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
agHelper,
propPane,
deployMode,
table,
} from "../../../../support/Objects/ObjectsCore";

describe(
Expand Down Expand Up @@ -55,7 +56,7 @@ describe(
cy.wait(2000);
deployMode.DeployApp();
cy.get(widgetsPage.chartWidget).should("not.exist");
cy.isSelectRow(1);
table.SelectTableRow(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use arrow functions for consistency and modern JavaScript practices.

-    it("1. Create MyPage and valdiate if its successfully created", function () {
+    it("1. Create MyPage and valdiate if its successfully created", () => {

Committable suggestion was skipped due low confidence.

cy.get(widgetsPage.chartWidget).should("be.visible");
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
agHelper,
deployMode,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";

describe(
Expand All @@ -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",
]);
Expand All @@ -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);
Expand All @@ -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",
]);
Expand All @@ -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);
Expand Down Expand Up @@ -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",
]);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
agHelper,
deployMode,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";

describe(
Expand All @@ -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",
]);
Expand All @@ -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);
Expand All @@ -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",
]);
Expand All @@ -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);
Expand Down Expand Up @@ -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",
]);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
entityExplorer,
agHelper,
propPane,
table,
} from "../../../../support/Objects/ObjectsCore";

describe(
Expand All @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use arrow functions for consistency and modern JavaScript practices.

-    it("2. validation of default data displayed in all widgets based on row selected", function () {
+    it("2. validation of default data displayed in all widgets based on row selected", () => {

Committable suggestion was skipped due low confidence.

cy.readTabledataPublish("1", "0").then((tabData) => {
const tabValue = tabData;
expect(tabValue).to.be.equal("2736212");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -38,10 +38,6 @@ describe(
.first()
.invoke("attr", "value")
.should("contain", tabValue);
// cy.get(publish.inputWidget + " " + "input")
// .last()
// .invoke("attr", "value")
// .should("contain", tabValue);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment on lines +15 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated method usage aligns with new testing standards. Consider converting function expressions to arrow functions for consistency and modern JavaScript practices.

- before(() => {
+ before(() => {
- it("1. Trigger errors need to be shown in the errors tab", function () {
+ it("1. Trigger errors need to be shown in the errors tab", () => {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
_.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);
_.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')}}");
_.table.SelectTableRow(1);
before(() => {
// setup code
});
it("1. Trigger errors need to be shown in the errors tab", () => {
// test code
});

_.debuggerHelper.AssertErrorCount(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import homePage from "../../../../locators/HomePage";
import {
agHelper,
homePage as homePageHelpers,
table,
} from "../../../../support/Objects/ObjectsCore";
import {
createMessage,
Expand Down Expand Up @@ -123,7 +124,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]")
Expand Down Expand Up @@ -210,7 +211,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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", "[]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading
Loading