Hi,
I'm trying to test the component with the react testing-library. The test is quite simple but for some reason when I run it the testid cannot be found. The error returned is TestingLibraryElementError: Unable to find an element by: [data-testid="clamped-text"] and the test example is as follow:
const longText = "...";
it("should clamp text", () => {
render(<ClampLines {...props} data-testid="clamped-text" />);
const containerDiv = screen.getByTestId("clamped-text");
expect(containerDiv).toBeInTheDocument();
});
When I go to analyse the elements in the browser, the element with that testid actually does not exist. Any help?
Hi,
I'm trying to test the component with the react testing-library. The test is quite simple but for some reason when I run it the
testidcannot be found. The error returned isTestingLibraryElementError: Unable to find an element by: [data-testid="clamped-text"]and the test example is as follow:When I go to analyse the elements in the browser, the element with that
testidactually does not exist. Any help?