salix-front/test/cypress/integration/property/propertyBasicData.spec.js

54 lines
1.8 KiB
JavaScript

describe('Property basic data', () => {
const selectors = {
resetBtn: '#st-actions > .q-btn-group > .q-btn[title="Reset"]',
saveBtn: '#st-actions > .q-btn-group > .q-btn[title="Save"]',
labelName: '[data-cy="Name_input"]',
};
const updateData = {
Name: { val: 'Palacio de Asgard' },
Cadaster: { val: 'REF-123-456' },
Owner: { val: 'VNL', type: 'select' },
Map: { val: 'http://www.google.com' },
'Purchase date': { val: '01-01-2001', type: 'date' },
Value: { val: 500000 },
'Notarial protocol': { val: '1291/2025' },
'Small holding': { val: 195 },
Area: { val: 5 },
Allocation: { val: 'COTES' },
Town: { val: 'Alzira', type: 'select' },
m2: { val: 5000 },
Registry: { val: 'Asgard' },
Tome: { val: 1 },
Book: { val: 1 },
Page: { val: 1 },
Farm: { val: 1 },
Registration: { val: 5 },
'Booked date': { val: '02-02-2002', type: 'date' },
Volume: { val: 1 },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/property/2/basic-data');
});
it('Should reset property basic data', () => {
cy.get(selectors.labelName)
.should('be.visible')
.click().invoke('text').then((name) => {
name= name.trim();
cy.get(selectors.labelName).click().type(`{selectall}{backspace}Tony Stark`);
cy.get(selectors.resetBtn).click();
cy.containContent(selectors.labelName, name);
});
});
it('Should edit property basic data', () => {
cy.fillInForm(updateData);
cy.get(selectors.saveBtn).click();
cy.checkNotification('Data saved');
});
});