test: Cypress - Flaky Fix (#24738)

## Description

**Fixed below flaky tests**

- TableV2_Widget_API_Derived_Column_spec.js
- GitImport_spec.js
- ListV2_SerververSide_spec.js
- Table_PropertyPane_2_spec.js
- CategroySlider_spec.ts
- TableV2_Derived_Column_Data_validation_spec.js
- ExportApplication_spec.js

## Type of change

- Flaky test fix

## How Has This Been Tested?
- Cypress test runs

## Checklist:
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
This commit is contained in:
Vijetha-Kaja 2023-06-22 20:30:46 +05:30 committed by GitHub
parent c608dfddd7
commit 38cb4745ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 203 additions and 187 deletions

View File

@ -20,7 +20,7 @@ describe("Test Create Api and Bind to Table widget", function () {
apiPage.CreateAndFillApi(
this.dataSet.paginationUrl + this.dataSet.paginationParam,
);
cy.RunAPI();
apiPage.RunAPI();
entityExplorer.SelectEntityByName("Table1");
propPane.UpdatePropertyFieldValue("Table data", "{{Api1.data}}");
cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox);

View File

@ -1,17 +1,24 @@
import gitSyncLocators from "../../../../../locators/gitSyncLocators";
import homePage from "../../../../../locators/HomePage";
import homePageLocators from "../../../../../locators/HomePage";
import reconnectDatasourceModal from "../../../../../locators/ReconnectLocators";
const commonlocators = require("../../../../../locators/commonlocators.json");
const datasourceEditor = require("../../../../../locators/DatasourcesEditor.json");
const jsObject = "JSObject1";
let newBranch = "feat/temp";
const mainBranch = "master";
let repoName, newWorkspaceName;
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
dataSources,
deployMode,
entityExplorer,
gitSync,
homePage,
table,
} from "../../../../../support/Objects/ObjectsCore";
describe("Git import flow ", function () {
before(() => {
_.homePage.NavigateToHome();
homePage.NavigateToHome();
cy.createWorkspace();
cy.wait("@createWorkspace").then((interception) => {
newWorkspaceName = interception.response.body.data.name;
@ -19,12 +26,12 @@ describe("Git import flow ", function () {
});
});
it("1. Import an app from JSON with Postgres, MySQL, Mongo db & then connect it to Git", () => {
_.homePage.NavigateToHome();
cy.get(homePage.optionsIcon).first().click();
cy.get(homePage.workspaceImportAppOption).click({ force: true });
cy.get(homePage.workspaceImportAppModal).should("be.visible");
homePage.NavigateToHome();
cy.get(homePageLocators.optionsIcon).first().click();
cy.get(homePageLocators.workspaceImportAppOption).click({ force: true });
cy.get(homePageLocators.workspaceImportAppModal).should("be.visible");
cy.wait(1000);
cy.xpath(homePage.uploadLogo).selectFile(
cy.xpath(homePageLocators.uploadLogo).selectFile(
"cypress/fixtures/gitImport.json",
{ force: true },
);
@ -36,23 +43,23 @@ describe("Git import flow ", function () {
cy.get(reconnectDatasourceModal.Modal).should("be.visible");
cy.ReconnectDatasource("TEDPostgres");
cy.wait(1000);
_.dataSources.FillPostgresDSForm();
dataSources.FillPostgresDSForm();
cy.testDatasource(true);
cy.get(".t--save-datasource").click({ force: true });
agHelper.GetNClick(dataSources._saveDs);
cy.wait(1000);
cy.ReconnectDatasource("TEDMySQL");
cy.wait(500);
_.dataSources.FillMySqlDSForm();
dataSources.FillMySqlDSForm();
cy.testDatasource(true);
cy.get(".t--save-datasource").click({ force: true });
agHelper.GetNClick(dataSources._saveDs);
cy.wait(1000);
cy.ReconnectDatasource("TEDMongo");
cy.wait(1000);
_.dataSources.FillMongoDSForm();
dataSources.FillMongoDSForm();
cy.testDatasource(true);
cy.get(".t--save-datasource").click({ force: true });
agHelper.GetNClick(dataSources._saveDs);
cy.wait(2000);
/*cy.get(homePage.toastMessage).should(
/*cy.get(homePageLocators.toastMessage).should(
"contain",
"Application imported successfully",
); */
@ -63,26 +70,26 @@ describe("Git import flow ", function () {
});
cy.wait(1000);
_.gitSync.CreateNConnectToGit();
gitSync.CreateNConnectToGit();
cy.get("@gitRepoName").then((repName) => {
repoName = repName;
_.gitSync.CreateGitBranch(repoName);
gitSync.CreateGitBranch(repoName);
});
_.agHelper.AssertElementExist(_.gitSync._bottomBarPull);
agHelper.AssertElementExist(gitSync._bottomBarPull);
});
});
it("2. Import the previous app connected to Git and reconnect Postgres, MySQL and Mongo db ", () => {
_.homePage.NavigateToHome();
homePage.NavigateToHome();
cy.createWorkspace();
cy.wait("@createWorkspace").then((interception) => {
const newWorkspaceName = interception.response.body.data.name;
cy.CreateAppForWorkspace(newWorkspaceName, "gitImport");
});
cy.get(homePage.homeIcon).click();
cy.get(homePage.optionsIcon).first().click();
cy.get(homePage.workspaceImportAppOption).click({ force: true });
cy.get(homePageLocators.homeIcon).click();
cy.get(homePageLocators.optionsIcon).first().click();
cy.get(homePageLocators.workspaceImportAppOption).click({ force: true });
cy.get(".t--import-json-card").next().click();
cy.importAppFromGit(repoName);
cy.wait(5000);
@ -92,27 +99,27 @@ describe("Git import flow ", function () {
cy.fillPostgresDatasourceForm();
cy.get(datasourceEditor.sectionAuthentication).click();
cy.testDatasource(true);
cy.get(".t--save-datasource").click({ force: true });
agHelper.GetNClick(dataSources._saveDs);
cy.wait(500);
cy.ReconnectDatasource("TEDMySQL");
cy.wait(500);
cy.fillMySQLDatasourceForm();
cy.get(datasourceEditor.sectionAuthentication).click();
cy.testDatasource(true);
cy.get(".t--save-datasource").click({ force: true });
agHelper.GetNClick(dataSources._saveDs);
cy.wait(500);
cy.ReconnectDatasource("TEDMongo");
cy.wait(500);
cy.fillMongoDatasourceForm();
cy.get(datasourceEditor.sectionAuthentication).click();
cy.testDatasource(true);
cy.get(".t--save-datasource").click({ force: true });
agHelper.GetNClick(dataSources._saveDs);
cy.wait(2000);
cy.get(reconnectDatasourceModal.ImportSuccessModal).should("be.visible");
cy.get(reconnectDatasourceModal.ImportSuccessModalCloseBtn).click({
force: true,
});
/* cy.get(homePage.toastMessage).should(
/* cy.get(homePageLocators.toastMessage).should(
"contain",
"Application imported successfully",
); */
@ -120,7 +127,7 @@ describe("Git import flow ", function () {
cy.log(interception.response.body.data);
cy.wait(1000);
});
_.agHelper.AssertElementExist(_.gitSync._bottomBarPull);
agHelper.AssertElementExist(gitSync._bottomBarPull);
cy.wait(3000); //for uncommited changes to appear if any!
cy.get("body").then(($body) => {
@ -142,7 +149,7 @@ describe("Git import flow ", function () {
});
it("4. Create a new branch, clone page and validate data on that branch in view and edit mode", () => {
//cy.createGitBranch(newBranch);
_.gitSync.CreateGitBranch(newBranch, true);
gitSync.CreateGitBranch(newBranch, true);
cy.get("@gitbranchName").then((branName) => {
newBranch = branName;
@ -156,43 +163,43 @@ describe("Git import flow ", function () {
// verify js object binded to input widget
cy.xpath("//input[@value='Success']");
_.entityExplorer.ClonePage();
entityExplorer.ClonePage();
// verify jsObject is not duplicated
_.agHelper.Sleep(2000); //for cloning of table data to finish
_.entityExplorer.SelectEntityByName(jsObject, "Queries/JS"); //Also checking jsobject exists after cloning the page
_.entityExplorer.SelectEntityByName("Page1 Copy");
agHelper.Sleep(2000); //for cloning of table data to finish
entityExplorer.SelectEntityByName(jsObject, "Queries/JS"); //Also checking jsobject exists after cloning the page
entityExplorer.SelectEntityByName("Page1 Copy");
cy.xpath("//input[@class='bp3-input' and @value='Success']").should(
"be.visible",
);
// deploy the app and validate data binding
cy.wait(2000);
cy.get(homePage.publishButton).click();
_.agHelper.AssertElementExist(_.gitSync._bottomBarPull);
cy.get(homePageLocators.publishButton).click();
agHelper.AssertElementExist(gitSync._bottomBarPull);
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
cy.get(gitSyncLocators.commitButton).click();
cy.intercept("POST", "api/v1/git/commit/app/*").as("commit");
_.agHelper.AssertElementExist(_.gitSync._bottomBarPull);
agHelper.AssertElementExist(gitSync._bottomBarPull);
cy.get(gitSyncLocators.closeGitSyncModal).click();
cy.wait(2000);
cy.merge(mainBranch);
cy.get(gitSyncLocators.closeGitSyncModal).click();
cy.wait(2000);
cy.latestDeployPreview();
_.table.AssertTableLoaded();
table.AssertTableLoaded();
// verify api response binded to input widget
cy.xpath("//input[@value='this is a test']");
// verify js object binded to input widget
cy.xpath("//input[@value='Success']");
// navigate to Page1 and verify data
cy.get(".t--page-switch-tab").contains("Page1").click({ force: true });
_.table.AssertTableLoaded();
table.AssertTableLoaded();
// verify api response binded to input widget
cy.xpath("//input[@value='this is a test']");
// verify js object binded to input widget
cy.xpath("//input[@value='Success']");
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it("5. Switch to master and verify data in edit and view mode", () => {
@ -201,20 +208,19 @@ describe("Git import flow ", function () {
// validate data binding in edit and deploy mode
cy.latestDeployPreview();
cy.get(".tbody").should("have.length", 2);
_.table.AssertTableLoaded(0, 1, "v1");
table.AssertTableLoaded(0, 1, "v1");
cy.xpath("//input[@value='this is a test']");
cy.xpath("//input[@value='Success']");
// navigate to Page1 and verify data
cy.get(".t--page-switch-tab").contains("Page1 Copy").click({ force: true });
_.table.AssertTableLoaded(0, 1, "v1");
table.AssertTableLoaded(0, 1, "v1");
cy.xpath("//input[@value='this is a test']");
cy.xpath("//input[@value='Success']");
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it("6. Add widget to master, merge then checkout to child branch and verify data", () => {
//_.canvasHelper.OpenWidgetPane();
_.entityExplorer.NavigateToSwitcher("Widgets");
entityExplorer.NavigateToSwitcher("Widgets");
cy.wait(2000); // wait for transition
cy.dragAndDropToCanvas("buttonwidget", { x: 300, y: 600 });
cy.wait(3000);
@ -229,6 +235,6 @@ describe("Git import flow ", function () {
});
after(() => {
_.gitSync.DeleteTestGithubRepo(repoName);
gitSync.DeleteTestGithubRepo(repoName);
});
});

View File

@ -1,31 +1,30 @@
import { REPO, CURRENT_REPO } from "../../../../fixtures/REPO";
import homePage from "../../../../locators/HomePage";
import * as _ from "../../../../support/Objects/ObjectsCore";
import homePageLocators from "../../../../locators/HomePage";
import { agHelper, homePage } from "../../../../support/Objects/ObjectsCore";
const commonlocators = require("../../../../locators/commonlocators.json");
describe("Export application as a JSON file", function () {
let workspaceId;
let appid;
let newWorkspaceName;
let appname;
before(() => {
cy.fixture("displayWidgetDsl").then((val) => {
_.agHelper.AddDsl(val);
agHelper.AddDsl(val);
});
});
it("1. Check if exporting app flow works as expected", function () {
cy.get(commonlocators.homeIcon).click({ force: true });
appname = localStorage.getItem("AppName");
cy.get(homePage.searchInput).type(appname);
cy.get(homePageLocators.searchInput).type(appname);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
// cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appMoreIcon).first().click({ force: true });
cy.get(homePage.exportAppFromMenu).click({ force: true });
_.agHelper.ValidateToastMessage("Successfully exported");
// cy.get(homePageLocators.applicationCard).first().trigger("mouseover");
cy.get(homePageLocators.appMoreIcon).first().click({ force: true });
cy.get(homePageLocators.exportAppFromMenu).click({ force: true });
agHelper.ValidateToastMessage("Successfully exported");
// fetching the exported app file manually to be verified.
cy.get(`a[id=t--export-app-link]`).then((anchor) => {
const url = anchor.prop("href");
@ -43,16 +42,16 @@ describe("Export application as a JSON file", function () {
it("2. User with admin access,should be able to export the app", function () {
if (CURRENT_REPO === REPO.CE) {
cy.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.homePage.NavigateToHome();
_.agHelper.GenerateUUID();
homePage.NavigateToHome();
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
_.homePage.CreateNewWorkspace("exportApp" + uid);
_.homePage.CreateAppInWorkspace("exportApp" + uid, "App" + uid);
homePage.CreateNewWorkspace("exportApp" + uid);
homePage.CreateAppInWorkspace("exportApp" + uid, "App" + uid);
appid = "App" + uid;
//cy.get("h2").contains("Drag and drop a widget here");
cy.get(homePage.shareApp).click({ force: true });
// cy.shareApp(Cypress.env("TESTUSERNAME1"), homePage.adminRole);
_.homePage.InviteUserToApplication(
cy.get(homePageLocators.shareApp).click({ force: true });
// cy.shareApp(Cypress.env("TESTUSERNAME1"), homePageLocators.adminRole);
homePage.InviteUserToApplication(
Cypress.env("TESTUSERNAME1"),
"Administrator",
);
@ -64,17 +63,17 @@ describe("Export application as a JSON file", function () {
);
cy.wait(2000);
cy.log({ appid });
cy.get(homePage.searchInput).type(appid);
cy.get(homePageLocators.searchInput).type(appid);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
//cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appMoreIcon).first().click({ force: true });
cy.get(homePage.exportAppFromMenu).should("be.visible");
cy.xpath(homePage.workspaceHeading).click({ force: true });
cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appEditIcon).first().click({ force: true });
cy.get(homePage.applicationName).click({ force: true });
//cy.get(homePageLocators.applicationCard).first().trigger("mouseover");
cy.get(homePageLocators.appMoreIcon).first().click({ force: true });
cy.get(homePageLocators.exportAppFromMenu).should("be.visible");
cy.xpath(homePageLocators.workspaceHeading).click({ force: true });
cy.get(homePageLocators.applicationCard).first().trigger("mouseover");
cy.get(homePageLocators.appEditIcon).first().click({ force: true });
cy.get(homePageLocators.applicationName).click({ force: true });
cy.contains("Export application").should("be.visible");
});
cy.LogOut();
@ -83,16 +82,16 @@ describe("Export application as a JSON file", function () {
it("3. User with developer access,should not be able to export the app", function () {
cy.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.homePage.NavigateToHome();
_.agHelper.GenerateUUID();
homePage.NavigateToHome();
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
_.homePage.CreateNewWorkspace("exportApp" + uid);
_.homePage.CreateAppInWorkspace("exportApp" + uid, "App" + uid);
homePage.CreateNewWorkspace("exportApp" + uid);
homePage.CreateAppInWorkspace("exportApp" + uid, "App" + uid);
appid = "App" + uid;
workspaceId = "exportApp" + uid;
//cy.get("h2").contains("Drag and drop a widget here");
cy.get(homePage.shareApp).click({ force: true });
_.homePage.InviteUserToApplication(
cy.get(homePageLocators.shareApp).click({ force: true });
homePage.InviteUserToApplication(
Cypress.env("TESTUSERNAME1"),
"Developer",
);
@ -102,33 +101,33 @@ describe("Export application as a JSON file", function () {
cy.LogintoApp(Cypress.env("TESTUSERNAME1"), Cypress.env("TESTPASSWORD1"));
cy.wait(2000);
cy.log({ appid });
cy.get(homePage.searchInput).type(appid);
cy.get(homePageLocators.searchInput).type(appid);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.get(homePage.appMoreIcon).first().click({ force: true });
cy.get(homePage.exportAppFromMenu).should("not.exist");
cy.xpath(homePage.workspaceHeading).click({ force: true });
cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appEditIcon).first().click({ force: true });
cy.get(homePage.applicationName).click({ force: true });
cy.get(homePageLocators.appMoreIcon).first().click({ force: true });
cy.get(homePageLocators.exportAppFromMenu).should("not.exist");
cy.xpath(homePageLocators.workspaceHeading).click({ force: true });
cy.get(homePageLocators.applicationCard).first().trigger("mouseover");
cy.get(homePageLocators.appEditIcon).first().click({ force: true });
cy.get(homePageLocators.applicationName).click({ force: true });
cy.contains("Export application").should("not.exist");
});
cy.LogOut();
});
it("4. User with viewer access,should not be able to export the app", function () {
cy.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
_.homePage.NavigateToHome();
_.agHelper.GenerateUUID();
homePage.LogintoApp(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
homePage.NavigateToHome();
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
_.homePage.CreateNewWorkspace("exportApp" + uid);
_.homePage.CreateAppInWorkspace("exportApp" + uid, "App" + uid);
homePage.CreateNewWorkspace("exportApp" + uid);
homePage.CreateAppInWorkspace("exportApp" + uid, "App" + uid);
appid = "App" + uid;
workspaceId = "exportApp" + uid;
//cy.get("h2").contains("Drag and drop a widget here");
cy.get(homePage.shareApp).click({ force: true });
cy.get(homePageLocators.shareApp).click({ force: true });
_.homePage.InviteUserToApplication(
homePage.InviteUserToApplication(
Cypress.env("TESTUSERNAME1"),
"App Viewer",
);
@ -137,12 +136,12 @@ describe("Export application as a JSON file", function () {
cy.LogintoApp(Cypress.env("TESTUSERNAME1"), Cypress.env("TESTPASSWORD1"));
cy.wait(2000);
cy.log({ appid });
cy.get(homePage.searchInput).type(appid);
cy.get(homePageLocators.searchInput).type(appid);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appEditIcon).should("not.exist");
cy.get(homePageLocators.applicationCard).first().trigger("mouseover");
cy.get(homePageLocators.appEditIcon).should("not.exist");
});
cy.LogOut();
});

View File

@ -1,4 +1,9 @@
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
deployMode,
entityExplorer,
jsEditor,
} from "../../../../../support/Objects/ObjectsCore";
const commonlocators = require("../../../../../locators/commonlocators.json");
const widgetSelector = (name) => `[data-widgetname-cy="${name}"]`;
@ -7,12 +12,12 @@ const containerWidgetSelector = `[type="CONTAINER_WIDGET"]`;
describe("List widget V2 Serverside Pagination", () => {
before(() => {
cy.fixture("Listv2/Listv2JSObjects").then((val) => {
_.agHelper.AddDsl(val);
agHelper.AddDsl(val);
});
});
it("1. Next button disabled when there's no data", () => {
_.jsEditor.CreateJSObject(
jsEditor.CreateJSObject(
`
const pageNo = List1.pageNo;
const pageSize = List1.pageSize;
@ -29,43 +34,31 @@ describe("List widget V2 Serverside Pagination", () => {
},
);
_.entityExplorer.SelectEntityByName("List1", "Widgets");
entityExplorer.SelectEntityByName("List1", "Widgets");
cy.get(commonlocators.listPaginateActivePage).should("have.text", "1");
cy.get(commonlocators.listPaginateNextButton).click({
force: true,
});
cy.get(commonlocators.listPaginateActivePage).should("have.text", "2");
cy.get(commonlocators.listPaginateNextButton).click({
force: true,
});
cy.get(commonlocators.listPaginateActivePage).should("have.text", "3");
cy.get(commonlocators.listPaginateNextButtonDisabled).should("exist");
cy.get(commonlocators.listPaginatePrevButton).click({
force: true,
});
cy.get(commonlocators.listPaginateActivePage).should("have.text", "2");
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "1");
agHelper.GetNClick(commonlocators.listPaginateNextButton, 0, true);
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "2");
agHelper.GetNClick(commonlocators.listPaginateNextButton, 0, true);
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "3");
agHelper.AssertElementExist(commonlocators.listPaginateNextButtonDisabled);
agHelper.GetNClick(commonlocators.listPaginatePrevButton, 0, true);
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "2");
deployMode.DeployApp();
});
it("2. Next button disabled but visible in view mode when there's no data", () => {
_.deployMode.DeployApp();
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "1");
agHelper.GetNClick(commonlocators.listPaginateNextButton, 0, true);
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "2");
agHelper.GetNClick(commonlocators.listPaginateNextButton, 0, true);
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "3");
agHelper.AssertElementExist(commonlocators.listPaginateNextButtonDisabled);
agHelper.GetNClick(commonlocators.listPaginatePrevButton, 0, true);
agHelper.AssertText(commonlocators.listPaginateActivePage, "text", "2");
cy.get(commonlocators.listPaginateActivePage).should("have.text", "1");
cy.get(commonlocators.listPaginateNextButton).click({
force: true,
});
cy.get(commonlocators.listPaginateActivePage).should("have.text", "2");
cy.get(commonlocators.listPaginateNextButton).click({
force: true,
});
cy.get(commonlocators.listPaginateActivePage).should("have.text", "3");
cy.get(commonlocators.listPaginateNextButtonDisabled).should("exist");
cy.get(commonlocators.listPaginatePrevButton).click({
force: true,
});
cy.get(commonlocators.listPaginateActivePage).should("have.text", "2");
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it("3. SelectedItemView and TriggeredItemView", () => {

View File

@ -1,5 +1,12 @@
import { getWidgetSelector } from "../../../../../locators/WidgetLocators";
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
assertHelper,
draggableWidgets,
entityExplorer,
locators,
propPane,
} from "../../../../../support/Objects/ObjectsCore";
describe("Category Slider spec", () => {
before(() => {
@ -8,74 +15,77 @@ describe("Category Slider spec", () => {
* and a Text widget with binding {{CategorySlider1.value}}
*/
cy.fixture("categorySliderWidgetDsl").then((dsl: string) => {
_.agHelper.AddDsl(dsl);
agHelper.AddDsl(dsl);
});
});
it("1. Validates Default Value", () => {
// open the Property Pane
_.entityExplorer.SelectEntityByName("CategorySlider1", "Widgets");
entityExplorer.SelectEntityByName("CategorySlider1", "Widgets");
_.propPane.UpdatePropertyFieldValue("Default value", "mdx");
propPane.UpdatePropertyFieldValue("Default value", "mdx");
_.agHelper.VerifyEvaluatedErrorMessage(
agHelper.VerifyEvaluatedErrorMessage(
"Default value is missing in options. Please update the value.",
);
_.propPane.UpdatePropertyFieldValue("Default value", "");
propPane.UpdatePropertyFieldValue("Default value", "");
_.agHelper.VerifyEvaluatedErrorMessage(
agHelper.VerifyEvaluatedErrorMessage(
"Default value is missing in options. Please update the value.",
);
_.propPane.UpdatePropertyFieldValue("Default value", "md");
propPane.UpdatePropertyFieldValue("Default value", "md");
// _.agHelper.VerifyEvaluatedValue("md");
//agHelper.VerifyEvaluatedValue("md");
});
it("2. Change Step Size and check if value changes", () => {
// Assert Text widget has value 10
_.agHelper
.GetText(getWidgetSelector(_.draggableWidgets.TEXT))
agHelper
.GetText(getWidgetSelector(draggableWidgets.TEXT))
.then(($label) => {
expect($label).to.eq("md");
});
// open the Property Pane
_.entityExplorer.SelectEntityByName("CategorySlider1", "Widgets");
entityExplorer.SelectEntityByName("CategorySlider1", "Widgets");
// Change the slider value
_.agHelper.GetElement(_.locators._sliderThumb).focus().type("{rightArrow}");
agHelper.GetElement(locators._sliderThumb).focus().type("{rightArrow}");
agHelper.Sleep(500);
// Assert the Text widget has value 20
_.agHelper
.GetText(getWidgetSelector(_.draggableWidgets.TEXT))
agHelper
.GetText(getWidgetSelector(draggableWidgets.TEXT))
.then(($label) => {
expect($label).to.eq("lg");
});
// Change the slider value
_.agHelper
.GetElement(_.locators._sliderThumb)
agHelper
.GetElement(locators._sliderThumb)
.focus()
.type("{leftArrow}")
.type("{leftArrow}");
_.agHelper.Sleep(200);
agHelper.Sleep(200);
// Assert the Text widget has value 0
_.agHelper
.GetText(getWidgetSelector(_.draggableWidgets.TEXT))
agHelper
.GetText(getWidgetSelector(draggableWidgets.TEXT))
.then(($label) => {
expect($label).to.eq("sm");
});
});
it("does not crash if an invalid mark option is passed", function () {
cy.get(".t--property-control-options .t--js-toggle").first().click();
cy.updateCodeInput(".t--property-control-options", "[[]]");
cy.get(".t--widget-categorysliderwidget")
.contains("Oops, Something went wrong.")
.should("not.exist");
it("3. Does not crash if an invalid mark option is passed", function () {
agHelper.GetNClick(locators._optionsJsToggle);
propPane.UpdatePropertyFieldValue("Options", "[[]]");
assertHelper.AssertContains(
"Oops, Something went wrong.",
"not.exist",
locators._widgetByName("CategorySlider1"),
);
});
});

View File

@ -1,12 +1,16 @@
const widgetsPage = require("../../../../../locators/Widgets.json");
const commonlocators = require("../../../../../locators/commonlocators.json");
const testdata = require("../../../../../fixtures/testdata.json");
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
deployMode,
locators,
table,
} from "../../../../../support/Objects/ObjectsCore";
describe("Table Widget property pane feature validation", function () {
before(() => {
cy.fixture("tableNewDslWithPagination").then((val) => {
_.agHelper.AddDsl(val);
agHelper.AddDsl(val);
});
});
@ -18,14 +22,13 @@ describe("Table Widget property pane feature validation", function () {
cy.openPropertyPane("tablewidget");
// Select show message in the "on selected row" dropdown
cy.getAlert("onRowSelected", "Row is selected");
_.deployMode.DeployApp(_.locators._widgetInDeployed("tablewidget"));
_.table.WaitUntilTableLoad(0, 0, "v1");
deployMode.DeployApp(locators._widgetInDeployed("tablewidget"));
table.WaitUntilTableLoad(0, 0, "v1");
// Select 1st row
cy.isSelectRow(2);
cy.wait(2000);
// Verify Row is selected by showing the message
cy.get(commonlocators.toastmsg).contains("Row is selected");
_.deployMode.NavigateBacktoEditor();
agHelper.ValidateToastMessage("Row is selected");
deployMode.NavigateBacktoEditor();
});
it("2. Check On Page Change Action", function () {
@ -33,14 +36,14 @@ describe("Table Widget property pane feature validation", function () {
cy.openPropertyPane("tablewidget");
// Select show message in the "on selected row" dropdown
cy.getAlert("onPageChange", "Page Changed");
_.deployMode.DeployApp(_.locators._widgetInDeployed("tablewidget"));
_.table.WaitUntilTableLoad(0, 0, "v1");
deployMode.DeployApp(locators._widgetInDeployed("tablewidget"));
table.WaitUntilTableLoad(0, 0, "v1");
cy.wait(2000);
// Change the page
cy.get(widgetsPage.nextPageButton).click({ force: true });
// Verify the page is changed
cy.get(commonlocators.toastmsg).contains("Page Changed");
_.deployMode.NavigateBacktoEditor();
agHelper.ValidateToastMessage("Page Changed");
deployMode.NavigateBacktoEditor();
});
it("3. Verify On Search Text Change Action", function () {
@ -48,14 +51,13 @@ describe("Table Widget property pane feature validation", function () {
cy.openPropertyPane("tablewidget");
// Show Message on Search text change Action
cy.getAlert("onSearchTextChanged", "Search Text Changed");
_.deployMode.DeployApp(_.locators._widgetInDeployed("tablewidget"));
_.table.WaitUntilTableLoad(0, 0, "v1");
deployMode.DeployApp(locators._widgetInDeployed("tablewidget"));
table.WaitUntilTableLoad(0, 0, "v1");
// Change the Search text
cy.get(widgetsPage.searchField).type("Hello");
cy.wait(2000);
// Verify the search text is changed
cy.get(commonlocators.toastmsg).contains("Search Text Changed");
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it("4. Test to validate text format", function () {
@ -77,11 +79,11 @@ describe("Table Widget property pane feature validation", function () {
cy.backFromPropertyPanel();
// Chage deat search text value to "data"
cy.testJsontext("defaultsearchtext", "data");
_.deployMode.DeployApp(_.locators._widgetInDeployed("tablewidget"));
_.table.WaitUntilTableLoad(0, 0, "v1");
deployMode.DeployApp(locators._widgetInDeployed("tablewidget"));
table.WaitUntilTableLoad(0, 0, "v1");
// Verify the deaullt search text
cy.get(widgetsPage.searchField).should("have.value", "data");
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it("6. Verify default selected row", function () {
@ -92,15 +94,15 @@ describe("Table Widget property pane feature validation", function () {
// Change default selected row value to 1
cy.get(widgetsPage.defaultSelectedRowField).type("1");
cy.wait(2000);
_.deployMode.DeployApp(_.locators._widgetInDeployed("tablewidget"));
_.table.WaitUntilTableLoad(0, 0, "v1");
deployMode.DeployApp(locators._widgetInDeployed("tablewidget"));
table.WaitUntilTableLoad(0, 0, "v1");
// Verify the default selected row
cy.get(widgetsPage.selectedRow).should(
"have.css",
"background-color",
"rgb(227, 223, 251)",
);
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it("7. Verify table column type button with button variant", function () {

View File

@ -1,31 +1,36 @@
/* eslint-disable cypress/no-unnecessary-waiting */
const commonlocators = require("../../../../../locators/commonlocators.json");
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
apiPage,
entityExplorer,
propPane,
} from "../../../../../support/Objects/ObjectsCore";
describe("Test Create Api and Bind to Table widget", function () {
before(() => {
cy.fixture("tableV2TextPaginationDsl").then((val) => {
_.agHelper.AddDsl(val);
agHelper.AddDsl(val);
});
});
it("1. Create an API and Execute the API and bind with Table V2", function () {
// Create and execute an API and bind with table
_.apiPage.CreateAndFillApi(
apiPage.CreateAndFillApi(
this.dataSet.paginationUrl + this.dataSet.paginationParam,
);
cy.RunAPI();
apiPage.RunAPI();
//Validate Table V2 with API data and then add a column
// Open property pane
_.entityExplorer.SelectEntityByName("Table1");
_.propPane.UpdatePropertyFieldValue("Table data", "{{Api1.data}}");
entityExplorer.SelectEntityByName("Table1");
propPane.UpdatePropertyFieldValue("Table data", "{{Api1.data}}");
// Check Widget properties
cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox);
// Open Text1 in propert pane
_.entityExplorer.SelectEntityByName("Text1");
_.propPane.UpdatePropertyFieldValue("Text", "{{Table1.selectedRow.url}}");
entityExplorer.SelectEntityByName("Text1");
propPane.UpdatePropertyFieldValue("Text", "{{Table1.selectedRow.url}}");
// Open Table1 propert pane
_.entityExplorer.SelectEntityByName("Table1");
entityExplorer.SelectEntityByName("Table1");
// Compare table 1st index data with itself
cy.readTableV2data("0", "0").then((tabData) => {
const tableData = tabData;
@ -47,7 +52,7 @@ describe("Test Create Api and Bind to Table widget", function () {
cy.wait(1000);
cy.moveToStyleTab();
// Click on cell background JS button
_.propPane.EnterJSContext("Cell Background", "Green");
propPane.EnterJSContext("Cell Background", "Green");
// Go back to table property pane
cy.get("[data-testid='t--property-pane-back-btn']").click({ force: true });
cy.wait("@updateLayout");
@ -78,7 +83,7 @@ describe("Test Create Api and Bind to Table widget", function () {
it("4. Update table json data and check the column names updated", function () {
// Open table propert pane
_.entityExplorer.SelectEntityByName("Table1");
entityExplorer.SelectEntityByName("Table1");
cy.backFromPropertyPanel();
// Change the table data
cy.testJsontext("tabledata", JSON.stringify(this.dataSet.TableInputUpdate));

View File

@ -178,6 +178,7 @@ export class CommonLocators {
_cancelActionExecution = ".t--cancel-action-button";
_widgetPane = "[data-testid='widget-sidebar-scrollable-wrapper']";
_sliderThumb = '[data-testid="slider-thumb"]';
_optionsJsToggle = ".t--property-control-options .t--js-toggle";
_bottomPaneCollapseIcon = ".t--tabs-collapse-icon";
_dropDownMultiTreeValue = (dropdownOption: string) =>
"//span[@class='rc-tree-select-tree-title']/parent::span[@title='" +