Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Async BrowserContext #1590

Merged
merged 18 commits into from
May 21, 2024
Merged

Conversation

inancgumus
Copy link
Member

What?

Update relevant BrowserContext methods from sync to async.

Checklist

  • I have used a meaningful title for the PR.
  • I have described the changes I've made in the "What?" section above.
  • I have performed a self-review of my changes.
  • I have run the npm start command locally and verified that the changes look good.
  • I have made my changes in the docs/sources/next folder of the documentation.
  • I have reflected my changes in the docs/sources/v{most_recent_release} folder of the documentation.
  • I have reflected my changes in the relevant folders of the two previous k6 versions of the documentation (if still applicable to previous versions).

Related PR(s)/Issue(s)

grafana/xk6-browser#1295

@inancgumus inancgumus marked this pull request as ready for review May 20, 2024 08:12
@inancgumus inancgumus requested review from ankur22 and removed request for heitortsergent and ankur22 May 20, 2024 08:12
@inancgumus inancgumus marked this pull request as draft May 20, 2024 08:16
@inancgumus inancgumus marked this pull request as ready for review May 20, 2024 09:29
@inancgumus inancgumus requested a review from ankur22 May 20, 2024 09:29
Copy link
Collaborator

@allansson allansson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one heck of a job. 👍

I found one example where we're missing an await, but other than that I couldn't find anything.

Left a suggestion on the return types as well.

Copy link
Contributor

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -5,14 +5,20 @@ description: 'Clears context cookies.'

# addCookies()

Adds a list of [cookies](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/cookie) into the [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/cookie). All pages within this [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/cookie) will have these [cookies](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/cookie) set.
Adds a list of [cookies](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/cookie) into the [browser context](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/). All pages within this [browser context](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/) will have these [cookies](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/cookie) set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the BrowserContext to browser context change. I think it makes it easier for the user to see it used in one way, so that they can easily understand the relationship between all the components.

Why did you make the change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was easier to read in a sentence. We've been using this pattern in other places (before this PR), too. I've created an issue to keep everything consistent: #1596.

@inancgumus inancgumus merged commit ef7728d into main-browser-async May 21, 2024
2 checks passed
@inancgumus inancgumus deleted the async/browsercontext branch May 21, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: browser The browser module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants