refactor: refs #8581 remove unused Cypress commands and update tests for invoice creation
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
6dc23f4a26
commit
25e60e549a
|
@ -1,26 +0,0 @@
|
|||
Cypress.Commands.add('createInvoiceIn', () => {
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.fillInForm(
|
||||
{
|
||||
vnSupplierSelect: { val: 'farmer king', type: 'select' },
|
||||
'Invoice nº_input': 'mockInvoice',
|
||||
Company_select: { val: 'orn', type: 'select' },
|
||||
'Expedition date_inputDate': '16-11-2001',
|
||||
},
|
||||
{ attr: 'data-cy' },
|
||||
);
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('deleteInvoiceIn', () => {
|
||||
cy.dataCy('cardDescriptor_subtitle')
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
const id = text.match(/\d+/g).join('');
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
url: `/api/InvoiceIns/${id}`,
|
||||
headers: { Authorization: 'DEFAULT_TOKEN' },
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,7 +1,5 @@
|
|||
/// <reference types="cypress" />
|
||||
import moment from 'moment';
|
||||
import './commands';
|
||||
|
||||
describe('InvoiceInBasicData', () => {
|
||||
const dialogInputs = '.q-dialog input';
|
||||
const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`;
|
||||
|
@ -30,35 +28,18 @@ describe('InvoiceInBasicData', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
cy.login('administrative');
|
||||
cy.visit('/#/invoice-in/list');
|
||||
cy.visit(`/#/invoice-in/1/basic-data`);
|
||||
});
|
||||
|
||||
it('should edit every field', () => {
|
||||
cy.createInvoiceIn();
|
||||
cy.dataCy('InvoiceInBasicData-menu-item').click();
|
||||
|
||||
cy.fillInForm(mock, { attr: 'data-cy' });
|
||||
cy.saveCard();
|
||||
cy.validateForm(mock, { attr: 'data-cy' });
|
||||
cy.deleteInvoiceIn();
|
||||
});
|
||||
|
||||
it('should edit, remove and create the dms data', () => {
|
||||
const firtsInput = 'Invoice 65';
|
||||
const secondInput = 'Swords';
|
||||
cy.createInvoiceIn();
|
||||
cy.dataCy('InvoiceInBasicData-menu-item').click();
|
||||
|
||||
//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');
|
||||
const firtsInput = 'Ticket:65';
|
||||
const secondInput = "I don't know what posting here!";
|
||||
|
||||
//edit
|
||||
cy.get(getDocumentBtns(2)).click();
|
||||
|
@ -75,6 +56,16 @@ describe('InvoiceInBasicData', () => {
|
|||
cy.get(getDocumentBtns(3)).click();
|
||||
cy.get('[data-cy="VnConfirm_confirm"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
cy.deleteInvoiceIn();
|
||||
|
||||
//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');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -80,7 +80,7 @@ describe('InvoiceInDescriptor', () => {
|
|||
});
|
||||
|
||||
describe('corrective', () => {
|
||||
const originalId = 1;
|
||||
const originalId = 4;
|
||||
|
||||
beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`));
|
||||
|
||||
|
@ -99,7 +99,7 @@ describe('InvoiceInDescriptor', () => {
|
|||
cols: [
|
||||
{
|
||||
name: 'supplierRef',
|
||||
val: '1234',
|
||||
val: '1237',
|
||||
operation: 'include',
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue