Does anybody know how to do integration testing of a (React) frontend with Django REST backend. I was able to write functional tests for the frontend with Nightwatch.js and with a fake server API. I am also able to separately test Django REST API - Django offers a LiveServerTestCase that can start a test server for you with a test database and destroy it at the end. I'm wondering if it's possible to somehow use/setup Django's test server that can be called by the front end (i.e. Nightwatch tests). I'm open to other ideas on how I can approach this problem.
Setting up our React app to integrate with Django We'll also use the promise-based HTTP client Axios to make HTTP request calls to our Django API. Next, go to the src/index. js file and add the following import statement: import "bootstrap/dist/css/bootstrap.
We have successfully connected our Django backend to a react frontend. You will need the Django REST framework to create the APIs the react frontend application will make use of to get backend data.
It is always a bit tricky to integration test heavy client side javascript applications. My tool of choice for this scenario is to use Capybara - a nice Ruby DSL for interacting with web pages - together with a javascript enabled driver. I have used both webkitdriver and poltergeist succesfully. They are both headless so you can run tests in the background without disturbing browsers popping up. (The case with selenium....) There are issues with both in certain cases that I don't remember right now.
Since you are using Django you may want to do testing in Python. I would suggest looking for support for one of the two drivers mentioned above. Also the node.js community may have something useful for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With