test: refs #6683 add Cypress tests for property basic data and summary; update DMS and list tests
This commit is contained in:
parent
46826b6b95
commit
bcf5750619
src/pages/Property
test/cypress/integration
|
@ -28,13 +28,11 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.name')"
|
||||
v-model="data.name"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.cadaster')"
|
||||
v-model="data.cadaster"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -80,7 +78,6 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.map')"
|
||||
v-model="data.url"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -94,13 +91,11 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.value')"
|
||||
v-model="data.value"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.protocol')"
|
||||
v-model="data.protocol"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -108,19 +103,16 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.smallHolding')"
|
||||
v-model="data.smallHolding"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.area')"
|
||||
v-model="data.area"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.allocation')"
|
||||
v-model="data.allocation"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -146,13 +138,11 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.m2')"
|
||||
v-model="data.m2"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.registry')"
|
||||
v-model="data.registry"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -160,25 +150,21 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.tome')"
|
||||
v-model="data.tome"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.book')"
|
||||
v-model="data.book"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.page')"
|
||||
v-model="data.page"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('property.farm')"
|
||||
v-model="data.farm"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -186,7 +172,6 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.registration')"
|
||||
v-model="data.registration"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
<VnInputDate
|
||||
placeholder="dd-mm-aaa"
|
||||
|
@ -198,7 +183,6 @@ const isNew = Boolean(!route.params.id);
|
|||
:label="t('property.volume')"
|
||||
v-model="data.volume"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -140,6 +140,7 @@ onMounted(async () => {
|
|||
<VnTitle
|
||||
:url="toPropertyUrl('basic-data')"
|
||||
:text="t('globals.summary.basicData')"
|
||||
data-cy="titleBasicDataBlock1"
|
||||
/>
|
||||
<div class="vn-card-group">
|
||||
<div class="vn-card-content">
|
||||
|
@ -158,6 +159,7 @@ onMounted(async () => {
|
|||
:href="`${entity?.url}`"
|
||||
target="_blank"
|
||||
class="grafana"
|
||||
data-cy="propertyMapLink"
|
||||
>
|
||||
{{ t('property.goToMap') }}
|
||||
</a>
|
||||
|
@ -187,6 +189,7 @@ onMounted(async () => {
|
|||
<VnTitle
|
||||
:url="toPropertyUrl('basic-data')"
|
||||
:text="t('globals.summary.basicData')"
|
||||
data-cy="titleBasicDataBlock2"
|
||||
/>
|
||||
<div class="vn-card-content">
|
||||
<VnLv
|
||||
|
@ -214,6 +217,7 @@ onMounted(async () => {
|
|||
<VnTitle
|
||||
:url="toPropertyUrl('basic-data')"
|
||||
:text="t('globals.summary.basicData')"
|
||||
data-cy="titleBasicDataBlock3"
|
||||
/>
|
||||
<div class="vn-card-content">
|
||||
<VnLv
|
||||
|
@ -234,6 +238,7 @@ onMounted(async () => {
|
|||
<VnTitle
|
||||
:url="toPropertyUrl('dms')"
|
||||
:text="t('globals.pageTitles.dms')"
|
||||
data-cy="titleDmsBlock"
|
||||
/>
|
||||
<QTable :columns="dmsColumns" :rows="entity?.propertyDms" flat>
|
||||
<template #header="props">
|
||||
|
@ -290,7 +295,11 @@ onMounted(async () => {
|
|||
</QTable>
|
||||
</QCard>
|
||||
<QCard v-if="entity?.notes.length > 0" class="vn-max">
|
||||
<VnTitle :url="toPropertyUrl('notes')" :text="t('globals.notes')" />
|
||||
<VnTitle
|
||||
:url="toPropertyUrl('notes')"
|
||||
:text="t('globals.notes')"
|
||||
data-cy="titleNotesBlock"
|
||||
/>
|
||||
<QCardSection
|
||||
v-if="entity?.notes"
|
||||
v-for="note in entity?.notes"
|
||||
|
|
|
@ -7,7 +7,7 @@ property:
|
|||
smallHolding: Parcela
|
||||
area: Polígono
|
||||
town: Municipio
|
||||
registry: R.U.
|
||||
registry: Registro urbanístico
|
||||
volume: Volumen
|
||||
book: Libro
|
||||
page: Folio
|
||||
|
@ -20,7 +20,7 @@ property:
|
|||
allocation: Partida
|
||||
tome: Volumen
|
||||
map: Mapa
|
||||
protocol: Protocolo notarial
|
||||
protocol: Prot. notarial
|
||||
purchased: F. compra
|
||||
booked: F. finalización
|
||||
createProperty: Nueva propiedad
|
||||
|
@ -33,7 +33,7 @@ property:
|
|||
id: Id
|
||||
name: Nombre
|
||||
propertyGroupFk: Grupo
|
||||
protocol: Protocolo notarial
|
||||
protocol: Prot. notarial
|
||||
companyFk: Propietario
|
||||
purchased: F. compra
|
||||
booked: F. finalización
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
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');
|
||||
});
|
||||
});
|
|
@ -1,17 +1,20 @@
|
|||
describe('Property DMS', () => {
|
||||
const getBtnSelector = (btnPosition) =>
|
||||
`tr:last-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
|
||||
const getBtnSelector = (trPosition, btnPosition) =>
|
||||
`tr:${trPosition}-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
|
||||
|
||||
const selectors = {
|
||||
lastRowDownloadBtn: getBtnSelector(1),
|
||||
lastRowEditBtn: getBtnSelector(2),
|
||||
lastRowDeleteBtn: getBtnSelector(3),
|
||||
lastRowDownloadBtn: getBtnSelector('last', 1),
|
||||
firstRowEditBtn: getBtnSelector('first', 2),
|
||||
lastRowDeleteBtn: getBtnSelector('last', 3),
|
||||
firstRowDeleteBtn: getBtnSelector('first', 3),
|
||||
lastRowReference: 'tr:last-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
|
||||
firstRowReference:
|
||||
'tr:first-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
|
||||
firstRowId: 'tr:first-child > :nth-child(2) > .q-tr > :nth-child(1) > span',
|
||||
lastRowWorkerLink: 'tr:last-child > :nth-child(8) > .q-tr > .link',
|
||||
descriptorTitle: '.descriptor .title',
|
||||
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
||||
descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
|
||||
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
|
||||
summaryTitle: '.summaryHeader',
|
||||
referenceInput: 'Reference_input',
|
||||
|
@ -38,6 +41,8 @@ describe('Property DMS', () => {
|
|||
Type: { val: 'Escritura original', type: 'select' },
|
||||
};
|
||||
|
||||
const workerSummaryUrlRegex = /worker\/\d+\/summary/;
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
|
@ -52,18 +57,30 @@ describe('Property DMS', () => {
|
|||
});
|
||||
|
||||
it('Should create new DMS', () => {
|
||||
const uploadFolder = Cypress.config('tmpUploadFolder');
|
||||
cy.dataCy(selectors.addBtn).click();
|
||||
cy.fillInForm(data);
|
||||
cy.dataCy(selectors.fileInput).selectFile('test/cypress/fixtures/image.jpg', {
|
||||
force: true,
|
||||
});
|
||||
cy.dataCy(selectors.saveFormBtn).click();
|
||||
const fileName = 'image.jpg';
|
||||
cy.readFile(`${uploadFolder}/${fileName}`).should('exist');
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
|
||||
it('Should edit DMS', () => {
|
||||
cy.get(selectors.firstRowEditBtn).click();
|
||||
cy.fillInForm(updateData);
|
||||
cy.dataCy(selectors.saveFormBtn).click();
|
||||
cy.checkNotification('Data saved');
|
||||
cy.validateContent(selectors.firstRowReference, updateData.Reference.val);
|
||||
});
|
||||
|
||||
it('Should delete DMS', () => {
|
||||
cy.get(selectors.firstRowDeleteBtn).click();
|
||||
cy.clickConfirm();
|
||||
cy.checkNotification('Data deleted');
|
||||
cy.validateContent(selectors.firstRowReference, '1');
|
||||
});
|
||||
|
||||
it('Should import DMS', () => {
|
||||
const data = {
|
||||
Document: { val: '10', type: 'select' },
|
||||
|
@ -73,21 +90,9 @@ describe('Property DMS', () => {
|
|||
cy.dataCy(selectors.saveFormBtn).click();
|
||||
cy.checkNotification('Data saved');
|
||||
cy.validateContent(selectors.lastRowReference, '1');
|
||||
});
|
||||
|
||||
it('Should edit DMS', () => {
|
||||
cy.get(selectors.lastRowEditBtn).click();
|
||||
cy.fillInForm(updateData);
|
||||
cy.dataCy(selectors.saveFormBtn).click();
|
||||
cy.checkNotification('Data saved');
|
||||
cy.validateContent(selectors.lastRowReference, updateData.Reference.val);
|
||||
});
|
||||
|
||||
it('Should delete DMS', () => {
|
||||
cy.get(selectors.lastRowDeleteBtn).click();
|
||||
cy.clickConfirm();
|
||||
cy.checkNotification('Data deleted');
|
||||
cy.validateContent(selectors.lastRowReference, data.Reference.val);
|
||||
});
|
||||
|
||||
it('Should download DMS', () => {
|
||||
|
@ -99,10 +104,32 @@ describe('Property DMS', () => {
|
|||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||
});
|
||||
|
||||
it('Should redirect to worker summary from worker descriptor pop-up', () => {
|
||||
cy.get(selectors.lastRowWorkerLink).click();
|
||||
cy.get(selectors.descriptorTitle).should('contain', 'administrative');
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.containContent(selectors.summaryTitle, 'administrative');
|
||||
describe.skip('Worker pop-ups', () => {
|
||||
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
|
||||
cy.get(selectors.lastRowWorkerLink)
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.invoke('text')
|
||||
.then((workerName) => {
|
||||
workerName = workerName.trim();
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.location().should('match', workerSummaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, workerName);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should redirect to the worker summary from summary pop-up from the worker descriptor pop-up', () => {
|
||||
cy.get(selectors.lastRowWorkerLink)
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.invoke('text')
|
||||
.then((workerName) => {
|
||||
workerName = workerName.trim();
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).click();
|
||||
cy.get(selectors.summaryGoToSummaryBtn).click();
|
||||
cy.location().should('match', workerSummaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, workerName);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
describe('Property list', () => {
|
||||
const selectors = {
|
||||
firstRow: 'tr:first-child > [data-col-field="name"]',
|
||||
summaryTitle: '.summaryHeader',
|
||||
descriptorTitle: '[data-cy="vnDescriptor_title"]',
|
||||
};
|
||||
|
||||
const summaryUrlRegex = /property\/\d+\/summary/;
|
||||
|
||||
const data = {
|
||||
Name: { val: 'Palacio de Asgard' },
|
||||
'Notarial protocol': { val: '1291/2025' },
|
||||
|
@ -42,9 +44,15 @@ describe('Property list', () => {
|
|||
});
|
||||
|
||||
it('Should redirect to the property summary when clicking the row', () => {
|
||||
cy.get(selectors.firstRow).should('be.visible').click();
|
||||
cy.url().should('match', /property\/\d+\/summary/);
|
||||
cy.containContent(selectors.summaryTitle, 'Stark Tower');
|
||||
cy.get(selectors.firstRow)
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.invoke('text')
|
||||
.then((name) => {
|
||||
name = name.trim();
|
||||
cy.location().should('match', summaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, name);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should create new property', () => {
|
||||
|
@ -52,7 +60,7 @@ describe('Property list', () => {
|
|||
cy.fillInForm(data);
|
||||
cy.dataCy('FormModelPopup_save').should('be.visible').click();
|
||||
cy.checkNotification('Data created');
|
||||
cy.url().should('match', /property\/\d+\/summary/);
|
||||
cy.containContent(selectors.summaryTitle, data.Name.val);
|
||||
cy.location().should('match', summaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, data.Name.val);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
describe('Property summary', () => {
|
||||
const selectors = {
|
||||
summaryTitle: '.summaryHeader',
|
||||
descriptorTitle: '[data-cy="vnDescriptor_title"]',
|
||||
summaryBasicDataBlock1Link: 'a.link[data-cy="titleBasicDataBlock1"]',
|
||||
summaryBasicDataBlock2Link: 'a.link[data-cy="titleBasicDataBlock2"]',
|
||||
summaryBasicDataBlock3Link: 'a.link[data-cy="titleBasicDataBlock3"]',
|
||||
summaryDmsBlockLink: 'a.link[data-cy="titleDmsBlock"]',
|
||||
summaryNotesBlockLink: 'a.link[data-cy="titleNotesBlock"]',
|
||||
summaryPropertyMapLink: 'a.grafana[data-cy="propertyMapLink"]',
|
||||
basicDataIcon: 'PropertyBasicData-menu-item',
|
||||
dmsIcon: 'PropertyDms-menu-item',
|
||||
notesIcon: 'PropertyNotes-menu-item',
|
||||
logIcon: 'PropertyLog-menu-item',
|
||||
};
|
||||
|
||||
const url = '/#/property/1/summary';
|
||||
const basicDataUrlRegex = /property\/1\/basic-data/;
|
||||
const dmsUrlRegex = /property\/1\/dms/;
|
||||
const notesUrlRegex = /property\/1\/notes/;
|
||||
const logUrlRegex = /property\/1\/history/;
|
||||
const workerSummaryUrlRegex = /worker\/\d+\/summary/;
|
||||
const propertyName = 'Stark Tower';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(url);
|
||||
});
|
||||
|
||||
it('Should load summary', () => {
|
||||
cy.containContent(selectors.summaryTitle, propertyName);
|
||||
cy.containContent(selectors.descriptorTitle, propertyName);
|
||||
});
|
||||
|
||||
it('Should redirect to the corresponding section when clicking on the icons in the left menu', () => {
|
||||
cy.dataCy(selectors.basicDataIcon).click();
|
||||
cy.location().should('match', basicDataUrlRegex);
|
||||
|
||||
cy.visit(url);
|
||||
cy.dataCy(selectors.dmsIcon).click();
|
||||
cy.location().should('match', dmsUrlRegex);
|
||||
|
||||
cy.visit(url);
|
||||
cy.dataCy(selectors.notesIcon).click();
|
||||
cy.location().should('match', notesUrlRegex);
|
||||
|
||||
cy.visit(url);
|
||||
cy.dataCy(selectors.logIcon).click();
|
||||
cy.location().should('match', logUrlRegex);
|
||||
});
|
||||
|
||||
it('Should redirect to property basic-data when clicking on basic-data title links', () => {
|
||||
cy.get(selectors.summaryBasicDataBlock1Link).click();
|
||||
cy.location().should('match', basicDataUrlRegex);
|
||||
cy.visit(url);
|
||||
cy.get(selectors.summaryBasicDataBlock2Link).click();
|
||||
cy.location().should('match', basicDataUrlRegex);
|
||||
cy.visit(url);
|
||||
cy.get(selectors.summaryBasicDataBlock3Link).click();
|
||||
cy.location().should('match', basicDataUrlRegex);
|
||||
});
|
||||
|
||||
it('Should redirect to property DMS when clicking on DMS title', () => {
|
||||
cy.get(selectors.summaryDmsBlockLink).click();
|
||||
cy.location().should('match', dmsUrlRegex);
|
||||
});
|
||||
|
||||
it('Should redirect to property notes when clicking on notes title', () => {
|
||||
cy.get(selectors.summaryNotesBlockLink).click();
|
||||
cy.location().should('match', notesUrlRegex);
|
||||
});
|
||||
|
||||
it('Should redirect to property map', () => {
|
||||
cy.get(selectors.summaryPropertyMapLink).invoke('removeAttr', 'target').click();
|
||||
cy.origin('https://www1.sedecatastro.gob.es', () => {
|
||||
cy.location().should('match', /sedecatastro.gob.es/);
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('Worker pop-ups', () => {
|
||||
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
|
||||
cy.get(selectors.lastRowWorkerLink)
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.invoke('text')
|
||||
.then((workerName) => {
|
||||
workerName = workerName.trim();
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.location().should('match', workerSummaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, workerName);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should redirect to the worker summary from summary pop-up from the worker descriptor pop-up', () => {
|
||||
cy.get(selectors.lastRowWorkerLink)
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.invoke('text')
|
||||
.then((workerName) => {
|
||||
workerName = workerName.trim();
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).click();
|
||||
cy.get(selectors.summaryGoToSummaryBtn).click();
|
||||
cy.location().should('match', workerSummaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, workerName);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -115,7 +115,7 @@ describe('Route extended list', () => {
|
|||
fillField(selector, type, value);
|
||||
});
|
||||
|
||||
cy.get('[title="Reset"]').click();
|
||||
cy.get(selectors.resetBtn).click();
|
||||
|
||||
originalFields.forEach(({ selector, value }) => {
|
||||
cy.validateContent(selector, value);
|
||||
|
|
Loading…
Reference in New Issue