salix-front/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js

72 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2023-11-09 09:29:28 +00:00
/// <reference types="cypress" />
2025-02-20 14:54:03 +00:00
import moment from 'moment';
2023-11-09 09:29:28 +00:00
describe('InvoiceInBasicData', () => {
const dialogInputs = '.q-dialog input';
2025-02-10 11:44:35 +00:00
const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`;
2025-02-20 14:54:03 +00:00
const futureDate = moment().add(1, 'days').format('DD-MM-YYYY');
const mock = {
invoiceInBasicDataSupplier: { val: 'Bros nick', type: 'select' },
invoiceInBasicDataSupplierRef_input: 'mockInvoice41',
2025-02-20 14:54:03 +00:00
invoiceInBasicDataIssued: { val: futureDate, type: 'date' },
invoiceInBasicDataOperated: { val: futureDate, type: 'date' },
invoiceInBasicDatabookEntried: { val: futureDate, type: 'date' },
invoiceInBasicDataBooked: {
val: moment().add(5, 'days').format('DD-MM-YYYY'),
type: 'date',
},
invoiceInBasicDataDeductibleExpenseFk: {
2025-02-20 15:35:14 +00:00
val: '4751000000',
2025-02-20 14:54:03 +00:00
type: 'select',
},
invoiceInBasicDataCurrencyFk: { val: 'USD', type: 'select' },
invoiceInBasicDataCompanyFk: { val: 'CCs', type: 'select' },
invoiceInBasicDataWithholdingSageFk: {
val: 'Arrendamiento y subarrendamiento',
type: 'select',
},
};
2023-11-09 09:29:28 +00:00
beforeEach(() => {
cy.login('administrative');
cy.visit(`/#/invoice-in/1/basic-data`);
2023-11-09 09:29:28 +00:00
});
2025-02-20 14:54:03 +00:00
it('should edit every field', () => {
cy.fillInForm(mock, { attr: 'data-cy' });
2023-11-09 09:29:28 +00:00
cy.saveCard();
2025-02-20 15:35:14 +00:00
cy.validateForm(mock, { attr: 'data-cy' });
2023-11-09 09:29:28 +00:00
});
2025-02-20 15:35:14 +00:00
it('should edit, remove and create the dms data', () => {
const firtsInput = 'Ticket:65';
const secondInput = "I don't know what posting here!";
2023-11-09 09:29:28 +00:00
2025-02-20 15:35:14 +00:00
//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');
2024-11-04 12:41:37 +00:00
2025-02-20 15:35:14 +00:00
//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');
2025-02-20 15:35:14 +00:00
});
2023-11-09 09:29:28 +00:00
});