How it started
This week I started writing code. While initially it was smooth when writing pre/post checks for logged-in-user.ts. It started falling apart when I started working on M1.2 which was to implement some of the acceptance tests for Logged-In User and Logged-Out User. There where many things contributed to this and some them can be mitigated if proper steps are taken.
What went wrong
Firstly, the some of the CUJs weren’t well written. When I looked at CUJs many felt like incomplete or not combined properly. While this can seem as major issue, I think there were few more issues which were big but can be improved on.
1. Writing code all again.
When I checked out CUJs, I started implementing whole acceptance tests from scratch. I thought that functions were written (in /utilities/users/ folder), I can rewrite the whole flow (test files in /specs/ folder). However, this consumed a lot of time. A better alternative would be to take flow part from old acceptance tests and modify it by the requirements of new CUJs
2. Running acceptance tests.
Running acceptance tests was (maybe still is) a big bottleneck. When I need to very if bugs are fixed, I have two option — run on CI, or run on local environment. What I wanted was a proper local setup. But it meant shutting down current server and thus undoing all of activities I did on server to write tests. Additionally, running acceptance tests on server boots it up from scratch taking 2-3 minutes extra. Though, I have found and exploring few solutions.
- Removing all tests from CI (Works): Remove all tests including e2e tests and create a commit starting with name “REVERT IT: ”. Once PR is ready to merge revert this commit.
- Use Jest directly (very messy, but quick way to check for bug fixes): In this method, boot the server and run jest manually. Additionally, update
afterAll()to not close browsers if in DEBUG mode. This will us check what caused the bug and we can continue. When re-running the test, we can comment out the test code that is already executed and might cause the errors. - Using Docker (didn’t work): I planned to change communication ports in
docker-compose.ymland try if 2 servers run at the same time. Though servers did run, the docker server wasn’t able to communicate with counterpart of Firebase Auth container.
How it’s going.
Well, I am on my schedule except for M1.2. For M1.2 I plan to dedicate a day and implement acceptance tests based on current version of CUJv3 Doc.