]>
Commit | Line | Data |
---|---|---|
e306af50 TL |
1 | import { PageHelper } from '../page-helper.po'; |
2 | ||
3 | export class NotificationSidebarPageHelper extends PageHelper { | |
4 | getNotificatinoIcon() { | |
5 | return cy.get('cd-notifications a'); | |
6 | } | |
7 | ||
8 | getSidebar() { | |
9 | return cy.get('cd-notifications-sidebar'); | |
10 | } | |
11 | ||
12 | getTasks() { | |
13 | return this.getSidebar().find('.card.tc_task'); | |
14 | } | |
15 | ||
16 | getNotifications() { | |
17 | return this.getSidebar().find('.card.tc_notification'); | |
18 | } | |
19 | ||
20 | getClearNotficationsBtn() { | |
21 | return this.getSidebar().find('button.btn-block'); | |
22 | } | |
23 | ||
24 | getCloseBtn() { | |
25 | return this.getSidebar().find('button.close'); | |
26 | } | |
27 | ||
28 | open() { | |
29 | this.getNotificatinoIcon().click(); | |
30 | this.getSidebar().should('be.visible'); | |
31 | } | |
32 | ||
33 | clearNotifications() { | |
34 | // It can happen that although notifications are cleared, by the time we check the notifications | |
35 | // amount, another notification can appear, so we check it more than once (if needed). | |
36 | this.getClearNotficationsBtn().click(); | |
37 | this.getNotifications() | |
38 | .should('have.length.gte', 0) | |
39 | .then(($elems) => { | |
40 | if ($elems.length > 0) { | |
41 | this.clearNotifications(); | |
42 | } | |
43 | }); | |
44 | } | |
45 | } |