As shown in the documentation, the type can be “error” | “info” | “success” | “warning”. But when i want to wite cypress tests, i do not have a selector for the type e. g. there seems to be no attribute i could refer on regarding the appropriate type/severity. Is there a way to locate an ix-toaster of a certain type?
Hello @Peter.Hellmann, thanks for reaching out! I have created a ticket for this, we will address this issue in an upcoming sprint.
1 Like
Thanks for supporting. The current workaround is to check the style of the icon, which is ugly but it works:
Then(
‘a {string} toastr is shown, containing {string}’,
(type: string, message: string) => {
const typeColorMap: { [key: string]: string } = {
error: ‘var(–theme-color-alarm)’,
info: ‘var(–theme-color-std-text)’,
success: ‘var(–theme-color-success)’,
warning: ‘var(–theme-color-warning)’,
};
const color = typeColorMap[type];
cy.get('ix-toast', { timeout: toastrMinTimeout })
.find(`ix-icon[style*="${color}"]`)
.should('be.visible');
cy.get('ix-toast', { timeout: toastrMinTimeout })
.contains(message)
.should('have.length', 1);
}
);