The value of filterdList.length always equals the total number of elements with the code provided below. As a result, this method consistently returns false because there is only one item in the table that matches the given name.
async itemExists(name) : Promise<boolean>{
const itemList = await element.all(this.itemList)
const filteredList= await Promise.all(itemList.filter( async (item) =>{
let text = await item.getText();
if (text == name) {
return true;
}
}));
return await filteredList.length == 1;
}
This method can be called as shown below:
console.log(await itemExists('unique item name'));