forked from verdnatura/salix-front
chore: refs #7197 fix tests
This commit is contained in:
parent
1efdd38cfe
commit
9e44896305
|
@ -72,7 +72,7 @@ const columns = computed(() => [
|
|||
]);
|
||||
|
||||
const getTotal = (data, key) =>
|
||||
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0);
|
||||
data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
|
||||
|
||||
const formatOpt = (row, { model, options }, prop) => {
|
||||
const obj = row[model];
|
||||
|
|
|
@ -8,12 +8,17 @@ describe('InvoiceInCorrective', () => {
|
|||
it('should create a correcting invoice', () => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-in/1/summary?limit=10`);
|
||||
cy.visit(`/#/invoice-in/1/summary`);
|
||||
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||
|
||||
cy.openActionsDescriptor();
|
||||
|
||||
cy.get(createRectificative).click();
|
||||
cy.get(saveDialog).click();
|
||||
cy.wait('@corrective').then((interception) => {
|
||||
const correctingId = interception.response.body;
|
||||
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
||||
});
|
||||
cy.get(rectificativeSection).click();
|
||||
cy.get('tbody > tr:visible').should('have.length', 1);
|
||||
});
|
||||
|
|
|
@ -11,25 +11,29 @@ describe('InvoiceInIntrastat', () => {
|
|||
|
||||
it('should edit the first line', () => {
|
||||
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid');
|
||||
|
||||
cy.get(inputBtns).eq(1).click();
|
||||
|
||||
cy.saveCard();
|
||||
cy.visit(`/#/invoice-in/1/intrastat`);
|
||||
|
||||
cy.getValue(firstLineCode).should('equal', 'Plantas vivas: Esqueje/injerto, Vid');
|
||||
cy.get(`${firstLineCode} span`).should(
|
||||
'have.text',
|
||||
'6021010:Plantas vivas: Esqueje/injerto, Vid'
|
||||
);
|
||||
});
|
||||
|
||||
it('should add a new row', () => {
|
||||
const rowData = [false, 'Plantas vivas: Esqueje/injerto, Vid', 30, 10, 5, 'FR'];
|
||||
|
||||
cy.addRow();
|
||||
cy.fillRow(thirdRow, rowData);
|
||||
cy.fillRow(thirdRow, [
|
||||
false,
|
||||
'Plantas vivas: Esqueje/injerto, Vid',
|
||||
30,
|
||||
10,
|
||||
5,
|
||||
'FR',
|
||||
]);
|
||||
cy.saveCard();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
});
|
||||
|
||||
it('should remove the first line', () => {
|
||||
cy.removeRow(2);
|
||||
cy.removeRow(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,9 +16,7 @@ describe('InvoiceInVat', () => {
|
|||
it('should edit the sage iva', () => {
|
||||
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
|
||||
cy.saveCard();
|
||||
cy.visit(`/#/invoice-in/1/vat`);
|
||||
|
||||
cy.getValue(firstLineVat).should('equal', '8');
|
||||
cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
|
||||
});
|
||||
|
||||
it('should add a new row', () => {
|
||||
|
|
|
@ -191,11 +191,14 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add('removeRow', (rowIndex) => {
|
||||
const trEls = 'tbody > tr:visible';
|
||||
let rowsBefore;
|
||||
cy.get('tbody > tr:visible')
|
||||
cy.get('tbody > tr')
|
||||
.its('length')
|
||||
.then((length) => {
|
||||
cy.get('.q-checkbox').eq(rowIndex).click();
|
||||
cy.get(`${trEls} .q-checkbox`)
|
||||
.eq(rowIndex - 1)
|
||||
.click();
|
||||
cy.removeCard();
|
||||
cy.get('.q-dialog button').eq(2).click();
|
||||
rowsBefore = length;
|
||||
|
@ -204,7 +207,7 @@ Cypress.Commands.add('removeRow', (rowIndex) => {
|
|||
// Check the existence of tbody before performing the second assertion.
|
||||
cy.get('tbody').then(($tbody) => {
|
||||
if ($tbody.length > 0)
|
||||
cy.get('tbody > tr:visible').should('have.length', rowsBefore - 1);
|
||||
cy.get('tbody > tr').should('have.length', rowsBefore - 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue