ressolved comments

This commit is contained in:
rashminagarajp 2020-05-15 17:50:09 +05:30
parent 0928af03b0
commit 31ca946199
9 changed files with 99 additions and 34 deletions

View File

@ -15,5 +15,6 @@
"DatepickerLable": "date",
"RichTextEditorName": "RichtextEditor",
"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"
"RichTexteditorBody": "Here is the text area to edit html",
"userApi": "http://postgrest.appsmith.com:3000"
}

View File

@ -4,31 +4,55 @@ const widgetsPage = require("../../../locators/Widgets.json");
const dsl = require("../../../fixtures/uibindingdsl.json");
describe("Binding the Datepicker and Text Widget", function() {
let nextDay;
let dateDp2;
before(() => {
cy.addDsl(dsl);
});
it("Bind the date picker in text widget", function() {
it("DatePicker1-text: Change the date in DatePicker1 and Validate the same in text widget", function() {
cy.openPropertyPane("textwidget");
//Changing the text on the text widget
cy.testCodeMirror("{{DatePicker1.defaultDate}}");
/**
* Bind the datepicker1 to text widget
*/
cy.testJsontext("text", "{{DatePicker1.defaultDate}}");
cy.get(commonlocators.editPropCrossButton).click();
});
it("Change the date in datePicker1 and validate the same in text widget", function() {
// changing the date to today
/**
* Fetching the date on DatePicker2
*/
cy.get(formWidgetsPage.datepickerWidget + " .bp3-input")
.eq(1)
.invoke("val")
.then(val => {
dateDp2 = val;
cy.log(dateDp2);
});
/**
* Changing date on datepicker1 to current date +1
*/
cy.openPropertyPane("datepickerwidget");
cy.SetDateToToday();
//Changing date on date picker1 to current date +1
cy.get(".DayPicker-Day[aria-selected='true'] + div").click();
cy.get(".t--property-control-ondateselected").click();
cy.get(formWidgetsPage.nextDayBtn).click();
cy.get(commonlocators.onDateSelectedField).click();
cy.get(commonlocators.editPropCrossButton).click();
//Validate the changes in text widget
const nd = Cypress.moment()
/**
*Validate the date in text widget
*/
nextDay = Cypress.moment()
.add(1, "days")
.format("YYYY-MM-DD");
cy.get(commonlocators.labelTextStyle).should("contain", nd);
cy.get(commonlocators.labelTextStyle).should("contain", nextDay);
});
it("Validate the Date is not changed in DatePicker2", function() {
cy.get(formWidgetsPage.datepickerWidget + " .bp3-input")
.eq(1)
.should("have.value", dateDp2);
});
});

View File

@ -1,6 +1,7 @@
const commonlocators = require("../../../locators/commonlocators.json");
const dsl = require("../../../fixtures/tableWidgetDsl.json");
const pages = require("../../../locators/Pages.json");
const apiPage = require("../../../locators/ApiEditor.json");
let apiData;
describe("Test Create Api and Bind to Table widget", function() {
@ -14,11 +15,10 @@ describe("Test Create Api and Bind to Table widget", function() {
});
it("Test_Add users api and execute api", function() {
// localStorage.setItem("ApiPaneV2", "ApiPaneV2");
cy.NavigateToApiEditor();
cy.testCreateApiButton();
cy.createApi("http://postgrest.appsmith.com:3000", "users");
cy.get(".CodeMirror-code span.cm-string.cm-property")
cy.createApi(this.data.userApi, "users");
cy.get(apiPage.responseBody)
.contains("name")
.siblings("span")
.invoke("text")
@ -27,14 +27,19 @@ describe("Test Create Api and Bind to Table widget", function() {
apiData = text;
cy.log("val1:" + apiData);
});
});
it("Test_Validate the Api data is updated on Table widget", function() {
});
it("Test_Validate the Api data is updated on Table widget", function() {
cy.get(pages.pagesIcon).click({ force: true });
cy.openPropertyPane("tablewidget");
cy.testCodeMirror("{{Api1.data}}");
cy.testJsontext("tabledata", "{{Api1.data}}");
cy.wait("@updateLayout");
cy.get(commonlocators.editPropCrossButton).click();
/**
* readTabledata--> is to read the table contents
* @param --> "row num" and "col num"
*/
cy.readTabledata("0", "1").then(tabData => {
expect(apiData).to.eq(`\"${tabData}\"`);
});

View File

@ -8,16 +8,24 @@ describe("DatePicker Widget Functionality", function() {
});
it("DatePicker Widget Functionality", function() {
// changing the date to today
cy.openPropertyPane("datepickerwidget");
// changing the date to today
cy.SetDateToToday();
//changing the Button Name
cy.widgetText(
this.data.Datepickername,
formWidgetsPage.datepickerWidget,
formWidgetsPage.datepickerWidget + " pre",
);
//Checking the edit props for DatePicker and also the properties of DatePicker widget
cy.testCodeMirror(this.data.DatepickerLable);
cy.wait("@updateLayout");
// change the date to next day
cy.get(".t--property-control-defaultdate input").click();
cy.get(".DayPicker-Day[aria-selected='true'] + div").click();
cy.get(formWidgetsPage.nextDayBtn).click();
const nd = Cypress.moment()
.add(1, "days")
.format("DD/MM/YYYY");

View File

@ -11,5 +11,6 @@
"addToPageBtnsId": ".t--addToPageButtons",
"ApiHomePage": ".t--apiHomePage",
"formActionButtons": ".t--formActionButtons",
"dataSourceField": ".t--dataSourceField"
"dataSourceField": ".t--dataSourceField",
"responseBody":".CodeMirror-code span.cm-string.cm-property"
}

View File

@ -8,5 +8,6 @@
"filepickerWidget":".t--draggable-filepickerwidget",
"formWidget":".t--draggable-formwidget",
"richTextEditorWidget":".t--draggable-richtexteditorwidget",
"richEditorOnTextChange":".t--property-control-ontextchange"
"richEditorOnTextChange":".t--property-control-ontextchange",
"nextDayBtn": ".DayPicker-Day[aria-selected='true'] + div.DayPicker-Day"
}

View File

@ -12,6 +12,7 @@
"bodyTextStyle":".bp3-running-text span",
"headingTextStyle":".bp3-heading span",
"editWidgetName":".bp3-editable-text",
"dropDownIcon":".t--property-control-textstyle span.bp3-icon-chevron-down"
"dropDownIcon":".t--property-control-textstyle span.bp3-icon-chevron-down",
"onDateSelectedField":".t--property-control-ondateselected"
}

View File

@ -376,15 +376,37 @@ Cypress.Commands.add("testCodeMirror", value => {
parseSpecialCharSequences: false,
});
// cy.wait("@updateLayout");
// commenting below line's, hence which effets the text area which is having js fun
/*cy.get(".CodeMirror textarea")
cy.get(".CodeMirror textarea")
.first()
.should("have.value", value); */
.should("have.value", value);
});
});
Cypress.Commands.add("testJsontext", (endp, value) => {
cy.get(".t--property-control-" + endp + " .CodeMirror textarea")
.first()
.focus({ force: true })
.type("{uparrow}", { force: true })
.type("{ctrl}{shift}{downarrow}", { force: true });
cy.focused().then($cm => {
if ($cm.val() !== "") {
cy.get(".CodeMirror textarea")
.first()
.clear({
force: true,
});
cy.wait("@updateLayout");
}
cy.get(".CodeMirror textarea")
.first()
.type(value, {
force: true,
parseSpecialCharSequences: false,
});
});
});
Cypress.Commands.add("SetDateToToday", () => {
cy.openPropertyPane("datepickerwidget");
cy.get(".t--property-control-defaultdate input").click();
cy.get(".bp3-datepicker-footer span")
.contains("Today")
@ -659,9 +681,9 @@ Cypress.Commands.add("createApi", (url, parameters) => {
force: true,
});
cy.get(".CodeMirror.CodeMirror-empty textarea")
.first()
.click({ force: true })
.type(parameters, { force: true });
.first()
.click({ force: true })
.type(parameters, { force: true });
cy.SaveAPI();
cy.get(ApiEditor.formActionButtons).should("be.visible");
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");

View File

@ -98,6 +98,8 @@ before(function() {
});
beforeEach(function() {
cy.server();
cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout");
Cypress.Cookies.preserveOnce("SESSION", "remember_token");
});