Playwright E2E Tests for Offline Mode | Monorepo Conversion #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduction
For about a year, the OpenMRS frontend has been continuously enhanced with offline related features. These have, at the moment, very little test coverage due to the complexity of covering offline mode using "normal" unit tests. We want to change this, but this more or less requires E2E tests to fully capture all possible interactions and flows.
The existing Cypress project would have been an ideal starting place for such test cases. Unfortunately, a known Cypress issue makes this nearly impossible without bad consequences. For this reason, this PR introduces another testing project specifically for offline related test cases in this repository. The new project is based on the Playwright framework which makes testing offline features possible while also following many of the newest best practices regarding E2E testing and browser automation.
The fact that a new project is added to this repository also meant that I had to do some repository restructuring. Since there are now two entirely separate projects living in this single repository, it made sense to convert it to a monorepo. This means that the existing Cypress code has been moved into a sub-directory (
./packages/cypress
) where it can peacefully coexist with the new playwright package. yarn workspaces take care of the dependency management.Discussion
I did my best to keep everything Cypress-related working. Obviously I'm not perfect, meaning that I might have broken one or the other non-obvious thing while merging the changes into a monorepo. A thorough review is welcome! 😄
I also want to note that, for the scope of this PR, the playwright project should simply be "parked" inside this repository. The goal is not to have it integrated with, e.g., pipelines or anything else. After merging, it should be possible to run the tests and to write new ones locally. Anything else is, from my POV, out of scope at the moment.