visualAssert seems not precise enough/how to confirm the Text Contents are formatted as expected?

I have a macro that checks using visualAssert the content of an editor. It is supposed to confirm that there are 2 line breaks in the text.

Thus, my steps are as follows:

  • create content using a macro step
  • assertVisual the content looks exactly as expected
  • save content
  • assertVisual again the content looks exactly as expected.

The content is as such:

<h1>This is a heading</h1>
This is a paragraph.

This is a "fake" paragraph.

the visualAssert checks an exact image of that content in the editor. Only the editor area is captured in the image.

I would expect that if the content looks like this

<h1>This is a heading</h1>
This is a paragraph. This is a "fake" paragraph.

the assertVisual would fail.

But it passes with flying colors.

This is the image used to assert:
(cannot upload as have no rights :frowning:)

Am I misunderstanding the usage of assertVisual? Or is this a bug?

How else would the exact content as illustrated above be verified?
I need to know if the 2 “fake” paragraphs are actually on 2 distinct lines, and if the h tags are there.

Thanks!

Resolved by adding a @1 confidence to the target value, which solved the issue.


Now my only problem is that the visualAssert triggers a switch to the actual window/screen where it has to assert the image, instead of doing that in the “background” so the UI.Vision GUI stays open.
This is a problem because if the assertion fails, one has no clue, it does not switch back to the GUI - it just stays on the “to assert” window.

However that is another topic.
The issue here is resolved by using confidence statement.