2 years ago
#54647
marian.vladoi
Can not access some url with jest-cucumber
I am using some simple code to implement e2e testes with jest-cucumber
.
export const givenOpenUrl = (given) => {
given(/^I open "(.*)"$/, async (arg0) => {
await page.goto(`${arg0}`)
})
}
export const thenMatchPageTitle = (then) => {
then(/^I see "(.*)" in the title$/, async (arg0) => {
await expect(page.title()).resolves.toMatch(arg0)
})
}
Also this code fails as well :
describe('Nozzle AI', () => {
beforeAll(async () => {
await page.goto('https://nozzle.ai', {waitUntil: 'domcontentloaded'});
});
it('should be titled "Nozzle"', async () => {
await expect(page.title()).resolves.toMatch('Nozzle');
});
});
However, I get different behaviors based on the URL that is passed.
For example, the tests are passing if I use https://www.google.com/
and failing when I use https://www.nozzle.ai/
with the following error:
Navigation failed because the browser has disconnected!
It seems that the page.title().resolve
has this error:
Expected an Error, but "" was thrown
I noticed that I am able to run this code with success :
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://nozzle.ai', {
waitUntil: 'networkidle2',
});
const title = await page.title()
console.log(title)
await browser.close();
})()
Any suggestions would be highly appreciated!
e2e-testing
cucumberjs
jest-puppeteer
0 Answers
Your Answer