forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notificationdrawerlightweight.spec.ts
62 lines (52 loc) · 3.35 KB
/
notificationdrawerlightweight.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
52
53
54
55
56
57
58
59
60
61
62
describe('Notification Drawer Lightweight Demo Test', () => {
it('Navigate to the notification drawer lightweight demo', () => {
cy.visit('http://localhost:3000/notification-drawer-lightweight-demo-nav-link');
});
it('Verify text in header title', () => {
cy.get('.pf-v5-c-notification-drawer__header-title').contains('Notifications');
});
it('Verify text in header status', () => {
cy.get('.pf-v5-c-notification-drawer__header-status').contains('2 unread alerts');
});
it('Verify 3 groups exist', () => {
cy.get('.pf-v5-c-notification-drawer__group').then((groups) => expect(groups.length).to.equal(3));
});
it('Verify first and last list items are hidden', () => {
cy.get('.pf-v5-c-notification-drawer__list').first().should('have.attr', 'hidden');
cy.get('.pf-v5-c-notification-drawer__list').eq(1).should('not.have.attr', 'hidden', false);
cy.get('.pf-v5-c-notification-drawer__list').last().should('have.attr', 'hidden');
});
it('Verify first item is expanded after click', () => {
cy.get('.pf-v5-c-notification-drawer__group').first().click();
cy.get('.pf-v5-c-notification-drawer__list').should('not.have.attr', 'hidden');
});
it('Verify list items in lightweight drawer are all in unread state', () => {
cy.get('.pf-v5-c-notification-drawer__list-item').first().should('not.have.class', 'pf-m-read');
cy.get('.pf-v5-c-notification-drawer__list-item').eq(1).should('not.have.class', 'pf-m-read');
cy.get('.pf-v5-c-notification-drawer__list-item').eq(2).should('not.have.class', 'pf-m-read');
cy.get('.pf-v5-c-notification-drawer__list-item').last().should('not.have.class', 'pf-m-read');
});
it('Verify list items are hoverable', () => {
cy.get('.pf-v5-c-notification-drawer__list-item').first().should('have.class', 'pf-m-hoverable');
cy.get('.pf-v5-c-notification-drawer__list-item').eq(1).should('have.class', 'pf-m-hoverable');
cy.get('.pf-v5-c-notification-drawer__list-item').eq(2).should('have.class', 'pf-m-hoverable');
cy.get('.pf-v5-c-notification-drawer__list-item').last().should('have.class', 'pf-m-hoverable');
});
it('Verify list items severities', () => {
cy.get('.pf-v5-c-notification-drawer__list-item').first().should('have.class', 'pf-m-info');
cy.get('.pf-v5-c-notification-drawer__list-item').eq(1).should('have.class', 'pf-m-danger');
cy.get('.pf-v5-c-notification-drawer__list-item').eq(2).should('have.class', 'pf-m-warning');
cy.get('.pf-v5-c-notification-drawer__list-item').last().should('have.class', 'pf-m-success');
});
it('Verify timestamp in list items', () => {
cy.get('.pf-v5-c-notification-drawer__list-item-timestamp').first().contains('5 minutes ago');
cy.get('.pf-v5-c-notification-drawer__list-item-timestamp').eq(1).contains('10 minutes ago');
cy.get('.pf-v5-c-notification-drawer__list-item-timestamp').eq(2).contains('20 minutes ago');
cy.get('.pf-v5-c-notification-drawer__list-item-timestamp').last().contains('30 minutes ago');
});
it('Verify all badges are marked unread', () => {
cy.get('.pf-v5-c-notification-drawer__group-toggle-count').first().should('not.have.attr', 'pf-m-unread');
cy.get('.pf-v5-c-notification-drawer__group-toggle-count').eq(1).should('not.have.attr', 'pf-m-unread');
cy.get('.pf-v5-c-notification-drawer__group-toggle-count').last().should('not.have.attr', 'pf-m-unread');
});
});