diff --git a/app/client/.gitlab-ci.yml b/app/client/.gitlab-ci.yml index 89ec8a5b57..b6f48df47d 100644 --- a/app/client/.gitlab-ci.yml +++ b/app/client/.gitlab-ci.yml @@ -75,6 +75,33 @@ cypress-test-release: - release - merge_requests +# cypress-test-fix: +# stage: build +# script: +# - *set_env_variables +# - yarn install +# # show where the Cypress test runner binaries are cached +# - $(npm bin)/cypress cache path +# # show all installed versions of Cypress binary +# - $(npm bin)/cypress cache list +# - $(npm bin)/cypress verify +# - curl https://s3.ap-south-1.amazonaws.com/dev.public.appsmith/react-build/build1.tar.gz --output build.tar.gz +# - tar xvf build.tar.gz +# - yarn global add serve +# - serve -s build -p 3000 & +# # This is required in order to ensure that all the test cases pass +# - echo "127.0.0.1 dev.appsmith.com" >> /etc/hosts +# - yarn test +# artifacts: +# when: always +# expire_in: 1 week +# paths: +# - cypress/screenshots +# - cypress/videos +# only: +# # We don't test on master right now because of changing environment variables for REACT_APP_BASE_URL. Need to figure out a way to configure that. +# - fix/test-revert + docker-package-release: image: docker:dind services: diff --git a/app/client/craco.build.config.js b/app/client/craco.build.config.js index f20adf3bd2..f8526e92ca 100644 --- a/app/client/craco.build.config.js +++ b/app/client/craco.build.config.js @@ -1,22 +1,24 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -const SentryWebpackPlugin = require('@sentry/webpack-plugin'); -const merge = require('webpack-merge'); -const common = require('./craco.common.config.js'); +const SentryWebpackPlugin = require("@sentry/webpack-plugin"); +const merge = require("webpack-merge"); +const common = require("./craco.common.config.js"); -const env = process.env.REACT_APP_ENVIRONMENT +const env = process.env.REACT_APP_ENVIRONMENT; -const plugins = [] +const plugins = []; -if(env === "PRODUCTION" || env === "STAGING") { - plugins.push(new SentryWebpackPlugin({ - include: 'build', - ignore: ['node_modules', 'webpack.config.js'], - release: process.env.REACT_APP_SENTRY_RELEASE - })) +if (env === "PRODUCTION" || env === "STAGING") { + plugins.push( + new SentryWebpackPlugin({ + include: "build", + ignore: ["node_modules", "webpack.config.js"], + release: process.env.REACT_APP_SENTRY_RELEASE, + }), + ); } module.exports = merge(common, { webpack: { - plugins: plugins + plugins: plugins, }, }); diff --git a/app/client/cypress.json b/app/client/cypress.json index 430cc545c4..b0c01cbf99 100644 --- a/app/client/cypress.json +++ b/app/client/cypress.json @@ -1,8 +1,9 @@ { "baseUrl":"http://dev.appsmith.com:3000/", - "defaultCommandTimeout": 10000, + "defaultCommandTimeout": 20000, + "requestTimeout": 21000, "pageLoadTimeout": 20000, - + "video": false, "reporter": "mochawesome", "reporterOptions": { "reportDir": "results", 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 91aae816f2..dc50f7b2be 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Button_spec.js @@ -1,25 +1,14 @@ const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); -context("Cypress test", function() { +describe("Button Widget Functionality", function() { it("Button Widget Functionality", function() { cy.NavigateToCommonWidgets(); cy.get(".t--nav-link-widgets-editor").click(); cy.get(widgetsPage.buttonWidget).click({ force: true }); //Changing the text on the Button - cy.get(".CodeMirror textarea") - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("Test Button Text", { force: true }) - .wait(5000); - - // TODO instead of testing the textarea, test the actual widget - // cy.get(".CodeMirror textarea") - // .first() - // .should("have.value", "Test Button Text"); + cy.testCodeMirror("Test Button Text"); //Select and verify the Show Modal from the onClick dropdown cy.get(widgetsPage.buttonOnClick) @@ -34,6 +23,6 @@ context("Cypress test", function() { .find(".bp3-button-text") .should("have.text", "Show Modal"); //Verify Modal Widget - cy.CreateModal(); + // cy.CreateModal(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Container_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Container_spec.js index d63e0c60fe..74a96b3306 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Container_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Container_spec.js @@ -1,7 +1,7 @@ const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); -context("Cypress test", function() { +describe("Container Widget Functionality", function() { it("Container Widget Functionality", function() { cy.NavigateToCommonWidgets(); cy.get(widgetsPage.containerWidget) @@ -12,16 +12,7 @@ context("Cypress test", function() { .first() .click(); //Checking the edit props for container changing the background color of container - cy.get(".CodeMirror textarea") - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("#C0C0C0", { force: true }) - .wait(5000); - - // TODO instead of testing the textarea, test the actual widget - // cy.get(".CodeMirror textarea").should("have.value", "#C0C0C0"); + cy.testCodeMirror("#C0C0C0"); cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Input_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Input_spec.js index f8eb3cdc51..0be816d1f3 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Input_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Input_spec.js @@ -1,7 +1,7 @@ const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); -context("Cypress test", function() { +describe("Input Widget Functionality", function() { it("Input Widget Functionality", function() { cy.NavigateToCommonWidgets(); cy.get(widgetsPage.inputWidget) @@ -12,14 +12,7 @@ context("Cypress test", function() { .first() .click(); //Checking the edit props for container and changing the Input label name - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("Test Input Label", { force: true }) - .wait(5000); + cy.testCodeMirror("Test Input Label"); cy.get(commonlocators.editPropCrossButton).click(); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Table_spec.js b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Table_spec.js index 488d5ca416..72fc7219e7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Table_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Table_spec.js @@ -1,7 +1,7 @@ const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); -context("Cypress test", function() { +describe("Table Widget Functionality", function() { it("Table Widget Functionality", function() { cy.NavigateToCommonWidgets(); cy.get(widgetsPage.tableWidget) @@ -12,18 +12,6 @@ context("Cypress test", function() { .first() .click(); //Checking the edit props for Table Widget and also the properties of Table widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .should("be.empty") - .clear({ force: true }) - .should("be.empty") - .type("{{UsersApi.data}}", { - parseSpecialCharSequences: false, - force: true, - }) - .wait(5000); cy.get(widgetsPage.tableOnRowSelected) .get(commonlocators.dropdownSelectButton) @@ -31,13 +19,14 @@ context("Cypress test", function() { .click({ force: true }) .get("ul.bp3-menu") .children() - .contains("Navigate to URL") + .contains("Navigate To") .click(); + cy.wait("@updateLayout"); cy.get(widgetsPage.tableOnRowSelected) .get(commonlocators.dropdownSelectButton) .first() .find("> .bp3-button-text") - .should("have.text", "Navigate to URL"); + .should("have.text", "Navigate To"); cy.get(commonlocators.editPropCrossButton).click(); }); }); 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 cdbca668f8..d7e688f3a1 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/CommonWidgets/Text_spec.js @@ -1,7 +1,7 @@ const widgetsPage = require("../../../locators/Widgets.json"); const commonlocators = require("../../../locators/commonlocators.json"); -context("Cypress test", function() { +describe("Text Widget Functionality", function() { it("Text Widget Functionality", function() { cy.NavigateToCommonWidgets(); cy.get(widgetsPage.textWidget) @@ -12,19 +12,7 @@ context("Cypress test", function() { .first() .click(); //Changing the text on the text widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("Test text", { force: true }) - .wait(5000); - - // TODO instead of testing the textarea, test the actual widget - // cy.get(".CodeMirror textarea") - // .first() - // .should("have.value", "Test text"); + cy.testCodeMirror("Test text"); cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/CheckBox_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/CheckBox_spec.js index 24f7d0e9a7..0bde83a76f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/CheckBox_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/CheckBox_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("Checkbox Widget Functionality", function() { it("Checkbox Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.checkboxWidget) @@ -12,16 +12,7 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for Checkbox and also the properties of Checkbox widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .should("be.empty") - .clear({ force: true }) - .type("Test Checkbox"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "Test Checkbox"); + cy.testCodeMirror("Test Checkbox"); cy.get(commonlocators.editPropCrossButton).click(); }); }); 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 6dbf32baf9..2ee9f08314 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/DatePicker_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("DatePicker Widget Functionality", function() { it("DatePicker Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.datepickerWidget) @@ -12,16 +12,7 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for DatePicker and also the properties of DatePicker widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .should("be.empty") - .clear({ force: true }) - .type("From Date"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "From Date"); + cy.testCodeMirror("From Date"); cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Dropdown_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Dropdown_spec.js index 8e5b3af13e..076b63b647 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Dropdown_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Dropdown_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("Dropdown Widget Functionality", function() { it("Dropdown Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.dropdownWidget) @@ -12,16 +12,7 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for Dropdown and also the properties of Dropdown widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("Test Dropdown"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "Test Dropdown"); + cy.testCodeMirror("Test Dropdown"); cy.get(formWidgetsPage.dropdownSelectionType) .find(".bp3-button") diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FilePicker_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FilePicker_spec.js index 01c7cfb7a9..368291a6a1 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FilePicker_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FilePicker_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("FilePicker Widget Functionality", function() { it("FilePicker Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.filepickerWidget) @@ -12,16 +12,8 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for FilePicker and also the properties of FilePicker widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .should("be.empty") - .clear({ force: true }) - .type("Upload Files"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "Upload Files"); + + cy.testCodeMirror("Upload Files"); cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FormWidget_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FormWidget_spec.js index 3d0db8fe43..8fbf98c304 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FormWidget_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/FormWidget_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("Form Widget Functionality", function() { it("Form Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.formWidget) @@ -12,16 +12,8 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for Form and also the properties of Form widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .should("be.empty") - .clear({ force: true }) - .type("Gray"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "Gray"); + cy.testCodeMirror("Gray"); + cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Radio_spec.js b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Radio_spec.js index 5470127547..2c999163c9 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Radio_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/Radio_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("Radio Widget Functionality", function() { it("Radio Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.radioWidget) @@ -12,27 +12,18 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for Radio Widget and also the properties of Radio widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("Test Radio"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "Test Radio"); + cy.testCodeMirror("Test Radio"); cy.get(formWidgetsPage.radioOnSelectionChangeDropdown) .get(commonlocators.dropdownSelectButton) .click({ force: true }) .get("ul.bp3-menu") .children() - .contains("Navigate to URL") + .contains("Navigate To") .click(); cy.get(formWidgetsPage.radioOnSelectionChangeDropdown) .get(commonlocators.dropdownSelectButton) .find("> .bp3-button-text") - .should("have.text", "Navigate to URL"); + .should("have.text", "Navigate To"); 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 8e0a32e9cd..54391a9f9e 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/FormWidgets/RichTextEditor_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const formWidgetsPage = require("../../../locators/FormWidgets.json"); -context("Cypress test", function() { +describe("RichTextEditor Widget Functionality", function() { it("RichTextEditor Widget Functionality", function() { cy.NavigateToFormWidgets(); cy.get(formWidgetsPage.richTextEditorWidget) @@ -17,13 +17,13 @@ context("Cypress test", function() { .click({ force: true }) .get("ul.bp3-menu") .children() - .contains("Navigate to URL") + .contains("Navigate To") .click(); cy.get(formWidgetsPage.richEditorOnTextChange) .get(commonlocators.dropdownSelectButton) .find("> span") .eq(0) - .should("have.text", "Navigate to URL"); + .should("have.text", "Navigate To"); cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Chart_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Chart_spec.js index 82172503c9..9715ee3187 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Chart_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Chart_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const viewWidgetsPage = require("../../../locators/ViewWidgets.json"); -context("Cypress test", function() { +describe("Chart Widget Functionality", function() { it("Chart Widget Functionality", function() { cy.NavigateToViewWidgets(); cy.get(viewWidgetsPage.chartWidget) @@ -12,16 +12,7 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for Chart and also the properties of Chart widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type("App Sign Up"); - cy.get(".CodeMirror textarea") - .first() - .should("have.value", "App Sign Up"); + cy.testCodeMirror("App Sign Up"); cy.get(viewWidgetsPage.chartSelectChartType) .find(".bp3-button") .click({ force: true }) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Image_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Image_spec.js index a3c3b46ef9..b1b066a25a 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Image_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Image_spec.js @@ -1,7 +1,7 @@ const commonlocators = require("../../../locators/commonlocators.json"); const viewWidgetsPage = require("../../../locators/ViewWidgets.json"); -context("Cypress test", function() { +describe("Image Widget Functionality", function() { it("Image Widget Functionality", function() { cy.NavigateToViewWidgets(); cy.get(viewWidgetsPage.imageWidget) @@ -12,21 +12,9 @@ context("Cypress test", function() { .first() .click({ force: true }); //Checking the edit props for Image and also the properties of Image widget - cy.get(".CodeMirror textarea") - .first() - .focus() - .type("{ctrl}{shift}{downarrow}") - .clear({ force: true }) - .should("be.empty") - .type( - "https://images.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940", - ); - cy.get(".CodeMirror textarea") - .first() - .should( - "have.value", - "https://images.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940", - ); + cy.testCodeMirror( + "https://images.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940", + ); cy.get(commonlocators.editPropCrossButton).click(); }); }); diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json index 766a9416be..204cd880d2 100644 --- a/app/client/cypress/locators/commonlocators.json +++ b/app/client/cypress/locators/commonlocators.json @@ -1,8 +1,8 @@ { "editIcon":".t--widget-propertypane-toggle", - "editPropCrossButton":"span[icon='cross']", + "editPropCrossButton":".t--property-pane-close-btn", "deleteWidgetIcon":".t--widget-delete-control", - "dropdownSelectButton":".t--open-dropdown-Select" + "dropdownSelectButton":".t--open-dropdown-Select-Action" } \ No newline at end of file diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 147670193c..3e25cc2136 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -10,6 +10,11 @@ Cypress.Commands.add("LogintoApp", (uname, pword) => { cy.get(loginPage.username).type(uname); cy.get(loginPage.password).type(pword); cy.get(loginPage.submitBtn).click(); + cy.wait("@applications").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); }); Cypress.Commands.add("SearchApp", appname => { @@ -19,6 +24,7 @@ Cypress.Commands.add("SearchApp", appname => { .first() .click({ force: true }); cy.get("#loading").should("not.exist"); + // Wait added because after opening the application editor, sometimes it takes a little time. }); Cypress.Commands.add("NavigateToCommonWidgets", () => { @@ -28,6 +34,7 @@ Cypress.Commands.add("NavigateToCommonWidgets", () => { .click({ force: true }); cy.get("#loading").should("not.exist"); cy.get(pages.widgetsEditor).click(); + cy.wait("@getPage"); cy.get("#loading").should("not.exist"); }); @@ -51,30 +58,65 @@ Cypress.Commands.add("NavigateToViewWidgets", () => { cy.get("#loading").should("not.exist"); }); -Cypress.Commands.add("CreateModal", () => { - 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("Alert Modal") - .click(); - cy.get(modalWidgetPage.controlModalType) - .find(".bp3-button > .bp3-button-text") - .should("have.text", "Alert Modal"); - cy.get(commonlocators.editPropCrossButton).click(); - cy.get(modalWidgetPage.modalWidget) - .get(commonlocators.deleteWidgetIcon) - .first() - .click({ force: true }); -}); +// Cypress.Commands.add("CreateModal", () => { +// 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("Alert Modal") +// .click(); +// cy.get(modalWidgetPage.controlModalType) +// .find(".bp3-button > .bp3-button-text") +// .should("have.text", "Alert Modal"); +// cy.get(commonlocators.editPropCrossButton).click(); +// cy.get(modalWidgetPage.modalWidget) +// .get(commonlocators.deleteWidgetIcon) +// .first() +// .click({ force: true }); +// }); Cypress.Commands.add("PublishtheApp", () => { cy.xpath(homePage.homePageID).contains("All changes saved"); cy.get(homePage.publishButton).click(); - // cy.window().then(win => { - // cy.get(homePage.publishCrossButton).click(); - // }); + cy.wait("@publishApp"); + cy.get(homePage.publishCrossButton).click(); +}); + +Cypress.Commands.add("getCodeMirror", () => { + return cy + .get(".CodeMirror textarea") + .first() + .focus() + .type("{ctrl}{shift}{downarrow}"); +}); + +Cypress.Commands.add("testCodeMirror", value => { + cy.get(".CodeMirror textarea") + .first() + .focus() + .type("{ctrl}{shift}{downarrow}") + .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, + }); + cy.wait("@updateLayout"); + cy.get(".CodeMirror textarea") + .first() + .should("have.value", value); + }); }); diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index 7c57379787..2efb143d99 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -19,6 +19,22 @@ const inputData = require("../fixtures/inputdata.json"); // Import commands.js using ES2015 syntax: import "./commands"; before(function() { + cy.server(); + cy.route("GET", "/api/v1/applications").as("applications"); + cy.route("GET", "/api/v1/users/profile").as("getUser"); + cy.route("GET", "/api/v1/plugins").as("getPlugins"); + + cy.route("GET", "/api/v1/configs/name/propertyPane").as("getPropertyPane"); + cy.route("GET", "/api/v1/datasources").as("getDataSources"); + cy.route("GET", "/api/v1/pages/application/*").as("getPagesForApp"); + cy.route("GET", "/api/v1/pages/*").as("getPage"); + cy.route("GET", "/api/v1/actions*").as("getActions"); + + cy.route("GET", "/api/v1/organizations").as("organizations"); + cy.route("POST", "/api/v1/actions/execute").as("executeAction"); + cy.route("POST", "/api/v1/applications/publish/*").as("publishApp"); + cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout"); + cy.LogintoApp(loginData.username, loginData.password); cy.SearchApp(inputData.appname); }); diff --git a/app/client/netlify.toml b/app/client/netlify.toml index 7816bc5ae3..6676f67554 100644 --- a/app/client/netlify.toml +++ b/app/client/netlify.toml @@ -1,3 +1,8 @@ +[[headers]] + for = "/static/*" + [header.values] + cache-control = "max-age=604800" + [context.production] [context.production.environment] REACT_APP_ENVIRONMENT = "PRODUCTION" diff --git a/app/client/package.json b/app/client/package.json index 1f5ebbc78a..1e284b1ccb 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -73,7 +73,11 @@ "react-dnd-html5-backend": "^9.3.4", "react-dnd-touch-backend": "^9.4.0", "react-dom": "^16.7.0", + "react-google-maps": "^9.4.5", "react-helmet": "^5.2.1", + "react-infinite-scroller": "^1.2.4", + "react-json-view": "^1.19.1", + "react-paginating": "^1.4.0", "react-redux": "^7.1.3", "react-router": "^5.1.2", "react-router-dom": "^5.1.2", @@ -89,10 +93,8 @@ "redux-saga": "^1.1.3", "reselect": "^4.0.0", "shallowequal": "^1.1.0", - "source-map-explorer": "^2.1.1", "styled-components": "^4.1.3", "tinycolor2": "^1.4.1", - "tinymce": "^5.2.0", "toposort": "^2.0.2", "ts-loader": "^6.0.4", "typescript": "^3.6.3", @@ -103,6 +105,8 @@ "analyze": "source-map-explorer 'build/static/js/*.js'", "start": "REACT_APP_BASE_URL=https://release-api.appsmith.com REACT_APP_ENVIRONMENT=DEVELOPMENT HOST=dev.appsmith.com craco start", "build": "./build.sh", + "build-local": "craco --max-old-space-size=4096 build --config craco.build.config.js", + "build-staging": "REACT_APP_BASE_URL=https://release-api.appsmith.com REACT_APP_ENVIRONMENT=STAGING craco --max-old-space-size=4096 build --config craco.build.config.js", "test": "cypress/test.sh", "eject": "react-scripts eject", "start-prod": "REACT_APP_BASE_URL=https://api.appsmith.com REACT_APP_ENVIRONMENT=PRODUCTION craco start", @@ -160,6 +164,7 @@ "react-test-renderer": "^16.11.0", "redux-devtools": "^3.5.0", "redux-devtools-extension": "^2.13.8", + "source-map-explorer": "^2.4.2", "storybook-addon-designs": "^5.1.1", "webpack-merge": "^4.2.2" }, diff --git a/app/client/public/index.html b/app/client/public/index.html index 8e809a7c22..73698b02c1 100755 --- a/app/client/public/index.html +++ b/app/client/public/index.html @@ -2,15 +2,12 @@
- - + - - - +