refactor: refs #8594 update vehicle summary tests to use expected variable for consistency
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jose Antonio Tubau 2025-02-26 12:33:35 +01:00
parent faa2458997
commit 70c2f6b2b0
1 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@ describe('Vehicle list', () => {
Description: { val: 'Exclusive for batpod transport' }, Description: { val: 'Exclusive for batpod transport' },
}; };
const expected = data['Nº Plate'].val;
const summaryUrl = '/summary'; const summaryUrl = '/summary';
beforeEach(() => { beforeEach(() => {
@ -39,19 +40,19 @@ describe('Vehicle list', () => {
cy.dataCy(selectors.saveFormBtn).should('be.visible').click(); cy.dataCy(selectors.saveFormBtn).should('be.visible').click();
cy.checkNotification('Data created'); cy.checkNotification('Data created');
cy.get(selectors.summaryHeader).should('contain', data['Nº Plate'].val); cy.get(selectors.summaryHeader).should('contain', expected);
cy.url().should('include', summaryUrl); cy.url().should('include', summaryUrl);
}); });
it('should open summary by clicking a vehicle', () => { it('should open summary by clicking a vehicle', () => {
cy.get(selectors.numberPlate).click(); cy.get(selectors.numberPlate).click();
cy.get(selectors.summaryHeader).should('contain', data['Nº Plate'].val); cy.get(selectors.summaryHeader).should('contain', expected);
cy.url().should('include', summaryUrl); cy.url().should('include', summaryUrl);
}); });
it('should redirect to vehicle summary when click summary icon on summary pop-up', () => { it('should redirect to vehicle summary when click summary icon on summary pop-up', () => {
cy.get(selectors.summaryPopupBtn).click(); cy.get(selectors.summaryPopupBtn).click();
cy.get(selectors.summaryHeader).should('contain', data['Nº Plate'].val); cy.get(selectors.summaryHeader).should('contain', expected);
cy.get(selectors.summaryGoToSummaryBtn).click(); cy.get(selectors.summaryGoToSummaryBtn).click();
cy.url().should('include', summaryUrl); cy.url().should('include', summaryUrl);
}); });