Search code examples
node.jsselenium-webdrivercucumberjs

cucumber js execution - ELIFECYLE ERR


I'm new to JS and trying cucumber js for the first time

This is how my step defn looks like: Pseudocodes

Given("I launch Google.com", async (){
await Launch.launchGoogle():
})

When("I enter search text cucumber js", async (){
await Launch.searchCucumber():
})

This is how my Launch.js looks like:

module.exports launchGoogle= async function() {
await driver.get("www.google.com"):
}

module.exports searchCucumber = async function(){
await driver.findElement(By.name("q")).sendKeys("cucumber");
}

In this case, when I run the feature with 2 steps, I get ELIFECYCLE ERR at the end of first step.

When I remove the await in the step definitions, it runs fine. But, the console displays as 2 steps passed even before the chrome browser is launched. That is, it fires the Given and When steps and shows the result even as the code in Launch.js is still executing.

Pls help how to solve this?


Solution

  • I just figured out that the default step timeout is 5000ms. Since, launching the browser and hitting the URL was taking more than that, it was failing. i just increased the step timeout to 30000ms and it works fine.