diff --git a/app/client/cypress.json b/app/client/cypress.json index 3c75281b43..5f84ec8125 100644 --- a/app/client/cypress.json +++ b/app/client/cypress.json @@ -1,11 +1,13 @@ { "baseUrl":"http://dev.appsmith.com:3000/", + "defaultCommandTimeout": 5000, + "pageLoadTimeout": 30000, "reporter": "mochawesome", "reporterOptions": { "reportDir": "results", "overwrite": false, - "html": false, - "json": true + "html": true, + "json": false } } \ No newline at end of file diff --git a/app/client/cypress/fixtures/inputdata.json b/app/client/cypress/fixtures/inputdata.json new file mode 100644 index 0000000000..fee8bc9415 --- /dev/null +++ b/app/client/cypress/fixtures/inputdata.json @@ -0,0 +1,4 @@ +{ + "appname": "Test App", + +} \ No newline at end of file diff --git a/app/client/cypress/fixtures/user.json b/app/client/cypress/fixtures/user.json index 9d5a67368d..7d95e02603 100644 --- a/app/client/cypress/fixtures/user.json +++ b/app/client/cypress/fixtures/user.json @@ -1,6 +1,6 @@ { "username": "testowner@appsmith.com", - "password": "own3rT3st1ng", + "password": "own3rT3st1ng" } \ No newline at end of file diff --git a/app/client/cypress/integration/CommonWidgets/Button_spec.js b/app/client/cypress/integration/CommonWidgets/Button_spec.js new file mode 100644 index 0000000000..486f77ec52 --- /dev/null +++ b/app/client/cypress/integration/CommonWidgets/Button_spec.js @@ -0,0 +1,15 @@ +var widgetsPage= require('../../locators/Widgets.json') +var loginPage= require('../../locators/LoginPage.json') +const loginData=require('../../fixtures/user.json') +var commonlocators = require('../../locators/commonlocators.json') + +context('Cypress test',function() { + + it('Button Widget Functionality',function(){ + + cy.get(widgetsPage.buttonWidget).click({ force: true }) + //Checking the edit props for Button + cy.get('.CodeMirror textarea').focus().type("{meta}a").clear({ force: true }).type("{{Text4.text}}", {parseSpecialCharSequences: false}) + cy.get(commonlocators.editPropCrossButton).click() + }) +}) \ No newline at end of file diff --git a/app/client/cypress/integration/CommonWidgets/Container_spec.js b/app/client/cypress/integration/CommonWidgets/Container_spec.js new file mode 100644 index 0000000000..23ef0e1873 --- /dev/null +++ b/app/client/cypress/integration/CommonWidgets/Container_spec.js @@ -0,0 +1,17 @@ +var widgetsPage= require('../../locators/Widgets.json') +var loginPage= require('../../locators/LoginPage.json') +const loginData=require('../../fixtures/user.json') +var commonlocators = require('../../locators/commonlocators.json') + +context('Cypress test',function() { + + it('Container Widget Functionality',function(){ + + cy.get(widgetsPage.containerWidget).first().trigger('mouseover',{force:true}) + cy.get(widgetsPage.containerWidget).children(commonlocators.editIcon).first().click() + //Checking the edit props for container and also the properties of container + cy.get('.CodeMirror textarea').focus().type("{meta}a").clear({ force: true }).type('#C0C0C0') + cy.get('.CodeMirror textarea').should('have.value', '#C0C0C0') + cy.get(commonlocators.editPropCrossButton).click() + }) +}) \ No newline at end of file diff --git a/app/client/cypress/integration/CommonWidgets/Input_spec.js b/app/client/cypress/integration/CommonWidgets/Input_spec.js new file mode 100644 index 0000000000..126a46aac1 --- /dev/null +++ b/app/client/cypress/integration/CommonWidgets/Input_spec.js @@ -0,0 +1,18 @@ +var widgetsPage= require('../../locators/Widgets.json') +var loginPage= require('../../locators/LoginPage.json') +const loginData=require('../../fixtures/user.json') +var commonlocators = require('../../locators/commonlocators.json') + +context('Cypress test',function() { + + it('Input Widget Functionality',function(){ + + cy.get(widgetsPage.inputWidget).first().trigger('mouseover') + cy.get(widgetsPage.inputWidget).children(commonlocators.editicon).first().click() + //Checking the edit props for container and also the properties of container + cy.get('.CodeMirror textarea').first().focus().type("{meta}a").clear({ force: true }).type('Test Input Label') + cy.get('.CodeMirror textarea').first().should('have.value', 'Test Input Label') + cy.get(commonlocators.editPropCrossButton).click() + + }) +}) \ No newline at end of file diff --git a/app/client/cypress/integration/CommonWidgets/Table_spec.js b/app/client/cypress/integration/CommonWidgets/Table_spec.js new file mode 100644 index 0000000000..0ffbfe238c --- /dev/null +++ b/app/client/cypress/integration/CommonWidgets/Table_spec.js @@ -0,0 +1,15 @@ +var widgetsPage= require('../../locators/Widgets.json') +var loginPage= require('../../locators/LoginPage.json') +const loginData=require('../../fixtures/user.json') +var commonlocators = require('../../locators/commonlocators.json') + +context('Cypress test',function() { + + it('Table Widget Functionality',function(){ + + cy.get(widgetsPage.tableWidget).first().trigger('mouseover',{force:true}) + cy.get(widgetsPage.tableWidget).children(commonlocators.editicon).first().click() + cy.get('.CodeMirror textarea').focus().type("{meta}a").clear({ force: true }).type("{{MockUsersApi.data}}",{parseSpecialCharSequences: false}) + cy.get(commonlocators.editPropCrossButton).click() + }) +}) \ No newline at end of file diff --git a/app/client/cypress/integration/CommonWidgets/Text_spec.js b/app/client/cypress/integration/CommonWidgets/Text_spec.js new file mode 100644 index 0000000000..58a8992e96 --- /dev/null +++ b/app/client/cypress/integration/CommonWidgets/Text_spec.js @@ -0,0 +1,16 @@ +var widgetsPage= require('../../locators/Widgets.json') +var loginPage= require('../../locators/LoginPage.json') +const loginData=require('../../fixtures/user.json') +var commonlocators = require('../../locators/commonlocators.json') + +context('Cypress test',function() { + + it('Text Widget Functionality',function(){ + + cy.get(widgetsPage.textWidget).first().trigger('mouseover') + cy.get(widgetsPage.textWidget).children(commonlocators.editIcon).first().click() + cy.get('.CodeMirror textarea').first().focus().type("{meta}a").clear({ force: true }).type('Test text') + cy.get(commonlocators.editPropCrossButton).click() + + }) +}) \ No newline at end of file diff --git a/app/client/cypress/integration/OnBoarding/Login_spec.js b/app/client/cypress/integration/OnBoarding/Login_spec.js index ba0cb7ea2c..18558bfc2d 100644 --- a/app/client/cypress/integration/OnBoarding/Login_spec.js +++ b/app/client/cypress/integration/OnBoarding/Login_spec.js @@ -1,20 +1,16 @@ var loginPage= require('../../locators/LoginPage.json') -const loginData=require('../../fixtures/user.json') +var homePage = require('../../locators/HomePage.json') +var commonlocators = require('../../locators/commonlocators.json') +var widgetsPage= require('../../locators/Widgets.json') + + context('Cypress test',function() { it('Login functionality',function(){ - - cy.LogintoApp(loginData.username,loginData.password) - cy.get('input[type="text"]').type('Test app') - cy.wait(3000) - cy.get('.t--application-edit-link').click() - cy.wait(5000) - cy.get('.t--draggable-buttonwidget').click({ force: true }) - cy.wait(2000) - cy.get('textarea').first().click({ force: true }).clear({ force: true }).type('Test', { force: true }) - cy.wait(5000) - cy.get('.t--application-publish-btn').click() - + + cy.get(widgetsPage.buttonWidget).click({ force: true }) + cy.get('.CodeMirror textarea').focus().type("{meta}a").clear({ force: true }).type('Test', { force: true }) + cy.get(commonlocators.editPropCrossButton).click() }) }) \ No newline at end of file diff --git a/app/client/cypress/integration/test.js b/app/client/cypress/integration/test.js deleted file mode 100644 index 7ef2207c9e..0000000000 --- a/app/client/cypress/integration/test.js +++ /dev/null @@ -1,43 +0,0 @@ -describe("My First Test", function() { - it("Visits the Kitchen Sink", function() { - cy.visit( - "http://localhost:3000/applications/5d807e45795dc6000482bc74/pages/5df08f966ccd2400049dde1a/edit", - ); - // cy.contains("Enter your Netlify Site URL"); - // cy.get(); - // Main button pressed (usually the left button) - // cy.get(".TABLE_WIDGET") - // .first() - // .trigger("mousedown") - // .trigger("mousemove", { which: 1, clientX: 400, clientY: 100 }) - // .trigger("mouseup"); - - // cy.contains("Submit").click(); - // cy.contains("Barbra", { timeout: 1000000 }).click(); - // // cy.contains("{{fetchUsers2}}"); - // cy.get('input[value="{{fetchUsers2}}"]') - // // .first() - // .clear() - // .type( - // "{{}{{}fetchUsers2.map(user => {{}return {{}'name': user.name}})}}", - // { - // force: true, - // }, - // ); - - // .then(function($input) { - // $input[0].setAttribute( - // "value", - // "{{fetchUsers2.map(user => {return {'name': user.name}})}}", - // ); - // }); - - // .invoke( - // "attr", - // "value", - // "{{fetchUsers2.map(user => {return {'name': user.name}})}}", - // ); - - expect(true).to.eq(true); - }); -}); diff --git a/app/client/cypress/locators/HomePage.json b/app/client/cypress/locators/HomePage.json new file mode 100644 index 0000000000..2a51f315ca --- /dev/null +++ b/app/client/cypress/locators/HomePage.json @@ -0,0 +1,7 @@ +{ + "searchInput": "input[type='text']", + "appEditIcon": ".t--application-edit-link", + "publishButton":".t--application-publish-btn", + "publishCrossButton":"span[icon='small-cross']" + +} \ No newline at end of file diff --git a/app/client/cypress/locators/LoginPage.json b/app/client/cypress/locators/LoginPage.json index d212984269..18c060c394 100644 --- a/app/client/cypress/locators/LoginPage.json +++ b/app/client/cypress/locators/LoginPage.json @@ -2,4 +2,4 @@ "username":"input[name='username']", "password":"input[name='password']", "submitBtn":"button[type='submit']" -} \ No newline at end of file +} diff --git a/app/client/cypress/locators/Widgets.json b/app/client/cypress/locators/Widgets.json new file mode 100644 index 0000000000..5b461110b4 --- /dev/null +++ b/app/client/cypress/locators/Widgets.json @@ -0,0 +1,13 @@ +{ + "containerWidget":".t--draggable-containerwidget", + "inputWidget":".t--draggable-inputwidget", + "togglebutton":"input[type='checkbox']", + "inputPropsDataType":".t--property-control-datatype", + "inputdatatypedropdownicon": "./html/body/div[6]/div/div[3]/div[2]/div[2]/div[2]/span/span/div/button/span[2]", + "inputdatatypeplaceholder":".t--property-control-placeholder", + "buttonWidget":".t--draggable-buttonwidget", + "textWidget":".t--draggable-textwidget", + "tableWidget":".t--draggable-tablewidget" + + +} \ No newline at end of file diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json new file mode 100644 index 0000000000..dca3ed8731 --- /dev/null +++ b/app/client/cypress/locators/commonlocators.json @@ -0,0 +1,4 @@ +{ + "editIcon":".t--widget-propertypane-toggle", + "editPropCrossButton":"span[icon='cross']" +} \ No newline at end of file diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 3caea750bd..a48f9903c3 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -1,9 +1,31 @@ var loginPage= require('../locators/LoginPage.json') +var homePage = require('../locators/HomePage.json') Cypress.Commands.add("LogintoApp",(uname,pword)=>{ cy.visit('/') - cy.wait(6000) + cy.get(loginPage.username).should('be.visible') cy.get(loginPage.username).type(uname) cy.get(loginPage.password).type(pword) cy.get(loginPage.submitBtn).click() -}) \ No newline at end of file +}) +Cypress.Commands.add("SearchApp",(appname)=>{ + cy.get(homePage.searchInput).type(appname) + cy.get(homePage.appEditIcon).should('have.length', 1) + cy.get(homePage.appEditIcon).click() + cy.get('#loading').should('not.exist') +}) + + +Cypress.Commands.add("PublishtheApp",()=>{ + cy.wait(4000) + cy.get(homePage.publishButton).click() + cy.window() + .then((win) => { + cy.get(homePage.publishCrossButton).click() + + }) + +}) + + + diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index d68db96df2..7971e94231 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -13,8 +13,26 @@ // https://on.cypress.io/configuration // *********************************************************** +const loginData=require('../fixtures/user.json') +const inputData=require('../fixtures/inputdata.json') + // Import commands.js using ES2015 syntax: import './commands' +before(function () { + + cy.LogintoApp(loginData.username,loginData.password) + cy.SearchApp(inputData.appname) + }) + + beforeEach(function () { + + Cypress.Cookies.preserveOnce('session_id', 'remember_token') + + }) // Alternatively you can use CommonJS syntax: // require('./commands') +after(function() { + + cy.PublishtheApp() +}) diff --git a/app/client/cypress/test.sh b/app/client/cypress/test.sh index 4e6f4ad9af..5f8c5f44aa 100755 --- a/app/client/cypress/test.sh +++ b/app/client/cypress/test.sh @@ -1 +1 @@ -$(npm bin)/cypress run CYPRESS_BASE_URL='http://dev.appsmith.com:3000/' --spec "cypress/integration/OnBoarding/Login_spec.js" \ No newline at end of file +$(npm bin)/cypress run CYPRESS_BASE_URL='http://dev.appsmith.com:3000/' --spec "cypress/integration/*/*" \ No newline at end of file diff --git a/app/client/package.json b/app/client/package.json index c13d5ccc58..c4646a43a0 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -17,6 +17,7 @@ "@sentry/browser": "^5.6.3", "@sentry/webpack-plugin": "^1.10.0", "@syncfusion/ej2-react-grids": "^17.4.40", + "@tinymce/tinymce-react": "^3.5.0", "@types/chance": "^1.0.7", "@types/fontfaceobserver": "^0.0.6", "@types/lodash": "^4.14.120", @@ -88,6 +89,7 @@ "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", @@ -135,7 +137,7 @@ "@typescript-eslint/eslint-plugin": "^2.0.0", "@typescript-eslint/parser": "^2.0.0", "babel-loader": "^8.0.6", - "cypress": "^3.7.0", + "cypress": "^4.1.0", "cypress-multi-reporters": "^1.2.4", "dotenv": "^8.1.0", "eslint": "^6.4.0", @@ -159,6 +161,7 @@ "husky": { "hooks": { "pre-commit": "lint-staged" + } } } diff --git a/app/client/public/index.html b/app/client/public/index.html index 59eb2affff..8e809a7c22 100755 --- a/app/client/public/index.html +++ b/app/client/public/index.html @@ -3,13 +3,12 @@ - + - - + Appsmith diff --git a/app/client/public/tinymce/tinymce.min.js b/app/client/public/tinymce/tinymce.min.js new file mode 100644 index 0000000000..43526e4c0a --- /dev/null +++ b/app/client/public/tinymce/tinymce.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.6 (2020-01-28) + */ +!function(j){"use strict";function i(){}var q=function(n,r){return function(){for(var e=[],t=0;t=i.length&&n(r)}}(t))})})}var Ut,jt,qt,$t=Vt.exports.boltExport,Wt=function(e){var n=k.none(),t=[],r=function(e){o()?a(e):t.push(e)},o=function(){return n.isSome()},i=function(e){z(e,a)},a=function(t){n.each(function(e){j.setTimeout(function(){t(e)},0)})};return e(function(e){n=k.some(e),i(t),t=[]}),{get:r,map:function(n){return Wt(function(t){r(function(e){t(n(e))})})},isReady:o}},Kt={nu:Wt,pure:function(t){return Wt(function(e){e(t)})}},Xt=function(n){function e(e){n().then(e,It)}return{map:function(e){return Xt(function(){return n().then(e)})},bind:function(t){return Xt(function(){return n().then(function(e){return t(e).toPromise()})})},anonBind:function(e){return Xt(function(){return n().then(function(){return e.toPromise()})})},toLazy:function(){return Kt.nu(e)},toCached:function(){var e=null;return Xt(function(){return null===e&&(e=n()),e})},toPromise:n,get:e}},Yt={nu:function(e){return Xt(function(){return new $t(e)})},pure:function(e){return Xt(function(){return $t.resolve(e)})}},Gt=function(e){return Ft(e,Yt.nu)},Jt=function(n){return{is:function(e){return n===e},isValue:a,isError:c,getOr:$(n),getOrThunk:$(n),getOrDie:$(n),or:function(e){return Jt(n)},orThunk:function(e){return Jt(n)},fold:function(e,t){return t(n)},map:function(e){return Jt(e(n))},mapError:function(e){return Jt(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return k.some(n)}}},Qt=function(n){return{is:c,isValue:c,isError:a,getOr:W,getOrThunk:function(e){return e()},getOrDie:function(){return function(e){return function(){throw new Error(e)}}(String(n))()},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return Qt(n)},mapError:function(e){return Qt(e(n))},each:i,bind:function(e){return Qt(n)},exists:c,forall:a,toOption:k.none}},Zt={value:Jt,error:Qt,fromOption:function(e,t){return e.fold(function(){return Qt(t)},Jt)}},en=window.Promise?window.Promise:(Ut=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},jt=nn.immediateFn||"function"==typeof j.setImmediate&&j.setImmediate||function(e){j.setTimeout(e,1)},nn.prototype["catch"]=function(e){return this.then(null,e)},nn.prototype.then=function(n,r){var o=this;return new nn(function(e,t){rn.call(o,new sn(n,r,e,t))})},nn.all=function(){var s=Array.prototype.slice.call(1===arguments.length&&Ut(arguments[0])?arguments[0]:arguments);return new nn(function(o,i){if(0===s.length)return o([]);var a=s.length;function u(t,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if("function"==typeof n)return void n.call(e,function(e){u(t,e)},i)}s[t]=e,0==--a&&o(s)}catch(r){i(r)}}for(var e=0;e\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Qn=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Zn=/[<>&\"\']/g,er=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,tr={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};Pn={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},Ln={"<":"<",">":">","&":"&",""":'"',"'":"'"};function nr(e,t){var n,r,o,i={};if(e){for(e=e.split(","),t=t||10,n=0;n>10),56320+(1023&t))):tr[t]||String.fromCharCode(t):Ln[e]||Hn[e]||function(e){var t;return(t=bt.fromTag("div").dom()).innerHTML=e,t.textContent||t.innerText||e}(e)})}},ur={},sr={},cr=Rn.makeMap,lr=Rn.each,fr=Rn.extend,dr=Rn.explode,hr=Rn.inArray,mr=function(e,t){return(e=Rn.trim(e))?e.split(t||" "):[]},gr=function(e){function t(e,t,n){function r(e,t){var n,r,o={};for(n=0,r=e.length;n