Is there a way to check if an element is present without using expect with Detox? Right now I'm having to nest my logic in try/catch blocks to control the flow of a test to mitigate flakiness as it checks the state of a screen before moving forward with the test. I would much rather be able to do with using if/else.
Thanks in advance for any suggestions.
Not the most elegant solution but I have used the following to stream line my code.
In a helper file, I create functions that wrap the try/catch, and return true/false:
For example:
Then when I am performing tests that depend on that element being visible or not I can do the following:
This isn't the best solution but until Detox come up with the ability to have if/else then it could suffice in a pinch.