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

test(BackgroundMedia): test for BackgroundMedia added #170

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

niktverd
Copy link
Contributor

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@niktverd niktverd force-pushed the test/background_media branch from e0860aa to aff2faf Compare May 29, 2023 06:40
@@ -78,7 +80,7 @@ const Image = (props: ImageAllProps) => {
const imageBackground = (oneImage: ImageProps) => {
const imageData = getMediaImage(oneImage);
return (
<animated.div style={{transform: parallaxInterpolate}}>
<animated.div style={{transform: parallaxInterpolate}} data-qa={qaIdOfAnimatedDiv}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need custom qa here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, it seems to me that we do not need custom ones
I cannot see necessity to pass a bunch of qaIds so deep in a component.

What we can do here is add a custom role to <animated.div />

<animated.div role="animated-div" />

By this way in a test we can access this element like

screen.getByRole('animated-div') // instead of screen.getByTestId(qaIdOfAnimatedDiv)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UPDATE: Have talk to Andrey. Adding role is not good idea. Describe it test's readme

src/components/Media/Video/Video.tsx Outdated Show resolved Hide resolved
@niktverd niktverd force-pushed the test/background_media branch from aff2faf to 6654cfb Compare June 2, 2023 07:25
expect(component).toHaveStyle(style);
});

test('render video with defined height', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe custom instead of defined?
Here and in other places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

<div
className={b('wrap', videoClassName)}
style={{height}}
data-qa={defaultMediaVideoQa}
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw in other places qa || defaultMediaVideoQa
Should we add here custom qa too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Slightly changed common way we assert qa attributes. Thank you for point on this pattern

@niktverd niktverd force-pushed the test/background_media branch from 872ca66 to 491d1f1 Compare September 8, 2023 12:20
@niktverd niktverd force-pushed the test/background_media branch from 5081b1f to e22eeee Compare September 15, 2023 12:03
@niktverd niktverd merged commit f95a76f into main Sep 15, 2023
3 checks passed
@niktverd niktverd deleted the test/background_media branch September 15, 2023 13:14
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.

3 participants