Repository navigation
Add feature tests and Run Tests wiring - #4
Open
pradeep-problemsetters wants to merge 7 commits into
Open
pradeep-problemsetters wants to merge 7 commits into
pradeep-problemsetters wants to merge 7 commits into
Conversation
- Backend tests (pytest, 32): sign-in and profiles, calendars, events, invitation responses, search, availability, insights and repeating events - Frontend tests (Vitest, 13): sign-in, week view, event editor and preview, calendars, search, find a time and insights - scripts/run-tests.cjs from the base template: one Run Tests at a time, results written to output/backend.xml and output/frontend.xml - Each test run uses its own database and drops it at the end, so the app's data is never touched - hackerrank.yml: scoring, test command, ports_settings and read-only test paths - vite.config.js: host and allowedHosts set to true, as the HackerRank config expects
A failed seed stopped the scoring command before bun run test, so neither report was written and the run scored nothing. The tests use their own database and do not need the seed, so the scoring command now runs them either way, like the Node base template does.
…lendar menu Four features had no UI test: answering an invitation from the event preview, choosing a repeat in the event editor, switching profile from the header, and Display this only in a calendar menu. One test each, so every feature now has a frontend test as well as backend tests.
A coverage run showed the same gaps on every stack. Backend: editing an event's guests and repeat rule, search with places and dates, yearly and every-N repeats, bad guest ids, the input rules, past and partly overlapping availability, and tokens for an account that lost its profile or was switched off. Frontend: editing an existing event, month view, and booking through Meet with. One test each, so the suite is now 39 backend and 20 frontend tests.
… runner Review changes: bun run test now runs the backend and frontend suites from package.json and merges their reports into a single output/junit.xml with junit-report-merger (pinned), which is the only scored file. scripts/run-tests.cjs and its scoring-run database mode are gone; every test run uses its own database. hackerrank.yml is no longer read-only. The run fails if either suite fails or ends without writing results.
conftest.py points the tests at one database, <app db>_test, dropped at the start of each run and emptied before every test, instead of a database per run with a sweep for runs that were killed. pytest.ini sets the report path. bun run test is now the same short script on every stack: it runs both suites and merges their reports into output/junit.xml. Each reporter always writes into .cache/junit, so no env vars are needed.
…ini calendar Advanced search sends the place, excluded words and an inclusive date range, and blocks a range that ends before it starts. The insights drawer shows the breakdown by type and by calendar with the remaining time, and Schedule focus time opens a focus-time item. The mini calendar moves the week view to a date picked in another month. Each new test caught two planted app bugs and nothing else failed. The frontend suite is now 23 tests.
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
bun run testruns both suites and merges their reports into oneoutput/junit.xmlwithjunit-report-merger(pinned to 9.0.4). That's the only scored file. pytest (pytest.ini) and Vitest always write their report into.cache/junit/, so the script is the same short line on all three stacks. Addspytestandpytest-timeout(pinned) torequirements.txt.hackerrank.ymlgets the scoring block, the test command,ports_settingsand read-only paths for the tests and test config.hackerrank.ymlitself is not read-only.conftest.pypoints the tests at their own database,<db>_test, before Django starts. It's dropped at the start of each run and emptied before every test, so the seeded demo data is never touched.setup.sh --seed; bun run test). Before, a broken seed stopped it and no report was written at all.vite.config.js:host: trueandallowedHosts: true, so the preview loads on HackerRank's public preview host.Verification
bun run teston Linux: 39 + 23 passing, andoutput/holds onlyjunit.xmlwith all 62 testcases. Stable over repeated runs.junit.xml. A leftover collection in the test database is gone after the next run.output/junit.xml, and the zip HRW stores matches the localgit archivefile for file.App.jsx:268, Ruff E402 inbackend/scripts/seed.py), same as on main. Nothing in the new test files is flagged.Notes
os._exit(0)leaves the backend out ofjunit.xmlwhile the run still exits 0 (HRW then scores those testcases as missing). Both can be hardened when a submission is converted to PBR.output/junit.xmland.cache/junit/. It should only look at tracked files (git ls-files).calendar_dband the Django seed fails with an index name clash. SettingMONGODB_URIinbackend/.envto its own database avoids it. It doesn't happen on HackerRank, where each workspace has its own MongoDB.