I have started to implement Navalia, it works great on production but fails when trying on localhost.
Here is my test case:
const { Chrome } = require('navalia');
const pageUrl = 'http://localhost:3000';
describe('Homepage', () => {
let chrome = {};
// Setup a clean instance for each test
beforeEach(() => {
chrome = new Chrome({
timeout: 100000,
flags: { headless: false }
});
});
// Tear down for each test
afterEach(() => {
return chrome.done();
});
it('should load', () => {
return chrome.goto(pageUrl)
.then(() => chrome.exists('[data-test="username"]'))
.then((exists) => expect(exists).toEqual(true));
});
});
When I use my production URL instead of localhost one it works fine. But with localhost I can see chrome opening, the page loads and the close before testing. Here are the logs
navalia:chrome :then() > Executing 1 actions +0ms
navalia:chrome :getChromeCDP() > starting chrome +2ms
navalia:chrome :getChromeCDP() > chrome launched on port 57985 +1s
navalia:chrome :goto() > going to http://localhost:3000 +0ms
navalia:chrome :goto() > waiting for pageload on http://localhost:3000 +2s
navalia:chrome :done() > finished +2s
navalia:chrome :done() > closing chrome +0ms
I finally got it, it was due to jasmine.DEFAULT_TIMEOUT_INTERVAL not being large enough so I increased it adding jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; to my code.
Hi there,
I have started to implement Navalia, it works great on production but fails when trying on localhost.
Here is my test case:
When I use my production URL instead of localhost one it works fine. But with localhost I can see chrome opening, the page loads and the close before testing. Here are the logs
Not sure how to debug that?
Thanks,