- Those that test everything together, the whole stack.
Just use regular TestCafe tests.
Test only frontend in isolation.
You can implement a mock server using request hooks, which will be added in TestCafe 0.20.0. We are now testing this version and are going to release it in a few days.
Alternatively, you can use client tests for separate modules.
Test api server in isolation.
Generally, TestCafe is designed for functional/end-to-end (e2e) tests. From what I gather, you wish to test CRUD operations and work with your database. If so, generally unit tests, not functional/e2e tests are performed for this. So, I suggest you add unit tests, e.g. with mocha.
I would love to hear some best practices from your side for each of these cases!
I recommend you take a look at TestPyramid by Martin Fowler and The Front-End Test Pyramid: How to Rethink Your Testing by Edd Yerburgh. The main idea of both articles is that there is no need to add too many e2e tests.
To sum-up, TestCafe is suitable for your first task ideally, for the second task - depending on your specific scenario, for the last task - it is better to use unit testing frameworks instead.