From 782c5e74bf63e6d98cafd471978fad579521ab6b Mon Sep 17 00:00:00 2001 From: shuhaib-aot Date: Mon, 18 Dec 2023 11:38:48 +0530 Subject: [PATCH] added data testid in Form client and designer table --- .../Form/FileUpload/SelectFormForDownload.js | 2 + .../components/Form/constants/ClientTable.js | 93 +++++++++++-------- .../components/Form/constants/FormTable.js | 50 ++++++---- 3 files changed, 88 insertions(+), 57 deletions(-) diff --git a/forms-flow-web/src/components/Form/FileUpload/SelectFormForDownload.js b/forms-flow-web/src/components/Form/FileUpload/SelectFormForDownload.js index 03a1863374..e405edacfc 100644 --- a/forms-flow-web/src/components/Form/FileUpload/SelectFormForDownload.js +++ b/forms-flow-web/src/components/Form/FileUpload/SelectFormForDownload.js @@ -74,6 +74,7 @@ const SelectFormForDownload = React.memo(({ form, type }) => { > addAllFormCheckList(!isAllFormChecked)} checked={isAllFormChecked} @@ -89,6 +90,7 @@ const SelectFormForDownload = React.memo(({ form, type }) => { updateFormCheckList(!isFormChecked)} title={t("Select for download")} diff --git a/forms-flow-web/src/components/Form/constants/ClientTable.js b/forms-flow-web/src/components/Form/constants/ClientTable.js index 801a2b2b0c..ae98992691 100644 --- a/forms-flow-web/src/components/Form/constants/ClientTable.js +++ b/forms-flow-web/src/components/Form/constants/ClientTable.js @@ -139,7 +139,7 @@ function ClientTable() { return ( <> -
+
@@ -188,12 +188,16 @@ function ClientTable() { onKeyDown={(e) => e.keyCode === 13 ? handleSearch() : "" } + data-testid="form-search-input-box" placeholder={t("Search by form title")} style={{ backgroundColor: "#ffff" }} title={t("Search by form title")} /> {search && ( - + @@ -201,6 +205,7 @@ function ClientTable() { )} @@ -219,20 +224,31 @@ function ClientTable() { - {index === openIndex && - - + - - } +
+
+ + + )} ))} @@ -291,8 +305,12 @@ function ClientTable() {
{t("Rows per page")} - - + + {pageLimit} @@ -304,6 +322,7 @@ function ClientTable() { onClick={() => { onSizePerPageChange(option.value); }} + data-testid={`page-limit-dropdown-item-${option.value}`} > {option.text} diff --git a/forms-flow-web/src/components/Form/constants/FormTable.js b/forms-flow-web/src/components/Form/constants/FormTable.js index fc571ca790..719e7d54cc 100644 --- a/forms-flow-web/src/components/Form/constants/FormTable.js +++ b/forms-flow-web/src/components/Form/constants/FormTable.js @@ -118,15 +118,7 @@ function FormTable() { dispatch(setBPMFormLimit(limit)); dispatch(setBPMFormListPage(1)); }; - - const viewOrEdit = (formData) => ( - - ); + @@ -245,10 +237,11 @@ function FormTable() { onKeyDown={(e) => (e.keyCode == 13 ? handleSearch() : "")} placeholder={t("Search by form title")} title={t("Search by form title")} + data-testid="form-search-input-box" style={{ backgroundColor: "#ffff" }} /> {search && ( - + @@ -256,6 +249,7 @@ function FormTable() { )} @@ -289,21 +283,34 @@ function FormTable() {
{!isDesigner && ( - )} - {e.title} + + {e.title} +
-
-

- {t("Form Description")} -

+ {index === openIndex && ( +
+
+

+ {t("Form Description")} +

-
-
-
{_.capitalize(e.formType)} {e.anonymous ? t("Public") : t("Private")} - {" "} - - {e.status === 'active' ? t("Published") : t("Unpublished")} + {e.status === "active" + ? t("Published") + : t("Unpublished")} - {viewOrEdit(e)} + - + { submitNewForm(e?._id); }} + data-testid={`designer-form-option-${e._id}-submit`} > {t("Submit New")} ) : null} - deleteForms(e)}> + deleteForms(e)} + data-testid={`designer-form-option-${e._id}-delete`}> {t("Delete")} @@ -346,8 +355,8 @@ function FormTable() {
{t("Rows per page")} - - + + {pageLimit} @@ -356,6 +365,7 @@ function FormTable() { { onSizePerPageChange(option.value); }}