I import an angular component from a library. It has the selector <imported-component-group>
.
I place this component inside my local angular component.
When writing a cypress component test, I can't access this imported component by its component name, but only by a class name I assign to it.
This is how I place the imported component inside my local component:
<imported-component-group *ngIf="showImportedComponent(condition$) | async" class="importedComponentGroup">
<imported-component>
...
</imported-component>
<imported-component>
...
</imported-component>
</imported-component-group>
And from my component test, I try to address it like so:
cy.get('imported-component-group')
and so:
cy.get('<imported-component-group>')
Both approaches do not find my component, but it works, if I address it via the class instead:
cy.get('.importedComponentGroup')
The *ngIf
condition should not be the problem, otherwise cy.get('.importedComponent')
would not find it either. Also, this component exists only once within the HTML code.
Since I only created the class for the component test, I would like to get rid of it and directly address the component by its tag name.
It would be great if anybody has an idea about what I am missing here.