matrix-react-sdk icon indicating copy to clipboard operation
matrix-react-sdk copied to clipboard

DRAFT: Add e2e tests for the module system

Open dhenneke opened this issue 2 years ago • 0 comments

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:

  1. 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 calls yarn install we expect it to be used directly as a TypeScript file, so Webpack is advised to run babel for it (-> change in element-web).
  2. We add a ELEMENT_BUILD_CONFIG variable that can change the location of the build_config.yaml file that is used in the build process. A yarn start:e2e script is adding the example_module created in 1. (-> change in element-web)
  3. 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.

dhenneke avatar Aug 10 '23 15:08 dhenneke