-
Notifications
You must be signed in to change notification settings - Fork 734
Automation gap - WOAUILIB-3704 #2902
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
Conversation
Its fails with error when I try to reset the modules after each test. |
@@ -44,3 +45,45 @@ describe('Text', () => { | |||
}); | |||
}); | |||
}); | |||
|
|||
// jest.mock('react-native/Libraries/ReactNative/I18nManager', () => ({ |
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.
@nitzanwix
Instead of mocking RN it might be simpler to override/mock our Constants.isRLT value
See here
https://github.com/wix/react-native-ui-lib/blob/master/src/components/sortableGridList/__tests__/usePresenter.spec.tsx
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.
He's testing the style here, so I don't think that'll work.
Although I'm not sure this is the best way to test this bug, an alternative might be with screenshots and I think we don't want to rely on that here.
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.
I'm trying to test the following. overriding/mocking in Constants will work for RTL but I want to also mock the platform. Currently this doesn't work and pops a invalid hook usage error.
react-native-ui-lib/src/components/text/index.tsx
Lines 195 to 203 in 068b4d0
...Platform.select({ | |
ios: { | |
writingDirection: Constants.isRTL ? writingDirectionTypes.RTL : writingDirectionTypes.LTR | |
}, | |
android: { | |
textAlign: 'left' | |
} | |
}) | |
}, |
Constants.isRTL = isRTL; | ||
}; | ||
|
||
describe('Automation gap', () => { |
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.
Consider adding tests for LTR as well
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.
For text? Or in general?
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.
The same tests but with LTR
const {onPress} = textProps; | ||
const renderTree = render(<WrapperScreenWithText onPress={onPress}/>); | ||
const textDriver = TextDriver({renderTree, testID: TEXT_ID}); | ||
return {renderTree, textDriver}; |
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.
Don't think you need to return renderTree
here
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.
Nice
Constants.isRTL = isRTL; | ||
}; | ||
|
||
describe('Automation gap', () => { |
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.
Please change the name
Description
Added automation gap for text alignment on rtl.
Changelog
N/A
Additional info
WOAUILIB-3704