Skip to content

Testing: Add team allocation phase module e2e coverage#1914

Open
mathildeshagl wants to merge 10 commits into
mainfrom
1818-e2e-team-allocation-phase-module-coverage
Open

Testing: Add team allocation phase module e2e coverage#1914
mathildeshagl wants to merge 10 commits into
mainfrom
1818-e2e-team-allocation-phase-module-coverage

Conversation

@mathildeshagl

@mathildeshagl mathildeshagl commented Jul 13, 2026

Copy link
Copy Markdown
Member

📝 Pull Request Template

Use this template to provide all necessary information for reviewing and testing your changes.

✨ What is the change?

Adds end-to-end coverage for the team allocation phase module and boots it in the make test-e2e stack, following the phase-module blueprint proven for self team allocation, assessment, interview, and certificate.

  • Stack: server-team-allocation + client-team-allocation + a dedicated db-team-allocation in docker-compose.e2e.yml, DB_TEAM_ALLOCATION_* env with a same-origin host var, /team-allocation/api/ + /team-allocation/ nginx proxy locations, and a /team-allocation/api/info readiness poll in global-setup.
  • Seed: standalone Team Allocation phases for the lecturer journey (Stan + Selma) and student journey (Stan), plus a participant-less TestCourse phase for the negative-auth check — isolated from the graph Team Allocation phase so parallel Playwright files never clobber allocations.
  • Specs (e2e/tests/team-allocation/, e2e/tests/api/team-allocation.api.spec.ts, e2e/src/pages/TeamAllocationPage.ts):
    • MF smoke — the remote loads and renders the allocations view inside the core shell.
    • Lecturer journey — sets up a team through the settings UI, publishes the allocation, and verifies the result on the allocations + participants views and via the API.
    • Student journey — opens the survey remote and reads its allocated team via the allocation API.
    • API auth — the phase endpoints reject unauthenticated and wrong-role requests (401) and accept an enrolled student on the read endpoints.
  • Docs: e2e/README.md updated (stack diagram, intro, and the TEASE-external allocation note).

Team allocation's algorithm runs in the external TEASE tool, so the lecturer journey publishes the computed assignment through the phase server's TEASE save endpoint (the tool's callback) rather than clicking a matchmaking button. The module has no student-facing "my team" page, so the student reads their allocated team through the allocation API.

📌 Reason for the change / Link to issue

The team allocation service (servers/team_allocation) and client (clients/team_allocation_component) had no e2e coverage and were not part of the e2e stack, leaving Module Federation remote loading, cross-service prompt-sdk auth, and the per-service database pattern unexercised for this module.

Closes #1818

🧪 How to Test

  1. From the repo root, run make test-e2e.
  2. Confirm the stack boots the team allocation server + client + own DB (global-setup logs team-allocation ready (via proxy)).
  3. Confirm all specs are green, including tests/team-allocation/{mf-smoke,lecturer-journey,student-journey}.spec.ts and tests/api/team-allocation.api.spec.ts (this branch: 146 passed).
  4. For interactive inspection: make test-e2e-ui (Playwright UI at http://127.0.0.1:8123), then run the team allocation specs; make test-e2e-down to tear down.

🖼️ Screenshots (if UI changes are included)

No product UI changes — this PR adds tests, e2e stack wiring, and seed data only.

✅ PR Checklist

  • Tested locally or on the dev environment
  • Code is clean, readable, and documented
  • Tests added or updated (if needed)
  • Screenshots attached for UI changes (if any)
  • Documentation updated (if relevant)

Summary by CodeRabbit

  • New Features

    • Added end-to-end coverage for the Team Allocation module, including lecturer and student journeys.
    • Extended the e2e Docker stack with dedicated Team Allocation services, routing for /team-allocation, and additional startup readiness gates.
    • Added a Team Allocation page-object for common UI interactions and assertions.
  • Tests

    • Added a Team Allocation federation smoke test.
    • Added API tests validating authentication/authorization for Team Allocation endpoints.
    • Added Team Allocation backend helpers and fixtures for allocation workflows.
  • Documentation

    • Updated e2e docs and diagrams to include the Team Allocation phase, fixtures, and negative-auth scenarios.

Add the team allocation server, client remote, and own Postgres to the
e2e Docker stack following the phase-module blueprint: compose services,
DB_TEAM_ALLOCATION_* env, same-origin host var, nginx proxy locations,
and a /team-allocation/api/info readiness poll in global-setup.
Seed standalone Team Allocation phases for the lecturer journey (Stan +
Selma) and student journey (Stan), plus a TestCourse negative-auth phase,
and export their phase-id constants. Isolated from the graph Team
Allocation phase so parallel Playwright files never clobber allocations.
Add TeamAllocationPage with locators for the allocations, survey, settings,
and participants views, and a module-federation smoke test asserting the
remote renders inside the core shell.
Lecturer journey creates a team through the settings UI, publishes the
allocation via the TEASE save endpoint (the external tool's callback), and
verifies the result on the allocations + participants views and the API.
Student journey opens the survey remote and reads its allocated team via the
allocation API (the module has no student-facing team view).
Assert the phase endpoints reject unauthenticated and wrong-role requests
(401) and accept an enrolled student on the read endpoints.
Add the module to the stack diagram and intro, and note the TEASE-external
allocation flow and the standalone journey phases.
…cation read

Open the survey timeframe in the student journey's setup so the survey remote
renders its form instead of the "not configured" error page, and read the
allocated team from the single-allocation endpoint, which returns the team UUID
as a bare string rather than a participation object.
@mathildeshagl mathildeshagl requested a review from a team July 13, 2026 07:01
@mathildeshagl mathildeshagl linked an issue Jul 13, 2026 that may be closed by this pull request
5 tasks
@mathildeshagl mathildeshagl self-assigned this Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The E2E stack now runs Team Allocation services with dedicated fixtures, routes module traffic through the core client, waits for readiness, and adds Playwright coverage for API authorization, lecturer allocation, student allocation, and module-federation loading.

Changes

Team allocation E2E coverage

Layer / File(s) Summary
Stack wiring and readiness
docker-compose.e2e.yml, e2e/.env.e2e, e2e/nginx/client-core.conf, e2e/src/env.ts, e2e/src/global-setup.ts
Adds Team Allocation services, database configuration, proxy routes, startup dependencies, and readiness checks.
Seeded phases and test fixtures
e2e/seed/e2e_seed.sql, e2e/src/data/constants.ts, e2e/README.md
Adds isolated lecturer, student, and foreign Team Allocation phases with participation data and stack documentation.
Team allocation test support
e2e/src/pages/TeamAllocationPage.ts, e2e/tests/team-allocation/helpers.ts
Adds page-object assertions and API helpers for teams, surveys, allocations, cleanup, and publishing.
Authentication and user journeys
e2e/tests/api/team-allocation.api.spec.ts, e2e/tests/team-allocation/*
Adds API authorization, module-federation smoke, lecturer, and student journey tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant E2E_Runner
  participant client_core
  participant Team_Allocation_Server
  participant Team_Allocation_Client
  E2E_Runner->>Team_Allocation_Client: wait for healthy
  E2E_Runner->>client_core: poll /team-allocation/api/info
  client_core->>Team_Allocation_Server: proxy API requests
  client_core->>Team_Allocation_Client: proxy module requests
  E2E_Runner->>Team_Allocation_Client: run Playwright journeys
Loading

Possibly related PRs

Suggested reviewers: rappm

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: added e2e coverage for the team allocation phase module.
Description check ✅ Passed The description follows the template with change summary, rationale, test steps, screenshots note, and checklist.
Linked Issues check ✅ Passed The changes satisfy #1818 by adding the service/client stack, seed data, lecturer and student journeys, and API auth checks.
Out of Scope Changes check ✅ Passed The diff stays focused on team allocation e2e wiring, docs, seed data, and tests, with no clear unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1818-e2e-team-allocation-phase-module-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
e2e/src/pages/TeamAllocationPage.ts (1)

41-53: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider scoping allocation assertions to their container for precision.

expectAllocatedMember checks the member name on the entire page (this.page.getByText(memberFullName)), not within the team card. expectParticipantAllocatedTeam checks lastName and teamName independently with .first() rather than verifying they co-occur on the same table row. Both work correctly with the current single-team, single-participant e2e fixtures, but would produce false positives if the seed data grows. Scoping the member check to the team card container and asserting row-level co-occurrence would make these assertions more robust.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/src/pages/TeamAllocationPage.ts` around lines 41 - 53, Scope
expectAllocatedMember’s member lookup to the team card container identified by
teamCardHeading(teamName). For expectParticipantAllocatedTeam, locate the
participant row containing lastName within `#table-view`, then assert teamName
within that same row instead of using independent first() lookups. Preserve the
existing visibility checks and timeouts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@e2e/src/pages/TeamAllocationPage.ts`:
- Around line 41-53: Scope expectAllocatedMember’s member lookup to the team
card container identified by teamCardHeading(teamName). For
expectParticipantAllocatedTeam, locate the participant row containing lastName
within `#table-view`, then assert teamName within that same row instead of using
independent first() lookups. Preserve the existing visibility checks and
timeouts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21a17fa8-b843-4ad5-91c6-73545d914070

📥 Commits

Reviewing files that changed from the base of the PR and between 7a25923 and 5fee966.

📒 Files selected for processing (14)
  • docker-compose.e2e.yml
  • e2e/.env.e2e
  • e2e/README.md
  • e2e/nginx/client-core.conf
  • e2e/seed/e2e_seed.sql
  • e2e/src/data/constants.ts
  • e2e/src/env.ts
  • e2e/src/global-setup.ts
  • e2e/src/pages/TeamAllocationPage.ts
  • e2e/tests/api/team-allocation.api.spec.ts
  • e2e/tests/team-allocation/helpers.ts
  • e2e/tests/team-allocation/lecturer-journey.spec.ts
  • e2e/tests/team-allocation/mf-smoke.spec.ts
  • e2e/tests/team-allocation/student-journey.spec.ts

Correct the deleteTeamByName doc comment (callers clear allocations first; the
helper does not), make the internal-only URL builders module-private, and add
the certificate module to the README stack diagram, intro, and blueprint list.
…ion-phase-module-coverage

# Conflicts:
#	e2e/README.md
@mathildeshagl mathildeshagl added the schau mi o Translation: Ready to review label Jul 13, 2026
…ion-phase-module-coverage

# Conflicts:
#	e2e/.env.e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/.env.e2e`:
- Line 101: Move the EXAMPLE_HOST entry in the environment configuration so it
appears before INTERVIEW_HOST, preserving its existing value and all other
entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5a114561-29c4-4116-becf-5dd7670b4caa

📥 Commits

Reviewing files that changed from the base of the PR and between 0a4977b and 8f02b33.

📒 Files selected for processing (3)
  • docker-compose.e2e.yml
  • e2e/.env.e2e
  • e2e/seed/e2e_seed.sql
🚧 Files skipped from review as they are similar to previous changes (2)
  • docker-compose.e2e.yml
  • e2e/seed/e2e_seed.sql

Comment thread e2e/.env.e2e
INTRO_COURSE_HOST=http://localhost:8082
DEVOPS_CHALLENGE_HOST=http://localhost:9010
TEAM_ALLOCATION_HOST=http://localhost:8083
EXAMPLE_HOST=http://localhost:8086

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Reorder EXAMPLE_HOST before INTERVIEW_HOST.

This currently triggers the reported dotenv-linter UnorderedKey warning and may fail environments that enforce dotenv linting.

🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 101-101: [UnorderedKey] The EXAMPLE_HOST key should go before the INTERVIEW_HOST key

(UnorderedKey)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/.env.e2e` at line 101, Move the EXAMPLE_HOST entry in the environment
configuration so it appears before INTERVIEW_HOST, preserving its existing value
and all other entries.

Source: Linters/SAST tools

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

Labels

schau mi o Translation: Ready to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2E: team allocation phase module coverage

1 participant