forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alert.spec.ts
51 lines (47 loc) · 1.75 KB
/
alert.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
describe('Alert Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/alert-demo-nav-link');
});
it('Verify alerts close', () => {
cy.get('#test-button-1').click();
cy.get('#test-button-2').click();
cy.get('#info-alert').should('not.exist');
});
it('Verify truncateTitle and no tooltip on short text', () => {
cy.get('#default-alert > .pf-c-alert__title')
.should('have.class', 'pf-m-truncate')
.then((noTooltipLink: JQuery<HTMLDivElement>) => {
cy.wrap(noTooltipLink)
.trigger('mouseenter')
.get('.pf-c-tooltip')
.should('not.exist');
cy.wrap(noTooltipLink).trigger('mouseleave');
});
});
it('Verify truncateTitle alert and tooltip', () => {
cy.get('#long-title-alert > .pf-c-alert__title')
.should('have.class', 'pf-m-truncate')
.then((tooltipLink: JQuery<HTMLDivElement>) => {
cy.get('.pf-c-tooltip').should('not.exist');
cy.wrap(tooltipLink)
.trigger('mouseenter')
.get('.pf-c-tooltip')
.should('exist');
cy.wrap(tooltipLink).trigger('mouseleave');
});
});
it('Verify expandable alert', () => {
cy.get('#expandable-alert')
.should('have.class', 'pf-m-expandable')
.should('not.have.class', 'pf-m-expanded')
.within(() => {
cy.get('.pf-c-alert__description').should('not.exist');
cy.get('.pf-c-alert__toggle').click();
cy.get('.pf-c-alert__description').should('exist');
cy.root().should('have.class', 'pf-m-expanded');
cy.get('.pf-c-alert__toggle').click();
cy.get('.pf-c-alert__description').should('not.exist');
cy.root().should('not.have.class', 'pf-m-expanded');
});
});
});