vendredi 18 décembre 2020

testcafe: report the page HTML on any assertion failure

is there a way to make testcafe report the page's html when an assertion fails, regardless of the reason? This information would be helpful in a lot of situations where you're not sure why the test failed and it only gives limited information like this:

1) The specified selector does not match any element in the DOM tree.

      | Selector('button')
    > |   .withText('Foo')

That could occur for any number of reasons, including not being on the page I think I'm on.

Ideally, there would be a way of setting this up in advance instead of changing every single assertion I've already written, but if there is a way of changing this assertion to give me the HTML content, that would be better than where I'm at: When I run through this test by hand, that button is there.

Aucun commentaire:

Enregistrer un commentaire