Skip to content
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

new driver for hint testing #2898

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

adids1221
Copy link
Contributor

@adids1221 adids1221 commented Jan 16, 2024

Description

Hint - create new driver and refactor tests to it

Changelog

Additional info

@ethanshar ethanshar added this to the Quality milestone Jan 22, 2024
@adids1221 adids1221 marked this pull request as ready for review January 22, 2024 09:04
jestSetup/jest-setup.js Outdated Show resolved Hide resolved
jestSetup/jest-setup.js Show resolved Hide resolved
Comment on lines 26 to 29
const hintTouchableDriver = usePressableDriver<TouchableOpacityProps>(useComponentDriver({
renderTree: props.renderTree,
testID: `${props.testID}`
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this just the Hint itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it is, do you think that the naming isn't good ?
It's the Touchable part of the component with out the View wrapper

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think it should be exported as press and probably something like pressOnBackground: overlayDriver.press for the overlay (same as in Modal)

src/components/hint/Hint.driver.new.ts Outdated Show resolved Hide resolved
src/components/hint/Hint.driver.new.ts Outdated Show resolved Hide resolved
src/components/hint/__tests__/index.spec.tsx Outdated Show resolved Hide resolved
src/components/hint/__tests__/index.spec.tsx Outdated Show resolved Hide resolved
src/components/hint/__tests__/index.spec.tsx Outdated Show resolved Hide resolved
src/components/hint/index.tsx Outdated Show resolved Hide resolved
src/components/hint/index.tsx Outdated Show resolved Hide resolved
@M-i-k-e-l
Copy link
Contributor

@adids1221 I'd also remove the comment from the change log 🙏

@M-i-k-e-l
Copy link
Contributor

Also, nice work on the mock, I'm sure that was not easy 👍

@adids1221
Copy link
Contributor Author

@M-i-k-e-l fix most of the comments, about the onBackgroundPress I'll try to add more test cases.
And about the mock I'll try to ask Niryo and I'll update.


const WhiteHint = <HintTestComponent showHint color={Colors.white}/>;
const WhiteHintDriver = new HintDriver({component: WhiteHint, testID: 'Hint'});
describe('Test Hint modal visibility:', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You want to test the Hint's visibility not the Modal's

return hintPressableDriver.press();
};

const hintPressOnBackground = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be pressOnBackground

Comment on lines 47 to 49
const getModal = () => {
return modalDriver;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is an internal implementation detail, you probably want to externalize isVisible instead

return overlayDriver;
};

const hintPress = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be press

Copy link
Contributor

Choose a reason for hiding this comment

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

Ping

Comment on lines 63 to 65
const getHintPressable = () => {
return hintPressableDriver;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove unused methods

@adids1221
Copy link
Contributor Author

@M-i-k-e-l didn't finished yet, having some issues with the Modal - isVisble in the test.
I'll ping you when all will be ready.

@adids1221
Copy link
Contributor Author

@M-i-k-e-l as we spoke we can't use isVisble on the Modal since it's not rendering to the screen.

@M-i-k-e-l
Copy link
Contributor

Hi @adids1221,
As discussed, please change the getOverlay and modalDriver (this is not the convention BTW) to specific getters

Comment on lines 24 to 27
const hintPressableDriver = usePressableDriver(useComponentDriver({
renderTree: props.renderTree,
testID: `${props.testID}`
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is simply driver, it is a duplicate and should be removed

return overlayDriver;
};

const hintPress = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ping

Comment on lines 47 to 49
const getOnBackgroundPressTouchable = () => {
return overlayDriver;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the convention I was talking about; if you're using getOnBackgroundPressTouchable().exists() the you should export something like isBackgroundExists() and not the whole driver.

return overlayDriver;
};

const getIsModalVisible = () => {
Copy link
Contributor

@M-i-k-e-l M-i-k-e-l Apr 9, 2024

Choose a reason for hiding this comment

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

IMO there should be an isVisible for both modal and overlay

Can't really remember the reason for your previous comment about modal's visibility, lets discuss it if it's still relevant.

@adids1221 adids1221 requested a review from M-i-k-e-l April 9, 2024 06:51
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.

None yet

3 participants