test: refs #8441 update route extended list tests to include ID selector and improve summary redirection checks
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
6d2fa8493c
commit
acd78fc859
|
@ -8,6 +8,7 @@ describe('Route extended list', () => {
|
|||
date: getSelector('dated'),
|
||||
description: getSelector('description'),
|
||||
served: getSelector('isOk'),
|
||||
id: getSelector('id'),
|
||||
firstRowSelectCheckBox:
|
||||
'tbody > tr:first-child > :nth-child(1) .q-checkbox__inner',
|
||||
lastRowSelectCheckBox: 'tbody > tr:last-child > :nth-child(1) .q-checkbox__inner',
|
||||
|
@ -22,13 +23,17 @@ describe('Route extended list', () => {
|
|||
searchbar: 'searchbar',
|
||||
firstTicketsRowSelectCheckBox:
|
||||
'.q-card .q-table > tbody > :nth-child(1) .q-checkbox',
|
||||
openSummaryBtn: 'tableAction-1',
|
||||
goToSummaryBtn: 'tableAction-2',
|
||||
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
||||
descriptorSubtitle: '[data-cy="vnDescriptor_subtitle"]',
|
||||
};
|
||||
|
||||
const checkboxState = {
|
||||
check: 'check',
|
||||
uncheck: 'close',
|
||||
};
|
||||
const url = '/#/route/extended-list';
|
||||
const summaryUrlRegex = /route\/\d+\/summary/;
|
||||
const dataCreated = 'Data created';
|
||||
const dataSaved = 'Data saved';
|
||||
|
||||
|
@ -45,7 +50,7 @@ describe('Route extended list', () => {
|
|||
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
|
||||
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
|
||||
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
|
||||
{ selector: selectors.date, type: 'date', value: '11/01/2001' },
|
||||
{ selector: selectors.date, type: 'date', value: '02/02/2001' },
|
||||
{ selector: selectors.description, type: 'input', value: 'Description updated' },
|
||||
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
|
||||
];
|
||||
|
@ -77,7 +82,7 @@ describe('Route extended list', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(url);
|
||||
cy.visit('/#/route/extended-list');
|
||||
cy.typeSearchbar('{enter}');
|
||||
});
|
||||
|
||||
|
@ -106,7 +111,7 @@ describe('Route extended list', () => {
|
|||
cy.fillInForm(data);
|
||||
|
||||
cy.dataCy(selectors.saveFormBtn).click();
|
||||
cy.url().should('include', '/summary');
|
||||
cy.location().should('match', summaryUrlRegex);
|
||||
cy.checkNotification(dataCreated);
|
||||
});
|
||||
|
||||
|
@ -122,7 +127,7 @@ describe('Route extended list', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('Should clone selected route and add ticket', () => {
|
||||
it('Should clone selected route, add ticket and mark as served', () => {
|
||||
cy.get(selectors.firstRowSelectCheckBox).click();
|
||||
cy.get(selectors.cloneBtn).click();
|
||||
cy.dataCy('Starting date_inputDate').type('01-01-2001');
|
||||
|
@ -134,6 +139,11 @@ describe('Route extended list', () => {
|
|||
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||
cy.checkNotification(dataSaved);
|
||||
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.markServedBtn).click();
|
||||
cy.typeSearchbar('{enter}');
|
||||
cy.validateContent(selectors.served, checkboxState.check);
|
||||
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.removeBtn).click();
|
||||
cy.dataCy(selectors.confirmBtn).click();
|
||||
|
@ -149,22 +159,6 @@ describe('Route extended list', () => {
|
|||
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||
});
|
||||
|
||||
it('Should mark as served the selected route', () => {
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.markServedBtn).click();
|
||||
|
||||
cy.typeSearchbar('{enter}');
|
||||
cy.validateContent(selectors.served, checkboxState.check);
|
||||
});
|
||||
|
||||
it('Should delete the selected route', () => {
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.removeBtn).click();
|
||||
cy.dataCy(selectors.confirmBtn).click();
|
||||
|
||||
cy.checkNotification(dataSaved);
|
||||
});
|
||||
|
||||
it('Should save changes in route', () => {
|
||||
updateFields.forEach(({ selector, type, value }) => {
|
||||
fillField(selector, type, value);
|
||||
|
@ -175,28 +169,41 @@ describe('Route extended list', () => {
|
|||
|
||||
cy.typeSearchbar('{enter}');
|
||||
|
||||
updateFields.forEach(({ selector, value, type }) => {
|
||||
if (type === 'date') {
|
||||
const [month, day, year] = value.split('/');
|
||||
value = `${day}/${month}/${year}`;
|
||||
}
|
||||
cy.get(selector).should('contain', value);
|
||||
updateFields.forEach(({ selector, value }) => {
|
||||
cy.validateContent(selector, value);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should open summary pop-up when click summuary icon', () => {
|
||||
cy.dataCy('tableAction-1').last().click();
|
||||
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);
|
||||
it('Should delete the selected route', () => {
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.removeBtn).click();
|
||||
cy.dataCy(selectors.confirmBtn).click();
|
||||
|
||||
cy.checkNotification(dataSaved);
|
||||
});
|
||||
|
||||
it('Should redirect to the summary from the route summary pop-up', () => {
|
||||
cy.dataCy('tableAction-1').last().click();
|
||||
cy.get('.header > .q-icon').should('be.visible').click();
|
||||
cy.url().should('include', '/summary');
|
||||
cy.get(selectors.id)
|
||||
.last()
|
||||
.invoke('text')
|
||||
.then((routeId) => {
|
||||
routeId = routeId.trim();
|
||||
cy.dataCy(selectors.openSummaryBtn).last().click();
|
||||
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
|
||||
cy.location().should('match', summaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorSubtitle, routeId);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should redirect to the summary when click go to summary icon', () => {
|
||||
cy.dataCy('tableAction-2').last().click();
|
||||
cy.url().should('include', '/summary');
|
||||
cy.get(selectors.id)
|
||||
.last()
|
||||
.invoke('text')
|
||||
.then((routeId) => {
|
||||
routeId = routeId.trim();
|
||||
cy.dataCy(selectors.goToSummaryBtn).last().click();
|
||||
cy.location().should('match', summaryUrlRegex);
|
||||
cy.containContent(selectors.descriptorSubtitle, routeId);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue