[PR #119] Customer App Task 10: API Tests Against a Real Server (e2e:app)
I requested this work.
- What was done: For the tenth task in the customer app plan, I had Claude build a test suite (
npm run e2e:app) that runs the app’s API functions against a real server. The server starts with a test database container (Testcontainers, a temporary database that is created for each test run and removed afterward). The tests use real requests to check whether the app’s data shapes and the server’s responses match. - Choices made:
- Fake Kakao and Apple sign-in accounts are added in the server’s test start file (
apps/server/test/e2e-main.ts). The file still starts only whenNODE_ENV=test, as before. - Like the admin web tests, the server is first compiled with
tsc(the TypeScript compiler, which turns the code into runnable JavaScript) and then started withnode. When the server responds, the tests run, and the server is stopped at the end. - Only the device features the app calls (secure storage, crypto, device info) are swapped for Node-compatible versions. The server calls (
fetch) are left as they are. - The normal Jest setup replaces
fetchwith a fake, which left status codes empty in the results. So a separate Node setup was used. No new package was added. - The compiled server goes into a folder that Git already ignores.
- Fake Kakao and Apple sign-in accounts are added in the server’s test start file (
- How it was checked:
- Before building, I ran the tests so I could see them fail. The suite could not start at all because its config file did not exist. That was a missing feature, not a wrong test.
- On the first run, two tests failed because of problems in the tests. The third test reused an account that the second test had already linked, so it depended on the order of the tests. The seventh test expected the wrong response for a withdrawn account. Fizz fixed both tests, and two test accounts were added on the server side.
- After the fixes, all 7 tests in
npm run e2e:apppassed. The tests themselves take about 3 seconds. The full run, including compiling the server and starting its container, took about 40 to 60 seconds. The command ends with a “Jest did not exit” warning, but it finishes on its own. I did not find the cause of the warning. npm run verifypassed 412 tests. The two sessions reported different times. The difference looks like a difference in conditions, but I did not confirm that.- The GitHub CI checks,
verifyande2e, both passed.
| Item | Details |
|---|---|
| What was built | The API test suite against a real server (npm run e2e:app), test sign-in accounts, Node-compatible setup |
| What it looks for | Places where the app’s data shapes and server responses do not match, and tests that depend on the order of other tests |
| Checks | e2e:app: 7 of 7 passed; verify: 412 passed; CI verify and e2e passed |
Who did what
- Me: I requested the work.
- Fizz (GPT-6 Luna): wrote the tests before the build, then fixed two of them after the first run.
- Claude (cloud session, Claude Sonnet 5.5): built the setup and the server start file.
- Claude (PL, Claude Sonnet 5.5): coordinated the work and organized the PR.
- Pollen (opencode/glm-5.3-flash-free): did the general review and approved it.
- Claude (Opus 5.5): did a read-only final review and approved it with a few small notes. It found no blocking problems.
What I learned
- A test that depends on the order of other tests breaks when run alone. The third test reused an account that the second test had already linked. Giving each test its own account makes it pass in any order.
- Check the server’s response before writing the expectation. For a withdrawn account, the server returns
403 account_withdrawnon token refresh. The test expected something else. The expectation was changed to match the server test for the same case. - Sending the same instruction to two sessions doubles the output. A follow-up instruction should go to the session that is already open, but a new session was opened by mistake. Both sessions then pushed the same work. The code was the same, but the two timing results were mixed in one sentence. From now on, follow-up instructions go only to the session that is already open.