I have a project in Django, with some pages using React to enhance user experience. I want to create integration tests to ensure there is no regression in those pages over time. After some struggling, I chose to test nightwatch.js
.
I have my webserver dedicated for testing running on localhost:8500
and I want that all queries done by nightwatch.js goes on this server. I configured the test tools like this :
...
"test_settings" : {
"default" : {
"launch_url" : "http://localhost:8500/",
...
The problem is I don't know how to use this setting. When I am using the init()
method, it looks like the test get stucked on the homepage... For example, with this test:
module.exports = {
'Test account login in /admin': function (browser) {
browser.init().url('/admin/')
.waitForElementVisible('body', 1000)
.setValue('#id_username', 'username')
... + click, wait, check results
.end();
}
};
... fails, and I can see it is because the browser was still on the homepage (some assert in the code reveals elements from my homepage).
What's the problem here? How can I make the browser be initiliazed on a particular URL ?