grafana / xk6-browser

The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
https://grafana.com/docs/k6/latest/javascript-api/k6-browser/
GNU Affero General Public License v3.0
344 stars 41 forks source link

Instrument page.waitForTimeout #1426

Open ankur22 opened 2 months ago

ankur22 commented 2 months ago

What

We need to instrument page.waitForTimeout with traces like we have done for some other APIs that we have (e.g. page.waitForNavigation).

Why

This is needed so that we can eventually make it clear with the page.waitForTimeout span when the test is performing some sort "sleep"/"wait" call to mimic user behaviour. e.g.:

  1. Navigate to a website.
  2. run page.waitForTimeout for a second to mimic the website user looking for a particular element.

At the moment it is not clear why the span for a page can be long, when it's usually due to the (current) use of sleep.

This would also align better with Playwright.

- [ ] https://github.com/grafana/xk6-browser/pull/1471
- [x] Add to release notes: https://github.com/grafana/k6/commit/705866817c8b8fffebb31c147be98b2dfc43ee21