I use Playwright at my current job and I tinker 🧰🪛🛠️🚧 with it here in my personal repo too!
The scripts in this repository are designed to be executed within a GitHub Actions workflow that resides in my primary repository.
When a pull request or commit occurs in the primary repository, the following workflow is triggered:
- Both repos are checked out (the primary repo that contains my website and this repo that has the Playwright specs)
- A local Node.js server is started within the GitHub runner environment
- Playwright scripts located in this repo execute tests against the locally hosted GitHub pages site in my primary repo.
The main entry point for the Playwright scripts is located in scripts/navigation.ts
. By default, these scripts are configured to interact with a local server running at http://localhost:3000
.
NOTE! If you try to run these scripts on your computer they will fail because there is no local server running and the files for the website exist in a different repo. If you want to run these tests, it's easiest to just swap the localHost
variable for production
in the navigation.ts script. This will allow you to run these tests against the live site. Otherwise, you would need to also clone my main repo, open both repos in VSCode, start the server, and then run the tests.
Feel free to contribute to this project by forking the repo and creating and submitting a pull request.