#5926 - Worker/PDA docuware #387
|
@ -65,16 +65,16 @@ const handleSendToTablet = async (row) => {
|
||||||
console.error('Error removing department');
|
console.error('Error removing department');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function checkFileFocuware({ deviceProductionFk }) {
|
function checkFileFocuware({ deviceProductionFk }, signed) {
|
||||||
return axios.post(`Docuwares/${deviceProductionFk}/checkFile`, {
|
return axios.post(`Docuwares/${deviceProductionFk}/checkFile`, {
|
||||||
fileCabinet: 'hr',
|
fileCabinet: 'hr',
|
||||||
signed: true,
|
signed,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const handleRefreshDocuware = async (row) => {
|
const handleRefreshDocuware = async (row) => {
|
||||||
try {
|
try {
|
||||||
if (isProduction()) {
|
if (isProduction()) {
|
||||||
await checkFileFocuware(row);
|
await checkFileFocuware(row, true);
|
||||||
}
|
}
|
||||||
notify(t('PDA Signed'), 'positive');
|
notify(t('PDA Signed'), 'positive');
|
||||||
row.isSigned = true;
|
row.isSigned = true;
|
||||||
|
@ -98,16 +98,29 @@ const handleDownloadDocuware = async (row) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetchDocuware(deviceProductions) {
|
async function fetchDocuware(deviceProductions) {
|
||||||
let promises = deviceProductions.map((device) => checkFileFocuware(device));
|
let promisesIsDocuware = deviceProductions.map((device) =>
|
||||||
promises = await Promise.all(promises);
|
checkFileFocuware(device, false)
|
||||||
promises.forEach((promise) => {
|
);
|
||||||
|
let promisesIsSigned = [];
|
||||||
|
promisesIsDocuware = await Promise.all(promisesIsDocuware);
|
||||||
|
promisesIsDocuware.forEach((promise) => {
|
||||||
const id = +promise.config.url.match(/\d+/)[0];
|
const id = +promise.config.url.match(/\d+/)[0];
|
||||||
const deviceProduction = deviceProductions.find(
|
const deviceProduction = deviceProductions.find(
|
||||||
({ deviceProductionFk }) => deviceProductionFk === id
|
({ deviceProductionFk }) => deviceProductionFk === id
|
||||||
);
|
);
|
||||||
if (!deviceProduction) return;
|
if (!deviceProduction) return;
|
||||||
if (promise.data) deviceProduction.isSigned = promise.data;
|
|
||||||
deviceProduction.isDocuware = promise.data;
|
deviceProduction.isDocuware = promise.data;
|
||||||
|
if (promise.data)
|
||||||
|
promisesIsSigned.push(checkFileFocuware(deviceProduction, true));
|
||||||
|
});
|
||||||
|
promisesIsSigned = await Promise.all(promisesIsSigned);
|
||||||
|
promisesIsSigned.forEach((promise) => {
|
||||||
|
const id = +promise.config.url.match(/\d+/)[0];
|
||||||
|
const deviceProduction = deviceProductions.find(
|
||||||
|
({ deviceProductionFk }) => deviceProductionFk === id
|
||||||
|
);
|
||||||
|
if (!deviceProduction) return;
|
||||||
|
deviceProduction.isSigned = !!promise.data.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
loadingDocuware.value = false;
|
loadingDocuware.value = false;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
describe.only('WorkerPda', () => {
|
describe('WorkerPda', () => {
|
||||||
const deviceProductionField =
|
const deviceProductionField =
|
||||||
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
|
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/worker/1110/pda`);
|
cy.visit(`/#/worker/1110/pda`);
|
||||||
cy.waitForElement('.q-page', { timeout: 7000 });
|
cy.waitForElement('.q-page');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('assign pda', () => {
|
it('assign pda', () => {
|
||||||
|
@ -14,24 +14,11 @@ describe.only('WorkerPda', () => {
|
||||||
cy.get('.vn-row > #simSerialNumber').type('123{enter}');
|
cy.get('.vn-row > #simSerialNumber').type('123{enter}');
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||||
});
|
});
|
||||||
describe.only(' Row Actions', () => {
|
describe(' Row Actions', () => {
|
||||||
it.skip('delete pda', () => {
|
describe(' Docuware Flow ', () => {
|
||||||
cy.get(
|
describe(' NOT Signed ', () => {
|
||||||
':nth-child(1) > .vn-row > :nth-child(5) > .q-btn__content > .q-icon'
|
|
||||||
).click();
|
|
||||||
cy.get(
|
|
||||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
|
||||||
).click();
|
|
||||||
cy.get('.q-notification__message').should('have.text', 'PDA deallocated');
|
|
||||||
});
|
|
||||||
describe.only(' Docuware Flow ', () => {
|
|
||||||
describe.skip(' NOT Signed ', () => {
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept(
|
cy.intercept('POST', '**/checkFile', 'false').as('not_signed');
|
||||||
'POST',
|
|
||||||
'**/checkFile',
|
|
||||||
'false' // and force the response to be: []
|
|
||||||
).as('not_signed'); // and assign an alias
|
|
||||||
});
|
});
|
||||||
it('docuware', () => {
|
it('docuware', () => {
|
||||||
// Btn icon-client is present
|
// Btn icon-client is present
|
||||||
|
@ -54,10 +41,6 @@ describe.only('WorkerPda', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
':nth-child(1) > .vn-row > :nth-child(6) > .q-btn__content > .q-icon'
|
':nth-child(1) > .vn-row > :nth-child(6) > .q-btn__content > .q-icon'
|
||||||
).click();
|
).click();
|
||||||
// Btn confirm is clicked
|
|
||||||
// cy.get(
|
|
||||||
// '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
|
||||||
// ).click();
|
|
||||||
// Btn cloud_download is present
|
// Btn cloud_download is present
|
||||||
cy.get(
|
cy.get(
|
||||||
':nth-child(1) > .vn-row > :nth-child(6) > .q-btn__content > .q-icon'
|
':nth-child(1) > .vn-row > :nth-child(6) > .q-btn__content > .q-icon'
|
||||||
|
@ -68,13 +51,9 @@ describe.only('WorkerPda', () => {
|
||||||
).click();
|
).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe.only(' Is Signed ', () => {
|
describe(' Is Signed ', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept(
|
cy.intercept('POST', '**/checkFile', { id: 1 }).as('not_docuware');
|
||||||
'POST',
|
|
||||||
'**/checkFile',
|
|
||||||
'true' // and force the response to be: []
|
|
||||||
).as('signed'); // and assign an alias
|
|
||||||
});
|
});
|
||||||
it('docuware', () => {
|
it('docuware', () => {
|
||||||
// Btn cloud_download is present
|
// Btn cloud_download is present
|
||||||
|
@ -88,5 +67,16 @@ describe.only('WorkerPda', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe(' Other actions ', () => {
|
||||||
|
it('delete pda', () => {
|
||||||
|
cy.get(
|
||||||
|
':nth-child(1) > .vn-row > :nth-child(5) > .q-btn__content > .q-icon'
|
||||||
|
).click();
|
||||||
|
cy.get(
|
||||||
|
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
||||||
|
).click();
|
||||||
|
cy.get('.q-notification__message').should('have.text', 'PDA deallocated');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue