grafana / xk6-browser

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

Generalize `page.on` events #1227

Open ankur22 opened 6 months ago

ankur22 commented 6 months ago

Feature Description

We currently have page.on('console') which enables users to action on all console logs that the website under test logs. We have many community requests to add more event handling for other events. These event handling will enable users to perform more dynamic actions in their test when certain events occur which can help them capture, diagnose, and assert when things are not going well or are going well.

Suggested Solution (optional)

In Playwright they have the following events on page.on:

Already existing or connected issues / PRs (optional)

https://github.com/grafana/xk6-browser/issues/1153

### Tasks
- [ ] Refactor `page.on('console')` to make it generic to allow extension of more events.
- [ ] Evaluate each event and decide which ones give the most value.
- [ ] Implement each event handling of the events that give the most value.
inancgumus commented 4 months ago

I've changed this issue's title to focus on the generalization of page.on as the total work is lengthy. Please revert if you think otherwise.