You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to
RaspberryPiFoundation/digital-editor-issues#878
We're already using https://github.com/testing-library for our react
unit tests code, the library for cypress brings the same benefits. It
will allow us to write end to end tests that better mimic user behaviour
by interacting with elements based on their role/text/labels rather than
their classes. As well as making the specs easier to follow and
de-coupled from our class names, it helps to ensure our site is
accessible (e.g. form elements have labels).
To demonstrate this I've written added a new test to work with multiple
files. If we like this approach, we can change over other specs as we
write or update them.
Note that cypress testing library doesn't seem to have direct support
for the Shadow DOM yet (see
testing-library/dom-testing-library#413 ) but
we still works if we load the shadow DOM using the cypress finder. One
quirk I found is that `findByLabelText` doesn't work from the root
shadow DOM element which is why I've called it on `children()`.
This branch is based off of `update-cypress`. If we're happy I will
merge to main after that branch.
---
Feedback wanted:
- Do we think there's a benefit to using testing library for our cypress
specs?
- Are we happy to migrate them over gradually? Alternatively we could
invest a bit of time to do them all at once (perhaps with the help of a
coding agent).
0 commit comments