From 895acb3681a7fda7c902bc3e37b8524d53f1be11 Mon Sep 17 00:00:00 2001 From: rashminagarajp Date: Fri, 8 May 2020 14:31:11 +0530 Subject: [PATCH 1/7] added someke test cases --- app/client/cypress/fixtures/example.json | 16 ++- app/client/cypress/fixtures/formdsl1.json | 119 +++++++++++++++++ .../CommonWidgets/Button_spec.js | 55 +++++--- .../CommonWidgets/Text_spec.js | 32 ++++- .../FormWidgets/DatePicker_spec.js | 56 +++++++- .../FormWidgets/RichTextEditor_spec.js | 69 ++++++++-- app/client/cypress/locators/ModalWidget.json | 3 +- app/client/cypress/locators/Widgets.json | 2 +- .../cypress/locators/commonlocators.json | 12 +- app/client/cypress/support/commands.js | 124 +++++++++++++----- app/client/cypress/support/index.js | 9 +- 11 files changed, 421 insertions(+), 76 deletions(-) create mode 100644 app/client/cypress/fixtures/formdsl1.json diff --git a/app/client/cypress/fixtures/example.json b/app/client/cypress/fixtures/example.json index da18d9352a..c9f2a1b975 100644 --- a/app/client/cypress/fixtures/example.json +++ b/app/client/cypress/fixtures/example.json @@ -1,5 +1,19 @@ { "name": "Using fixtures to represent data", "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" + "body": "Fixtures are a great way to mock data for responses to routes", + "ButtonLabel":"Test Button", + "ButtonName":"Submitbutton", + "AlertModalName":"Alert_Modal", + "FormModalName":"Form_Modal", + "TextLabelValue":"Test Text Label", + "TextName":"TestTextBox", + "TextLabel":"Label", + "TextBody":"Body", + "TextHeading":"Heading", + "Datepickername":"Datepicker", + "DatepickerLable":"date", + "RichTextEditorName":"RichtextEditor", + "HtmlText":"This is the initialcontent

This is a Heading

This is a paragraph.

", + "RichTexteditorBody":"Here is the text area to edit html" } \ No newline at end of file diff --git a/app/client/cypress/fixtures/formdsl1.json b/app/client/cypress/fixtures/formdsl1.json new file mode 100644 index 0000000000..1eb938642a --- /dev/null +++ b/app/client/cypress/fixtures/formdsl1.json @@ -0,0 +1,119 @@ +{ + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 1224, + "snapColumns": 16, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 1254, + "containerStyle": "none", + "snapRows": 33, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "dynamicBindings": {}, + "version": 3, + "minHeight": 1292, + "parentColumnSpace": 1, + "leftColumn": 0, + "children": [ + { + "backgroundColor": "#FFFFFF", + "widgetName": "Container3", + "type": "CONTAINER_WIDGET", + "containerStyle": "card", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 75.25, + "parentRowSpace": 38, + "dynamicBindings": {}, + "leftColumn": 0, + "rightColumn": 16, + "topRow": 1, + "bottomRow": 23, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "backgroundColor": "transparent", + "widgetName": "6gcpyqo8my", + "type": "CANVAS_WIDGET", + "containerStyle": "none", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 1, + "parentRowSpace": 1, + "leftColumn": 0, + "rightColumn": 1204, + "topRow": 0, + "bottomRow": 532, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "isVisible": true, + "isDisabled": false, + "datePickerType": "DATE_PICKER", + "dateFormat": "DD/MM/YYYY", + "label": "Date", + "widgetName": "DatePicker1", + "defaultDate": "2020-05-07T10:52:14.548+05:30", + "type": "DATE_PICKER_WIDGET", + "isLoading": false, + "parentColumnSpace": 71.75, + "parentRowSpace": 38, + "leftColumn": 1, + "rightColumn": 8, + "topRow": 13, + "bottomRow": 14, + "parentId": "7tkpo9s22m", + "widgetId": "4y9j8f6kg2" + }, + { + "isVisible": true, + "text": "Submit", + "buttonStyle": "PRIMARY_BUTTON", + "widgetName": "Button1", + "isDisabled": false, + "isDefaultClickDisabled": true, + "type": "BUTTON_WIDGET", + "isLoading": false, + "parentColumnSpace": 71.75, + "parentRowSpace": 38, + "leftColumn": 12, + "rightColumn": 14, + "topRow": 9, + "bottomRow": 10, + "parentId": "7tkpo9s22m", + "widgetId": "nlzw81fc9u" + }, + { + "isVisible": true, + "defaultText": "This is the initial content of the editor", + "isDisabled": false, + "widgetName": "RichTextEditor1", + "isDefaultClickDisabled": true, + "type": "RICH_TEXT_EDITOR_WIDGET", + "isLoading": false, + "parentColumnSpace": 71.75, + "parentRowSpace": 38, + "leftColumn": 3, + "rightColumn": 11, + "topRow": 2, + "bottomRow": 7, + "parentId": "7tkpo9s22m", + "widgetId": "6h8j08u7ea" + } + ], + "widgetId": "7tkpo9s22m", + "detachFromLayout": true, + "canExtend": false + } + ], + "widgetId": "8xlprxx5pe" + } + ] + } + } \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js index 5bb6666552..85e776881e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js @@ -1,6 +1,7 @@ const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); const dsl = require("../../../fixtures/commondsl.json"); +const homePage = require("../../../locators/HomePage.json"); describe("Button Widget Functionality", function() { beforeEach(() => { @@ -8,27 +9,49 @@ describe("Button Widget Functionality", function() { }); it("Button Widget Functionality", function() { - cy.get(".t--nav-link-widgets-editor").click(); + cy.get(widgetsPage.buttonWidget) + .first() + .trigger("mouseover"); cy.get(widgetsPage.buttonWidget).click({ force: true }); + //changing the Button Name + cy.widgetText( + this.data.ButtonName, + widgetsPage.buttonWidget, + widgetsPage.buttonWidget + " pre", + ); + //Changing the text on the Button - cy.testCodeMirror("Test Button Text"); + cy.testCodeMirror(this.data.ButtonLabel); + cy.xpath(homePage.homePageID).contains("All changes saved"); - //Select and verify the Show Modal from the onClick dropdown - cy.get(widgetsPage.buttonOnClick) - .get(commonlocators.dropdownSelectButton) - .click({ force: true }) - .get("ul.bp3-menu") - .children() - .contains("Show Modal") - .click(); - cy.get(widgetsPage.buttonOnClick) - .get(commonlocators.dropdownSelectButton) - .find(".bp3-button-text") - .should("have.text", "Show Modal"); + //Verify the Button name and label + cy.get(widgetsPage.buttonWidget).trigger("mouseover"); + cy.get(widgetsPage.buttonWidget + " span.bp3-button-text").should( + "have.text", + this.data.ButtonLabel, + ); - //Verify Modal Widget - cy.CreateModal(); + //Check the disableed checkbox and Validate + cy.CheckWidgetProperties(commonlocators.disableCheckbox); + cy.get(widgetsPage.buttonWidget + " .bp3-minimal.bp3-disabled").should( + "exist", + ); + + // //UnCheck the disabled checkbox and validate + cy.UnCheckWidgetProperties(commonlocators.disableCheckbox); + cy.get(widgetsPage.buttonWidget + " .bp3-minimal.bp3-disabled").should( + "not.exist", + ); + + //creating the Alert Modal and verify Modal name + cy.createModal("Alert Modal", this.data.AlertModalName); + + //creating the Form Modal and verify Modal name + cy.get(widgetsPage.buttonWidget) + .first() + .click({ force: true }); + cy.createModal("Form Modal", this.data.FormModalName); }); afterEach(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js index 80db1dd2d7..b2f0c154f1 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js @@ -15,9 +15,35 @@ describe("Text Widget Functionality", function() { .get(commonlocators.editIcon) .first() .click(); - //Changing the text on the text widget - cy.testCodeMirror("Test text"); - cy.get(commonlocators.editPropCrossButton).click(); + + //Changing the text label + cy.testCodeMirror(this.data.TextLabelValue); + + //changing the Text Name and verifying + cy.widgetText( + this.data.TextName, + widgetsPage.textWidget, + widgetsPage.textWidget + " pre", + ); + + //Changing the Text Style's and validating + cy.ChangeTextStyle( + this.data.TextLabel, + commonlocators.labelTextStyle, + this.data.TextLabelValue, + ); + + cy.ChangeTextStyle( + this.data.TextBody, + commonlocators.bodyTextStyle, + this.data.TextLabelValue, + ); + + cy.ChangeTextStyle( + this.data.TextHeading, + commonlocators.headingTextStyle, + this.data.TextLabelValue, + ); }); afterEach(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js index f056ad1b59..0772529372 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js @@ -15,8 +15,62 @@ describe("DatePicker Widget Functionality", function() { .children(commonlocators.editicon) .first() .click({ force: true }); + //Changing the name of the date picker + 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("From Date"); + cy.testCodeMirror(this.data.DatepickerLable); + + // changing the date to today + cy.SetDateToToday(); + + // change the date to next day + cy.get(".t--property-control-defaultdate input").click(); + cy.get(".DayPicker-Day[aria-selected='true'] + div").click(); + const nd = Cypress.moment() + .add(1, "days") + .format("DD/MM/YYYY HH:mm"); + cy.log(nd); + + //Validating the Date + cy.get(formWidgetsPage.datepickerWidget + " .bp3-input").should( + "contain.value", + nd, + ); + + // 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); + + //Check the Disabled checkbox + cy.CheckWidgetProperties(commonlocators.disableCheckbox); + cy.get( + formWidgetsPage.datepickerWidget + " .bp3-input-group.bp3-disabled", + ).should("exist"); + + //UnCheck the Disabled checkbox + cy.UnCheckWidgetProperties(commonlocators.disableCheckbox); + cy.get( + formWidgetsPage.datepickerWidget + " .bp3-input-group.bp3-disabled", + ).should("not.exist"); + cy.get(commonlocators.editPropCrossButton).click(); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js index f3164fe5a2..0d066231aa 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js @@ -1,6 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -const dsl = require("../../../fixtures/formdsl.json"); +const dsl = require("../../../fixtures/formdsl1.json"); +const homePage = require("../../../locators/HomePage.json"); describe("RichTextEditor Widget Functionality", function() { beforeEach(() => { @@ -14,19 +15,59 @@ describe("RichTextEditor Widget Functionality", function() { .children(commonlocators.editicon) .first() .click({ force: true }); - //Checking the edit props for RichTextEditor and also the properties of RichTextEditor widget - cy.get(formWidgetsPage.richEditorOnTextChange) - .get(commonlocators.dropdownSelectButton) - .click({ force: true }) - .get("ul.bp3-menu") - .children() - .contains("Navigate To") - .click(); - cy.get(formWidgetsPage.richEditorOnTextChange) - .get(commonlocators.dropdownSelectButton) - .find("> span") - .eq(0) - .should("have.text", "Navigate To"); + + //changing the Text Name + cy.widgetText( + this.data.RichTextEditorName, + formWidgetsPage.richTextEditorWidget, + formWidgetsPage.richTextEditorWidget + " pre", + ); + + //Edit the text area with Html + cy.testCodeMirror(this.data.HtmlText); + + //Validating Html + cy.get(formWidgetsPage.richTextEditorWidget + " iframe").then($iframe => { + const $body = $iframe.contents().find("body"); + cy.wrap($body) + .find("h1") + .should("have.text", "This is a Heading"); + }); + + cy.get(commonlocators.editPropCrossButton).click(); + + cy.get(formWidgetsPage.richTextEditorWidget) + .children(commonlocators.editicon) + .first() + .click({ force: true }); + + //Edit the text area with Plain text + cy.testCodeMirror(this.data.RichTexteditorBody); + + //Validating Plain text + cy.get(formWidgetsPage.richTextEditorWidget + " iframe").then($iframe => { + const $body = $iframe.contents().find("body"); + cy.wrap($body) + .find("p") + .should("have.text", this.data.RichTexteditorBody); + }); + + //Check the Disabled checkbox + cy.CheckWidgetProperties( + ".t--property-control-disable input[type='checkbox']", + ); + cy.get( + formWidgetsPage.richTextEditorWidget + " button[disabled='disabled']", + ).should("exist"); + + //UnCheck the Disabled checkbox + cy.UnCheckWidgetProperties( + ".t--property-control-disable input[type='checkbox']", + ); + cy.get( + formWidgetsPage.richTextEditorWidget + " button[disabled='disabled']", + ).should("not.exist"); + cy.get(commonlocators.editPropCrossButton).click(); }); diff --git a/app/client/cypress/locators/ModalWidget.json b/app/client/cypress/locators/ModalWidget.json index ef3fec17e7..48314b877a 100644 --- a/app/client/cypress/locators/ModalWidget.json +++ b/app/client/cypress/locators/ModalWidget.json @@ -2,6 +2,7 @@ "selectModal":".t--open-dropdown-Select-Modal", "createModalButton":".t--create-modal-btn", "controlModalType": ".t--property-control-modaltype", - "modalWidget":".t--modal-widget" + "modalWidget":".t--modal-widget", + "modalName":".t--modal-widget >div>pre" } \ No newline at end of file diff --git a/app/client/cypress/locators/Widgets.json b/app/client/cypress/locators/Widgets.json index 881b518c44..0a6e9058b2 100644 --- a/app/client/cypress/locators/Widgets.json +++ b/app/client/cypress/locators/Widgets.json @@ -11,6 +11,6 @@ "dropdownSelectButton":".t--open-dropdown-Select", "buttonOnClick": ".t--property-control-onclick", "deleteWidget":".t--modal-widget>div .t--widget-delete-control", - "textbuttonWidget":"button.bp3-button[type='button']" + "textbuttonWidget":".t--draggable-buttonwidget button.bp3-button[type='button']" } \ No newline at end of file diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json index 07f2047337..4b48c96a7a 100644 --- a/app/client/cypress/locators/commonlocators.json +++ b/app/client/cypress/locators/commonlocators.json @@ -3,5 +3,15 @@ "editPropCrossButton":".t--property-pane-close-btn", "deleteWidgetIcon":".t--widget-delete-control", "dropdownSelectButton":".t--open-dropdown-Select-Action", - "homeIcon":".bp3-icon.bp3-icon-home" + "homeIcon":".bp3-icon.bp3-icon-home", + "typeWidgetName":".bp3-editable-text-editing>input", + "requiredCheckbox":".t--property-control-required input[type='checkbox']", + "visibleCheckbox":".t--property-control-visible input[type='checkbox']", + "disableCheckbox":".t--property-control-disabled input[type='checkbox']", + "labelTextStyle":".bp3-ui-text span", + "bodyTextStyle":".bp3-running-text span", + "headingTextStyle":".bp3-heading span", + "editWidgetName":".bp3-editable-text", + "dropDownIcon":".t--property-control-textstyle span.bp3-icon-chevron-down" + } \ No newline at end of file diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 959859d48c..e40d071c61 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -4,6 +4,7 @@ const pages = require("../locators/Pages.json"); const commonlocators = require("../locators/commonlocators.json"); const modalWidgetPage = require("../locators/ModalWidget.json"); const widgetsPage = require("../locators/Widgets.json"); +const formWidgetsPage = require("../locators/FormWidgets.json"); Cypress.Commands.add("CreateApp", appname => { cy.get(homePage.CreateApp) @@ -13,15 +14,17 @@ Cypress.Commands.add("CreateApp", appname => { cy.get(homePage.CreateApp) .contains("Submit") .click({ force: true }); - // cy.wait(2000); + // cy.wait(2000); cy.get("#loading").should("not.exist"); }); Cypress.Commands.add("DeleteApp", appName => { cy.get(commonlocators.homeIcon).click({ force: true }); - cy.get(homePage.searchInput).type(appName); - //cy.wait(2000); - cy.get("#loading").should("not.exist"); + cy.wait("@applications"); + cy.get(homePage.searchInput) + .focus() + .type(appName); + cy.wait(2000); cy.get(homePage.appMoreIcon) .first() .click({ force: true }); @@ -62,37 +65,6 @@ Cypress.Commands.add("SearchApp", appname => { // Wait added because after opening the application editor, sometimes it takes a little time. }); -// Cypress.Commands.add("NavigateToCommonWidgets", () => { -// cy.get(pages.pagesIcon).click({ force: true }); -// cy.get(pages.commonWidgets) -// .find(">div") -// .click({ force: true }); -// cy.get("#loading").should("not.exist"); -// cy.get(pages.widgetsEditor).click(); -// cy.wait("@getPage"); -// cy.get("#loading").should("not.exist"); -// }); - -// Cypress.Commands.add("NavigateToFormWidgets", () => { -// cy.get(pages.pagesIcon).click({ force: true }); -// cy.get(pages.formWidgets) -// .find(">div") -// .click({ force: true }); -// cy.get("#loading").should("not.exist"); -// cy.get(pages.widgetsEditor).click(); -// cy.get("#loading").should("not.exist"); -// }); - -// Cypress.Commands.add("NavigateToViewWidgets", () => { -// cy.get(pages.pagesIcon).click({ force: true }); -// cy.get(pages.viewWidgets) -// .find(">div") -// .click({ force: true }); -// cy.get("#loading").should("not.exist"); -// cy.get(pages.widgetsEditor).click(); -// cy.get("#loading").should("not.exist"); -// }); - Cypress.Commands.add("CreateModal", () => { cy.get(modalWidgetPage.selectModal).click(); cy.get(modalWidgetPage.createModalButton).click({ force: true }); @@ -110,6 +82,73 @@ Cypress.Commands.add("CreateModal", () => { cy.reload(); }); +Cypress.Commands.add("createModal", (modalType, ModalName) => { + cy.get(widgetsPage.buttonOnClick) + .get(commonlocators.dropdownSelectButton) + .click({ force: true }) + .get("ul.bp3-menu") + .children() + .contains("Show Modal") + .click(); + cy.get(modalWidgetPage.selectModal).click(); + cy.get(modalWidgetPage.createModalButton).click({ force: true }); + + cy.get(modalWidgetPage.controlModalType) + .find(".bp3-button") + .click({ force: true }) + .get("ul.bp3-menu") + .children() + .contains(modalType) + .click(); + cy.xpath(homePage.homePageID).contains("All changes saved"); + + // changing the model name verify + cy.widgetText( + ModalName, + modalWidgetPage.modalName, + modalWidgetPage.modalName, + ); + cy.get(commonlocators.editPropCrossButton).click(); + cy.reload(); +}); + +Cypress.Commands.add("CheckWidgetProperties", checkBoxTypeCss => { + cy.get(checkBoxTypeCss).check({ + force: true, + }); + cy.xpath(homePage.homePageID).contains("All changes saved"); +}); + +Cypress.Commands.add("UnCheckWidgetProperties", checkBoxTypeCss => { + cy.get(checkBoxTypeCss).uncheck({ + force: true, + }); + cy.xpath(homePage.homePageID).contains("All changes saved"); +}); + +Cypress.Commands.add( + "ChangeTextStyle", + (dropDownValue, textStylecss, labelName) => { + cy.get(commonlocators.dropDownIcon).click(); + cy.get("ul.bp3-menu") + .children() + .contains(dropDownValue) + .click(); + cy.get(textStylecss).should("have.text", labelName); + }, +); + +Cypress.Commands.add("widgetText", (text, inputcss, innercss) => { + cy.get(commonlocators.editWidgetName) + .dblclick({ force: true }) + .type(text) + .type("{enter}"); + cy.get(inputcss) + .first() + .trigger("mouseover", { force: true }); + cy.get(innercss).should("have.text", text); +}); + Cypress.Commands.add("PublishtheApp", () => { cy.xpath(homePage.homePageID).contains("All changes saved"); cy.get(homePage.publishButton).click(); @@ -153,6 +192,21 @@ Cypress.Commands.add("testCodeMirror", value => { }); }); +Cypress.Commands.add("SetDateToToday", () => { + cy.get(formWidgetsPage.datepickerWidget) + .first() + .trigger("mouseover"); + cy.get(formWidgetsPage.datepickerWidget) + .children(commonlocators.editicon) + .first() + .click({ force: true }); + cy.get(".t--property-control-defaultdate input").click(); + cy.get(".bp3-datepicker-footer span") + .contains("Today") + .click(); + cy.xpath(homePage.homePageID).contains("All changes saved"); +}); + Cypress.Commands.add("DeleteModal", () => { cy.get(widgetsPage.textbuttonWidget).dblclick("topRight", { force: true }); cy.get(widgetsPage.deleteWidget) diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index 27b7e4556f..6d91f1973d 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -38,6 +38,7 @@ before(function() { cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout"); cy.LogintoApp(loginData.username, loginData.password); + // cy.SearchApp(inputData.appname) cy.generateUUID().then(id => { appId = id; cy.CreateApp(id); @@ -48,16 +49,18 @@ before(function() { cy.NavigateToWidgets(pageid); }); + cy.fixture("example").then(function(data) { + this.data = data; + }); + beforeEach(function() { Cypress.Cookies.preserveOnce("session_id", "remember_token"); }); after(function() { - // ---commenting Publish app and Delete page as of now--- // - //cy.Deletepage(pageid); + // cy.Deletepage(pageid); //cy.PublishtheApp(); cy.DeleteApp(appId); - }); }); From f4c17f74231ca0b0525b1e2b12a55eaa3dc902cd Mon Sep 17 00:00:00 2001 From: Rashmi P Date: Fri, 8 May 2020 10:38:35 +0000 Subject: [PATCH 2/7] Update RichTextEditor_spec.js --- .../Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js index 0d066231aa..e779ea2e1b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js @@ -49,7 +49,7 @@ describe("RichTextEditor Widget Functionality", function() { const $body = $iframe.contents().find("body"); cy.wrap($body) .find("p") - .should("have.text", this.data.RichTexteditorBody); + .should("contain.text", this.data.RichTexteditorBody); }); //Check the Disabled checkbox From c7cc13c50c55060310d507e3c56a44891c6e7fea Mon Sep 17 00:00:00 2001 From: Rashmi P Date: Mon, 11 May 2020 05:15:26 +0000 Subject: [PATCH 3/7] Formatted the example.json --- app/client/cypress/fixtures/example.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/client/cypress/fixtures/example.json b/app/client/cypress/fixtures/example.json index c9f2a1b975..49d81cecb2 100644 --- a/app/client/cypress/fixtures/example.json +++ b/app/client/cypress/fixtures/example.json @@ -1,7 +1,7 @@ { - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes", + "name":"Using fixtures to represent data", + "email":"hello@cypress.io", + "body":"Fixtures are a great way to mock data for responses to routes", "ButtonLabel":"Test Button", "ButtonName":"Submitbutton", "AlertModalName":"Alert_Modal", From a1f6b62d268b91b6ccb4f7bb4622ef9d624d4494 Mon Sep 17 00:00:00 2001 From: rashminagarajp Date: Mon, 11 May 2020 16:08:49 +0530 Subject: [PATCH 4/7] seperated after block and update replaced session_id to SESSION --- app/client/cypress/support/index.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index 5916d605b0..8e7319d6d2 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -77,15 +77,15 @@ before(function() { cy.fixture("example").then(function(data) { this.data = data; }); - - beforeEach(function() { - Cypress.Cookies.preserveOnce("session_id", "remember_token"); - }); - - after(function() { - // ---commenting Publish app and Delete page as of now--- // - // cy.Deletepage(pageid); - //cy.PublishtheApp(); - cy.DeleteApp(appId); - }); +}); + +beforeEach(function() { + Cypress.Cookies.preserveOnce("SESSION", "remember_token"); +}); + +after(function() { + // ---commenting Publish app and Delete page as of now--- // + // cy.Deletepage(pageid); + //cy.PublishtheApp(); + cy.DeleteApp(appId); }); From 987d2342b0ab5378bc38a964a13fe906b8299206 Mon Sep 17 00:00:00 2001 From: rashminagarajp Date: Tue, 12 May 2020 10:05:21 +0530 Subject: [PATCH 5/7] replaced Delete Application through UI by API --- .../CommonWidgets/Button_spec.js | 4 +--- .../Smoke_TestSuite/CommonWidgets/Text_spec.js | 1 + .../FormWidgets/RichTextEditor_spec.js | 7 ------- app/client/cypress/support/commands.js | 18 ++++++++++++++++++ app/client/cypress/support/index.js | 7 +++++-- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js index a9624ca766..fbe5aad335 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js @@ -46,9 +46,7 @@ describe("Button Widget Functionality", function() { cy.createModal("Alert Modal", this.data.AlertModalName); //creating the Form Modal and verify Modal name - cy.get(widgetsPage.buttonWidget) - .first() - .click({ force: true }); + cy.openPropertyPane("buttonwidget"); cy.createModal("Form Modal", this.data.FormModalName); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js index 63c75164ad..89e10a8469 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js @@ -1,5 +1,6 @@ const commonlocators = require("../../../locators/commonlocators.json"); const dsl = require("../../../fixtures/commondsl.json"); +const widgetsPage = require("../../../locators/Widgets.json"); describe("Text Widget Functionality", function() { beforeEach(() => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js index 80959dda7a..d9842bbffa 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js @@ -28,13 +28,6 @@ describe("RichTextEditor Widget Functionality", function() { .should("have.text", "This is a Heading"); }); - cy.get(commonlocators.editPropCrossButton).click(); - - cy.get(formWidgetsPage.richTextEditorWidget) - .children(commonlocators.editicon) - .first() - .click({ force: true }); - //Edit the text area with Plain text cy.testCodeMirror(this.data.RichTexteditorBody); diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 067efbe98f..1771470008 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -287,6 +287,24 @@ Cypress.Commands.add("addDsl", dsl => { }); }); +Cypress.Commands.add("DeleteAppByApi", () => { + let currentURL; + let appId; + cy.url().then(url => { + currentURL = url; + const myRegexp = /applications(.*)/; + const match = myRegexp.exec(currentURL); + appId = match[1].split("/")[1]; + cy.log(appId + "appId"); + cy.request( + "DELETE", + "https://release-api.appsmith.com/api/v1/applications/" + appId, + ).then(response => { + expect(response.status).equal(200); + }); + }); +}); + Cypress.Commands.add("NavigateToDatasourceEditor", () => { cy.get(datasourceEditor.datasourceEditorIcon).click({ force: true }); }); diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index 8e7319d6d2..f432dc46a8 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -85,7 +85,10 @@ beforeEach(function() { after(function() { // ---commenting Publish app and Delete page as of now--- // - // cy.Deletepage(pageid); + + //cy.Deletepage(pageid); //cy.PublishtheApp(); - cy.DeleteApp(appId); + //cy.DeleteApp(appId); + //-- Deleting the application by Api---// + cy.DeleteAppByApi(); }); From 76d65761f27e42b23be2ede363808bee2039ee15 Mon Sep 17 00:00:00 2001 From: Rashmi P Date: Tue, 12 May 2020 09:55:59 +0000 Subject: [PATCH 6/7] Formatted the json --- app/client/cypress/fixtures/example.json | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/client/cypress/fixtures/example.json b/app/client/cypress/fixtures/example.json index 49d81cecb2..47dc71d630 100644 --- a/app/client/cypress/fixtures/example.json +++ b/app/client/cypress/fixtures/example.json @@ -1,19 +1,19 @@ { - "name":"Using fixtures to represent data", - "email":"hello@cypress.io", - "body":"Fixtures are a great way to mock data for responses to routes", - "ButtonLabel":"Test Button", - "ButtonName":"Submitbutton", - "AlertModalName":"Alert_Modal", - "FormModalName":"Form_Modal", - "TextLabelValue":"Test Text Label", - "TextName":"TestTextBox", - "TextLabel":"Label", - "TextBody":"Body", - "TextHeading":"Heading", - "Datepickername":"Datepicker", - "DatepickerLable":"date", - "RichTextEditorName":"RichtextEditor", - "HtmlText":"This is the initialcontent

This is a Heading

This is a paragraph.

", - "RichTexteditorBody":"Here is the text area to edit html" + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes", + "ButtonLabel": "Test Button", + "ButtonName": "Submitbutton", + "AlertModalName": "Alert_Modal", + "FormModalName": "Form_Modal", + "TextLabelValue": "Test Text Label", + "TextName": "TestTextBox", + "TextLabel": "Label", + "TextBody": "Body", + "TextHeading": "Heading", + "Datepickername": "Datepicker", + "DatepickerLable": "date", + "RichTextEditorName": "RichtextEditor", + "HtmlText": "This is the initialcontent

This is a Heading

This is a paragraph.

", + "RichTexteditorBody": "Here is the text area to edit html" } \ No newline at end of file From a83b62ea2284d658b5c5c26f7c2b27460f960eea Mon Sep 17 00:00:00 2001 From: Rashmi P Date: Tue, 12 May 2020 10:46:00 +0000 Subject: [PATCH 7/7] Fixed time Issue on date picker --- .../integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js index 4667349c88..0396785d3f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js @@ -21,7 +21,7 @@ describe("DatePicker Widget Functionality", function() { cy.get(".DayPicker-Day[aria-selected='true'] + div").click(); const nd = Cypress.moment() .add(1, "days") - .format("DD/MM/YYYY HH:mm"); + .format("DD/MM/YYYY"); cy.log(nd); //Validating the Date