From 4b9e533ccdc2f8c78b67bbe5587a0731647eaa0e Mon Sep 17 00:00:00 2001 From: jtubau Date: Tue, 8 Apr 2025 14:16:33 +0200 Subject: [PATCH] refactor: refs #8441 intercept api call instead .q-notification --- .../integration/route/vehicle/vehicleList.spec.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/cypress/integration/route/vehicle/vehicleList.spec.js b/test/cypress/integration/route/vehicle/vehicleList.spec.js index 23bdf0c7c..44bfde1c1 100644 --- a/test/cypress/integration/route/vehicle/vehicleList.spec.js +++ b/test/cypress/integration/route/vehicle/vehicleList.spec.js @@ -35,12 +35,16 @@ describe('Vehicle list', () => { }); it('Should add new vehicle', () => { + cy.intercept('POST', '/api/Vehicles').as('postRequest'); cy.addBtnClick(); cy.fillInForm(data); - cy.dataCy(selectors.saveFormBtn).click(); + cy.dataCy(selectors.saveFormBtn).should('be.visible').click(); - cy.checkNotification('Data created'); - cy.url().should('match', summaryUrlRegex); + cy.wait('@postRequest').then((interception) => { + expect(interception.response.statusCode).to.eq(200); + }); + + cy.location().should('match', summaryUrlRegex); cy.containContent(selectors.descriptorTitle, expected); }); @@ -50,7 +54,7 @@ describe('Vehicle list', () => { .invoke('text') .then((numberPlate) => { numberPlate = numberPlate.trim(); - cy.url().should('match', summaryUrlRegex); + cy.location().should('match', summaryUrlRegex); cy.containContent(selectors.descriptorTitle, numberPlate); }); }); @@ -62,7 +66,7 @@ describe('Vehicle list', () => { numberPlate = numberPlate.trim(); cy.get(selectors.summaryPopupBtn).click(); cy.get(selectors.summaryGoToSummaryBtn).click(); - cy.url().should('match', summaryUrlRegex); + cy.location().should('match', summaryUrlRegex); cy.containContent(selectors.descriptorTitle, numberPlate); }); });