Skip to content

chore: Implemented Robust Playwright E2E Testing Suite and Fixed App Layout & Focus Bugs#974

Merged
steam-bell-92 merged 2 commits into
steam-bell-92:mainfrom
nishtha-agarwal-211:main
Jun 3, 2026
Merged

chore: Implemented Robust Playwright E2E Testing Suite and Fixed App Layout & Focus Bugs#974
steam-bell-92 merged 2 commits into
steam-bell-92:mainfrom
nishtha-agarwal-211:main

Conversation

@nishtha-agarwal-211
Copy link
Copy Markdown
Contributor

@nishtha-agarwal-211 nishtha-agarwal-211 commented Jun 3, 2026

Summary

Fixes #873
This Pull Request introduces a comprehensive automated end-to-end (E2E) testing suite powered by Playwright to ensure high reliability across all major modern browser engines (Chromium, Firefox, WebKit). It also resolves several critical UI interaction, layout, and JavaScript execution bugs that previously broke focus trapping, project modal triggers, and initial page rendering.


Key Changes

1. Automated E2E Testing Suite

  • Playwright Configuration: Added web-app/playwright.config.js to automatically spin up a local Python dev server (python3 -m http.server 8000) and test the app across Chromium, Firefox, and WebKit.
  • Continuous Integration (CI): Configured a .github/workflows/playwright.yml workflow to automatically execute the E2E test suite on pull requests and pushes to the main branch.
  • Playwright Spec Files (web-app/tests-e2e/):
    • theme.spec.js: Validates the light/dark theme toggles, checking data-theme attribute changes on <html> and corresponding custom CSS variable values.
    • search.spec.js: Verifies category tab filtering and search bar text inputs accurately filter the project list.
    • modal.spec.js: Confirms modal open triggers, validates modal focus traps, tests close actions (Escape key, close button, clicking outside), and checks that focus correctly returns to the triggering card element.
    • playground.spec.js: Exercises the CodeMirror editor playground, validates mock run actions, and checks console execution logs.

2. Core Web App Bug Fixes

  • Modal Nesting & Focus Trap:
    • Relocated the #projectModal element to the root level of document.body during initialization. This prevents it from becoming inert when the main wrappers are marked as aria-hidden / inert while the modal is open.
    • Resolved ReferenceError: window.setMainInert is not a function by correctly exposing the local function to the window scope.
  • Sidebar Nesting & Event Propagation:
    • Fixed a dangling </div> in index.html that corrupted structural HTML layouts.
    • Changed the inline capture-phase click guard (true) on the sidebar to bubble-phase (false), permitting legitimate click handlers (like project card triggers) to bubble up correctly and open modals.
  • Syntax & Import Errors:
    • Restored the correct nesting of the main DOMContentLoaded listener in js/main.js which had been closed prematurely.
    • Added the missing utility import updateProjectVisibility to main.js.
  • Runtime Errors:
    • Updated js/projects/tic-tac-toe.js to only run initialization when the game's start button (#start-btn) exists, preventing runtime exceptions on non-game pages.

Copilot AI review requested due to automatic review settings June 3, 2026 15:10
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

@nishtha-agarwal-211 is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Playwright-based end-to-end test coverage and CI automation, along with small app tweaks to improve testability/stability (modal behavior, initialization guards).

Changes:

  • Introduce Playwright E2E specs for theme toggle, search/filter, modal focus trap, and Python playground.
  • Add Playwright configuration + GitHub Actions workflow to run tests on PRs/pushes.
  • Adjust app code/markup to support modal inert/focus behavior and avoid project script initialization errors.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
web-app/tests-e2e/theme.spec.js New E2E test validating theme toggle + CSS variables.
web-app/tests-e2e/search.spec.js New E2E test for sidebar search autocomplete + category filtering.
web-app/tests-e2e/playground.spec.js New E2E test ensuring Pyodide loads and runs default code.
web-app/tests-e2e/modal.spec.js New E2E test for modal lifecycle and focus trapping.
web-app/playwright.config.js Adds Playwright runner config + local webServer settings.
web-app/package.json Adds Playwright dependency and test:e2e script.
web-app/js/projects/tic-tac-toe.js Guards Tic-Tac-Toe initialization.
web-app/js/main.js Modal-related tweaks (inert), DOM reparenting, and imports for filtering utilities.
web-app/index.html Adjusts click-guard behavior and removes some guard selectors.
.github/workflows/playwright.yml Adds CI workflow to install browsers and run Playwright tests.
Files not reviewed (1)
  • web-app/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web-app/js/main.js
main.js — App wiring for Premium Python Projects Gallery
═══════════════════════════════════════════════════════════════ */

import { updateProjectVisibility } from "./modules/utils.js";
Comment on lines +870 to +872
if (document.getElementById("start-btn")) {
initTicTacToe();
}
Comment on lines +31 to +33
return Array.from(modalEl.querySelectorAll(sel))
.filter(el => !el.closest('[aria-hidden="true"]') && !el.classList.contains("visually-hidden"))
.map(el => el.tagName + (el.id ? '#' + el.id : '') + (el.className ? '.' + el.className.split(' ').join('.') : ''));
Comment on lines +15 to +16
expect(bg).toBe('#0c0f1a');
expect(text).toBe('#f0f2f5');
Comment on lines +35 to +36
expect(bg).toBe('#f4f6f9');
expect(text).toBe('#0f172a');
Comment thread web-app/package.json
"@codemirror/state": "^6.6.0",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.43.0",
"@playwright/test": "^1.60.0",
Comment thread web-app/index.html
e.stopPropagation();
}
}, true /* capture — runs before main.js bubble handler */);
}, false /* bubble — runs after target target bubble handlers */);
@steam-bell-92 steam-bell-92 merged commit eebc6f6 into steam-bell-92:main Jun 3, 2026
8 of 10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🎉 Thank you for your contribution!

Your Pull Request has been merged successfully.

We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone.

If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request.

Thanks again for your support! 🙌

@nishtha-agarwal-211
Copy link
Copy Markdown
Contributor Author

@steam-bell-92, can you please add tags/labels for gssoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: Add End-to-End Browser Testing with Playwright

3 participants