-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Semantic matching basics #4788 #4793
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
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
8a2ae13
Semantic matching basics #4788
markdevocht bb8ea2c
100% threshold pass with new tests
markdevocht ec360d6
Semantic Types update
markdevocht 1cacc44
Detox changes:
markdevocht 77cc6c5
update of some changes
markdevocht 3cd4be3
Updated code with refactoring and new functionality
markdevocht 8933c66
updates done based on Yarik's comments
markdevocht 036407e
rawType update
markdevocht 9d05359
semantic tests updated
markdevocht 0790be1
revert the old MatchersScreen
markdevocht b9e7b30
Revert "Reverting Yarik's fix and updating iOS simulators to 18.5"
markdevocht 1cce6c8
updated from PR
markdevocht 4ffe12f
update config simulators
markdevocht 5679221
adding scrollview to the main screen
markdevocht ada1f0d
created icon for the example app on iOS
markdevocht 047f3b8
Revert "created icon for the example app on iOS"
markdevocht dc94fda
test update for android
markdevocht 85e197c
cleanup
markdevocht a6f33c4
test updates
markdevocht d05349b
lint error cleanup
markdevocht 8907b0a
update tests
markdevocht 0816552
lint errors update
markdevocht ef69e4c
linter passing
markdevocht 393b42f
test coverage to 100%
markdevocht 27a0507
orientation test update
markdevocht 99e86db
Revert "adding scrollview to the main screen"
markdevocht b56ee9f
Revert "test update for android"
markdevocht d9f3cf6
moving semantic types to bottom of screen
markdevocht e00996d
change of placement of semantic types test on main screen
markdevocht 8188a58
Reapply "Reverting Yarik's fix and updating iOS simulators to 18.5"
markdevocht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| // @ts-nocheck | ||
| jest.mock('../../matchers/semanticTypes', () => ({ | ||
| getTypes: jest.fn(), | ||
| getClasses: jest.fn(), | ||
| includes: jest.fn() | ||
| })); | ||
|
|
||
|
|
||
| const semanticTypes = require('../../matchers/semanticTypes'); | ||
|
|
||
| const { TypeMatcher } = require('./native'); | ||
|
|
||
| describe('Native Matchers', () => { | ||
| describe('TypeMatcher', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('should handle regular class names', () => { | ||
| semanticTypes.includes.mockReturnValue(false); | ||
| semanticTypes.getClasses.mockReturnValue([ | ||
| { className: 'com.example.CustomView', excludes: [] } | ||
| ]); | ||
|
|
||
| expect(() => { | ||
| new TypeMatcher('com.example.CustomView'); | ||
| }).not.toThrow(); | ||
| }); | ||
|
|
||
| it('should handle semantic types automatically', () => { | ||
| semanticTypes.includes.mockReturnValue(true); | ||
| semanticTypes.getClasses.mockReturnValue([ | ||
| { className: 'android.widget.ImageView', excludes: [] }, | ||
| { className: 'com.facebook.react.views.image.ReactImageView', excludes: [] } | ||
| ]); | ||
|
|
||
| expect(() => { | ||
| new TypeMatcher('image'); | ||
| }).not.toThrow(); | ||
| }); | ||
|
|
||
| it('should handle exclusion objects for semantic types', () => { | ||
| semanticTypes.includes.mockReturnValue(true); | ||
| semanticTypes.getClasses.mockReturnValue([ | ||
| { | ||
| className: 'android.widget.ProgressBar', | ||
| excludes: ['android.widget.AbsSeekBar'] | ||
| }, | ||
| { | ||
| className: 'androidx.core.widget.ContentLoadingProgressBar', | ||
| excludes: ['android.widget.AbsSeekBar'] | ||
| } | ||
| ]); | ||
|
|
||
| expect(() => { | ||
| new TypeMatcher('activity-indicator'); | ||
| }).not.toThrow(); | ||
| }); | ||
|
|
||
| it('should handle mixed string and exclusion objects', () => { | ||
| semanticTypes.includes.mockReturnValue(true); | ||
| semanticTypes.getClasses.mockReturnValue([ | ||
| { | ||
| className: 'android.widget.ProgressBar', | ||
| excludes: ['android.widget.AbsSeekBar'] | ||
| }, | ||
| { | ||
| className: 'androidx.core.widget.ContentLoadingProgressBar', | ||
| excludes: ['android.widget.AbsSeekBar'] | ||
| } | ||
| ]); | ||
|
|
||
| expect(() => { | ||
| new TypeMatcher('progress'); | ||
| }).not.toThrow(); | ||
| }); | ||
|
|
||
| it('should handle regular class names when not semantic types', () => { | ||
| semanticTypes.includes.mockReturnValue(false); | ||
| semanticTypes.getClasses.mockReturnValue([ | ||
| { className: 'android.widget.ImageView', excludes: [] } | ||
| ]); | ||
|
|
||
| expect(() => { | ||
| new TypeMatcher('android.widget.ImageView'); | ||
| }).not.toThrow(); | ||
| }); | ||
|
|
||
| it('should throw error when no class names are found', () => { | ||
| semanticTypes.includes.mockReturnValue(false); | ||
| semanticTypes.getClasses.mockReturnValue([]); | ||
|
|
||
| expect(() => { | ||
| new TypeMatcher('empty-type'); | ||
| }).toThrow('No class names found for: empty-type'); | ||
| }); | ||
| }); | ||
| }); |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.