Integration testing of React frontend using Django backend server

Does anyone know how to do front-end (React) integration testing with a Django backend server. I was able to write functional tests for the interface with Nightwatch.js and with the fake server API. I can also test the Django REST API separately - Django offers LiveServerTestCase, which can start a test server for you with a test database and destroy it at the end. I am wondering if it is possible in some way to use / configure a Django test server that can be called by the frontend (i.e. the Nightwatch tests). I am open to other ideas on how I can approach this problem.

+3


source to share


1 answer


It's always a bit tricky to integrate with javascript apps with heavy client apps. My tool of choice for this scenario is to use Capybara - a nice Ruby DSL for interacting with web pages - along with the javascript driver included . I have used both webkitdriver and poltergeist successfully. They are both headless, so you can run tests in the background without disrupting the appearance of browsers. (Selenium case ....) There are problems with both in some cases that I don't remember right now.



Since you are using Django, you can try Python testing . I would suggest seeking support from one of the two drivers mentioned above. Also the node.js community might have something useful for this.

+2


source







All Articles