test: Automated tests for Table Migration scenarios + Flaky fixes (#11360)

* Migration table script added

* Migration case & inputv2 flaky fix

* Added menu btn validations

* MigrationSpec - Added sorting valiation

* Flaky tests fix

* LIstWidget api.users count fix

* ListWidget api.users count validation fix

* Bind_ApI spec - added waituntil
This commit is contained in:
Aishwarya-U-R 2022-02-24 08:41:35 +05:30 committed by GitHub
parent facf6a3d96
commit 67652287f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 8433 additions and 180 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +1,25 @@
{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":1296,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":440,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":47,"minHeight":420,"parentColumnSpace":1,"dynamicBindingPathList":[],"leftColumn":0,"children":[]}
{
"widgetName": "MainContainer",
"backgroundColor": "none",
"rightColumn": 1296,
"snapColumns": 64,
"detachFromLayout": true,
"widgetId": "0",
"topRow": 0,
"bottomRow": 440,
"containerStyle": "none",
"snapRows": 125,
"parentRowSpace": 1,
"type": "CANVAS_WIDGET",
"canExtend": true,
"version": 47,
"minHeight": 420,
"parentColumnSpace": 1,
"dynamicBindingPathList": [
],
"leftColumn": 0,
"children": [
]
}

View File

@ -1,10 +1,11 @@
const homePage = require("../../../locators/HomePage.json");
const dsl = require("../../../fixtures/forkedApp.json");
//const dsl = require("../../../fixtures/forkedApp.json");
describe("Import, Export and Fork application and validate data binding", function() {
let orgid;
let appid;
let newOrganizationName;
it("Import application and validate data on pageload", function() {
// import application
cy.get(homePage.homeIcon).click();
@ -16,10 +17,11 @@ describe("Import, Export and Fork application and validate data binding", functi
cy.xpath(homePage.uploadLogo).attachFile("forkedApp.json");
cy.get(homePage.orgImportAppButton).click({ force: true });
cy.wait("@importNewApplication").then((interception) => {
let appId = interception.response.body.data.id;
let defaultPage = interception.response.body.data.pages.find(
(eachPage) => !!eachPage.isDefault,
);
//let appId = interception.response.body.data.id;
// let defaultPage = interception.response.body.data.pages.find(
// (eachPage) => !!eachPage.isDefault,
// );
cy.get(homePage.toastMessage).should(
"contain",
"Application imported successfully",

View File

@ -1,3 +1,5 @@
/// <reference types="Cypress" />
const commonlocators = require("../../../../locators/commonlocators.json");
const dsl = require("../../../../fixtures/listwidgetdsl.json");
const pages = require("../../../../locators/Pages.json");
@ -32,8 +34,7 @@ describe("Test Create Api and Bind to Table widget", function() {
it("Test_Validate the Api data is updated on List widget", function() {
cy.SearchEntityandOpen("List1");
cy.testJsontext("items", "{{Api1.data.users}}");
cy.get(".t--draggable-textwidget span").should("have.length", 8);
cy.get(".t--draggable-textwidget span").should("have.length.gte", 8);
cy.get(".t--draggable-textwidget span")
.first()
.invoke("text")
@ -41,7 +42,17 @@ describe("Test Create Api and Bind to Table widget", function() {
expect(text).to.equal(valueToTest);
});
cy.PublishtheApp();
cy.get(".t--widget-textwidget span").should("have.length", 8);
cy.waitUntil(
() => cy.get(".t--widget-textwidget span").should("be.visible"),
{
errorMsg: "Pubish app page is not loaded evn after 20 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500));
cy.get(".t--widget-textwidget span").should("have.length.gte", 8);
cy.get(".t--widget-textwidget span")
.first()
.invoke("text")
@ -54,7 +65,7 @@ describe("Test Create Api and Bind to Table widget", function() {
cy.get(publishPage.backToEditor).click({ force: true });
cy.SearchEntityandOpen("List1");
cy.testJsontext("itemspacing\\(px\\)", "50");
cy.get(".t--draggable-textwidget span").should("have.length", 6);
cy.get(".t--draggable-textwidget span").should("have.length.gte", 6);
cy.get(".t--draggable-textwidget span")
.first()
.invoke("text")
@ -62,7 +73,15 @@ describe("Test Create Api and Bind to Table widget", function() {
expect(text).to.equal(valueToTest);
});
cy.PublishtheApp();
cy.get(".t--widget-textwidget span").should("have.length", 6);
cy.waitUntil(
() => cy.get(".t--widget-textwidget span").should("be.visible"),
{
errorMsg: "Pubish app page is not loaded evn after 20 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500));
cy.get(".t--widget-textwidget span").should("have.length.gte", 6);
cy.get(".t--widget-textwidget span")
.first()
.invoke("text")

View File

@ -0,0 +1,432 @@
const homePage = require("../../../../locators/HomePage.json");
describe("Migration Validate", function() {
it("1. Import application and Validate Migration on pageload", function() {
// import application
cy.get(homePage.homeIcon).click();
cy.get(homePage.optionsIcon)
.first()
.click();
cy.get(homePage.orgImportAppOption).click({ force: true });
cy.get(homePage.orgImportAppModal).should("be.visible");
cy.xpath(homePage.uploadLogo).attachFile("TableMigrationAppExported.json");
cy.get(homePage.orgImportAppButton).click({ force: true });
cy.wait("@importNewApplication").then((interception) => {
// let appId = interception.response.body.data.id;
// let defaultPage = interception.response.body.data.pages.find(
// (eachPage) => !!eachPage.isDefault,
// );
cy.get(homePage.toastMessage).should(
"contain",
"Application imported successfully",
);
//Renaming imported app!
const uuid = () => Cypress._.random(0, 1e4);
const name = uuid();
cy.wait(2000);
cy.get(homePage.applicationName)
.clear()
.type(`app${name}`);
cy.wrap(`app${name}`).as("appname");
cy.wait(2000);
// Validating data binding for the imported application
//Validating Latitude & Longitude are hidden columns:
cy.xpath(
"//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']/div[text()='latitude']",
)
.invoke("attr", "class")
.then((classes) => {
cy.log("classes are:" + classes);
expect(classes).includes("hidden-header");
});
cy.xpath(
"//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']/div[text()='longitude']",
)
.invoke("attr", "class")
.then((classes) => {
cy.log("classes are:" + classes);
expect(classes).includes("hidden-header");
});
//Validating order of header row!
cy.xpath(
"//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]",
)
.invoke("text")
.then((x) => {
expect(x).to.eq(
"Card NumberidNameاسمaddress住所PhoneemailCompanyjobimagessnPin CodeCreditLimitOutstandingStateAvailable LimitCard TypeChange Credit limitimageURLlatitudelongitude",
);
cy.log("header set is:" + x);
});
//Validating Id column sorting happens as Datatype is Number in app!
cy.xpath(
"//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']/div[text()='id']",
)
.click()
.wait(2000);
cy.readTabledataPublish("0", "1").then((cellData) => {
expect(cellData).to.be.equal("100");
});
cy.readTabledataPublish("1", "1").then((cellData) => {
expect(cellData).to.be.equal("99");
});
cy.readTabledataPublish("2", "1").then((cellData) => {
expect(cellData).to.be.equal("98");
});
//Revert the Id column sorting!
cy.xpath(
"//div[@class='tableWrap']//div[@class='thead']//div[@class='tr'][1]//div[@role='columnheader']/div[text()='id']",
)
.click()
.wait(2000);
cy.readTabledataPublish("0", "1").then((cellData) => {
expect(cellData).to.be.equal("1");
});
cy.readTabledataPublish("1", "1").then((cellData) => {
expect(cellData).to.be.equal("2");
});
cy.readTabledataPublish("2", "1").then((cellData) => {
expect(cellData).to.be.equal("3");
});
//Card Number mapping to text widget!
cy.isSelectRow(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]")
.eq(1)
.invoke("text")
.then((cardNo) => {
expect(cardNumber).to.be.equal(cardNo);
});
});
//Address mapping to text widget!
cy.readTabledataPublish("2", "4").then((address) => {
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
.eq(1)
.invoke("text")
.then((addr) => {
expect(address.replace(/\r?\n|\r/, "")).to.eq(addr);
});
});
//Validating Available limit column computation maintained!
cy.readTabledataPublish("0", "16").then((availLimit) => {
cy.readTabledataPublish("0", "13").then((creditLimit) => {
cy.readTabledataPublish("0", "14").then((outstanding) => {
expect(Number(availLimit)).to.eq(creditLimit - outstanding);
});
});
});
//Validating State button click & binding & text widget mapping!
cy.getTableDataSelector("0", "15").then((selector) => {
cy.get(selector + " button.bp3-button")
.click()
.wait(3000);
cy.waitUntil(
() =>
cy
.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
.eq(0)
.should("contain.text", "State:"),
{
errorMsg: "Execute call did not complete evn after 10 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500));
cy.get(selector + " button span")
.invoke("text")
.then((statetxt) => {
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
.eq(0)
.invoke("text")
.then((txtWidtxt) => {
cy.log("statetxt is:" + statetxt);
let text =
statetxt == "Activate" ? "State:Inactive" : "State:Active";
expect(text).to.eq(txtWidtxt);
});
});
});
//Validating Image URL click & navigation!
cy.getTableDataSelector("0", "19").then((selector) => {
// Stubbing window.open to open in the same tab
cy.window().then((window) => {
cy.stub(window, "open").callsFake((url) => {
window.location.href = url; //.substring(1);
window.location.target = "_self";
});
});
cy.get(selector + " span.bp3-popover-target span")
.invoke("text")
.then((url) => {
cy.get(selector + " span.bp3-popover-target")
.click()
.wait(2000);
cy.wait("@postExecute");
cy.url().should("contain", url);
cy.go(-1);
});
});
// cy.wait(4000);
// cy.get("div.tableWrap").should("be.visible"); //wait for page load!
cy.waitUntil(() => cy.get("div.tableWrap").should("be.visible"), {
errorMsg: "Page is not loaded evn after 10 secs",
timeout: 20000,
interval: 1000,
}).then(() => cy.wait(500)); //wait for page load!
cy.getTableDataSelector("0", "18").then((selector) => {
cy.get(selector + " button")
.click()
.wait(1000);
cy.xpath(
"//div//a[contains(@class, 'bp3-menu-item')]/div[text()='AddcreditLimit']/parent::a",
)
.click()
.wait(2000);
cy.waitUntil(
() =>
cy
.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.should("contain.text", "CreditLimit:"),
{
errorMsg: "Execute call did not complete evn after 10 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500)); //allow time for n/w to finish
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.invoke("text")
.then((addreduce) => {
expect(addreduce).to.eq("CreditLimit:Add");
});
});
//Manu Btn validation: - 2nd menu item
cy.getTableDataSelector("0", "18").then((selector) => {
cy.get(selector + " button")
.click()
.wait(1000);
cy.xpath(
"//div//a[contains(@class, 'bp3-menu-item')]/div[text()='Reducecreditlimit']/parent::a",
)
.click()
.wait(2000);
cy.waitUntil(
() =>
cy
.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.should("contain.text", "CreditLimit:"),
{
errorMsg: "Execute call did not complete evn after 10 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500)); //allow time for n/w to finish
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.invoke("text")
.then((addreduce) => {
expect(addreduce).to.eq("CreditLimit:Reduce");
});
});
//Another row!
//Card Number mapping to text widget!
cy.isSelectRow(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]")
.eq(1)
.invoke("text")
.then((cardNo) => {
expect(cardNumber).to.be.equal(cardNo);
});
});
//Address mapping to text widget!
cy.readTabledataPublish("2", "4").then((address) => {
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
.eq(1)
.invoke("text")
.then((addr) => {
expect(address.replace(/\r?\n|\r/, "")).to.eq(addr);
});
});
//Validating Available limit column computation maintained!
cy.readTabledataPublish("2", "16").then((availLimit) => {
cy.readTabledataPublish("2", "13").then((creditLimit) => {
cy.readTabledataPublish("2", "14").then((outstanding) => {
expect(Number(availLimit)).to.eq(creditLimit - outstanding);
});
});
});
//Validating State button click & binding & text widget mapping!
cy.getTableDataSelector("2", "15").then((selector) => {
cy.get(selector + " button.bp3-button")
.click()
.wait(2000);
cy.waitUntil(
() =>
cy
.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
.eq(0)
.should("contain.text", "State:"),
{
errorMsg: "Execute call did not complete evn after 10 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500));
cy.get(selector + " button span")
.invoke("text")
.then((statetxt) => {
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][2]")
.eq(0)
.invoke("text")
.then((txtWidtxt) => {
cy.log("statetxt is:" + statetxt);
let text =
statetxt == "Activate" ? "State:Inactive" : "State:Active";
expect(text).to.eq(txtWidtxt);
});
});
});
//Validating Image URL click & navigation!
cy.getTableDataSelector("2", "19").then((selector) => {
// Stubbing window.open to open in the same tab
cy.window().then((window) => {
cy.stub(window, "open").callsFake((url) => {
window.location.href = url; //.substring(1);
window.location.target = "_self";
});
});
cy.get(selector + " span.bp3-popover-target span")
.invoke("text")
.then((url) => {
cy.get(selector + " span.bp3-popover-target")
.click()
.wait(2000);
cy.wait("@postExecute");
cy.url().should("contain", url);
cy.go(-1);
});
});
//cy.wait(4000);
//cy.get("div.tableWrap").should("be.visible");
cy.waitUntil(() => cy.get("div.tableWrap").should("be.visible"), {
errorMsg: "Page is not loaded evn after 10 secs",
timeout: 20000,
interval: 1000,
}).then(() => cy.wait(500)); //wait for page load!
//Manu Btn validation: - 1st menu item
cy.isSelectRow(2);
cy.getTableDataSelector("2", "18").then((selector) => {
cy.get(selector + " button")
.click()
.wait(1000);
cy.xpath(
"//div//a[contains(@class, 'bp3-menu-item')]/div[text()='AddcreditLimit']/parent::a",
)
.click()
.wait(2000); //allow time for n/w to finish
cy.waitUntil(
() =>
cy
.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.should("contain.text", "CreditLimit:"),
{
errorMsg: "Execute call did not complete evn after 10 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500)); //allow time for n/w to finish
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.invoke("text")
.then((addreduce) => {
expect(addreduce).to.eq("CreditLimit:Add");
});
});
//Manu Btn validation: - 2nd menu item
cy.getTableDataSelector("2", "18").then((selector) => {
cy.get(selector + " button")
.click()
.wait(1000);
cy.xpath(
"//div//a[contains(@class, 'bp3-menu-item')]/div[text()='Reducecreditlimit']/parent::a",
)
.click()
.wait(2000); //allow time for n/w to finish
cy.waitUntil(
() =>
cy
.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.should("contain.text", "CreditLimit:"),
{
errorMsg: "Execute call did not complete evn after 10 secs",
timeout: 20000,
interval: 1000,
},
).then(() => cy.wait(500)); //allow time for n/w to finish
cy.xpath("//div[contains(@class, ' t--widget-textwidget')][1]")
.eq(0)
.invoke("text")
.then((addreduce) => {
expect(addreduce).to.eq("CreditLimit:Reduce");
});
});
});
});
});

View File

@ -0,0 +1,120 @@
const explorer = require("../../../../locators/explorerlocators.json");
const widgetName = "inputwidgetv2";
const widgetInput = `.t--widget-${widgetName} input`;
describe("Input widget V2 - ", () => {
it("1. DragDrop Input & Label/Text widgets", () => {
cy.get(explorer.addWidget).click();
cy.dragAndDropToCanvas(widgetName, { x: 300, y: 300 });
cy.get(`.t--widget-${widgetName}`).should("exist");
cy.dragAndDropToCanvas("textwidget", { x: 300, y: 500 });
cy.openPropertyPane("textwidget");
cy.updateCodeInput(
".t--property-control-text",
`{{Input1.text}}:{{Input1.value}}:{{Input1.isValid}}`,
);
});
it("2. Validate input widget resets OnSubmit", () => {
cy.openPropertyPane(widgetName);
cy.get(
".t--property-control-onsubmit .t--open-dropdown-Select-Action",
).click();
cy.selectShowMsg();
cy.addSuccessMessage("Submitted!!");
cy.get(widgetInput).clear();
cy.wait(300);
cy.get(widgetInput).type("test{enter}"); //Clicking enter submits the form here
cy.wait(300);
cy.get(widgetInput).should("contain.value", "");
});
it("3. Validate DataType - TEXT can be entered into Input widget", () => {
[
"test:test:true",
"test123:test123:true",
"123:123:true",
"::true",
"$100.22:$100.22:true",
"test@appsmith.com:test@appsmith.com:true",
].forEach((text) => enterAndTest(text.split(":")[0], text));
cy.openPropertyPane(widgetName);
cy.get(".t--property-control-required label")
.last()
.click({ force: true });
[
"test:test:true",
"test123:test123:true",
"123:123:true",
"-:-:true",
"::false",
"$100.22:$100.22:true",
"test@appsmith.com:test@appsmith.com:true",
].forEach((text) => enterAndTest(text.split(":")[0], text));
});
it("4. Validate DataType - NUMBER can be entered into Input widget", () => {
cy.openPropertyPane(widgetName);
cy.selectDropdownValue(".t--property-control-datatype", "Number");
[
"test:",
"test123:123",
"123:123",
"-:-",
":",
"$100.22:100.22",
"test@appsmith.com:",
].forEach((text) => {
enterAndTest(text.split(":")[0], text.split(":")[1]);
});
});
it("5. Validate DataType - PASSWORD can be entered into Input widget", () => {
cy.openPropertyPane(widgetName);
cy.selectDropdownValue(".t--property-control-datatype", "Password");
["test", "test123", "123", "-", "", "$100.22", "test@appsmith.com"].forEach(
(text) => {
enterAndTest(text, text);
},
);
});
it("6. Validate DataType - EMAIL can be entered into Input widget", () => {
cy.openPropertyPane(widgetName);
cy.selectDropdownValue(".t--property-control-datatype", "Email");
["test", "test123", "123", "-", "", "$100.22", "test@appsmith.com"].forEach(
(text) => {
enterAndTest(text, text);
},
);
});
it("7. Validating other properties - Input validity with #valid", () => {
cy.openPropertyPane(widgetName);
[
["{{1 === 2}}", "false"],
["", "true"],
["{{1 === 1}}", "true"],
["", "true"],
].forEach(([input, expected]) => {
cy.updateCodeInput(".t--property-control-valid", input);
cy.wait(500);
cy.validateEvaluatedValue(expected);
});
});
function enterAndTest(text, expected) {
cy.get(`.t--widget-${widgetName} input`).clear();
cy.wait(300);
if (text) {
cy.get(`.t--widget-${widgetName} input`)
.click()
.type(text); //.should('have.value', text);
}
cy.get(".t--widget-textwidget").should("contain", expected);
}
});

View File

@ -1,169 +0,0 @@
const dsl = require("../../../../fixtures/emptyDSL.json");
const explorer = require("../../../../locators/explorerlocators.json");
const widgetName = "inputwidgetv2";
const widgetInput = `.t--widget-${widgetName} input`;
describe("Input widget V2 - ", () => {
before(() => {
cy.addDsl(dsl);
});
it("Add new dropdown widget", () => {
cy.get(explorer.addWidget).click();
cy.dragAndDropToCanvas(widgetName, { x: 300, y: 300 });
cy.get(`.t--widget-${widgetName}`).should("exist");
cy.dragAndDropToCanvas("textwidget", { x: 300, y: 500 });
cy.openPropertyPane("textwidget");
cy.updateCodeInput(
".t--property-control-text",
`{{Input1.text}}:{{Input1.value}}:{{Input1.isValid}}`,
);
});
describe("TEXT type -", () => {
it("should test text can be entered into widget", () => {
function enterAndTest(text, expected) {
cy.get(`.t--widget-${widgetName} input`).clear();
cy.wait(300);
if (text) {
cy.get(`.t--widget-${widgetName} input`).type(text);
}
cy.get(".t--widget-textwidget").should("contain", expected);
}
[
"test:test:true",
"test123:test123:true",
"123:123:true",
"::true",
"$100.22:$100.22:true",
"test@appsmith.com:test@appsmith.com:true",
].forEach((text) => enterAndTest(text.split(":")[0], text));
cy.openPropertyPane(widgetName);
cy.get(".t--property-control-required label")
.last()
.click({ force: true });
[
"test:test:true",
"test123:test123:true",
"123:123:true",
"-:-:true",
"::false",
"$100.22:$100.22:true",
"test@appsmith.com:test@appsmith.com:true",
].forEach((text) => enterAndTest(text.split(":")[0], text));
});
});
describe("Number type -", () => {
it("should test text can be entered into widge", () => {
cy.openPropertyPane(widgetName);
cy.selectDropdownValue(".t--property-control-datatype", "Number");
function enterAndTest(text, expected) {
cy.get(`.t--widget-${widgetName} input`).clear();
cy.wait(300);
if (text) {
cy.get(`.t--widget-${widgetName} input`).type(text);
}
cy.get(".t--widget-textwidget").should("contain", expected);
}
[
"test:",
"test123:123",
"123:123",
"-:-",
":",
"$100.22:100.22",
"test@appsmith.com:",
].forEach((text) => {
enterAndTest(text.split(":")[0], text.split(":")[1]);
});
});
});
describe("Password type -", () => {
it("should test text can be entered into widget", () => {
cy.openPropertyPane(widgetName);
cy.selectDropdownValue(".t--property-control-datatype", "Password");
function enterAndTest(text) {
cy.get(`.t--widget-${widgetName} input`).clear();
cy.wait(300);
if (text) {
cy.get(`.t--widget-${widgetName} input`).type(text);
}
cy.get(".t--widget-textwidget").should("contain", text);
}
[
"test",
"test123",
"123",
"-",
"",
"$100.22",
"test@appsmith.com",
].forEach(enterAndTest);
});
});
describe("Email type -", () => {
it("should test text can be entered into widget", () => {
cy.openPropertyPane(widgetName);
cy.selectDropdownValue(".t--property-control-datatype", "Email");
function enterAndTest(text) {
cy.get(`.t--widget-${widgetName} input`).clear();
cy.wait(300);
if (text) {
cy.get(`.t--widget-${widgetName} input`).type(text);
}
cy.get(".t--widget-textwidget").should("contain", text);
}
[
"test",
"test123",
"123",
"-",
"",
"$100.22",
"test@appsmith.com",
].forEach(enterAndTest);
});
});
it("should check that widget input resets on submit", () => {
cy.openPropertyPane(widgetName);
cy.get(
".t--property-control-onsubmit .t--open-dropdown-Select-Action",
).click();
cy.selectShowMsg();
cy.addSuccessMessage("Submitted!!");
cy.get(widgetInput).clear();
cy.wait(300);
cy.get(widgetInput).type("test{enter}");
cy.wait(300);
cy.get(widgetInput).should("contain.value", "");
});
describe("Should test other properties of the input widget - ", () => {
it("#valid", () => {
cy.openPropertyPane(widgetName);
[
["{{1 === 2}}", "false"],
["", "true"],
["{{1 === 1}}", "true"],
["", "true"],
].forEach(([input, expected]) => {
cy.updateCodeInput(".t--property-control-valid", input);
cy.wait(500);
cy.validateEvaluatedValue(expected);
});
});
});
});

View File

@ -3653,6 +3653,12 @@ Cypress.Commands.add("setQueryTimeout", (timeout) => {
cy.get(queryLocators.query).click();
});
//Usage: If in need to type {enter} {esc} etc then .text('sometext').type('{enter}')
Cypress.Commands.add("text", { prevSubject: true }, (subject, text) => {
subject.val(text);
return cy.wrap(subject);
});
//Not Used!
Cypress.Commands.add("VerifyNoDataDisplayAbsence", () => {
cy.xpath("//div[text()='No data to display']", { timeout: 0 }).should(

View File

@ -16,6 +16,7 @@
import "cypress-real-events/support";
import "cypress-xpath";
import "cypress-wait-until";
/// <reference types="cypress-xpath" />
let appId;