I have a project which uses Angular and Django and I am experiencing a weird behavior when I test my application using StaticLiveServerTestCase and Selenium.
When I start testing it everything seems to work but, if I refresh the main page I receive a 404. So, if I test without base url it works, but once Angular adds the base url the test returns 404: http://127.0.0.1:8000/baseURL/test
My URL is defined as follows: re_path('test', views.index, name='index')
So, summarizing, when I test http://127.0.0.1:8000/test it works, but if I test http://127.0.0.1:8000/baseURL/test it does not -if I run my app normally, buth URLs work.
According to my novice knowledge and as the url pattern is defined both urls should work. Obviously I am missing something else.
Thanks in advance.
Note: Test class if defined as follows:
class Tests(StaticLiveServerTestCase):
def set_chrome_options(cls):
options = Options()
options.add_experimental_option("useAutomationExtension", False)
return options
@classmethod
def setUpClass(cls):
cls.host = "127.0.0.1"
cls.port = 8000
super(Tests, cls).setUpClass()
cls.selenium = webdriver.Chrome(executable_path=settings.DRIVER_PATH, options=cls.set_chrome_options(cls))
...
Aucun commentaire:
Enregistrer un commentaire