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

Use getBy, not queryBy, to fail on missing element #1

Merged

Conversation

sompylasar
Copy link
Collaborator

BREAKING CHANGE: The queries will now throw a useful message and fail
the test if the queried element is missing.

@sompylasar
Copy link
Collaborator Author

While working on a PR to add getCommandWaiter to dom-testing-library as waitForElements, I realized that the breaking change I made here is not compatible with the current implementation of getCommandWaiter which does not catch exceptions. Somehow this works with my setup of Cypress, both waits for DOM and rejects if not found. I'll work more on this, so stay tuned.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Super! Thanks :)

@kentcdodds kentcdodds merged commit 5106558 into testing-library:master Apr 7, 2018
@sompylasar
Copy link
Collaborator Author

@kentcdodds Wowow I should have told you explicitly not to merge it yet, sorry. Anyway, it's still experimental, so hopefully won't break anyone's setups. I'm working on adding the waiter to dom-testing-library with some tests to it.

@kentcdodds
Copy link
Member

No worries. This hasn't been published to npm yet 😉 I want to wait until it's fully tested first.

@sompylasar
Copy link
Collaborator Author

For the record, waitForElement is being added here: testing-library/dom-testing-library#10

@kentcdodds
Copy link
Member

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants