From c7f3b86d8afc555db14b61bb115b5a3c8cbee5a4 Mon Sep 17 00:00:00 2001 From: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com> Date: Thu, 24 Mar 2022 14:59:29 +0530 Subject: [PATCH] test: added test for recaptcha (#11805) * Added test for Recaptcha * updated test --- .../cypress/fixtures/buttonRecaptchaDsl.json | 87 +++++++++++++++++++ .../BindButton_Text_WithRecaptcha_spec.js | 38 ++++++++ 2 files changed, 125 insertions(+) create mode 100644 app/client/cypress/fixtures/buttonRecaptchaDsl.json create mode 100644 app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js diff --git a/app/client/cypress/fixtures/buttonRecaptchaDsl.json b/app/client/cypress/fixtures/buttonRecaptchaDsl.json new file mode 100644 index 0000000000..b5605cdd56 --- /dev/null +++ b/app/client/cypress/fixtures/buttonRecaptchaDsl.json @@ -0,0 +1,87 @@ +{ + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 1056, + "snapColumns": 64, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 800, + "containerStyle": "none", + "snapRows": 125, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 52, + "minHeight": 780, + "parentColumnSpace": 1, + "dynamicBindingPathList": [], + "leftColumn": 0, + "children": [ + { + "isVisible": true, + "animateLoading": true, + "text": "Submit", + "buttonColor": "#03B365", + "buttonVariant": "PRIMARY", + "placement": "CENTER", + "widgetName": "Button1", + "isDisabled": false, + "isDefaultClickDisabled": true, + "recaptchaType": "V3", + "version": 1, + "type": "BUTTON_WIDGET", + "hideCard": false, + "displayName": "Button", + "key": "b3xxd5tj9s", + "iconSVG": "/static/media/icon.cca02633.svg", + "widgetId": "56yla62kkw", + "renderMode": "CANVAS", + "isLoading": false, + "parentColumnSpace": 16.3125, + "parentRowSpace": 10, + "leftColumn": 19, + "rightColumn": 35, + "topRow": 10, + "bottomRow": 14, + "parentId": "0" + }, + { + "isVisible": true, + "text": "{{Button1.recaptchaToken}}", + "fontSize": "PARAGRAPH", + "fontStyle": "BOLD", + "textAlign": "LEFT", + "textColor": "#231F20", + "truncateButtonColor": "#FFC13D", + "widgetName": "Text1", + "shouldScroll": false, + "shouldTruncate": false, + "version": 1, + "animateLoading": true, + "type": "TEXT_WIDGET", + "hideCard": false, + "displayName": "Text", + "key": "6cg9oqz0if", + "iconSVG": "/static/media/icon.97c59b52.svg", + "widgetId": "iymasdikx5", + "renderMode": "CANVAS", + "isLoading": false, + "parentColumnSpace": 16.3125, + "parentRowSpace": 10, + "leftColumn": 19, + "rightColumn": 35, + "topRow": 26, + "bottomRow": 30, + "parentId": "0", + "dynamicBindingPathList": [ + { + "key": "text" + } + ], + "dynamicTriggerPathList": [] + } + ] + } +} \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js new file mode 100644 index 0000000000..58a27a3fdf --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js @@ -0,0 +1,38 @@ +const commonlocators = require("../../../../locators/commonlocators.json"); +const formWidgetsPage = require("../../../../locators/FormWidgets.json"); +const dsl = require("../../../../fixtures/buttonRecaptchaDsl.json"); +const pages = require("../../../../locators/Pages.json"); +const widgetsPage = require("../../../../locators/Widgets.json"); +const publish = require("../../../../locators/publishWidgetspage.json"); +const testdata = require("../../../../fixtures/testdata.json"); + +describe("Binding the Button widget with Text widget using Recpatcha v3", function() { + before(() => { + cy.addDsl(dsl); + }); + + it("Validate the Button binding with Text Widget with Recaptcha Token", function() { + cy.get("button") + .contains("Submit") + .should("be.visible") + .click({ force: true }); + cy.SearchEntityandOpen("Text1"); + cy.get(".t--draggable-textwidget .bp3-ui-text").should("be.visible"); + cy.get(".t--draggable-textwidget .bp3-ui-text").should("have.value", ""); + cy.SearchEntityandOpen("Button1"); + cy.get(".t--property-control-googlerecaptchaversion .bp3-popover-target") + .last() + .should("be.visible") + .click({ force: true }); + cy.get(".t--dropdown-option:contains('reCAPTCHA v2')").click({ + force: true, + }); + cy.get("button") + .contains("Submit") + .should("be.visible") + .click({ force: true }); + cy.SearchEntityandOpen("Text1"); + cy.get(".t--draggable-textwidget .bp3-ui-text").should("be.visible"); + cy.get(".t--draggable-textwidget .bp3-ui-text").should("have.value", ""); + }); +});