My scenario: I have developed a unique custom Django widget that relies on JavaScript, and now I need to write tests for it. My objective is to create HTML with a form containing inputs generated by the widget, submit this form, and then perform validations on the incoming POST request. I believe this can be achieved using Selenium and optionally LiveServerTestCase.
However, I am encountering some challenges:
- Selenium does not provide the capability to intercept such requests.
- LiveServerTestCase initiates the server in a separate thread, which makes it difficult to access view code and include assertions.
Is there a way to intercept requests from Selenium? Are there alternative methods to effectively test these functionalities?