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 browser module isVisible and isHidden docs #1457

Merged
merged 9 commits into from
Jan 4, 2024

Conversation

ankur22
Copy link
Contributor

@ankur22 ankur22 commented Dec 20, 2023

What?

This updates the docs for the isVisible and isHidden APIs in all associated classes.

Checklist

Please fill in this template:

  • 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 make docs command locally and verified that the changes look good.

If updating the documentation for the next release of k6:

  • I have made my changes in the docs/sources/next folder of the documentation.

Related PR(s)/Issue(s)

Related issue: grafana/xk6-browser#981

@ankur22 ankur22 force-pushed the update/browser-isVisible-isHidden branch from 3b441a6 to 28d80f9 Compare December 20, 2023 15:49
Copy link
Contributor

@ka3de ka3de left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just some small suggestions, but feel free to discard them if you think the current version is OK, these are no blockers by any means.

Also, I have a comment, maybe more for @heitortsergent:
Now we have a mix of methods for elementHandle and frame, some we do have our own specific documentation page, and some are just links to Playwright's method, as they are equivalent. This makes it look a little bit weird in the navigation sidebar. See:
Screenshot from 2023-12-21 08-21-15

The elementHandle has many methods listed in the table, on the right side doc, but on the left navigation sidebar it only lists the ones that we have documentation for. The same happens for frame. I guess this is OK and expected until we progressively add our own specific docs for each method, but it seemed a little bit weird, as it might look like it only has these two methods which are documented.

Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

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

LGTM after @ka3de's suggestions.

Copy link
Collaborator

@heitortsergent heitortsergent left a comment

Choose a reason for hiding this comment

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

Just left one comment with a question, LGTM! :shipit:

@ka3de that's a good point about the left-hand navigation only including a few methods, that can be confusing... One thing we could do is to fill out the section with pages for all the methods, even if the content in those pages is just linking to the playwright docs. But I'd also be curious if any users find it confusing, or think we don't might not support more methods if they only look at the left-hand navigation.


{{% admonition type="warning" %}}

Use locator-based [`locator.isHidden([options])`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/locator/ishidden/) instead.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just out of curiosity, is there a specific reason why we recommend using the locator-based method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Locators are seen to be better since they will auto wait and retry the search for the element with the given selector. This means that we can set a locator, navigate to a page, and then still work with the locator after the navigation occurs (as long as the element is actually on the new page). Whereas with the frame APIs, once a navigation occurs, we cannot use the old reference to the element that was setup before the navigation. In a nutshell, locators are safer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, that does seem better, thanks for the explanation! 🙇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably needs to be explained somewhere in our docs though 👍

Copy link
Member

Choose a reason for hiding this comment

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

We explain locators with a Page Object Model example here. We might expand on it.

@ankur22 ankur22 merged commit 899aa75 into update/browser-dblclick Jan 4, 2024
2 checks passed
@ankur22 ankur22 deleted the update/browser-isVisible-isHidden branch January 4, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants