From 9f16410bdf399cfad23d207f2c81343d1174521c Mon Sep 17 00:00:00 2001 From: Tibor Kollar Date: Tue, 6 Aug 2024 12:25:57 +0200 Subject: [PATCH] test: add cypress test for notification panel functionality. --- cypress/e2e/ui/notification-panel.cy.js | 56 +++++++++++++++++++++++++ src/layouts/MainLayout.vue | 1 + 2 files changed, 57 insertions(+) create mode 100644 cypress/e2e/ui/notification-panel.cy.js diff --git a/cypress/e2e/ui/notification-panel.cy.js b/cypress/e2e/ui/notification-panel.cy.js new file mode 100644 index 0000000000..790ab70079 --- /dev/null +++ b/cypress/e2e/ui/notification-panel.cy.js @@ -0,0 +1,56 @@ +/// + +Cypress.on('uncaught:exception', (err, runnable) => { + // returning false here prevents Cypress from + // failing the test + return false +}) + +describe('Check notification panel functionality', () => { + it('Set Data', () => { + cy.fixture('baseurl').then((data) => { + cy.visit(data.baseurl) + }) + cy.setZclProperties() + }) + it( + 'Open notification panel', + { retries: { runMode: 2, openMode: 2 } }, + () => { + cy.get('#Notifications').click() + cy.wait(500) + cy.get('#NotificationPanel') + .parent() + .should('not.have.class', ' q-layout--prevent-focus') + } + ) + it('Check active status on navbar', () => { + cy.get('#Notifications').should('have.class', 'navmenu-item--active') + }) + it( + 'Close notification panel', + { retries: { runMode: 2, openMode: 2 } }, + () => { + cy.get('#Notifications').click() + cy.wait(500) + cy.get('#NotificationPanel') + .parent() + .should('have.class', 'q-layout--prevent-focus') + } + ) + it( + 'Open notification panel and open preview panel', + { retries: { runMode: 2, openMode: 2 } }, + () => { + cy.get('#Notifications').click() + cy.wait(500) + cy.get('#NotificationPanel') + .parent() + .should('not.have.class', 'q-layout--prevent-focus') + cy.get('#Preview').click() + cy.get('#NotificationPanel') + .parent() + .should('have.class', 'q-layout--prevent-focus') + } + ) +}) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 61b63c276c..eb40029267 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -95,6 +95,7 @@ side="right" :breakpoint="0" class="bg-glass column" + id="NotificationPanel" >