I'm trying to do some coverage, and one of my test consists to click on a button.
But the fact is my button is a custom component, inside another component :
The button
public class TuileRadio extends Button {
/** La classe CSS quand bouton activé */
private String activeClassName = "etude-impact-tuileradio-active";
/** La classe CSS quand bouton désactivé */
private String inactiveClassName = "etude-impact-tuileradio-inactive";
/**
* Constructeur
*/
public TuileRadio() {
super();
setClassName(this.inactiveClassName);
}
...
}
The class which has an instance of TuileRadio
public class TuilePackRadio extends VerticalLayout {
/** TuileRadio associée */
private final TuileRadio tuileRadio;
...
/**
* Constructeur
*
* @param activeImage image si tuile sélectionnée
* @param desactiveImage image si tuile déselectionnée
*/
public TuilePackRadio(final Image activeImage, final Image desactiveImage) {
this(new TuileRadio());
this.activeImage = activeImage;
this.desactiveImage = desactiveImage;
setActive(false);
}
}
I try to click to this button with : _click(_get(TuileRadio.class, spec -> spec.withId(ConstanteEtudeDImpactOptiqueID.ETUDEIMPACT_GARACT_TUILE_RADIO_SANTECLAIR)));
I assume it can finds my TuileRadio, but the click must be on TuilePackRadio (because it does some actions after).
So, how can I simulate the click on the TuilePackRadio ? Because function _click does not recognize it as a button.
Hello,
I'm trying to do some coverage, and one of my test consists to click on a button. But the fact is my button is a custom component, inside another component :
The button
The class which has an instance of TuileRadio
I try to click to this button with :
_click(_get(TuileRadio.class, spec -> spec.withId(ConstanteEtudeDImpactOptiqueID.ETUDEIMPACT_GARACT_TUILE_RADIO_SANTECLAIR)));
I assume it can finds my TuileRadio, but the click must be on TuilePackRadio (because it does some actions after). So, how can I simulate the click on the TuilePackRadio ? Because function _click does not recognize it as a button.
Thank you !