Skip to content

Add frontend tests for core pages #14

Open

Description

@sennaicodes

The backend has 94 test files, the frontend has 16. Most pages under frontend/pages/ have no tests, including the ones players use most.

Good places to start

  • frontend/pages/problems/[slug].js: practice problem view, run and submit states, error display.
  • frontend/pages/leaderboard.js: sorting, empty state, pagination.
  • frontend/pages/login.js and register.js: validation messages and error handling.
  • frontend/pages/practice.js: problem list filtering by difficulty and tag.

Follow the style in frontend/__tests__/ (Jest plus Testing Library, API calls mocked).

Definition of done

  • Tests cover behavior a player would notice, not implementation details.
  • Each new test fails if you break the thing it covers (mention how you checked in the pull request).
  • cd frontend && npm test && npm run lint passes.

One page per pull request is ideal.

Activity

  1. added
    help wanted
    good first issue
    on Oct 8, 2026
  2. adityamukesh commented on Oct 8, 2026

    @adityamukesh
    Contributor

    Hi @sennaicodes! I can add frontend tests for the core player pages.

    Test Coverage Plan:

    • problems/[slug].js:
      • Test problem details rendering, testcase tabs, and editor state.
      • Test action dispatch for "Run Code" and "Submit", mocking API responses for Pending, Accepted, and Wrong Answer states.
      • Test error boundaries and execution timeout notifications.
    • leaderboard.js:
      • Test pagination/infinite scroll, user search filter, and ranking row renders.
    • Setup: Use Jest + React Testing Library with @testing-library/user-event following the existing test conventions.

    Could you assign this to me? I will open a PR with comprehensive test suites!

  3. sennaicodes commented on Oct 13, 2026

    @sennaicodes
    CollaboratorAuthor

    Thanks @adityamukesh — happy to have you take this on! I've assigned you the issue. Your proposed coverage is a good starting point.

    For the first PR, please focus on frontend/pages/problems/[slug].js. We'll review that together before moving on to the leaderboard in a separate PR.

    Expectations for the first pass:

    • Start from the latest default branch and check existing tests so we add missing coverage without duplicating it. Follow the project's Jest and React Testing Library conventions.
    • Cover player-visible behavior: problem details and testcase tabs; Run Code and Submit loading/results; accepted and wrong-answer feedback; and API failure/timeout feedback where the page supports it. Assert what the player sees and can do, rather than internal dispatches or component state.
    • Mock API calls and external editor/execution dependencies at their boundaries. Keep the tests deterministic, with no live services or arbitrary sleeps, while exercising the page's actual behavior.
    • Keep this PR scoped to tests and necessary test setup. If you uncover a production bug or need a dependency/configuration change, flag it in the draft PR before expanding scope. No need to add features to make a test possible.
    • Include regression evidence: temporarily break the behavior under test, confirm the relevant test fails, then restore the code. Describe the checks in the PR; don't commit the deliberate breakage.
    • Run cd frontend && npm test && npm run lint. Include the commands, results, coverage added, and any existing failures or remaining gaps in the PR description. Don't weaken or skip checks to get a green result.

    Please open a small draft PR early with your first useful tests so we can give feedback before you build out the whole suite. Let us know roughly when you expect that first draft and ask here if anything is unclear. Merge will follow review and passing checks; useful, maintainable coverage matters more than test count. Looking forward to your contribution!

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

Metadata

Metadata

Assignees

Labels

good first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions