Publish/test cases

This commit is contained in:
Aditya Acharya 2020-05-26 12:22:29 +00:00 committed by Satbir Singh
parent f7f494d9b4
commit 1ef092b9d2
14 changed files with 236 additions and 78 deletions

View File

@ -95,5 +95,9 @@
"HtmlText": "This is the initial<b>content </b> <h1> This is a Heading</h1> <p> This is a paragraph.</p>",
"RichTexteditorBody": "Here is the text area to edit html",
"userApi": "http://postgrest.appsmith.com:3000",
"validateImage": "https://cdn.dribbble.com/users/1787323/screenshots/4563995/dribbbe_hammer-01.png"
"validateImage": "https://cdn.dribbble.com/users/1787323/screenshots/4563995/dribbbe_hammer-01.png",
"defaultdata":"TestData",
"label":"one",
"rgbValue":"rgb(255, 0, 0)",
"tabName":"Aditya"
}

View File

@ -3,7 +3,7 @@ const widgetsPage = require("../../../locators/Widgets.json");
const dsl = require("../../../fixtures/commondsl.json");
describe("Container Widget Functionality", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
@ -25,7 +25,7 @@ describe("Container Widget Functionality", function() {
cy.testCodeMirror(this.data.colour);
cy.get(widgetsPage.containerD)
.should("have.css", "background-color")
.and("eq", "rgb(255, 0, 0)");
.and("eq", this.data.rgbValue);
/**
* @param{toggleButton Css} Assert to be checked
*/
@ -35,8 +35,14 @@ describe("Container Widget Functionality", function() {
.scrollIntoView({ easing: "linear" })
.should("be.visible");
cy.get(commonlocators.editPropCrossButton).click();
cy.PublishtheApp();
});
it("Container Widget Functionality To Verify The Colour", function() {
cy.get(widgetsPage.containerD)
.eq(0)
.should("have.css", "background-color")
.and("eq", this.data.rgbValue);
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -1,9 +1,10 @@
const commonlocators = require("../../../locators/commonlocators.json");
const dsl = require("../../../fixtures/commondsl.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
describe("Input Widget Functionality", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
it("Input Widget Functionality", function() {
@ -14,29 +15,26 @@ describe("Input Widget Functionality", function() {
* @param{InputPre Css} Assertion
*/
cy.widgetText("day", widgetsPage.inputWidget, widgetsPage.inputval);
/**
* @param{Text} Random Value
*/
cy.testCodeMirror(this.data.inputdata);
cy.get(widgetsPage.label)
.first()
.trigger(this.data.Hover, { force: true })
.should("have.text", "one");
cy.get(widgetsPage.datatype)
.find(commonlocators.dropdownbuttonclick)
.click({ force: true })
.get(commonlocators.dropdownmenu)
.children()
.contains("Number")
.contains("Text")
.click();
cy.get(widgetsPage.innertext)
.click({ force: true })
.type(this.data.para)
.should("be.empty");
.type(this.data.para);
cy.get(publish.inputWidget + " " + "input")
.invoke("attr", "value")
.should("contain", this.data.para);
cy.openPropertyPane("inputwidget");
cy.get(widgetsPage.defaultInput)
.type(this.data.command)
.type("hello");
.type(this.data.defaultdata);
cy.get(publish.inputWidget + " " + "input")
.invoke("attr", "value")
.should("contain", this.data.defaultdata);
cy.get(widgetsPage.placeholder)
.type(this.data.command)
.type(this.data.placeholder);
@ -45,7 +43,7 @@ describe("Input Widget Functionality", function() {
*/
cy.get(widgetsPage.innertext)
.invoke("attr", "placeholder")
.should("contain", "check");
.should("contain", this.data.placeholder);
cy.get(widgetsPage.Regex)
.click()
.type(this.data.regex);
@ -53,12 +51,46 @@ describe("Input Widget Functionality", function() {
* @param{Show Alert} Css for InputChange
*/
cy.getAlert(commonlocators.optionchangetextInput);
cy.get(widgetsPage.inputButtonPos)
.eq(0)
.click({ force: true });
cy.PublishtheApp();
});
afterEach(() => {
// put your clean up code if any
it("Input Widget Functionality To Validate Default Text and Placeholder", function() {
cy.get(publish.inputWidget + " " + "input")
.invoke("attr", "value")
.should("contain", this.data.defaultdata);
cy.get(publish.inputWidget + " " + "input")
.invoke("attr", "placeholder")
.should("contain", this.data.placeholder);
cy.get(publish.backToEditor).click();
});
it("Input Widget Functionality To Check Disabled Widget", function() {
cy.openPropertyPane("inputwidget");
cy.togglebar(commonlocators.Disablejs + " " + "input");
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input").should("be.disabled");
cy.get(publish.backToEditor).click();
});
it("Input Widget Functionality To Check Enabled Widget", function() {
cy.openPropertyPane("inputwidget");
cy.togglebarDisable(commonlocators.Disablejs + " " + "input");
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input").should("be.enabled");
cy.get(publish.backToEditor).click();
});
it("Input Functionality To Unchecked Visible Widget", function() {
cy.openPropertyPane("inputwidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input").should("not.be.visible");
cy.get(publish.backToEditor).click();
});
it("Input Functionality To Check Visible Widget", function() {
cy.openPropertyPane("inputwidget");
cy.togglebar(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input").should("be.visible");
cy.get(publish.backToEditor).click();
});
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -1,13 +1,13 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const dsl = require("../../../fixtures/formdsl.json");
describe("Checkbox Widget Functionality", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
it("Checkbox Widget Functionality", function() {
cy.openPropertyPane("checkboxwidget");
/**
@ -33,12 +33,44 @@ describe("Checkbox Widget Functionality", function() {
* @param{Show Alert} Css for InputChange
*/
cy.getAlert(commonlocators.optionchangetextCheckbox);
cy.get(widgetsPage.checkboxLabel)
.contains("value")
.click({ force: true });
cy.PublishtheApp();
});
afterEach(() => {
// put your clean up code if any
it("Checkbox Functionality To Check Label", function() {
cy.get(publish.checkboxWidget + " " + "label").should(
"have.text",
this.data.checkbocInputName,
);
cy.get(publish.backToEditor).click();
});
it("Checkbox Functionality To Check Disabled Widget", function() {
cy.openPropertyPane("checkboxwidget");
cy.togglebar(commonlocators.Disablejs + " " + "input");
cy.PublishtheApp();
cy.get(publish.checkboxWidget + " " + "input").should("be.disabled");
cy.get(publish.backToEditor).click();
});
it("Checkbox Functionality To Check Enabled Widget", function() {
cy.openPropertyPane("checkboxwidget");
cy.togglebarDisable(commonlocators.Disablejs + " " + "input");
cy.PublishtheApp();
cy.get(publish.checkboxWidget + " " + "input").should("be.enabled");
cy.get(publish.backToEditor).click();
});
it("Checkbox Functionality To Unchecked Visible Widget", function() {
cy.openPropertyPane("checkboxwidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.checkboxWidget + " " + "input").should("not.be.visible");
cy.get(publish.backToEditor).click();
});
it("Checkbox Functionality To Check Visible Widget", function() {
cy.openPropertyPane("checkboxwidget");
cy.togglebar(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.checkboxWidget + " " + "input").should("be.visible");
cy.get(publish.backToEditor).click();
});
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -21,8 +21,8 @@ describe("DatePicker Widget Functionality", function() {
);
//Checking the edit props for DatePicker and also the properties of DatePicker widget
cy.testCodeMirror(this.data.DatepickerLable);
cy.wait("@updateLayout");
// cy.testCodeMirror(this.data.DatepickerLable);
// cy.wait("@updateLayout");
// change the date to next day
cy.get(".t--property-control-defaultdate input").click();
@ -47,17 +47,9 @@ describe("DatePicker Widget Functionality", function() {
// Check the required checkbox
cy.CheckWidgetProperties(commonlocators.requiredCheckbox);
cy.get(formWidgetsPage.datepickerWidget + " .bp3-label").should(
"contain.text",
"date *",
);
// UnCheck the required checkbox
cy.UnCheckWidgetProperties(commonlocators.requiredCheckbox);
cy.get(formWidgetsPage.datepickerWidget + " .bp3-label").should(
"contain.text",
"date",
);
// Check the visible checkbox
cy.CheckWidgetProperties(commonlocators.visibleCheckbox);

View File

@ -1,9 +1,10 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const dsl = require("../../../fixtures/formdsl.json");
describe("Form Widget Functionality", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
it("Form Widget Functionality", function() {
@ -24,7 +25,7 @@ describe("Form Widget Functionality", function() {
cy.testCodeMirror(this.data.colour);
cy.get(formWidgetsPage.formD)
.should("have.css", "background-color")
.and("eq", "rgb(255, 0, 0)");
.and("eq", this.data.rgbValue);
/**
* @param{toggleButton Css} Assert to be checked
*/
@ -33,9 +34,29 @@ describe("Form Widget Functionality", function() {
.scrollTo("bottom")
.should("be.visible");
cy.get(commonlocators.editPropCrossButton).click();
cy.PublishtheApp();
});
afterEach(() => {
// put your clean up code if any
it("Form Widget Functionality To Verify The Colour", function() {
cy.get(formWidgetsPage.formD)
.should("have.css", "background-color")
.and("eq", this.data.rgbValue);
});
it("Form Widget Functionality To Unchecked Visible Widget", function() {
cy.get(publish.backToEditor).click();
cy.openPropertyPane("formwidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.formWidget).should("not.be.visible");
cy.get(publish.backToEditor).click();
});
it("Form Widget Functionality To Check Visible Widget", function() {
cy.openPropertyPane("formwidget");
cy.togglebar(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.formWidget).should("be.visible");
cy.get(publish.backToEditor).click();
});
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -1,9 +1,10 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const dsl = require("../../../fixtures/formdsl.json");
describe("Radio Widget Functionality", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
it("Radio Widget Functionality", function() {
@ -18,13 +19,6 @@ describe("Radio Widget Functionality", function() {
formWidgetsPage.radioWidget,
formWidgetsPage.radioInput,
);
/**
* @param{Text} Random Colour
*/
cy.testCodeMirror(this.data.radioInputName);
cy.get(formWidgetsPage.labelradio)
.eq(0)
.should("have.text", "Test Radio");
/**
* @param{IndexValue} Provide Input Index Value
* @param{Text} Index Text Value.
@ -64,12 +58,29 @@ describe("Radio Widget Functionality", function() {
.click({ force: true })
.type(this.data.command)
.type("2");
cy.get(formWidgetsPage.labelradio)
.eq(3)
.click({ force: true });
cy.PublishtheApp();
});
afterEach(() => {
// put your clean up code if any
it("Radio Functionality To Unchecked Visible Widget", function() {
cy.get(publish.backToEditor).click();
cy.openPropertyPane("radiogroupwidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.radioWidget + " " + "input").should("not.be.visible");
cy.get(publish.backToEditor).click();
});
it("Radio Functionality To Check Visible Widget", function() {
cy.openPropertyPane("radiogroupwidget");
cy.togglebar(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.radioWidget + " " + "input").should("be.visible");
});
it("Radio Functionality To Button Text", function() {
cy.get(publish.radioWidget + " " + "label")
.eq(3)
.should("have.text", "test3");
cy.get(publish.backToEditor).click();
});
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -1,10 +1,11 @@
const commonlocators = require("../../../locators/commonlocators.json");
const Layoutpage = require("../../../locators/Layout.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const dsl = require("../../../fixtures/layoutdsl.json");
describe("Tab widget test", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
it("Tab Widget Functionality Test", function() {
@ -39,9 +40,29 @@ describe("Tab widget test", function() {
.scrollIntoView({ easing: "linear" })
.should("be.visible");
cy.get(commonlocators.crossbutton).click({ force: true });
cy.PublishtheApp();
});
afterEach(() => {
// put your clean up code if any
it("Tab Widget Functionality To Select Tabs", function() {
cy.get(publish.tabWidget)
.contains(this.data.tabName)
.click({ force: true })
.should("be.selected");
});
it("Tab Widget Functionality To Unchecked Visible Widget", function() {
cy.get(publish.backToEditor).click();
cy.openPropertyPane("tabswidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.tabWidget).should("not.be.visible");
cy.get(publish.backToEditor).click();
});
it("Tab Widget Functionality To Check Visible Widget", function() {
cy.openPropertyPane("tabswidget");
cy.togglebar(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.tabWidget).should("be.visible");
});
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -1,12 +1,12 @@
const commonlocators = require("../../../locators/commonlocators.json");
const viewWidgetsPage = require("../../../locators/ViewWidgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const dsl = require("../../../fixtures/viewdsl.json");
describe("Image Widget Functionality", function() {
beforeEach(() => {
before(() => {
cy.addDsl(dsl);
});
it("Image Widget Functionality", function() {
cy.openPropertyPane("imagewidget");
/**
@ -31,9 +31,28 @@ describe("Image Widget Functionality", function() {
.invoke("attr", "src")
.should("contain", this.data.validateImage);
cy.get(commonlocators.editPropCrossButton).click();
cy.PublishtheApp();
});
afterEach(() => {
// put your clean up code if any
it("Image Widget Functionality To Validate Image", function() {
cy.get(publish.imageWidget + " " + "img")
.invoke("attr", "src")
.should("contain", this.data.validateImage);
});
it("Image Widget Functionality To Unchecked Visible Widget", function() {
cy.get(publish.backToEditor).click();
cy.openPropertyPane("imagewidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.imageWidget).should("not.be.visible");
cy.get(publish.backToEditor).click();
});
it("Image Widget Functionality To Check Visible Widget", function() {
cy.openPropertyPane("imagewidget");
cy.togglebar(commonlocators.visibleCheckbox);
cy.PublishtheApp();
cy.get(publish.imageWidget).should("be.visible");
});
});
afterEach(() => {
// put your clean up code if any
});

View File

@ -35,10 +35,7 @@ describe("Map Widget Functionality", function() {
cy.get(viewWidgetsPage.zoomLevel)
.eq(1)
.click({ force: true });
/**
* @param{Show Alert} Css for InputChange
*/
cy.getAlert(commonlocators.mapOptionChange);
cy.get(viewWidgetsPage.mapSearch).should("be.visible");
cy.get(viewWidgetsPage.mapSearch)
.invoke("attr", "placeholder")

View File

@ -14,7 +14,7 @@
"optionchangetextInput": ".t--property-control-ontextchanged .CodeMirror-code",
"optionchangeRadioselect": ".t--property-control-onselectionchange .CodeMirror-code",
"onMarkerclick": ".t--property-control-onmarkerclick .CodeMirror-code",
"success": "div[type='success']",
"success": "div[type='success'] span",
"mapOptionChange": ".t--property-control-onmarkerclick .CodeMirror-code",
"dropdownbuttonclick": ".bp3-button",
"menuSelection": ".bp3-button > .bp3-button-text",
@ -32,6 +32,8 @@
"editWidgetName": ".bp3-editable-text",
"dropDownIcon": ".t--property-control-textstyle span.bp3-icon-chevron-down",
"onDateSelectedField":".t--property-control-ondateselected",
"TableRow":".t--draggable-tablewidget .e-gridcontent.e-lib.e-droppable"
"TableRow":".t--draggable-tablewidget .e-gridcontent.e-lib.e-droppable",
"Disablejs":".t--property-control-disabled",
"requiredjs":".t--property-control-required"
}

View File

@ -0,0 +1,9 @@
{
"inputWidget":".t--widget-inputwidget",
"backToEditor":".bp3-icon.bp3-icon-chevron-left",
"checkboxWidget":".t--widget-checkboxwidget",
"radioWidget":".t--widget-radiogroupwidget",
"formWidget":".t--widget-formwidget",
"imageWidget":".t--widget-imagewidget",
"tabWidget":".t--widget-tabswidget"
}

View File

@ -419,6 +419,8 @@ Cypress.Commands.add("widgetText", (text, inputcss, innercss) => {
});
Cypress.Commands.add("PublishtheApp", () => {
cy.server();
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
cy.xpath(homePage.homePageID).contains("All changes saved");
cy.get(homePage.publishButton).click();
cy.wait("@publishApp");
@ -580,6 +582,11 @@ Cypress.Commands.add("togglebar", value => {
.check({ force: true })
.should("be.checked");
});
Cypress.Commands.add("togglebarDisable", value => {
cy.get(value)
.uncheck({ force: true })
.should("not.checked");
});
Cypress.Commands.add("radiovalue", (value, value2) => {
cy.get(value)
.click()
@ -881,3 +888,8 @@ Cypress.Commands.add("pageNoValidate", index => {
const pageVal = cy.get(data);
return pageVal;
});
Cypress.Commands.add("alertValidate", text => {
cy.get(commonlocators.success)
.should("be.visible")
.and("have.text", text);
});

View File

@ -22,7 +22,7 @@ let appId;
import "./commands";
before(function() {
console.log("**** Got Cypress base URL as: ", process.env.CYPRESS_BASE_URL);
cy.viewport("macbook-15");
cy.server();
cy.route("GET", "/api/v1/applications").as("applications");
cy.route("GET", "/api/v1/users/profile").as("getUser");
@ -80,8 +80,8 @@ before(function() {
cy.route("DELETE", "/api/v1/applications/*").as("deleteApplication");
cy.route("PUT", "/api/v1/actions/*").as("saveQuery");
cy.LogintoApp(loginData.username, loginData.password);
cy.LogintoApp(loginData.username, loginData.password);
// cy.SearchApp(inputData.appname)
cy.generateUUID().then(id => {
appId = id;