mardi 2 juillet 2019

angular testing get element by text

I'm trying to write unit tests for an angular 8 application. Inside spec file of a component (navbar.component.spec.ts) I want to click buttons. I want to get buttons by inner text of them. How could I do that ?

I'm using *ngFor Only way I can think of is giving ids and using ids like const buttonElem = debug.query(By.css('#asd'));

Aucun commentaire:

Enregistrer un commentaire