As it turns out, TDD on the frontend follows a similar approach involving automated UI testing and Unit tests.
Testing strategies
Automated UI testing
When we write E2E tests for our API, we first compose our request, send it, and assert that it returns what is expected. In other words, our E2E tests are mimicking how an end user would interact with our API. For the frontend, a user would interact with our application through the user interface (UI). Therefore, the equivalent to E2E testing would be automated UI testing.
UI tests automate the actions that a user of the application would take. For example, if we want to test that an user can register, we'd write a test that:
- Navigates to the /register page
- Types in the...