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

Refactor runtime out of VU context in tests #1433

Closed ankur22 closed 1 week ago

ankur22 commented 2 months ago

What?

Removing the automatic addition of the runtime from the vu context in tests.

Why?

A recent change was added to k6 engine, and I soon realised that there was something broken with the vu context in the browser code. The vu context doesn't automatically come with the runtime, this is added by us.

I wanted to ensure that we weren't surprised when adding the latest change in the k6 engine in the future, so i've removed the automatic addition of the runtime when the vu context is created for the tests.

This means that if we make a change in the codebase that affects the runtime in the vu context we will find out before any changes are added in the k6 engine.

Checklist

Related PR(s)/Issue(s)

inancgumus commented 2 months ago

Great job on making the tests more stable! 🎉 I'm happy to approve this.

I read your explanation, but I’m still a bit confused about why this change is needed. Could you help clarify it for me? Also, I noticed that k6 has a similar setup here if that helps.

One last thing, I saw that the test added in this PR is quite similar to startIteration, which already verifies the tests using it. What do you think about switching to use startIteration?

ankur22 commented 1 week ago

I'm closing this due to the imminent merge.