fix: refs #8441 update vehicle DMS selectors to target first row elements for consistency
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
e4f0d13a9b
commit
dc7338ee8a
|
@ -1,16 +1,16 @@
|
||||||
describe('Vehicle DMS', () => {
|
describe('Vehicle DMS', () => {
|
||||||
const getSelector = (btnPosition) =>
|
const getSelector = (btnPosition) =>
|
||||||
`tr:last-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
|
`tr:first-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
|
||||||
|
|
||||||
const selectors = {
|
const selectors = {
|
||||||
lastRowDownloadBtn: getSelector(1),
|
firstRowDownloadBtn: getSelector(1),
|
||||||
lastRowEditBtn: getSelector(2),
|
firstRowEditBtn: getSelector(2),
|
||||||
lastRowDeleteBtn: getSelector(3),
|
firstRowDeleteBtn: getSelector(3),
|
||||||
lastRowReference: 'tr:last-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
|
lastRowReference: 'tr:last-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
|
||||||
firstRowReference:
|
firstRowReference:
|
||||||
'tr:first-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
|
'tr:first-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
|
||||||
firstRowId: 'tr:first-child > :nth-child(2) > .q-tr > :nth-child(1) > span',
|
firstRowId: 'tr:first-child > :nth-child(2) > .q-tr > :nth-child(1) > span',
|
||||||
lastRowWorkerLink: 'tr:last-child > :nth-child(8) > .q-tr > .link',
|
firstRowWorkerLink: 'tr:first-child > :nth-child(8) > .q-tr > .link',
|
||||||
descriptorTitle: '.descriptor .title',
|
descriptorTitle: '.descriptor .title',
|
||||||
descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
|
descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
|
||||||
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
|
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
|
||||||
|
@ -55,19 +55,6 @@ describe('Vehicle DMS', () => {
|
||||||
.should('have.length.greaterThan', 0);
|
.should('have.length.greaterThan', 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Should download DMS', () => {
|
|
||||||
const fileName = '11.jpg';
|
|
||||||
cy.intercept('GET', /\/api\/dms\/11\/downloadFile/).as('download');
|
|
||||||
cy.get(selectors.lastRowDownloadBtn).click();
|
|
||||||
|
|
||||||
cy.wait('@download').then((interception) => {
|
|
||||||
expect(interception.response.statusCode).to.equal(200);
|
|
||||||
expect(interception.response.headers['content-disposition']).to.contain(
|
|
||||||
fileName,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should create new DMS', () => {
|
it('Should create new DMS', () => {
|
||||||
const formSelectors = {
|
const formSelectors = {
|
||||||
actionBtn: selectors.addBtn,
|
actionBtn: selectors.addBtn,
|
||||||
|
@ -78,6 +65,25 @@ describe('Vehicle DMS', () => {
|
||||||
cy.testDmsAction('create', formSelectors, data, 'Data saved');
|
cy.testDmsAction('create', formSelectors, data, 'Data saved');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should download DMS', () => {
|
||||||
|
let fileName;
|
||||||
|
cy.get(selectors.firstRowId)
|
||||||
|
.invoke('text')
|
||||||
|
.then((label) => {
|
||||||
|
label = label.trim();
|
||||||
|
fileName = `${label}.jpg`;
|
||||||
|
});
|
||||||
|
cy.intercept('GET', /\/api\/dms\/\d+\/downloadFile/).as('download');
|
||||||
|
cy.get(selectors.firstRowDownloadBtn).click();
|
||||||
|
|
||||||
|
cy.wait('@download').then((interception) => {
|
||||||
|
expect(interception.response.statusCode).to.equal(200);
|
||||||
|
expect(interception.response.headers['content-disposition']).to.contain(
|
||||||
|
fileName,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Should import DMS', () => {
|
it('Should import DMS', () => {
|
||||||
const data = {
|
const data = {
|
||||||
Document: { val: '10', type: 'select' },
|
Document: { val: '10', type: 'select' },
|
||||||
|
@ -93,8 +99,8 @@ describe('Vehicle DMS', () => {
|
||||||
|
|
||||||
it('Should edit DMS', () => {
|
it('Should edit DMS', () => {
|
||||||
const formSelectors = {
|
const formSelectors = {
|
||||||
actionBtn: selectors.lastRowEditBtn,
|
actionBtn: selectors.firstRowEditBtn,
|
||||||
selectorContentToCheck: selectors.lastRowReference,
|
selectorContentToCheck: selectors.firstRowReference,
|
||||||
saveFormBtn: selectors.saveFormBtn,
|
saveFormBtn: selectors.saveFormBtn,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,8 +115,8 @@ describe('Vehicle DMS', () => {
|
||||||
|
|
||||||
it('Should delete DMS', () => {
|
it('Should delete DMS', () => {
|
||||||
const formSelectors = {
|
const formSelectors = {
|
||||||
actionBtn: selectors.lastRowDeleteBtn,
|
actionBtn: selectors.firstRowDeleteBtn,
|
||||||
selectorContentToCheck: selectors.lastRowReference,
|
selectorContentToCheck: selectors.firstRowReference,
|
||||||
};
|
};
|
||||||
|
|
||||||
cy.testDmsAction(
|
cy.testDmsAction(
|
||||||
|
@ -125,7 +131,7 @@ describe('Vehicle DMS', () => {
|
||||||
describe('Worker pop-ups', () => {
|
describe('Worker pop-ups', () => {
|
||||||
it('Should redirect to worker summary from worker descriptor pop-up', () => {
|
it('Should redirect to worker summary from worker descriptor pop-up', () => {
|
||||||
cy.checkRedirectionFromPopUp({
|
cy.checkRedirectionFromPopUp({
|
||||||
selectorToClick: selectors.lastRowWorkerLink,
|
selectorToClick: selectors.firstRowWorkerLink,
|
||||||
steps: [selectors.descriptorGoToSummaryBtn],
|
steps: [selectors.descriptorGoToSummaryBtn],
|
||||||
expectedUrlRegex: workerSummaryUrlRegex,
|
expectedUrlRegex: workerSummaryUrlRegex,
|
||||||
expectedTextSelector: selectors.descriptorTitle,
|
expectedTextSelector: selectors.descriptorTitle,
|
||||||
|
@ -134,7 +140,7 @@ describe('Vehicle DMS', () => {
|
||||||
|
|
||||||
it('Should redirect to worker summary from summary pop-up from worker descriptor pop-up', () => {
|
it('Should redirect to worker summary from summary pop-up from worker descriptor pop-up', () => {
|
||||||
cy.checkRedirectionFromPopUp({
|
cy.checkRedirectionFromPopUp({
|
||||||
selectorToClick: selectors.lastRowWorkerLink,
|
selectorToClick: selectors.firstRowWorkerLink,
|
||||||
steps: [
|
steps: [
|
||||||
selectors.descriptorOpenSummaryBtn,
|
selectors.descriptorOpenSummaryBtn,
|
||||||
selectors.summaryGoToSummaryBtn,
|
selectors.summaryGoToSummaryBtn,
|
||||||
|
|
Loading…
Reference in New Issue