Any angular tips and tricks for automation testing?

As a selenium automation QA what I can ask our Аngular devs to make it easier for me to test our projects?
Can they add any static locators to their web elements?

It’s been a long while since I’ve touched Angular, but the first thing I remember and can recommend is that you use Protractor if you aren’t already, as it’s probably the only Selenium-based framework that can easily attach to angular bindings.

Aside from that, the best thing I can suggest is some static attribute on the elements you’re targeting to test that won’t be modified by CSS changes and the like. We use a “data-test=” attribute on the HTML element, which can be picked up with a css selector pattern using ‘[data-test=“foo”]’

3 Likes

I agree with topperfalkon, Angular generates a lot of ids which do not persist between builds so adding an attribute will allow you to find elements on the page by the attribute. data-test= is a great one! also if they can add an attribute which tells you when the page is done loading. we used a this: page-load=true is visible while the page is loading and it is false when its loaded.

2 Likes