Minimal Playwright setup for JavaScript-based browser scenarios with:
- HTML reporting
- JUnit XML reporting
- Optional
.envsupport viadotenv - A hello-world smoke test
- Common npm scripts for local execution
- Node.js 20+
- npm 10+
Clone the repo and install dependencies:
npm installInstall the browser:
npx playwright install chromiumCopy the environment file and set BASE_URL to your target server:
cp .env.example .envRun the hello-world verification test:
npm run test:helloIf you are creating a new project rather than cloning this one:
npm init -y
npm install --save-dev @playwright/test dotenv
npx playwright install chromiumRun all tests:
npm testRun a single file directly:
npx playwright test tests/hello-world.spec.jsRun with Playwright UI mode (interactive, useful for debugging):
npm run test:uiEvery test run writes:
- HTML report to
playwright-report/ - JUnit XML to
test-results/junit/results.xml
Open the HTML report after a run:
npm run report:htmlA minimal workflow is included at .github/workflows/ci.yml.
It runs on:
- push to
mainormaster - pull requests
- manual trigger via
workflow_dispatch - repository dispatch event type
workspace_dispatch
The workflow uploads both:
- JUnit XML report
- Playwright HTML report
The workflow can also publish JUnit results to Testspace.
The workflow is configured to publish to the Testspace staging server:
samples.stridespace.com
CI publishes:
- test-results/junit/results.xml
BASE_URL must be set before running tests. Set it in your .env file:
BASE_URL=https://your-server.example.comOr pass it inline:
BASE_URL=https://your-server.example.com npm test.
|-- package.json
|-- playwright.config.js
|-- README.md
`-- tests/
`-- hello-world.spec.js