From 300e384f750ae21b28bb84cbac599f3e2d2ae48b Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Mar 2024 10:32:41 +0100 Subject: [PATCH] feat: refs #5186 add e2e --- src/router/modules/shelving.js | 2 +- .../parking/parkingBasicData.spec.js | 23 ++++++++++++++ .../integration/parking/parkingList.spec.js | 31 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/cypress/integration/parking/parkingBasicData.spec.js create mode 100644 test/cypress/integration/parking/parkingList.spec.js diff --git a/src/router/modules/shelving.js b/src/router/modules/shelving.js index af2605c93..826629064 100644 --- a/src/router/modules/shelving.js +++ b/src/router/modules/shelving.js @@ -38,7 +38,7 @@ export default { component: () => import('src/pages/Shelving/Card/ShelvingForm.vue'), }, { - path: '/parking', + path: '/parking/list', name: 'ParkingList', meta: { title: 'parkingList', diff --git a/test/cypress/integration/parking/parkingBasicData.spec.js b/test/cypress/integration/parking/parkingBasicData.spec.js new file mode 100644 index 000000000..b5633992c --- /dev/null +++ b/test/cypress/integration/parking/parkingBasicData.spec.js @@ -0,0 +1,23 @@ +/// +describe('ParkingBasicData', () => { + const codeInput = 'form .q-card .q-input input'; + const sectorSelect = 'form .q-card .q-select input'; + const sectorOpt = '.q-menu .q-item'; + beforeEach(() => { + cy.login('developer'); + cy.visit(`/#/parking/1/basic-data`); + }); + + it('should edit the code and sector', () => { + cy.get(sectorSelect).type('Second'); + cy.get(sectorOpt).click(); + + cy.get(codeInput).eq(0).clear(); + cy.get(codeInput).eq(0).type(123); + + cy.saveCard(); + + cy.get(sectorSelect).should('have.value', 'Second sector'); + cy.get(codeInput).should('have.value', 123); + }); +}); diff --git a/test/cypress/integration/parking/parkingList.spec.js b/test/cypress/integration/parking/parkingList.spec.js new file mode 100644 index 000000000..37164dc77 --- /dev/null +++ b/test/cypress/integration/parking/parkingList.spec.js @@ -0,0 +1,31 @@ +/// +describe('ParkingList', () => { + const firstCard = '.q-card:nth-child(1)'; + const firstChipId = + ':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content'; + const firstDetailBtn = + ':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn'; + const summaryHeader = '.summaryBody .header'; + const screen = '.q-page-container > .q-drawer-container > .fullscreen'; + + beforeEach(() => { + cy.login('developer'); + cy.visit(`/#/parking/list`); + cy.get(screen).click(); + }); + + it('should redirect on clicking a invoice', () => { + cy.get(firstChipId) + .invoke('text') + .then((content) => { + const id = content.substring(4); + cy.get(firstCard).click(); + cy.url().should('include', `/parking/${id}/summary`); + }); + }); + + it('should open the details', () => { + cy.get(firstDetailBtn).click(); + cy.get(summaryHeader).contains('Basic data'); + }); +});