mercredi 31 octobre 2018

Will an element with an href attribute always work when clicked

I am writing a suite of automated UI tests. I have a set of tests that verifies the links in a navbar work correctly, they take an annoying long time because it's loading 2 pages per test and there are many links in the nav bar. I am wondering if it is necessary to actually click the links?

One of the links would look like this, they're all basically the same, all contained inside a list of of <li> elements:

<a href="/projects/7d9162e5-e59c-452e-b9f5-684a2e0f2924/home" data-reactid=".0.2.0.0.0.$0.0">
  <span class="icon icon-home" data-reactid=".0.2.0.0.0.$0.0.0"></span>
  <span class="label" data-reactid=".0.2.0.0.0.$0.0.1">Home</span>
</a>

I could grab the content from the href attribute and request the page programmatically (don't load it in the browser) to assert that the href is correct and this would be significantly faster.

Is there any chance that an element could have an href attribute that points to the page as expected, but for whatever reason clicking on this element could be broken?

Aucun commentaire:

Enregistrer un commentaire