-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update fantom test, add helpers (#49337)
Summary: *Note: This diff adds helpers and updates the one test we have. The next diff adds a bunch of tests, see that diff for how these helpers are used to scale to a large number of tests.* ----- ## Overview Adds helpers for the LogBox e2e test to make it easier to write simple, readable, tests with a healthy level of abstraction over the e2e APIs. ## API The helpers expose an ability to render a component, and return methods to get the UI state: ``` // Returns the LogBox inspector UI as an object. getInspectorUI: () => ?InspectorUI, // Returns the LogBox notification UI as an object. getNotificationUI: () => ?NotificationUI, ``` These return objects that represent the main text elements in the UI like `title` and `message`. The helpers also provide methods for interacting with the LogBox UI: ``` // True if the LogBox inspector is open. isOpen: () => boolean, // Tap the notification to open the LogBox inspector. openNotification: () => void, // Tap to close the notification. dimissNotification: () => void, // Tap the minimize button to collapse the LogBox inspector. mimimizeInspector: () => void, // Tap the dismiss button to close the LogBox inspector. dismissInspector: () => void, // Tap the next button to go to the next log. nextLog: () => void, // Tap the previous button to go to the previous log. previousLog: () => void, ``` ## Example test This allows writing tests like: ``` test('should log error', () => { const logBox = renderLogBox(<ComponentThatErrors />); // Should show notification expect(logBox.isOpen()).toBe(false); expect(logBox.getNotifciationUI()).toEqual({ count: '!', message: 'error message', }); // Tap the notification logBox.openNotification(); // Should show log expect(logBox.isOpen()).toBe(true); expect(logBox.getInspectorUI()).toEqual({ header: 'Log 1 of 1', title: 'Console Error', message: 'error message', stackFrames: [ 'ComponentThatErrors' ], componentStackFrames: [ '<ComponentThatErrors />', ], isDismissable: true, }); }) ``` ## Changelog Changelog: [internal] Reviewed By: rubennorte Differential Revision: D69443041
- Loading branch information
1 parent
a733930
commit 25939f4
Showing
22 changed files
with
375 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.