-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chip-clickable): add cypress test on Chip Clickable
- Loading branch information
1 parent
95868fe
commit 1ac43bf
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { BdsChipClickable } from '../dist/blip-ds-react'; | ||
|
||
const ChipClickable = () => { | ||
return ( | ||
<> | ||
<button>Botão anterior</button> | ||
<BdsChipClickable | ||
avatar="Michael Scott" | ||
clickable | ||
close | ||
color="default" | ||
icon="edit" | ||
size="standard" | ||
onChipClickableClick={cy.stub().as('chipClickableClick')} | ||
> | ||
ChipClickable | ||
</BdsChipClickable> | ||
</> | ||
); | ||
}; | ||
|
||
describe('Teste de Renderização ChipClickable', () => { | ||
// Teste de Renderização | ||
it('deve renderizar o button com o avatar correto', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').should('have.attr', 'avatar', 'Michael Scott'); | ||
}); | ||
// Teste de Renderização | ||
it('deve renderizar o button com o clickable correto', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').should('have.attr', 'clickable', 'true'); | ||
}); | ||
// Teste de Renderização | ||
it('deve renderizar o button com o close correto', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').should('have.attr', 'close', 'true'); | ||
}); | ||
// Teste de Renderização | ||
it('deve renderizar o button com o color correto', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').should('have.attr', 'color', 'default'); | ||
}); | ||
// Teste de Renderização | ||
it('deve renderizar o button com o icon correto', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').should('have.attr', 'icon', 'edit'); | ||
}); | ||
// Teste de Renderização | ||
it('deve renderizar o button com o size correto', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').should('have.attr', 'size', 'standard'); | ||
}); | ||
}); | ||
|
||
describe('Teste de Eventos ChipClickable', () => { | ||
// Teste de Evento bdsClick | ||
it('deve chamar o evento onBdsClick ao clicar', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('bds-chip-clickable').shadow().find('.chip_clickable').click(); | ||
cy.get('@chipClickableClick').should('have.been.called'); | ||
}); | ||
}); | ||
|
||
describe('Teste de Acessibilidade button', () => { | ||
// Teste de Acessibilidade com Tab | ||
it('deve ser possível navegar para o button usando a tecla Tab', () => { | ||
cy.mount(<ChipClickable />); | ||
cy.get('button').first().focus(); | ||
cy.wait(50); | ||
cy.realPress('Tab'); | ||
cy.wait(50); | ||
cy.get('bds-chip-clickable').should('have.focus'); | ||
}); | ||
}); |