refactor: refs #8422 update vehicle DMS tests and add download verification
This commit is contained in:
parent
0d056d3ed6
commit
070def57bb
|
@ -32,12 +32,14 @@ describe('Vehicle DMS', () => {
|
|||
};
|
||||
|
||||
const updateData = {
|
||||
Reference: { val: 'Vehicle:5678-DEF' },
|
||||
Reference: { val: 'Vehicle:4598-FGH' },
|
||||
Company: { val: 'CCs', type: 'select' },
|
||||
Warehouse: { val: 'Warehouse Two', type: 'select' },
|
||||
Type: { val: 'Facturas Recibidas', type: 'select' },
|
||||
};
|
||||
|
||||
const workerSummaryUrlRegex = /worker\/\d+\/summary/;
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
|
@ -51,16 +53,22 @@ describe('Vehicle DMS', () => {
|
|||
.should('have.length.greaterThan', 0);
|
||||
});
|
||||
|
||||
it('Should download DMS', () => {
|
||||
cy.get(selectors.lastRowDownloadBtn).click();
|
||||
cy.wait(2000);
|
||||
|
||||
const downloadsFolder = Cypress.config('downloadsFolder');
|
||||
const fileName = '11.jpg';
|
||||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||
});
|
||||
|
||||
it('Should create new DMS', () => {
|
||||
const uploadFolder = Cypress.config('tmpUploadFolder');
|
||||
cy.dataCy(selectors.addBtn).click();
|
||||
cy.dataCy(selectors.referenceInput).type(`{selectall}${data.Reference.val}`);
|
||||
cy.dataCy(selectors.fileInput).selectFile('test/cypress/fixtures/image.jpg', {
|
||||
force: true,
|
||||
});
|
||||
cy.dataCy(selectors.saveFormBtn).click();
|
||||
const fileName = 'image.jpg';
|
||||
cy.readFile(`${uploadFolder}/${fileName}`).should('exist');
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
|
||||
|
@ -87,22 +95,18 @@ describe('Vehicle DMS', () => {
|
|||
cy.get(selectors.lastRowDeleteBtn).click();
|
||||
cy.clickConfirm();
|
||||
cy.checkNotification('Data deleted');
|
||||
cy.validateContent(selectors.lastRowReference, 'Vehicle:3333-BAT');
|
||||
});
|
||||
|
||||
it('Should download DMS', () => {
|
||||
const downloadsFolder = Cypress.config('downloadsFolder');
|
||||
cy.get(selectors.lastRowDownloadBtn).click();
|
||||
cy.wait(3000);
|
||||
|
||||
const fileName = '1.txt';
|
||||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||
cy.containContent(selectors.lastRowReference, 'Vehicle:3333-BAT');
|
||||
});
|
||||
|
||||
it('Should redirect to worker summary from worker descriptor pop-up', () => {
|
||||
cy.get(selectors.lastRowWorkerLink).click();
|
||||
cy.get(selectors.descriptorTitle).should('contain', 'administrative');
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.containContent(selectors.summaryTitle, 'administrative');
|
||||
cy.get(selectors.lastRowWorkerLink)
|
||||
.click()
|
||||
.invoke('text')
|
||||
.then((workerName) => {
|
||||
workerName = workerName.trim();
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).click();
|
||||
cy.url().should('match', workerSummaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorTitle, workerName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue