fix: refs #8422 vehicleDms tests
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jose Antonio Tubau 2025-03-20 13:34:14 +01:00
parent de9f1bca9a
commit cb99c50f33
2 changed files with 18 additions and 10 deletions

View File

@ -12,7 +12,7 @@ describe('Vehicle DMS', () => {
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',
descriptorGoToSummaryBtn: '.descriptor [data-cy="goToSummaryBtn"]',
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
summaryTitle: '.summaryHeader',
referenceInput: 'Reference_input',
companySelect: 'Company_select',
@ -71,8 +71,7 @@ describe('Vehicle DMS', () => {
cy.dataCy(selectors.importBtn).click();
cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification('Data created');
cy.validateContent(selectors.lastRowReference, 'Vehicle:5678-DEF');
cy.validateContent(selectors.lastRowReference, '1');
});
it('Should edit DMS', () => {
@ -83,6 +82,13 @@ describe('Vehicle DMS', () => {
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, 'Vehicle:3333-BAT');
});
it('Should download DMS', () => {
const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowDownloadBtn).click();
@ -92,13 +98,6 @@ describe('Vehicle DMS', () => {
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
});
it('Should delete DMS', () => {
cy.get(selectors.lastRowDeleteBtn).click();
cy.clickConfirm();
cy.checkNotification('Data deleted');
cy.validateContent(selectors.lastRowReference, 'Vehicle:3333-BAT');
});
it('Should redirect to worker summary from worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink).click();
cy.get(selectors.descriptorTitle).should('contain', 'administrative');

View File

@ -322,6 +322,15 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => {
cy.get(selector).should('have.text', expectedValue);
});
Cypress.Commands.add('containContent', (selector, expectedValue) => {
cy.get(selector)
.should('be.visible')
.invoke('text')
.then((text) => {
expect(text).to.include(expectedValue);
});
});
Cypress.Commands.add('openActionDescriptor', (opt) => {
cy.openActionsDescriptor();
const listItem = '[role="menu"] .q-list .q-item';