refactor: refs #8626 improve test messages and selectors in route tests
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
2883779f3c
commit
17a18e8b49
|
@ -9,7 +9,7 @@ describe('AgencyWorkCenter', () => {
|
|||
const messages = {
|
||||
dataCreated: 'Data created',
|
||||
alreadyAssigned: 'This workCenter is already assigned to this agency',
|
||||
removed: 'WorkCenter removed successfully',
|
||||
removed: 'Work center removed successfully',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -8,6 +8,8 @@ describe('Route extended list', () => {
|
|||
date: getSelector('dated'),
|
||||
description: getSelector('description'),
|
||||
served: getSelector('isOk'),
|
||||
firstRowSelectCheckBox:
|
||||
'tbody > tr:first-child > :nth-child(1) .q-checkbox__inner',
|
||||
lastRowSelectCheckBox: 'tbody > tr:last-child > :nth-child(1) .q-checkbox__inner',
|
||||
removeBtn: '[title="Remove"]',
|
||||
resetBtn: '[title="Reset"]',
|
||||
|
@ -19,7 +21,7 @@ describe('Route extended list', () => {
|
|||
markServedBtn: '#st-actions > .q-btn-group > :nth-child(3)',
|
||||
searchbar: 'searchbar',
|
||||
firstTicketsRowSelectCheckBox:
|
||||
'.q-card > :nth-child(2) > .q-table__container > .q-table__middle > .q-table > tbody > :nth-child(1) > .q-table--col-auto-width > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg > .q-checkbox__svg',
|
||||
'.q-card .q-table > tbody > :nth-child(1) .q-checkbox',
|
||||
};
|
||||
|
||||
const checkboxState = {
|
||||
|
@ -117,12 +119,21 @@ describe('Route extended list', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('Should clone selected route', () => {
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
it('Should clone selected route and add ticket', () => {
|
||||
cy.get(selectors.firstRowSelectCheckBox).click();
|
||||
cy.get(selectors.cloneBtn).click();
|
||||
cy.dataCy('Starting date_inputDate').type('10-05-2001');
|
||||
cy.dataCy('Starting date_inputDate').type('01-01-2001');
|
||||
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||
cy.validateContent(selectors.date, '05/10/2001');
|
||||
cy.validateContent(selectors.date, '01/01/2001');
|
||||
|
||||
cy.dataCy('tableAction-0').last().click();
|
||||
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
|
||||
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||
cy.checkNotification(dataSaved);
|
||||
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
cy.get(selectors.removeBtn).click();
|
||||
cy.dataCy(selectors.confirmBtn).click();
|
||||
});
|
||||
|
||||
it('Should download selected route', () => {
|
||||
|
@ -143,22 +154,15 @@ describe('Route extended list', () => {
|
|||
cy.validateContent(selectors.served, checkboxState.check);
|
||||
});
|
||||
|
||||
it('Should delete the selected route', () => {
|
||||
it('Should delete the selected routes', () => {
|
||||
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||
|
||||
cy.get(selectors.removeBtn).click();
|
||||
|
||||
cy.dataCy(selectors.confirmBtn).click();
|
||||
|
||||
cy.checkNotification(dataSaved);
|
||||
});
|
||||
|
||||
it('Should add ticket to route', () => {
|
||||
cy.dataCy('tableAction-0').first().click();
|
||||
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
|
||||
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||
cy.checkNotification(dataSaved);
|
||||
});
|
||||
|
||||
it('Should save changes in route', () => {
|
||||
updateFields.forEach(({ selector, type, value }) => {
|
||||
fillField(selector, type, value);
|
||||
|
|
|
@ -2,11 +2,11 @@ describe('Vehicle', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('deliveryAssistant');
|
||||
cy.visit(`/#/route/vehicle/7`);
|
||||
cy.visit(`/#/route/vehicle/7/summary`);
|
||||
});
|
||||
|
||||
it('should delete a vehicle', () => {
|
||||
cy.openActionsDescriptor();
|
||||
cy.dataCy('descriptor-more-opts').click();
|
||||
cy.get('[data-cy="delete"]').click();
|
||||
cy.checkNotification('Vehicle removed');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue