matrix-react-sdk
matrix-react-sdk copied to clipboard
DRAFT: Add e2e tests for the module system
This PR implements a proposal for testing the Module System with Cypress. It needs to be viewed together with https://github.com/vector-im/element-web/pull/25951.
The changes:
- We create a module in the
cypress/example_module(tbd) folder. It has a minimal setup with a package.json, but we don't expect that anyone callsyarn installwe expect it to be used directly as a TypeScript file, so Webpack is advised to run babel for it (-> change in element-web). - We add a
ELEMENT_BUILD_CONFIGvariable that can change the location of thebuild_config.yamlfile that is used in the build process. Ayarn start:e2escript is adding theexample_modulecreated in 1. (-> change in element-web) - Cypress runs and we use flags in the localStorage to "enable" the module. (1) This takes case that the module doesn't interfere with any other tests and (2) it allows us to put the tests into the existing Cypress setup without the need for a different build of Element to test the modules. Individual parts of the module could also be enabled/disabled via localStorage flags in certain tests (this PR).
I added two example tests for the translations and the RoomViewLifecycle.PreviewRoomNotLoggedIn lifecycle to show how a test could look like.
@germain-gg we discussed this before, and I wanted to propose this so we have a base for our discussions. Do you think this setup would work for us? I would be happy to receive feedback, and other ideas on how to make the module system testable.
Checklist
- [ ] Tests written for new code (and old code if feasible)
- [ ] Linter and other CI checks pass
- [x] Sign-off given on the changes (see CONTRIBUTING.md)
Type: task Notes: none
This change is marked as an internal change (Task), so will not be included in the changelog.