49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe('Entry PreAccount Functionality', () => {
|
|
beforeEach(() => {
|
|
cy.login('administrative');
|
|
cy.visit('/#/entry/pre-account');
|
|
});
|
|
|
|
it("should pre-account without questions if it's agricultural", () => {
|
|
selectRowsByCol('id', [2]);
|
|
cy.dataCy('preAccount_btn').click();
|
|
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. ", () => {
|
|
selectRowsByCol('id', [3]);
|
|
cy.dataCy('preAccount_btn').click();
|
|
cy.dataCy('Reference_input').type('{selectall}234343fh', { delay: 0 });
|
|
cy.dataCy('VnDms_inputFile').selectFile('test/cypress/fixtures/image.jpg', {
|
|
force: true,
|
|
});
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.checkNotification('It has been successfully pre-accounted');
|
|
});
|
|
|
|
it('should ask to inherit the doc. and open VnDms popup if user choose "no"', () => {
|
|
selectRowsByCol('id', [101]);
|
|
cy.dataCy('preAccount_btn').click();
|
|
cy.dataCy('updateFileNo').click();
|
|
cy.get('#formModel').should('be.visible');
|
|
});
|
|
|
|
it('should ask to inherit the doc. and open VnDms popup if user choose "yes" and pre-account', () => {
|
|
selectRowsByCol('id', [101]);
|
|
cy.dataCy('preAccount_btn').click();
|
|
cy.dataCy('updateFileYes').click();
|
|
cy.checkNotification('It has been successfully pre-accounted');
|
|
});
|
|
});
|
|
|
|
function selectRowsByCol(col = 'id', vals = []) {
|
|
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();
|
|
}
|
|
}
|