I have this problem when trying to execute this block of code for each of the categories of an array, which works when not needing to use Promise.all() to handle only one category. When executing tests, something seems to be missing because I get an error (see below).
await Promise.all(categories.map(async category => {
// Upload file
await orderPage.uploadFile(`data/${fileName}`);
// Open Category dropdown menu
await orderPage.clickElement(await orderPage.categoryMenu);
// Select category
await orderPage.categorySearchBar.setValue(category.name);
await browser.keys('Enter');
}));
uploadFile() method:
async uploadFile(filePath) {
const remoteFilePath = await browser.uploadFile(filePath);
await browser.execute(() => {
document.querySelector('input[type=file]').style.display = 'block';
});
await this.inputFile.setValue(remoteFilePath);
}
This is the error I get: Error message