Commit 829bb3e
authored
Introduce testing library with cypress (#1284)
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).1 parent b99cd5c commit 829bb3e
File tree
6 files changed
+92
-8
lines changed- cypress
- e2e
- support
6 files changed
+92
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
154 | 184 | | |
155 | 185 | | |
156 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1620 | 1620 | | |
1621 | 1621 | | |
1622 | 1622 | | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1623 | 1630 | | |
1624 | 1631 | | |
1625 | 1632 | | |
| |||
2966 | 2973 | | |
2967 | 2974 | | |
2968 | 2975 | | |
| 2976 | + | |
2969 | 2977 | | |
2970 | 2978 | | |
2971 | 2979 | | |
| |||
3707 | 3715 | | |
3708 | 3716 | | |
3709 | 3717 | | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
| 3745 | + | |
3710 | 3746 | | |
3711 | 3747 | | |
3712 | 3748 | | |
| |||
5224 | 5260 | | |
5225 | 5261 | | |
5226 | 5262 | | |
| 5263 | + | |
| 5264 | + | |
| 5265 | + | |
| 5266 | + | |
| 5267 | + | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
| 5271 | + | |
5227 | 5272 | | |
5228 | 5273 | | |
5229 | 5274 | | |
| |||
8227 | 8272 | | |
8228 | 8273 | | |
8229 | 8274 | | |
| 8275 | + | |
| 8276 | + | |
| 8277 | + | |
| 8278 | + | |
| 8279 | + | |
| 8280 | + | |
| 8281 | + | |
8230 | 8282 | | |
8231 | 8283 | | |
8232 | 8284 | | |
| |||
15500 | 15552 | | |
15501 | 15553 | | |
15502 | 15554 | | |
| 15555 | + | |
| 15556 | + | |
| 15557 | + | |
| 15558 | + | |
| 15559 | + | |
| 15560 | + | |
| 15561 | + | |
15503 | 15562 | | |
15504 | 15563 | | |
15505 | 15564 | | |
15506 | 15565 | | |
15507 | 15566 | | |
15508 | 15567 | | |
15509 | 15568 | | |
15510 | | - | |
15511 | | - | |
15512 | | - | |
15513 | | - | |
15514 | | - | |
15515 | | - | |
15516 | | - | |
15517 | 15569 | | |
15518 | 15570 | | |
15519 | 15571 | | |
| |||
0 commit comments