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

58 lines
2.2 KiB
JavaScript
Raw Normal View History

2023-11-09 09:29:28 +00:00
/// <reference types="cypress" />
describe('InvoiceInBasicData', () => {
const firstFormSelect = '.q-card > .vn-row:nth-child(1) > .q-select';
2023-11-09 09:29:28 +00:00
const dialogInputs = '.q-dialog input';
2025-02-10 11:44:35 +00:00
const resetBtn = '.q-btn-group--push > .q-btn--flat';
const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`;
2023-11-09 09:29:28 +00:00
beforeEach(() => {
cy.login('developer');
2025-02-10 11:44:35 +00:00
cy.visit(`/#/invoice-in/1/basic-data`);
2023-11-09 09:29:28 +00:00
});
it('should edit the provideer and supplier ref', () => {
2025-02-10 11:44:35 +00:00
cy.dataCy('UnDeductibleVatSelect').type('4751000000');
cy.get('.q-menu .q-item').contains('4751000000').click();
cy.get(resetBtn).click();
cy.waitForElement('#formModel').within(() => {
cy.dataCy('vnSupplierSelect').type('Bros nick');
})
2025-02-10 11:44:35 +00:00
cy.get('.q-menu .q-item').contains('Bros nick').click();
2023-11-09 09:29:28 +00:00
cy.saveCard();
2025-02-10 09:20:40 +00:00
cy.get(`${firstFormSelect} input`).invoke('val').should('eq', 'Bros nick');
2023-11-09 09:29:28 +00:00
});
2024-11-04 12:41:37 +00:00
it('should edit, remove and create the dms data', () => {
2023-11-09 09:29:28 +00:00
const firtsInput = 'Ticket:65';
const secondInput = "I don't know what posting here!";
2024-11-04 12:41:37 +00:00
//edit
2025-02-10 11:44:35 +00:00
cy.get(getDocumentBtns(2)).click();
2024-05-24 07:56:16 +00:00
cy.get(dialogInputs).eq(0).type(`{selectall}${firtsInput}`);
cy.get('textarea').type(`{selectall}${secondInput}`);
2024-11-04 12:41:37 +00:00
cy.get('[data-cy="FormModelPopup_save"]').click();
2025-02-10 11:44:35 +00:00
cy.get(getDocumentBtns(2)).click();
2023-11-09 09:29:28 +00:00
cy.get(dialogInputs).eq(0).invoke('val').should('eq', firtsInput);
cy.get('textarea').invoke('val').should('eq', secondInput);
2024-11-04 12:41:37 +00:00
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data saved');
//remove
2025-02-10 11:44:35 +00:00
cy.get(getDocumentBtns(3)).click();
2024-11-04 12:41:37 +00:00
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.checkNotification('Data saved');
2023-11-09 09:29:28 +00:00
2024-11-04 12:41:37 +00:00
//create
cy.get('[data-cy="dms-create"]').eq(0).click();
cy.get('[data-cy="VnDms_inputFile"').selectFile(
'test/cypress/fixtures/image.jpg',
{
force: true,
}
2023-11-09 09:29:28 +00:00
);
2024-11-04 12:41:37 +00:00
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('Data saved');
2023-11-09 09:29:28 +00:00
});
});