salix-front/test/cypress/integration/zone/zoneBasicData.spec.js

36 lines
1.0 KiB
JavaScript

describe('ZoneBasicData', () => {
const priceBasicData = '[data-cy="Price_input"]';
const saveBtn = '.q-btn-group > .q-btn--standard';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/4/basic-data');
});
it('should throw an error if the name is empty', () => {
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(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(saveBtn).click();
cy.checkNotification('Data saved');
});
});