From 2ee20028760aa36985c683137dcc8305ee4a8306 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 29 Jan 2025 17:46:33 +0100 Subject: [PATCH] test: refs #7119 await fetching data --- .../integration/zone/zoneBasicData.spec.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/cypress/integration/zone/zoneBasicData.spec.js b/test/cypress/integration/zone/zoneBasicData.spec.js index 95a075fb3..70ded3f79 100644 --- a/test/cypress/integration/zone/zoneBasicData.spec.js +++ b/test/cypress/integration/zone/zoneBasicData.spec.js @@ -1,5 +1,6 @@ describe('ZoneBasicData', () => { const priceBasicData = '[data-cy="Price_input"]'; + const saveBtn = '.q-btn-group > .q-btn--standard'; beforeEach(() => { cy.viewport(1280, 720); @@ -8,20 +9,27 @@ describe('ZoneBasicData', () => { }); it('should throw an error if the name is empty', () => { - cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}'); - cy.get('.q-btn-group > .q-btn--standard').click(); + cy.intercept('GET', /\/api\/Zones\/4./).as('zone'); + + cy.wait('@zone').then(() => { + cy.get('[data-cy="zone-basic-data-name"] input').type( + '{selectall}{backspace}', + ); + }); + + cy.get(saveBtn).click(); cy.checkNotification("can't be blank"); }); it('should throw an error if the price is empty', () => { cy.get(priceBasicData).clear(); - cy.get('.q-btn-group > .q-btn--standard').click(); + cy.get(saveBtn).click(); cy.checkNotification('cannot be blank'); }); it("should edit the basicData's zone", () => { cy.get('.q-card > :nth-child(1)').type(' modified'); - cy.get('.q-btn-group > .q-btn--standard').click(); + cy.get(saveBtn).click(); cy.checkNotification('Data saved'); }); });