Essentially, I have a number of "row-points" elements and when I am trying to get, find or query all of them, the length of my array is always 0 (it is not returned at all). If I try to use a normal query, like findByTestId or getByText, the library says that more than 1 element is found.
To Reproduce
Steps to reproduce the behavior:
Use the html above.
Use the next piece of code to get the rows elements:
The console.log line here returns 1) TypeError: Cannot read property 'textContent' of undefined. However, it returns the same error with a Selector that is proved working when defined in the constructor of this Page (BoardPage in this case) and used in the test code, as normal. Like this:
Describe the bug I have a similar HTML:
Essentially, I have a number of "row-points" elements and when I am trying to get, find or query all of them, the length of my array is always 0 (it is not returned at all). If I try to use a normal query, like findByTestId or getByText, the library says that more than 1 element is found.
To Reproduce Steps to reproduce the behavior:
Expected behavior The text of the 2nd element in the array is logged in the console.
Actual behavior 1) TypeError: Cannot read property 'textContent' of undefined
Desktop (please complete the following information):
EDIT:
Apparently, the problem is evident also within a helper method in a Page class, like this one:
The console.log line here returns 1) TypeError: Cannot read property 'textContent' of undefined. However, it returns the same error with a Selector that is proved working when defined in the constructor of this Page (BoardPage in this case) and used in the test code, as normal. Like this:
this.boardRows = screen.findAllByTestId('row-position'); ...