Skip to content

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

Merged
merged 9 commits into from
Jan 23, 2024
Merged

Conversation

nitzanyiz
Copy link
Collaborator

@nitzanyiz nitzanyiz commented Jan 17, 2024

Description

Added automation gap for text alignment on rtl.

Changelog

N/A

Additional info

WOAUILIB-3704

@nitzanyiz nitzanyiz requested a review from M-i-k-e-l January 18, 2024 09:04
@nitzanyiz nitzanyiz assigned nitzanyiz and M-i-k-e-l and unassigned nitzanyiz Jan 18, 2024
@nitzanyiz
Copy link
Collaborator Author

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', () => ({
Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

...Platform.select({
ios: {
writingDirection: Constants.isRTL ? writingDirectionTypes.RTL : writingDirectionTypes.LTR
},
android: {
textAlign: 'left'
}
})
},

@ethanshar ethanshar added this to the Quality milestone Jan 22, 2024
@nitzanyiz nitzanyiz marked this pull request as ready for review January 22, 2024 08:57
@nitzanyiz nitzanyiz requested a review from ethanshar January 22, 2024 09:10
@nitzanyiz nitzanyiz changed the title Added test for automation gap bug on android Automation gap - WOAUILIB-3704 Jan 22, 2024
Constants.isRTL = isRTL;
};

describe('Automation gap', () => {
Copy link
Collaborator

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

Copy link
Collaborator Author

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?

Copy link
Collaborator

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};
Copy link
Collaborator

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

Copy link
Collaborator

@M-i-k-e-l M-i-k-e-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@M-i-k-e-l M-i-k-e-l merged commit a50498c into master Jan 23, 2024
@M-i-k-e-l M-i-k-e-l deleted the infra/TextAlignmentAutomationGap branch January 23, 2024 13:20
Constants.isRTL = isRTL;
};

describe('Automation gap', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants