Architecture
January 26, 2020 ยท View on GitHub
There are multiple layers to the library:
- ReactScreenshotTest is the library's main entrypoint.
- It exposes a simple API.
- Internally, it coordinates Jest, the component server and the screenshot renderer.
- ReactComponentServer is an HTTP server that renders React components server-side.
- ScreenshotRenderer is an interface wrapping a browser.
- There are multiple implementations, in particular PuppeteerScreenshotRenderer (using Puppeteer) and PercyScreenshotRenderer (loading screenshots over HTTP).
- ScreenshotServer is an HTTP server that takes a screenshot of a particular URL.
- A screenshot server can either be local or it can run within Docker.
- Running it in Docker allows us to take consistent snapshots across platforms.