In my work-project I’ve got an issue with the search in a data record list.
When I enter the search word into the data record list search field and I wait for the successful response of the automatically generated POST call, there is lag of almost 1500ms between when the call gets the 200 OK
response` and when the expected results are shown in the data record list.
The issue is that the table starts to load the results as soon as the success response is received but in this loading time the test moves forward to the next step already which is failing because the table content is not correct yet!
Is there a more pleasant way to skip those 1500ms than to use await page.waitForTimeout(1500)
?
This is my current solution
await Promise.all([
await this.searchField.fill(testNumber.toString()),
await this.page.waitForResponse(resp => resp.url().includes('<PART OF THE URL>') && resp.status() === 200)
])
await this.page.waitForTimeout(1500)
Without the await page.waitForTimeout(1500)
it doesn’t work.