Skip to content

Test file snapshot renders a new baseid for each run #1940

Answered by SiTaggart
macdonmc asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @macdonmc

Yes, this is somewhat unfortunate, but intended behaviour. To ensure our components stay accessible, it requires us to rely quite heavily on IDrefs in HTML. The problem with that is IDs have to be unique them to work correctly. Because we can't guarantee how many or what components are in any given page, to prevent ID clashes we have to rely on unique ID generation.

What that can mean though is you do get indeterminate IDs for tests environments, especially if you are adding tests to a test suite over time.

For that reason, we don't actually recommend snapshotting component markup in tests, we don't even do it ourselves and are slowly replacing any remaining DOM snapshots wit…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@macdonmc
Comment options

Answer selected by kate-porter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants