From 210b04eb7e089153a05211a12a8ffd399ef0ff30 Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Tue, 7 Nov 2023 11:08:55 -0500 Subject: [PATCH] Fix test --- src/components/TextInputWithValidation/index.tsx | 6 +++++- src/components/TupleSelect/TupleSelect.test.tsx | 4 ++-- .../TupleSelectWithRegexConditional.test.tsx | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/TextInputWithValidation/index.tsx b/src/components/TextInputWithValidation/index.tsx index 7793c76242..2984b9d247 100644 --- a/src/components/TextInputWithValidation/index.tsx +++ b/src/components/TextInputWithValidation/index.tsx @@ -81,7 +81,11 @@ const TextInputWithValidation: React.FC = ) : ( - + {validatorErrorMessage} ) diff --git a/src/components/TupleSelect/TupleSelect.test.tsx b/src/components/TupleSelect/TupleSelect.test.tsx index 21d6731855..172ed3cf8f 100644 --- a/src/components/TupleSelect/TupleSelect.test.tsx +++ b/src/components/TupleSelect/TupleSelect.test.tsx @@ -78,8 +78,8 @@ describe("tupleSelect", () => { expect(input).toHaveValue("bad"); expect(onSubmit).not.toHaveBeenCalled(); expect(validator).toHaveBeenLastCalledWith("bad"); - expect(screen.getByDataCy("tuple-select-warning")).toBeInTheDocument(); - await user.hover(screen.queryByDataCy("tuple-select-warning")); + expect(screen.getByLabelText("validation error")).toBeInTheDocument(); + await user.hover(screen.getByLabelText("validation error")); await screen.findByText(validatorErrorMessage); }); }); diff --git a/src/components/TupleSelectWithRegexConditional/TupleSelectWithRegexConditional.test.tsx b/src/components/TupleSelectWithRegexConditional/TupleSelectWithRegexConditional.test.tsx index ff8a23f7bb..0a13a8821b 100644 --- a/src/components/TupleSelectWithRegexConditional/TupleSelectWithRegexConditional.test.tsx +++ b/src/components/TupleSelectWithRegexConditional/TupleSelectWithRegexConditional.test.tsx @@ -77,8 +77,8 @@ describe("tupleSelectWithRegexConditional", () => { expect(input).toHaveValue("bad"); expect(onSubmit).not.toHaveBeenCalled(); expect(validator).toHaveBeenLastCalledWith("bad"); - expect(screen.getByDataCy("tuple-select-warning")).toBeInTheDocument(); - await user.hover(screen.queryByDataCy("tuple-select-warning")); + expect(screen.getByLabelText("validation error")).toBeInTheDocument(); + await user.hover(screen.getByLabelText("validation error")); await waitFor(() => { expect(screen.getByText(validatorErrorMessage)).toBeInTheDocument(); });