diff --git a/app/client/cypress/fixtures/CurrencyInputIssueExport.json b/app/client/cypress/fixtures/CurrencyInputIssueExport.json new file mode 100644 index 0000000000..b22e11dc57 --- /dev/null +++ b/app/client/cypress/fixtures/CurrencyInputIssueExport.json @@ -0,0 +1,131 @@ +{ + "clientSchemaVersion": 1.0, + "serverSchemaVersion": 5.0, + "exportedApplication": { + "name": "Currency Input Issue", + "isPublic": false, + "pages": [{ "id": "Page1", "isDefault": true }], + "publishedPages": [{ "id": "Page1", "isDefault": true }], + "viewMode": false, + "appIsExample": false, + "unreadCommentThreads": 0.0, + "clonedFromApplicationId": "62b9902720ae3225cef293f1", + "color": "#C7F3E3", + "icon": "medical", + "slug": "currency-input-issue", + "applicationVersion": 2.0, + "isManualUpdate": false, + "deleted": false + }, + "datasourceList": [], + "pageList": [ + { + "unpublishedPage": { + "name": "Page1", + "slug": "page1", + "layouts": [ + { + "viewMode": false, + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 1224.0, + "snapColumns": 64.0, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0.0, + "bottomRow": 640.0, + "containerStyle": "none", + "snapRows": 64.0, + "parentRowSpace": 1.0, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 59.0, + "minHeight": 650.0, + "parentColumnSpace": 1.0, + "dynamicBindingPathList": [], + "leftColumn": 0.0, + "children": [ + { + "boxShadow": "none", + "widgetName": "CurrencyInput1", + "displayName": "Currency Input", + "iconSVG": "/static/media/icon.f312efcb48ce4dafb08c20291635b30b.svg", + "searchTags": ["amount", "total"], + "topRow": 4.0, + "bottomRow": 8.0, + "defaultCurrencyCode": "USD", + "parentRowSpace": 10.0, + "labelWidth": 5.0, + "autoFocus": false, + "type": "CURRENCY_INPUT_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 18.0625, + "dynamicTriggerPathList": [], + "resetOnSubmit": true, + "leftColumn": 2.0, + "dynamicBindingPathList": [ + { "key": "accentColor" }, + { "key": "borderRadius" } + ], + "labelPosition": "Left", + "labelStyle": "", + "isDisabled": false, + "key": "rhpg46n9mr", + "labelTextSize": "0.875rem", + "isRequired": true, + "isDeprecated": false, + "rightColumn": 22.0, + "widgetId": "bk4hqop0jo", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisible": true, + "label": "Label", + "allowCurrencyChange": false, + "version": 1.0, + "parentId": "0", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "decimals": 0.0, + "iconAlign": "left", + "defaultText": "" + } + ] + }, + "layoutOnLoadActions": [], + "validOnPageLoadActions": true, + "id": "Page1", + "deleted": false, + "policies": [], + "userPermissions": [] + } + ], + "userPermissions": [], + "policies": [] + }, + "deleted": false, + "gitSyncId": "62b996e68a38bf3f8d030646_62bac6018a38bf3f8d030683" + } + ], + "actionList": [], + "actionCollectionList": [], + "updatedResources": { + "actionList": [], + "pageList": ["Page1"], + "actionCollectionList": [] + }, + "editModeTheme": { + "name": "Default", + "displayName": "Modern", + "isSystemTheme": true, + "deleted": false + }, + "publishedTheme": { + "name": "Default", + "displayName": "Modern", + "isSystemTheme": true, + "deleted": false + } +} diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/CurrencyInputIssue_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/CurrencyInputIssue_Spec.js new file mode 100644 index 0000000000..3cfcff08e9 --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/CurrencyInputIssue_Spec.js @@ -0,0 +1,50 @@ +/// +import { ObjectsRegistry } from "../../../support/Objects/Registry"; +import reconnectDatasourceModal from "../../../locators/ReconnectLocators"; + +const themelocators = require("../../../locators/ThemeLocators.json"); + +let homePage = ObjectsRegistry.HomePage, + agHelper = ObjectsRegistry.AggregateHelper; + +const widgetName = "currencyinputwidget"; +const wiggetClass = `.t--widget-${widgetName}`; +const widgetInput = `${wiggetClass} input`; + +describe("Currency Input Issue", function() { + before(function() { + agHelper.ClearLocalStorageCache(); + }); + + beforeEach(function() { + agHelper.RestoreLocalStorageCache(); + }); + + afterEach(function() { + agHelper.SaveLocalStorageCache(); + }); + + it("1. Import application json", function() { + cy.visit("/applications"); + homePage.ImportApp("CurrencyInputIssueExport.json"); + cy.wait("@importNewApplication").then((interception) => { + agHelper.Sleep(); + const { isPartialImport } = interception.response.body.data; + if (isPartialImport) { + cy.get(reconnectDatasourceModal.SkipToAppBtn).click({ + force: true, + }); + cy.wait(2000); + } else { + homePage.AssertImport(); + } + }); + }); + + it("2. should check that the widget input is not showing any error", function() { + cy.get(widgetInput).type("123456789"); + cy.focused().then(() => { + cy.get(themelocators.popover).should("not.exist"); + }); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_TableV2_Sorting_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_TableV2_Sorting_spec.js index 9bffc1e948..d9b9b347eb 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_TableV2_Sorting_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_TableV2_Sorting_spec.js @@ -51,7 +51,7 @@ describe("Binding the Table and input Widget", function() { it("3. validation of column id displayed in input widgets based on sorted column", function() { cy.SearchEntityandOpen("Input1"); - cy.testJsontext("defaulttext", testdata.sortedColumn+ "}}"); + cy.testJsontext("defaulttext", testdata.sortedColumn + "}}"); cy.wait("@updateLayout").should( "have.nested.property", "response.body.responseMeta.status", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_Table_Sorting_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_Table_Sorting_spec.js index 54e317c08c..c22c7c1490 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_Table_Sorting_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_InputWidget_Table_Sorting_spec.js @@ -51,7 +51,7 @@ describe("Binding the Table and input Widget", function() { it("3. Validation of column id displayed in input widgets based on sorted column", function() { cy.SearchEntityandOpen("Input1"); - cy.testJsontext("defaulttext", testdata.sortedColumn+ "}}"); + cy.testJsontext("defaulttext", testdata.sortedColumn + "}}"); cy.wait("@updateLayout").should( "have.nested.property", "response.body.responseMeta.status", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput_spec.js index eb81bb923c..177a10a0fa 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/CurrencyInput_spec.js @@ -1,5 +1,6 @@ const dsl = require("../../../../fixtures/emptyDSL.json"); const explorer = require("../../../../locators/explorerlocators.json"); +const themelocators = require("../../../../locators/ThemeLocators.json"); const widgetName = "currencyinputwidget"; const widgetInput = `.t--widget-${widgetName} input`; @@ -272,4 +273,11 @@ describe("Currency widget - ", () => { // Check if isDirty is reset to false cy.get(".t--widget-textwidget").should("contain", "false"); }); + + it("Should check that widget input is not showing any errors on input", function() { + cy.get(widgetInput).type("123456789"); + cy.focused().then(() => { + cy.get(themelocators.popover).should("not.exist"); + }); + }); }); diff --git a/app/client/cypress/support/ApiCommands.js b/app/client/cypress/support/ApiCommands.js index eeb93aedf6..3739b4b8d0 100644 --- a/app/client/cypress/support/ApiCommands.js +++ b/app/client/cypress/support/ApiCommands.js @@ -24,9 +24,9 @@ Cypress.Commands.add("enterDatasource", (datasource) => { cy.get(apiwidget.resourceUrl) .first() .click({ force: true }) - .type(datasource, { parseSpecialCharSequences: false }) - //.type("{esc}}"); - cy.assertPageSave(); + .type(datasource, { parseSpecialCharSequences: false }); + //.type("{esc}}"); + cy.assertPageSave(); }); Cypress.Commands.add("ResponseStatusCheck", (statusCode) => { diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index dae5e13129..1adf560a1c 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -736,8 +736,8 @@ Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => { .trigger("mousemove", x, y, { eventConstructor: "MouseEvent" }) .trigger("mousemove", x, y, { eventConstructor: "MouseEvent" }) .trigger("mouseup", x, y, { eventConstructor: "MouseEvent" }); - cy.assertPageSave(); - }); + cy.assertPageSave(); +}); Cypress.Commands.add( "dragAndDropToWidget", diff --git a/app/client/src/widgets/CurrencyInputWidget/widget/derived.js b/app/client/src/widgets/CurrencyInputWidget/widget/derived.js index 31ee8ec1ec..b01d9d4ada 100644 --- a/app/client/src/widgets/CurrencyInputWidget/widget/derived.js +++ b/app/client/src/widgets/CurrencyInputWidget/widget/derived.js @@ -73,8 +73,8 @@ export default { if (text) { const parsed = parseFloat( text - .replace(new RegExp("\\" + getLocaleThousandSeparator(), "g"), "") - .replace(new RegExp("\\" + getLocaleDecimalSeperator()), "."), + .replace(new RegExp(`[${getLocaleThousandSeparator()}]`, "g"), "") + .replace(new RegExp(`[${getLocaleDecimalSeperator()}]`), "."), ); if (_.isNaN(parsed)) {