From 0b5be9e67fef0e164c3d6ca5c429892263d8c1d4 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 7 Nov 2024 17:19:35 +0100 Subject: [PATCH] chore: correct checkNotification --- test/cypress/support/commands.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 73c786680d..b536121b11 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -280,13 +280,14 @@ Cypress.Commands.add('openActions', (row) => { cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click(); }); -Cypress.Commands.add('checkNotification', (type) => { - const values = { - created: 'Data created', - updated: 'Data saved', - deleted: 'Data deleted', - }; - cy.get('.q-notification__message').should('have.text', values[type]); +Cypress.Commands.add('checkNotification', (text) => { + cy.get('.q-notification') + .should('be.visible') + .last() + .then(($lastNotification) => { + if (!Cypress.$($lastNotification).text().includes(text)) + throw new Error(`Notification not found: "${text}"`); + }); }); Cypress.Commands.add('checkValueForm', (id, search) => {