What value do you see in the DOM comparison? I find the current RF 4 tests that use xmldiff to very the generated DOM do not guard against regressions, but merely introduce overhead in updating the tests when introducin changes. To me it makes more sense to check that a particular element is present, rather than checking that is it present in a praticular tree representation.

The other conceptual problem with testing markup by expectations is that you are usually writing a test to verify what you expect to see.

Does it contain this and that?

You don't test against what is not expected to see at all.

I think that's the key point. You test verifying what you expect to see, because it is important. The presence of additional spans/divs used for positioning and/or styling is not important, and shuld be excluded from the test. Otherwise the test will fail when those non-functional elements are changed, and you end up with a test maintenance burden when anytime you modify the DOM structure.

OTOH once a component if finalized, the DOM structure does not change frequently, and it would be beneficial to catch breaking changes in DOM generation code introduced by a library upgrade. I'm just skeptical that such breaking changes wouldn't be caught by testing markup expectations - tests for the critical pieces of markup.