Comments (7)
This sounds like a pretty good idea. I've been using the debug method quite often, and it's usually just to check that at element exists or not. I've found that styling can useful in some cases though, particularly when the component tree has several views for layout. They kind of provide some context.
I agree that they should definitely stay in snapshots as they play a very useful role in sanity checking the rendered output.
from native-testing-library.
Thanks for the feedback @lewie9021! I think this is a good call out.
My team really only ever sees debug when the library calls it because something wasn't found, and then what we're usually looking for at that point is what is actually on the screen instead of what we thought was there. But, good point that not everyone uses it that way. At some point, depending on the feedback we get, I may just publish a beta with styles stripped out and see what folks think about it.
Just wondering, have you checked out jest-native? Especially for asserting/checking styles, it's super useful!
from native-testing-library.
I think it's great that debug is ran automatically if there is a failure and I use it for exactly that. The cases when I use it manually is usually during the creating of tests, especially when I'm dealing with complex forms. I think publishing a beta would make the most sense.
I've not just yet, but it's certainly something I'll be looking into very soon. Out of curiosity, does the disabled matcher take into account accessabilityStates too? I think it could be useful to have a selected matcher too. This is something I've had to write myself recently.
from native-testing-library.
Yep, it does take the accessibility state into account! Another thing to keep in mind if you’re looking for something that’s selected is that you can do this:
getByText(
/hello/i,
{ selector: ({ props }) => props.accessibilityStates.includes(‘selected’) }
);
I can take a look at a pull request for a selected matcher
expect(element).toHaveProp(‘accessibilityState’, [‘selected’])
but I could still take a look if you don’t think these options cover your case! 💯
from native-testing-library.
Thanks for the tip on the second parameter. I didn't realise that was possible!
I think my current knowledge of the two repos is too limited to be comfortable with submitting such a PR at this time. To avoid derailing this discussion any further, I'll potentially raise an issue in the future to debate it more directly. I appreciate the alternative approaches you have suggested :)
Please keep us posted on the beta release. I'm interested in testing the proposed debug output.
from native-testing-library.
I’ve thought about this more and researched how it works with inline styles in dom-testing-library, and decided this would be too much custom behavior. This is going down a path of implementing custom behaviors that I’d really rather this library not deal with or maintain for now.
That said, it may be very possible for someone to build a plug-in for NTL that could print the native test instances this way, maybe it would be a good ecosystem package 🤷♂️
from native-testing-library.
After reading this, I doubt you'll be interested but I've submitted a PR for this exact issue #70 . I'm not familiar with how a plugin would work in this instance, I would be interested in moving it to a plugin if you're not interested in adding it to this repo -- would you be willing to point me in the right direction for this?
from native-testing-library.
Related Issues (20)
- Preset with Expo in install doc is out of date HOT 3
- Support for fire Scrollview onScroll events HOT 1
- query does not work in react-native and apollo HOT 3
- fix act warning on latest react native version v62 when running multiple tests HOT 2
- How do I use getByText without it getting hung up on a <Image> inside the <Text>? HOT 3
- How should drag events be simulated? HOT 1
- ValueChange does not work as expected with Picker HOT 3
- "Unable to find an element with the value" with Picker HOT 2
- View's 'measure' method callback not invoked HOT 1
- Cannot convert undefined or null to object at assign (<anonymous>) HOT 13
- Check disabled button HOT 2
- View's `measure` + other native methods are null HOT 2
- Help with test setup HOT 1
- Test failures related to LogBox HOT 3
- Test failure after 0.63 HOT 2
- Support Installation via Git Dependency HOT 1
- Add upcoming deprecation to project README HOT 5
- fireEvent.layout doesn't trigger onLayout for TouchableOpacity HOT 2
- queryByTitle missing? HOT 1
- v6.0.0 don't works with react-native 0.61.5 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from native-testing-library.