-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[RNMobile] Add integration test helpers #38619
Conversation
Size Change: +1.56 kB (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
f246b8e
to
da5842f
Compare
da5842f
to
73b35fd
Compare
27bb33a
to
b6ec278
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together! It is quite obvious that a lot of thought went into the organization and potential value gained from the abstractions. 🙇🏻
I left a few questions that I hope will help me better understand some of the code. None are blockers by any means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Great work! Excited to see the impact of making test writing easier and more approachable.
What?
This PR incorporates a set of helper functions for integration tests.
NOTE: I'm planning to also move the helpers from
block-draggable/test/helpers.native.js
in another PR.Why?
This is part of an ongoing effort for making easier writing integration tests for the native version.
How?
The helpers have been extracted mainly from the Gallery block test cases, as it incorporated several of them. A new folder named
integration-test-helpers
has been added totest/native
path, in this folder we'll hold the helpers, ideally one file per helper.In this PR we're incorporating the following ones, some of them were already being exposed from
test/native/helpers.js
file:addBlock
- Adds a block via the block picker.advanceAnimationByTime
,advanceAnimationByFrame
- Advance Reanimated animations by time or frames.dismissModal
- Dismisses a modal.getBlock
- Gets a block from the root block list.getEditorHtml
- Gets the current HTML output of the editor.getInnerBlock
- Gets an inner block from another block.initializeEditor
- Initialize an editor for test assertions.openBlockSettings
- Opens the block settings of the current selected block.changeAndSelectTextOfRichText
- Changes the text and selection of a RichText component.changeTextOfRichText
- Changes the text of a RichText component.pasteIntoRichText
- Paste content into a RichText component.setupCoreBlocks
- Registers all core blocks or a specific list of blocks before running tests (once the tests are run, all registered blocks are unregistered).setupMediaPicker
- Sets up Media Picker mock functions.setupMediaUpload
- Sets up the media upload mock functions for testing.changeTextOfTextInput
- Changes the text of a TextInput component.triggerBlockListLayout
- Helper for ensuring that all items of a Block List component are rendered.waitForModalVisible
- Waits for a modal to be visible.waitForStoreResolvers
- Executes a function that triggers store resolvers and waits for them to be finished.waitFor
- Custom implementation of the "waitFor" utility from@testing-library/react-native
library.withFakeTimers
- Set up fake timers for executing a function and restores them afterwards.withReanimatedTimer
- Prepare timers for executing a function that uses the Reanimated APIs.NOTE: The above helpers are also listed in a README file that is referenced in the React Native Integration Test Guide.
Testing Instructions
npm run native test
.Screenshots or screencast
N/A