feat: setup Playwright e2e testing infrastructure#328
feat: setup Playwright e2e testing infrastructure#328DSingh0304 wants to merge 2 commits intokeploy:mainfrom
Conversation
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
SUGGESTION
Files Reviewed (5 files)
Overall Assessment: This PR adds a solid Playwright E2E testing foundation. The configuration is well-structured with proper environment variable handling and fallbacks. The GitHub Actions workflow is properly configured for CI. The main concern is ensuring the |
There was a problem hiding this comment.
Pull request overview
Sets up Playwright-based end-to-end testing for the Next.js blog app, including local developer workflows and CI execution in GitHub Actions.
Changes:
- Adds Playwright test configuration (multi-browser projects, webServer auto-start, artifact output dirs).
- Introduces initial e2e test structure with a placeholder smoke test and
.env.testtemplate. - Adds npm scripts and a GitHub Actions workflow to run Playwright tests in CI.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/e2e/smoke.spec.ts |
Adds initial smoke test exercising homepage load/title. |
playwright.config.ts |
Defines Playwright config (projects, timeouts, reporters, webServer, env loading). |
package.json |
Adds Playwright/dotenv dev deps and e2e scripts; updates Node types. |
package-lock.json |
Locks new dependencies (@playwright/test, playwright, dotenv) and type updates. |
.gitignore |
Updates ignored env/test artifact patterns, adds Playwright output/cache ignores. |
.github/workflows/playwright.yml |
Adds CI workflow to run Playwright tests (Chromium matrix initially). |
.env.test.example |
Provides template env vars for local e2e runs. |
Comments suppressed due to low confidence (2)
.github/workflows/playwright.yml:74
- This workflow creates a new PR comment on every run and doesn’t declare the
issues: write/pull-requests: writepermissions needed forgithub.rest.issues.createComment(the repo already uses explicit permissions in other workflows). This can fail the job in repos/orgs with restricted default token permissions, and it will spam PR threads. Prefer using a create-or-update comment action (sticky comment) and add an explicitpermissionsblock, or remove the commenting step entirely.
- name: Comment PR with result
if: github.event_name == 'pull_request' && always()
uses: actions/github-script@v7
with:
script: |
const status = '${{ job.status }}';
const emoji = status === 'success' ? '✅' : '❌';
const message = status === 'success'
? `${emoji} Playwright tests passed on **${{ matrix.browser }}**!`
: `${emoji} Playwright tests failed on **${{ matrix.browser }}**. Check the [workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
});
package.json:56
@types/nodewas bumped from v18 to v25 while the repo’s GitHub Actions workflows run Node 18. This mismatch can introduce confusing/incorrect Node API typings (and may require newer TS features) compared to the actual runtime. Consider pinning@types/nodeto the major that matches the supported runtime (e.g.,^18.x) unless there’s a specific reason to target Node 25 types.
"@playwright/test": "^1.58.2",
"@types/node": "^25.3.0",
"@types/prismjs": "^1.26.3",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related Tickets & Documents
Part of e2e testing initiative
Description
This PR establishes the foundation for comprehensive end-to-end testing using Playwright. It sets up the testing infrastructure with environment-based configuration, multi-browser support, and GitHub Actions CI integration.
The configuration enables automated testing across different browsers and environments without code changes, provides fast local development feedback, and ensures code quality through automated PR checks.
Changes
Type of Change
Testing
npx playwright install.env.testfrom templatenpm run test:e2e:chromium✅npm run test:e2e:ui✅Demo
Test Commands Available:
Browser Coverage:
Environment and Dependencies
New Dependencies:
@playwright/test(v1.58.2) - Test frameworkdotenv(v17.3.1) - Environment variable managementConfiguration Changes:
.env.testfile from.env.test.exampletemplateWORDPRESS_API_URL,NEXT_PUBLIC_WORDPRESS_API_URLnpx playwright installChecklist
Additional Notes