From 470452868bff60f3d0e0efa1bcde471c0cd8e905 Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Tue, 9 Apr 2024 13:37:52 +0530 Subject: [PATCH 1/5] updated the error message --- src/components/UI/Form/Input/Input.module.css | 2 +- src/containers/Template/Form/HSM/HSM.test.tsx | 2 +- src/containers/Template/Form/Template.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/UI/Form/Input/Input.module.css b/src/components/UI/Form/Input/Input.module.css index 68b805f44..e99ee489d 100644 --- a/src/components/UI/Form/Input/Input.module.css +++ b/src/components/UI/Form/Input/Input.module.css @@ -87,4 +87,4 @@ .Input { width: 100%; } -} +} \ No newline at end of file diff --git a/src/containers/Template/Form/HSM/HSM.test.tsx b/src/containers/Template/Form/HSM/HSM.test.tsx index 942cd5d15..24f6d3a90 100644 --- a/src/containers/Template/Form/HSM/HSM.test.tsx +++ b/src/containers/Template/Form/HSM/HSM.test.tsx @@ -108,7 +108,7 @@ describe('Add mode', () => { // expect an error expect( screen.getByText( - 'Message and sample look different. Please check for any characters, extra spaces or new lines.' + 'Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].' ) ).toBeInTheDocument(); }); diff --git a/src/containers/Template/Form/Template.tsx b/src/containers/Template/Form/Template.tsx index 6ee82e3e1..f3c6cf104 100644 --- a/src/containers/Template/Form/Template.tsx +++ b/src/containers/Template/Form/Template.tsx @@ -41,7 +41,7 @@ const HSMValidation = { return finalExampleValue === finalmessageValue; }, message: - 'Message and sample look different. Please check for any characters, extra spaces or new lines.', + 'Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].', }) ) .required('Example is required.'), From 70aacd9c064f27f701e6d415ba5f66bd3ab18305 Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Mon, 15 Apr 2024 09:00:24 +0530 Subject: [PATCH 2/5] added traslation --- src/containers/Template/Form/Template.tsx | 49 ++++++++++++----------- src/i18n/en/en.json | 3 +- src/i18n/hi/hi.json | 3 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/containers/Template/Form/Template.tsx b/src/containers/Template/Form/Template.tsx index f3c6cf104..c40c0e18c 100644 --- a/src/containers/Template/Form/Template.tsx +++ b/src/containers/Template/Form/Template.tsx @@ -30,30 +30,6 @@ import styles from './Template.module.css'; const regexForShortcode = /^[a-z0-9_]+$/g; -const HSMValidation = { - example: Yup.string() - .max(1024, 'Maximum 1024 characters are allowed') - .when('body', ([body], schema: any) => - schema.test({ - test: (exampleValue: any) => { - const finalmessageValue = body && body.replace(/\{\{([1-9]|1[0-9])\}\}/g, '[]'); - const finalExampleValue = exampleValue && exampleValue.replace(/\[[^\]]*\]/g, '[]'); - return finalExampleValue === finalmessageValue; - }, - message: - 'Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].', - }) - ) - .required('Example is required.'), - category: Yup.object().nullable().required('Category is required.'), - shortcode: Yup.string() - .required('Element name is required.') - .matches( - regexForShortcode, - 'Only lowercase alphanumeric characters and underscores are allowed.' - ), -}; - const dialogMessage = ' It will stop showing when you are drafting a customized message.'; const queries = { @@ -398,6 +374,31 @@ const Template = ({ } }; + const HSMValidation = { + example: Yup.string() + .max(1024, 'Maximum 1024 characters are allowed') + .when('body', ([body], schema: any) => + schema.test({ + test: (exampleValue: any) => { + const finalmessageValue = body && body.replace(/\{\{([1-9]|1[0-9])\}\}/g, '[]'); + const finalExampleValue = exampleValue && exampleValue.replace(/\[[^\]]*\]/g, '[]'); + return finalExampleValue === finalmessageValue; + }, + message: t( + 'Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].' + ), + }) + ) + .required('Example is required.'), + category: Yup.object().nullable().required('Category is required.'), + shortcode: Yup.string() + .required('Element name is required.') + .matches( + regexForShortcode, + 'Only lowercase alphanumeric characters and underscores are allowed.' + ), + }; + const validateURL = (value: string) => { if (value && type) { setValidatingURL(true); diff --git a/src/i18n/en/en.json b/src/i18n/en/en.json index 5cf8dfcd6..422d705eb 100644 --- a/src/i18n/en/en.json +++ b/src/i18n/en/en.json @@ -465,5 +465,6 @@ "No conversations found!": "No conversations found!", "Add group to collection": "Add group to collection", "Contact": "Contact", - "Remove Contact": "Remove Contact" + "Remove Contact": "Remove Contact", + "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].": "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica]." } diff --git a/src/i18n/hi/hi.json b/src/i18n/hi/hi.json index 1f7055716..771b13809 100644 --- a/src/i18n/hi/hi.json +++ b/src/i18n/hi/hi.json @@ -444,5 +444,6 @@ "Your personal WhatsApp number": "आपका निजी WhatsApp नंबर", "Register with ": "Register with ", "Validating URL": "URL मान्य करना", - "Enter name, label, keyword": "नाम, लेबल, कीवर्ड दर्ज करें" + "Enter name, label, keyword": "नाम, लेबल, कीवर्ड दर्ज करें", + "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].": "संदेश और नमूना अलग दिखते हैं. आपको वेरिएबल्स को बदलना होगा जैसे। {{1}} उदाहरण के लिए [ ] में संलग्न वास्तविक मानों के साथ। {{1}} को [मोनिका] से बदलें।" } From 455063478186ba6737ae4da23f9e49737d28ddca Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Mon, 15 Apr 2024 09:06:34 +0530 Subject: [PATCH 3/5] added translation --- src/containers/Template/Form/Template.tsx | 6 +++--- src/i18n/en/en.json | 5 ++++- src/i18n/hi/hi.json | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/containers/Template/Form/Template.tsx b/src/containers/Template/Form/Template.tsx index c40c0e18c..5a0e33e83 100644 --- a/src/containers/Template/Form/Template.tsx +++ b/src/containers/Template/Form/Template.tsx @@ -376,7 +376,7 @@ const Template = ({ const HSMValidation = { example: Yup.string() - .max(1024, 'Maximum 1024 characters are allowed') + .max(1024, t('Maximum 1024 characters are allowed')) .when('body', ([body], schema: any) => schema.test({ test: (exampleValue: any) => { @@ -390,9 +390,9 @@ const Template = ({ }) ) .required('Example is required.'), - category: Yup.object().nullable().required('Category is required.'), + category: Yup.object().nullable().required(t('Category is required.')), shortcode: Yup.string() - .required('Element name is required.') + .required(t('Element name is required.')) .matches( regexForShortcode, 'Only lowercase alphanumeric characters and underscores are allowed.' diff --git a/src/i18n/en/en.json b/src/i18n/en/en.json index 422d705eb..8faf21ad9 100644 --- a/src/i18n/en/en.json +++ b/src/i18n/en/en.json @@ -466,5 +466,8 @@ "Add group to collection": "Add group to collection", "Contact": "Contact", "Remove Contact": "Remove Contact", - "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].": "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica]." + "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].": "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].", + "Maximum 1024 characters are allowed": "Maximum 1024 characters are allowed", + "Element name is required.": "Element name is required.", + "Category is required.": "Category is required." } diff --git a/src/i18n/hi/hi.json b/src/i18n/hi/hi.json index 771b13809..20698613e 100644 --- a/src/i18n/hi/hi.json +++ b/src/i18n/hi/hi.json @@ -445,5 +445,8 @@ "Register with ": "Register with ", "Validating URL": "URL मान्य करना", "Enter name, label, keyword": "नाम, लेबल, कीवर्ड दर्ज करें", - "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].": "संदेश और नमूना अलग दिखते हैं. आपको वेरिएबल्स को बदलना होगा जैसे। {{1}} उदाहरण के लिए [ ] में संलग्न वास्तविक मानों के साथ। {{1}} को [मोनिका] से बदलें।" + "Message and sample look different. You have to replace variables eg. {{1}} with actual values enclosed in [ ] eg. Replace {{1}} with [Monica].": "संदेश और नमूना अलग दिखते हैं. आपको वेरिएबल्स को बदलना होगा जैसे। {{1}} उदाहरण के लिए [ ] में संलग्न वास्तविक मानों के साथ। {{1}} को [मोनिका] से बदलें।", + "Maximum 1024 characters are allowed": "अधिकतम 1024 वर्णों की अनुमति है", + "Element name is required.": "तत्व का नाम आवश्यक है.", + "Category is required.": "श्रेणी आवश्यक है." } From 5089c3a862efbb8c63c9a2b70095817e533371e2 Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Mon, 15 Apr 2024 11:51:55 +0530 Subject: [PATCH 4/5] changes cypress branch --- .github/workflows/cypress-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-testing.yml b/.github/workflows/cypress-testing.yml index f683eaaa6..c14ddea05 100644 --- a/.github/workflows/cypress-testing.yml +++ b/.github/workflows/cypress-testing.yml @@ -96,7 +96,7 @@ jobs: git clone https://github.com/glific/cypress-testing.git echo done. go to dir. cd cypress-testing - git checkout test_cases_wa_group + git checkout main cd .. cp -r cypress-testing/cypress cypress yarn add cypress From 7f8d6436b008e0aeb8cd300ea76e21a9c0f28260 Mon Sep 17 00:00:00 2001 From: akanshaaaa19 Date: Mon, 15 Apr 2024 12:35:15 +0530 Subject: [PATCH 5/5] changed the branch for cypress testing --- .github/workflows/cypress-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-testing.yml b/.github/workflows/cypress-testing.yml index c14ddea05..f683eaaa6 100644 --- a/.github/workflows/cypress-testing.yml +++ b/.github/workflows/cypress-testing.yml @@ -96,7 +96,7 @@ jobs: git clone https://github.com/glific/cypress-testing.git echo done. go to dir. cd cypress-testing - git checkout main + git checkout test_cases_wa_group cd .. cp -r cypress-testing/cypress cypress yarn add cypress