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) =>
|
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 formatOpt = (row, { model, options }, prop) => {
|
||||||
const obj = row[model];
|
const obj = row[model];
|
||||||
|
|
|
@ -8,12 +8,17 @@ describe('InvoiceInCorrective', () => {
|
||||||
it('should create a correcting invoice', () => {
|
it('should create a correcting invoice', () => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
cy.login('developer');
|
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.openActionsDescriptor();
|
||||||
|
|
||||||
cy.get(createRectificative).click();
|
cy.get(createRectificative).click();
|
||||||
cy.get(saveDialog).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(rectificativeSection).click();
|
||||||
cy.get('tbody > tr:visible').should('have.length', 1);
|
cy.get('tbody > tr:visible').should('have.length', 1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,25 +11,29 @@ describe('InvoiceInIntrastat', () => {
|
||||||
|
|
||||||
it('should edit the first line', () => {
|
it('should edit the first line', () => {
|
||||||
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid');
|
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid');
|
||||||
|
|
||||||
cy.get(inputBtns).eq(1).click();
|
cy.get(inputBtns).eq(1).click();
|
||||||
|
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.visit(`/#/invoice-in/1/intrastat`);
|
cy.get(`${firstLineCode} span`).should(
|
||||||
|
'have.text',
|
||||||
cy.getValue(firstLineCode).should('equal', 'Plantas vivas: Esqueje/injerto, Vid');
|
'6021010:Plantas vivas: Esqueje/injerto, Vid'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a new row', () => {
|
it('should add a new row', () => {
|
||||||
const rowData = [false, 'Plantas vivas: Esqueje/injerto, Vid', 30, 10, 5, 'FR'];
|
|
||||||
|
|
||||||
cy.addRow();
|
cy.addRow();
|
||||||
cy.fillRow(thirdRow, rowData);
|
cy.fillRow(thirdRow, [
|
||||||
|
false,
|
||||||
|
'Plantas vivas: Esqueje/injerto, Vid',
|
||||||
|
30,
|
||||||
|
10,
|
||||||
|
5,
|
||||||
|
'FR',
|
||||||
|
]);
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove the first line', () => {
|
it('should remove the first line', () => {
|
||||||
cy.removeRow(2);
|
cy.removeRow(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,9 +16,7 @@ describe('InvoiceInVat', () => {
|
||||||
it('should edit the sage iva', () => {
|
it('should edit the sage iva', () => {
|
||||||
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
|
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.visit(`/#/invoice-in/1/vat`);
|
cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
|
||||||
|
|
||||||
cy.getValue(firstLineVat).should('equal', '8');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a new row', () => {
|
it('should add a new row', () => {
|
||||||
|
|
|
@ -191,11 +191,14 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('removeRow', (rowIndex) => {
|
Cypress.Commands.add('removeRow', (rowIndex) => {
|
||||||
|
const trEls = 'tbody > tr:visible';
|
||||||
let rowsBefore;
|
let rowsBefore;
|
||||||
cy.get('tbody > tr:visible')
|
cy.get('tbody > tr')
|
||||||
.its('length')
|
.its('length')
|
||||||
.then((length) => {
|
.then((length) => {
|
||||||
cy.get('.q-checkbox').eq(rowIndex).click();
|
cy.get(`${trEls} .q-checkbox`)
|
||||||
|
.eq(rowIndex - 1)
|
||||||
|
.click();
|
||||||
cy.removeCard();
|
cy.removeCard();
|
||||||
cy.get('.q-dialog button').eq(2).click();
|
cy.get('.q-dialog button').eq(2).click();
|
||||||
rowsBefore = length;
|
rowsBefore = length;
|
||||||
|
@ -204,7 +207,7 @@ Cypress.Commands.add('removeRow', (rowIndex) => {
|
||||||
// Check the existence of tbody before performing the second assertion.
|
// Check the existence of tbody before performing the second assertion.
|
||||||
cy.get('tbody').then(($tbody) => {
|
cy.get('tbody').then(($tbody) => {
|
||||||
if ($tbody.length > 0)
|
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