https://github.com/syntapy/test_driven_web_app_template
Template Repo: Dockerized screenshot tests for web app
https://github.com/syntapy/test_driven_web_app_template
cypress end-to-end-testing frontend playwright test-automation webapp
Last synced: about 2 months ago
JSON representation
Template Repo: Dockerized screenshot tests for web app
- Host: GitHub
- URL: https://github.com/syntapy/test_driven_web_app_template
- Owner: syntapy
- Created: 2024-12-04T19:40:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-06T03:39:49.000Z (over 1 year ago)
- Last Synced: 2025-03-27T08:14:48.211Z (about 1 year ago)
- Topics: cypress, end-to-end-testing, frontend, playwright, test-automation, webapp
- Language: Shell
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Intro
Boilerplate to run web app and automated browser test client in separate docker containers
Also provides github actions workflow template
## Motivation
For me, screenshot tests don't match locally with Github Actions. But I am also on a non-standard OS (Qubes OS) which runs linux using Xen hypervisor, so that may be why
I'm doing this to make it easy for me to start a new web app project with reliable test driven functionality
Test driven development is nice and fun to have, and makes refactoring a breeze.
As such I want to make this the core of my development habit as I learn
This tries to help get rid of the tedium of setting up automated testing
Docker is used to make screenshot tests reliable across different machines, e.g. the local dev environment and CI tests in the cloud
It probably won't help with enabling exact screen renderings across different CPU architectures though, from what I've read online, but I don't have experience to say that definitively
# Usage
This is tested in Linux. I have no idea if it may work in Windows
### Installation
This needs Docker installed so that there is access to `docker` and `docker compose`
### Setup
- Specify image and docker repository names for your app and test client in the `docker/.env` file, as indicated by the `docker/env_example` file
- Web app code goes in `app/` dir, and test client goes in `test/` dir. Maybe best to use submodules for those? Idk...
- Environment for your app is specified in `docker/Dockerfile.app`
- Environment for your test client is specified in `docker/Dockerfile.test`
#### Pre-mod
You'll want to delete the if statement in `.github/workflows/test.yml` to actually run the app test
#### Permissions
For the workflow to be able to make pull requests, you need to set permissions.
In your repository, go into `Settings` > `Actions` > `General`
There under `Workflow permissions` check the `Allow GitHub Actions to create and approve pull requests`
### Running
The shell scripts to run the app are in `bin` folder
- Run web app with `./bin/up_app` from repository root dir
- Can use options to set entrypoint and command for web app container
- Run `./bin/up_app -h` for usage
- In separate terminal run test client shell with `./bin/run_test`
- This allows you to run `npm` commands there directly