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

docs: add example to expand the usage of the get method #5469

Closed
wants to merge 6 commits into from

Conversation

hlawuleka
Copy link

No description provided.

@netlify
Copy link

netlify bot commented Sep 7, 2023

👷 Deploy request for cypress-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a0208be

@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for benevolent-cat-040f48 ready!

Name Link
🔨 Latest commit a0208be
🔍 Latest deploy log https://app.netlify.com/sites/benevolent-cat-040f48/deploys/64f9d91ccb45cd00081112d9
😎 Deploy Preview https://deploy-preview-5469--benevolent-cat-040f48.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cypress-app-bot
Copy link
Collaborator

docs/api/queries/get.mdx Outdated Show resolved Hide resolved
docs/api/queries/get.mdx Outdated Show resolved Hide resolved
@MikeMcC399
Copy link
Contributor

Copy link
Contributor

@marktnoonan marktnoonan left a comment

Choose a reason for hiding this comment

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

I made a couple of comments:

  • The syntax doesn't seem right in the example
  • The code could use some more context to explain why you might want to do this

Otherwise, this looks good! I would be happy to approve after these changes are made.

@@ -143,6 +143,12 @@ cy.get('form').within(() => {
})
```

#### Find an anchor element by its label/text, remove some attribute and click it

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to an add explanation of why this is useful. Something like:

Suggested change
The following may be useful to change remove a `target` of `"_blank"` before clicking a link that would otherwise launch a new tab/window:

#### Find an anchor element by its label/text, remove some attribute and click it

```javascript
cy.get('a', { name: 'My link text' }).invoke('removeAttr', 'target').click();
Copy link
Contributor

Choose a reason for hiding this comment

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

The syntax here is not correct - it looks like a mix of Cypress and Testing Library syntax, the following would work though:

Suggested change
cy.get('a', { name: 'My link text' }).invoke('removeAttr', 'target').click();
cy.contains('a', 'hello').invoke('removeAttr', 'target').click();

Copy link
Contributor

Choose a reason for hiding this comment

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

@marktnoonan

If the example is changed from cy.get() to cy.contains(), would it then need to be added to https://github.com/cypress-io/cypress-documentation/blob/main/docs/api/queries/contains.mdx instead?

@jaffrepaul jaffrepaul removed their request for review September 29, 2023 19:27
@jaffrepaul jaffrepaul removed their assignment Sep 29, 2023
@jennifer-shehane
Copy link
Member

@hlawuleka Thanks for the contribution! Could you please sign our CLA? Also can you address the feedback? Otherwise we'll need to close this PR.

@emilyrohrbough
Copy link
Member

@hlawuleka We haven't heard anything from you, so we are closing this PR. If you have time to take another look, please re-open with the provided feedback addressed!

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.

8 participants