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 push occurs in the primary repository, the following workflow is triggered:
- Both the primary repo that contains my website and this repo that has the Playwright specs are checked out.
- 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.
This project uses Husky along with ESLint, Prettier, and lint-staged to enforce code quality checks on staged files before each commit. Here's how it works:
- Husky: Configured to run
lint-staged
before each commit. - lint-staged: Executes ESLint for linting and Prettier for code formatting specifically on staged files (
*.{js,jsx,ts,tsx}
).
Feel free to contribute to this project by forking the repo and creating and submitting a pull request.