test: refs #8422 add temporary upload folder configuration

This commit is contained in:
Jose Antonio Tubau 2025-03-12 08:30:02 +01:00
parent f4b72c5d75
commit 21196fcc3b
2 changed files with 27 additions and 19 deletions

View File

@ -44,6 +44,7 @@ export default defineConfig({
supportFile: 'test/cypress/support/index.js',
videosFolder: 'test/cypress/videos',
downloadsFolder: 'test/cypress/downloads',
tmpUploadFolder: '../salix/storage/tmp/dms',
video: false,
specPattern: 'test/cypress/integration/**/*.spec.js',
experimentalRunAllSpecs: true,

View File

@ -9,6 +9,13 @@ describe('Vehicle DMS', () => {
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',
workerDescriptorPopupTitle:
'.q-menu > .descriptor > .body > .q-list > .q-item__label--header > .title > span',
workerDescriptorGoToSummary:
'[href="#/worker/5/summary"] > .q-btn > .q-btn__content > .q-icon',
summaryTitle: '.summaryHeader > div',
referenceInput: 'Reference_input',
companySelect: 'Company_select',
warehouseSelect: 'Warehouse_select',
@ -46,29 +53,35 @@ describe('Vehicle DMS', () => {
.should('have.length.greaterThan', 0);
});
xit('Should create new DMS', () => {
const filePath = '11.jpg';
it('Should create new DMS', () => {
const uploadFolder = Cypress.config('tmpUploadFolder');
cy.dataCy(selectors.addBtn).click();
cy.dataCy(selectors.referenceInput).type(data.Reference.val);
cy.dataCy(selectors.fileInput).type(filePath);
cy.dataCy(selectors.referenceInput).type(`{selectall}${data.Reference.val}`);
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 import DMS', () => {
const data = {
Document: { val: '1', type: 'select' },
Document: { val: '10', type: 'select' },
};
cy.dataCy(selectors.importBtn).click();
cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click();
cy.validateContent(selectors.lastRowReference, 'Ticket:11');
cy.checkNotification('Data created');
cy.validateContent(selectors.lastRowReference, 'Vehicle:5678-DEF');
});
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);
});
@ -84,20 +97,14 @@ describe('Vehicle DMS', () => {
it('Should delete DMS', () => {
cy.get(selectors.lastRowDeleteBtn).click();
cy.clickConfirm();
cy.validateContent(selectors.firstRowReference, 'Vehicle:3333-BAT');
cy.checkNotification('Data deleted');
cy.validateContent(selectors.lastRowReference, 'Vehicle:3333-BAT');
});
it('Should redirect to worker summary from worker descriptor pop-up', () => {
cy.get(':nth-child(1) > :nth-child(8) > .q-tr > .link').click();
cy.get(
'.q-menu > .descriptor > .body > .q-list > .q-item__label--header > .title > span',
).should('have.text', 'administrativeNick');
cy.get(
'[href="#/worker/5/summary"] > .q-btn > .q-btn__content > .q-icon',
).click();
cy.get('.summaryHeader > div').should(
'have.text',
'5 - administrative administrative',
);
cy.get(selectors.lastRowWorkerLink).click();
cy.get(selectors.workerDescriptorPopupTitle).should('contain', 'administrative');
cy.get(selectors.workerDescriptorGoToSummary).click();
cy.get(selectors.summaryTitle).should('contain', 'administrative');
});
});