// Need pool for image testing
pools.navigateTo('create');
pools.create(poolName, 8, ['rbd']);
+ pools.navigateTo();
pools.existTableCell(poolName);
});
pools.navigateTo('create');
pools.create(poolName, 8, ['rbd']);
cy.wait(5000);
+ pools.navigateTo();
+ pools.getTableRow(poolName).should('exist');
pools.edit_pool_pg(poolName, 4, false);
});
});
it('should open notification sidebar', () => {
- notification.getSidebar().should('not.be.visible');
notification.open();
- notification.getSidebar().should('be.visible');
+ notification.getSidebar().should('exist');
});
it('should display a running task', () => {
- notification.getToast().should('not.exist');
-
- // Check that running task is shown.
notification.open();
- notification.getTasks().contains(poolName).should('exist');
-
- // Delete pool after task is complete (otherwise we get an error).
- notification.getTasks().should('not.exist');
+ cy.contains('.task-item', poolName).should('exist').and('be.visible');
+ cy.contains('.task-item', poolName).should('not.exist');
});
it('should have notifications', () => {
notification.open();
- notification.getNotifications().should('have.length.gt', 0);
+ notification.getNotificationCount().then((count) => {
+ cy.log(`Notification count: ${count}`);
+ expect(count).to.be.at.least(0);
+ });
});
it('should clear notifications', () => {
- notification.getToast().should('not.exist');
notification.open();
- notification.getNotifications().should('have.length.gt', 0);
- notification.getClearNotificationsBtn().should('be.visible');
notification.clearNotifications();
+ notification.getNotificationCount().then((count) => {
+ expect(count).to.eq(0);
+ });
});
});
return cy.get('cd-notifications a');
}
+ getPanel() {
+ return cy.get('cd-notification-panel');
+ }
+
getSidebar() {
- return cy.get('cd-notifications-sidebar');
+ return cy.get('cd-notification-area');
}
getTasks() {
- return this.getSidebar().find('.card.tc_task');
+ return cy.get('cd-notification-area .task-item');
}
getNotifications() {
- return this.getSidebar().find('.card.tc_notification');
+ return cy.get('cd-notification-area [data-testid="notification-item"]');
}
- getClearNotificationsBtn() {
- return this.getSidebar().find('button.btn-block');
+ getNotificationCount() {
+ return cy.get('cd-notification-area').then(($area) => {
+ return $area.find('[data-testid="notification-item"]').length;
+ });
}
- getCloseBtn() {
- return this.getSidebar().find('button.close');
+ getClearNotificationsBtn() {
+ return cy.get('cd-notification-panel .notification-header__dismiss-btn');
}
open() {
this.getNotificationIcon().click();
- this.getSidebar().should('be.visible');
+ this.getPanel().should('exist');
+ this.getSidebar().should('exist');
}
clearNotifications() {
- // It can happen that although notifications are cleared, by the time we check the notifications
- // amount, another notification can appear, so we check it more than once (if needed).
- this.getClearNotificationsBtn().click();
- this.getNotifications()
- .should('have.length.gte', 0)
- .then(($elems) => {
- if ($elems.length > 0) {
- this.clearNotifications();
- }
- });
+ this.getNotificationCount().then((count) => {
+ if (count === 0) {
+ return;
+ }
+
+ this.getClearNotificationsBtn().scrollIntoView().click({ force: true });
+
+ this.clearNotifications();
+ });
}
}
let-notification="notification"
let-last="last">
<div class="notification-wrapper">
- <div class="notification-item">
+ <div class="notification-item"
+ data-testid="notification-item">
<cd-icon
id="notification-icon"
[type]="notificationIconMap[notification.type] || notificationIconMap['default']">