test: refs #8581 validate form
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-02-20 16:35:14 +01:00
parent 813e677a12
commit 6e8f54ec1f
1 changed files with 30 additions and 32 deletions

View File

@ -1,9 +1,7 @@
/// <reference types="cypress" />
import moment from 'moment';
describe('InvoiceInBasicData', () => {
const firstFormSelect = '.q-card > .vn-row:nth-child(1) > .q-select';
const dialogInputs = '.q-dialog input';
const resetBtn = '.q-btn-group--push > .q-btn--flat';
const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`;
const futureDate = moment().add(1, 'days').format('DD-MM-YYYY');
const mock = {
@ -17,7 +15,7 @@ describe('InvoiceInBasicData', () => {
type: 'date',
},
invoiceInBasicDataDeductibleExpenseFk: {
val: 'Retenciones',
val: '4751000000',
type: 'select',
},
invoiceInBasicDataCurrencyFk: { val: 'USD', type: 'select' },
@ -36,38 +34,38 @@ describe('InvoiceInBasicData', () => {
it('should edit every field', () => {
cy.fillInForm(mock, { attr: 'data-cy' });
cy.saveCard();
// cy.get(`${firstFormSelect} input`).invoke('val').should('eq', 'Bros nick');
cy.validateForm(mock, { attr: 'data-cy' });
});
// it.skip('should edit, remove and create the dms data', () => {
// const firtsInput = 'Ticket:65';
// const secondInput = "I don't know what posting here!";
it('should edit, remove and create the dms data', () => {
const firtsInput = 'Ticket:65';
const secondInput = "I don't know what posting here!";
// //edit
// cy.get(getDocumentBtns(2)).click();
// cy.get(dialogInputs).eq(0).type(`{selectall}${firtsInput}`);
// cy.get('textarea').type(`{selectall}${secondInput}`);
// cy.get('[data-cy="FormModelPopup_save"]').click();
// cy.get(getDocumentBtns(2)).click();
// cy.get(dialogInputs).eq(0).invoke('val').should('eq', firtsInput);
// cy.get('textarea').invoke('val').should('eq', secondInput);
// cy.get('[data-cy="FormModelPopup_save"]').click();
// cy.checkNotification('Data saved');
//edit
cy.get(getDocumentBtns(2)).click();
cy.get(dialogInputs).eq(0).type(`{selectall}${firtsInput}`);
cy.get('textarea').type(`{selectall}${secondInput}`);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get(getDocumentBtns(2)).click();
cy.get(dialogInputs).eq(0).invoke('val').should('eq', firtsInput);
cy.get('textarea').invoke('val').should('eq', secondInput);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data saved');
// //remove
// cy.get(getDocumentBtns(3)).click();
// cy.get('[data-cy="VnConfirm_confirm"]').click();
// cy.checkNotification('Data saved');
//remove
cy.get(getDocumentBtns(3)).click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.checkNotification('Data saved');
// //create
// cy.get('[data-cy="invoiceInBasicDataDmsAdd"]').eq(0).click();
// cy.get('[data-cy="VnDms_inputFile"').selectFile(
// 'test/cypress/fixtures/image.jpg',
// {
// force: true,
// },
// );
// cy.get('[data-cy="FormModelPopup_save"]').click();
// cy.checkNotification('Data saved');
// });
//create
cy.get('[data-cy="invoiceInBasicDataDmsAdd"]').eq(0).click();
cy.get('[data-cy="VnDms_inputFile"').selectFile(
'test/cypress/fixtures/image.jpg',
{
force: true,
},
);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data saved');
});
});