fix: refs #8277 improve tests
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
5b80c22bae
commit
e127c4cec9
|
@ -264,7 +264,7 @@ async function preAccount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateFile() {
|
async function updateFile() {
|
||||||
await axios.post(`Dms/${dmsFk}/updateFile`, { dmsTypeId });
|
await axios.post(`Dms/${dmsFk}/updateFile`, { dmsTypeId: dmsTypeId.value });
|
||||||
await createInvoice(false);
|
await createInvoice(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,49 +5,50 @@ describe('Entry PreAccount Functionality', () => {
|
||||||
cy.visit('/#/entry/pre-account');
|
cy.visit('/#/entry/pre-account');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only('should handle entries with different suppliers or companies', () => {
|
it('should handle entries with different suppliers or companies', () => {
|
||||||
cy.contains('[data-col-field="id"]', /^\s*3\s*$/)
|
selectRowsByCol('id', [3, 2]);
|
||||||
.parent()
|
|
||||||
.find('td > .q-checkbox')
|
|
||||||
.click();
|
|
||||||
cy.contains('[data-col-field="id"]', /^\s*2\s*$/)
|
|
||||||
.parent()
|
|
||||||
.find('td:nth-child(1)')
|
|
||||||
.click();
|
|
||||||
cy.dataCy('preAccount_btn').click();
|
cy.dataCy('preAccount_btn').click();
|
||||||
cy.checkNotification('Entries must have the same supplier and company');
|
cy.checkNotification('Entries must have the same supplier and company');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should pre-account without questions if it's agricultural", () => {
|
it("should pre-account without questions if it's agricultural", () => {
|
||||||
cy.selectRows([2]);
|
selectRowsByCol('id', [2]);
|
||||||
cy.dataCy('preAccount_btn').click();
|
cy.dataCy('preAccount_btn').click();
|
||||||
cy.checkNotification('It has been successfully pre-accounted');
|
cy.checkNotification('It has been successfully pre-accounted');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should ask to upload a doc. if it's not agricultural and doesn't have doc. ", () => {
|
it("should ask to upload a doc. if it's not agricultural and doesn't have doc. ", () => {
|
||||||
cy.selectRows([1]);
|
selectRowsByCol('id', [3]);
|
||||||
cy.dataCy('preAccount_btn').click();
|
cy.dataCy('preAccount_btn').click();
|
||||||
cy.dataCy('Reference_input').type('{selectall}234343fh', { delay: 0 });
|
cy.dataCy('Reference_input').type('{selectall}234343fh', { delay: 0 });
|
||||||
cy.dataCy('VnDms_inputFile').selectFile('test/cypress/fixtures/image.jpg', {
|
cy.dataCy('VnDms_inputFile').selectFile('test/cypress/fixtures/image.jpg', {
|
||||||
force: true,
|
force: true,
|
||||||
});
|
});
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
cy.checkNotification('It has been successfully pre-accounted');
|
cy.checkNotification('It has been successfully pre-accounted');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should ask to inherit the doc. and open VnDms popup if user choose "no"', () => {
|
it('should ask to inherit the doc. and open VnDms popup if user choose "no"', () => {
|
||||||
cy.selectRows([2]);
|
selectRowsByCol('id', [102]);
|
||||||
cy.dataCy('preAccount_btn').click();
|
cy.dataCy('preAccount_btn').click();
|
||||||
cy.dataCy('updateFile_no').click();
|
cy.dataCy('updateFile_no').click();
|
||||||
cy.get('#formModel').should('be.visible');
|
cy.get('#formModel').should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should ask to inherit the doc. and open VnDms popup if user choose "yes" and pre-account', () => {
|
it('should ask to inherit the doc. and open VnDms popup if user choose "yes" and pre-account', () => {
|
||||||
cy.selectRows([2]);
|
selectRowsByCol('id', [102]);
|
||||||
cy.dataCy('preAccount_btn').click();
|
cy.dataCy('preAccount_btn').click();
|
||||||
cy.dataCy('updateFile_yes').click();
|
cy.dataCy('updateFile_yes').click();
|
||||||
cy.checkNotification('It has been successfully pre-accounted');
|
cy.checkNotification('It has been successfully pre-accounted');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function selectRowsByCol(col = 'id', vals = []) {
|
||||||
function selectRowsByCol(col= 'id', values = [])
|
for (const val of vals) {
|
||||||
|
const regex = new RegExp(`^\\s*(${val})\\s*$`);
|
||||||
|
cy.contains(`[data-col-field="${col}"]`, regex)
|
||||||
|
.parent()
|
||||||
|
.find('td > .q-checkbox')
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue