Move threads e2e tests over to cypress (#8501)

* Add non-consent (default) Synapse template

* Add consent test

* Add create room test

* Stash work

* Initial threads tests

* fix

* Delete old threads e2e tests, plan new ones

* Fix typed s'more

* Try something else

* specify d.ts

* Fix types once and for all?

* Fix the consent tests

* Iterate threads test harness

* Fix dispatcher types

* Iterate threads test

* fix typing

* Alternative import attempt

* let it break let it break let it break

* Tweak types

* Stash

* delint and update docs

* null-guard scrollIntoView

* Iterate threads test

* Apply suggestions from code review
This commit is contained in:
Michael Telatynski 2022-05-10 18:09:31 +01:00 committed by GitHub
parent 14127c777b
commit ad4d3f9a88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 810 additions and 288 deletions

View file

@ -31,7 +31,7 @@ This will run the Cypress tests once, non-interactively.
You can also run individual tests this way too, as you'd expect:
```
yarn run test:cypress cypress/integration/1-register/register.spec.ts
yarn run test:cypress --spec cypress/integration/1-register/register.spec.ts
```
Cypress also has its own UI that you can use to run and debug the tests.
@ -131,12 +131,17 @@ but the signature can be maintained for simpler maintenance.
### Joining a Room
Many tests will also want to start with the client in a room, ready to send & receive messages. Best
way to do this may be to get an access token for the user and use this to create a room with the REST
API before logging the user in.
API before logging the user in. You can make use of `cy.getBot(synapse)` and `cy.getClient()` to do this.
### Convenience APIs
We should probably end up with convenience APIs that wrap the synapse creation, logging in and room
creation that can be called to set up tests.
### 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
exposed on `window.matrixcs`. This has the limitation that it is only accessible with the app loaded.
This may be revisited in the future.
## Good Test Hygiene
This section mostly summarises general good Cypress testing practice, and should not be news to anyone
already familiar with Cypress.