Add E2E tests for task submission workflow - #121
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements end-to-end test coverage for the complete task submission workflow, from task creation through successful work submission and status verification. It adds the missing API layer needed to exercise that flow in tests and wires those tests into frontend CI so they run on every pull request.
Previously, the frontend only supported file validation via
POST /api/task-submissions/validate. There was no way to create a task, submit work against it, or verify that task status changed after submission. This PR closes that gap with a lightweight in-memory task workflow and API routes that mirror the TaskBounty contract behavior closely enough for reliable E2E testing.What changed
Task workflow service
frontend/src/lib/task-workflow.tswith in-memory task and submission storageopen→in_progresson first successful submissionresetTaskWorkflowStore()for deterministic test isolation between casesfrontend/src/types/task-workflow.tsNew API routes
POST/api/tasksopenGET/api/tasks/[taskId]POST/api/tasks/[taskId]/submissionsSubmission requests reuse the existing file validation logic from
task-submission-files.ts, so uploads still go through the same security checks (extension allow-list, MIME/content matching, size limits, filename safety).End-to-end tests
Added
frontend/src/lib/task-submission-e2e.test.tswith full workflow coverage:Happy path
openpendingstatusin_progress1Duplicate submission protection
409Invalid task creation
400Invalid file submission
openand submission count stays0CI integration
Updated
.github/workflows/frontend-ci.ymlto runpnpm testbeforepnpm build, so the new E2E tests are enforced in GitHub CI and not just locally.Build fix
Fixed duplicate JSX attributes in
frontend/src/components/Navbar.tsxthat were causing the TypeScript production build to fail.Acceptance criteria
Design notes
This implementation uses an in-memory store rather than on-chain contract calls because the active frontend does not yet have Soroban client wiring for task lifecycle operations. The workflow intentionally mirrors the reference TaskBounty contract semantics:
openin_progressThat makes these tests a useful regression suite now and a stable foundation once the UI and contract integration are added later.
Test plan
cd frontend && pnpm testcd frontend && pnpm build/api/tasks/api/tasks/[taskId]/api/tasks/[taskId]/submissionsPOST /api/tasksGET /api/tasks/{id}POST /api/tasks/{id}/submissionsFollow-ups (out of scope)
closes #85