Skip to content

Fix broken snapshot testing #320

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 1 commit into from
Dec 7, 2021

Conversation

syucream
Copy link
Contributor

@syucream syucream commented Dec 4, 2021

Current snapshot doesn't contain content get by async API calls so this PR wait the calls, then assert rendered content.

});
await waitForElementToBeRemoved(screen.getByTestId("loading"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

* NOTE It's a workaround for Material-UI v4 issue on snapshot testing. It works but make snapshot HTML not-human-readable.
* see also https://github.com/mui-org/material-ui/issues/21293#issuecomment-654921524
*/
const modifiedHtml = container.innerHTML
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TablePagination component generates random ids fails snapshot testing. For now it removes these ids from fragment.

mui/material-ui#21293
https://blog.shinki.net/posts/material-ui-testing-library-snapshot

@codecov-commenter
Copy link

Codecov Report

Merging #320 (9c7333c) into master (cbe76a9) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #320   +/-   ##
=======================================
  Coverage   86.69%   86.69%           
=======================================
  Files         101      101           
  Lines        5073     5073           
  Branches     1179     1179           
=======================================
  Hits         4398     4398           
  Misses        408      408           
  Partials      267      267           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbe76a9...9c7333c. Read the comment docs.

@userlocalhost userlocalhost merged commit 8824b36 into dmm-com:master Dec 7, 2021
@userlocalhost userlocalhost deleted the fix/snapshot-testing branch December 7, 2021 06:06
hinashi pushed a commit to hinashi/airone that referenced this pull request Sep 21, 2022
STACK-1896 Feature Source NAT flavor support
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