81 lines
2.1 KiB
JavaScript
81 lines
2.1 KiB
JavaScript
describe('WorkerPda', () => {
|
|
const deviceId = 4;
|
|
beforeEach(() => {
|
|
cy.login('developer');
|
|
cy.visit(`/#/worker/1110/pda`);
|
|
});
|
|
|
|
it('assign and delete pda', () => {
|
|
creatNewPDA();
|
|
cy.checkNotification('Data created');
|
|
cy.visit(`/#/worker/1110/pda`);
|
|
removeNewPDA();
|
|
cy.checkNotification('PDA deallocated');
|
|
});
|
|
|
|
it('send and download pdf to docuware', () => {
|
|
//Send
|
|
cy.intercept('POST', '/api/Docuwares/upload-pda-pdf', (req) => {
|
|
req.reply({
|
|
statusCode: 200,
|
|
body: {},
|
|
});
|
|
});
|
|
|
|
creatNewPDA();
|
|
|
|
cy.dataCy('workerPda-send').click();
|
|
cy.clickConfirm();
|
|
cy.checkNotification('PDF sended to signed');
|
|
|
|
//Download
|
|
cy.intercept('POST', /\/api\/Docuwares\/Jones%20Jessica\/checkFile/, (req) => {
|
|
req.reply({
|
|
statusCode: 200,
|
|
body: {
|
|
id: deviceId,
|
|
state: 'Firmado',
|
|
},
|
|
});
|
|
});
|
|
cy.get('#st-actions').contains('refresh').click();
|
|
cy.intercept('GET', '/api/Docuwares/download-pda-pdf**', (req) => {
|
|
req.reply({
|
|
statusCode: 200,
|
|
body: {},
|
|
});
|
|
});
|
|
|
|
cy.dataCy('workerPda-download').click();
|
|
removeNewPDA();
|
|
});
|
|
|
|
it('send 2 pdfs to docuware', () => {
|
|
cy.intercept('POST', '/api/Docuwares/upload-pda-pdf', (req) => {
|
|
req.reply({
|
|
statusCode: 200,
|
|
body: {},
|
|
});
|
|
});
|
|
|
|
creatNewPDA();
|
|
creatNewPDA(2);
|
|
cy.selectRows([1, 2]);
|
|
cy.get('#st-actions').contains('Send').click();
|
|
cy.checkNotification('PDF sended to signed');
|
|
|
|
removeNewPDA();
|
|
});
|
|
|
|
function creatNewPDA(id = deviceId) {
|
|
cy.addBtnClick();
|
|
cy.selectOption('[data-cy="pda-dialog-select"]', id);
|
|
cy.saveCard();
|
|
}
|
|
|
|
function removeNewPDA() {
|
|
cy.dataCy('workerPda-remove').first().click();
|
|
cy.clickConfirm();
|
|
}
|
|
});
|