describe('Vehicle list', () => { const selectors = { saveFormBtn: 'FormModelPopup_save', summaryPopupBtn: 'tr:last-child > .q-table--col-auto-width > .q-btn', summaryGoToSummaryBtn: '.header > .q-icon', summaryHeader: '.summaryHeader > div', numberPlate: 'tr:last-child > [data-col-field="numberPlate"] > .no-padding', }; const data = { 'Nº Plate': { val: '9465-LPA' }, 'Trade Mark': { val: 'WAYNE INDUSTRIES' }, Model: { val: 'BATREMOLQUE' }, Type: { val: 'remolque', type: 'select' }, Warehouse: { val: 'Warehouse One', type: 'select' }, Country: { val: 'Portugal', type: 'select' }, Description: { val: 'Exclusive for batpod transport' }, }; const expected = data['Nº Plate'].val; const summaryUrl = '/summary'; beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/route/vehicle/list`); cy.typeSearchbar('{enter}'); }); it('should list vehicles', () => { cy.get('.q-table') .children() .should('be.visible') .should('have.length.greaterThan', 0); }); it('Should add new vehicle', () => { cy.addBtnClick(); cy.fillInForm(data); cy.dataCy(selectors.saveFormBtn).should('be.visible').click(); cy.checkNotification('Data created'); cy.get(selectors.summaryHeader).should('contain', expected); cy.url().should('include', summaryUrl); }); it('should open summary by clicking a vehicle', () => { cy.get(selectors.numberPlate).click(); cy.get(selectors.summaryHeader).should('contain', expected); cy.url().should('include', summaryUrl); }); it('should redirect to vehicle summary when click summary icon on summary pop-up', () => { cy.get(selectors.summaryPopupBtn).click(); cy.get(selectors.summaryHeader).should('contain', expected); cy.get(selectors.summaryGoToSummaryBtn).click(); cy.url().should('include', summaryUrl); }); });