1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

Add Cypress Testing Library (#10446)

This commit is contained in:
Michael Weimann
2023-03-29 08:47:05 +02:00
committed by GitHub
parent 6eda1fa6e2
commit 7cb90d0f78
7 changed files with 123 additions and 12 deletions

View File

@ -154,6 +154,14 @@ API before logging the user in. You can make use of `cy.getBot(homeserver)` and
We should probably end up with convenience APIs that wrap the homeserver creation, logging in and room
creation that can be called to set up tests.
### Try to write tests from the users's perspective
Like for instance a user will not look for a button by querying a CSS selector. Instead you should work
with roles / labels etc.. You can make use of `cy.findBy…` queries provided by
[Cypress Testing Library](https://github.com/testing-library/cypress-testing-library) and some convencience
commands, such as `findButton(name)` or `findTextbox(name)`.
See [`/cypress/support/find.ts`](../cypress/support/find.ts) for a complete list.
### Using matrix-js-sdk
Due to the way we run the Cypress tests in CI, at this time you can only use the matrix-js-sdk module