-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Add basic support for interactions #85
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…react,react-native)
* docs: add new methods api docs * docs: update docs * docs: document the `call` method * docs: add docs for owlTestCallbacks * fix: correct example of wrapping a component to add `OwlTestProps` types * docs: update docs * chore: Cleanup ConfigEnv Co-authored-by: Manos Konstantinidis <hello@manos.im>
…rging icon for consistency
manosim
approved these changes
May 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR proposes an alternative solution to using Detox.
Proposed solution
When launching the app for OWL testing, we can patch the
createElementfunction of React; this PR is done by calling theinitClientmethod.This allows us to spy on elements with
testIDsand store a reference to their methods, likeonPressandonChanged; we can also store a ref to the element that allows us to call methods like:focus,scrollToEnd, etc.Ideally, the user won't need to add this manually, but we could do it automatically using, for example, a file called
index.owl.jswhere the app will be compiled using this as the entry-point.In my tests, when calling
initClientin the same file ofindex.js, I couldn't "detect" elements; thecreateElementwas never called for those.The communication between App and Test happens via the server started on launch. I've added a working example of calling the
onPressmethod for a Pressable component.This method also allows us to trigger other actions, like:
onChangeText, focus and scrollToEnd. It can also be used to get the layout size of a ScrollView, which can be used to get a fullscreen screenshot.I've also included an example of how we could wait for certain elements to be visible before taking a screenshot.
Some differences with Detox:
onPressmethod, even though the element is not in view or is disabled.awaitmight be needed by the users to ensure that the screen has been fully rendered.TODO:
index.owl.jswithout the user needing to callinitClient