From d9b0ed1174fbfc34145a06346d7004a44ed4d65b Mon Sep 17 00:00:00 2001 From: jtubau Date: Fri, 21 Feb 2025 14:17:45 +0100 Subject: [PATCH 1/8] feat: refs #8648 enhance roadmapList tests with improved selectors and additional scenarios --- .../route/roadMap/roadmapList.spec.js | 70 ++++++++++++++++++- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js index 6d46b2cf6..64fcd1330 100644 --- a/test/cypress/integration/route/roadMap/roadmapList.spec.js +++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js @@ -1,12 +1,76 @@ describe('RoadMap', () => { + const getSelector = (colField) => + `tr:last-child > [data-col-field="${colField}"] > .no-padding`; + + const selectors = { + roadmap: getSelector('name'), + id: getSelector('id'), + etd: getSelector('etd'), + summaryHeader: '.summaryHeader > :nth-child(2)', + summaryGoToSummaryBtn: '.summaryHeader > a > .q-icon', + summaryBtn: 'tableAction-0', + inputRoadmap: 'Roadmap_input', + checkbox: '.q-virtual-scroll__content tr:last-child .q-checkbox', + cloneFormBtn: '.q-card__actions > .q-btn--standard', + cloneBtn: '#subToolbar > :nth-child(3)', + deleteBtn: ':nth-child(4) > .q-btn__content', + confirmBtn: 'VnConfirm_confirm', + inputEtd: 'ETD_inputDate', + }; + + const data = { + roadmap: 'TEST-ROADMAP', + etd: '01/01/2025', + }; + + const dataCreated = 'Data created'; + const summaryUrl = '/summary'; + beforeEach(() => { + cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/route/roadmap`); + cy.typeSearchbar('{enter}'); }); + + it('Should list roadmaps', () => { + cy.get('.q-table') + .children() + .should('be.visible') + .should('have.length.greaterThan', 0); + }); + it('Route list create roadmap and redirect', () => { cy.addBtnClick(); - cy.get('input[name="name"]').type('roadMapTestOne{enter}'); - cy.get('.q-notification__message').should('have.text', 'Data created'); - cy.url().should('include', '/summary'); + cy.dataCy(selectors.inputRoadmap).type(`${data.roadmap}{enter}`); + cy.checkNotification(dataCreated); + cy.url().should('include', summaryUrl); + }); + + it('open summary', () => { + cy.dataCy(selectors.summaryBtn).last().click(); + cy.get(selectors.summaryHeader).should('contain', data.roadmap); + cy.get(selectors.summaryGoToSummaryBtn).click(); + cy.get(selectors.summaryHeader).should('contain', data.roadmap); + }); + + it('Should clone selected roadmap with new ETD', () => { + cy.get(selectors.checkbox).click(); + cy.get(selectors.cloneBtn).click(); + cy.dataCy(selectors.inputEtd).click().type(`${data.etd}{enter}`); + cy.get(selectors.cloneFormBtn).click(); + cy.get(selectors.etd).should('contain', data.etd); + }); + + it('Should delete selected roadmap', () => { + cy.get(selectors.id).then(($el) => { + const valor = $el.text(); + + cy.get(selectors.checkbox).click(); + cy.get(selectors.deleteBtn).click(); + cy.dataCy(selectors.confirmBtn).click(); + cy.typeSearchbar('{enter}'); + cy.get(selectors.id).should('not.have.text', valor); + }); }); }); From 8b370c4a5065be37432a112c0e0f8ec4cec2ddf1 Mon Sep 17 00:00:00 2001 From: jtubau Date: Mon, 3 Mar 2025 09:25:02 +0100 Subject: [PATCH 2/8] feat: refs #7587 add 'ticketClaimed' translation and implement claims retrieval in TicketDescriptor --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Ticket/Card/TicketDescriptor.vue | 34 ++++++++++++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 5b667555e..0b77a95ca 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -530,6 +530,7 @@ ticket: customerCard: Customer card ticketList: Ticket List newOrder: New Order + ticketClaimed: Claimed ticket boxing: expedition: Expedition created: Created diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3f004485d..ad826c071 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -537,6 +537,7 @@ ticket: customerCard: Ficha del cliente ticketList: Listado de tickets newOrder: Nuevo pedido + ticketClaimed: Ticket reclamado boxing: expedition: Expedición created: Creado diff --git a/src/pages/Ticket/Card/TicketDescriptor.vue b/src/pages/Ticket/Card/TicketDescriptor.vue index c5f3233b1..ba66c0df4 100644 --- a/src/pages/Ticket/Card/TicketDescriptor.vue +++ b/src/pages/Ticket/Card/TicketDescriptor.vue @@ -11,6 +11,7 @@ import { toDateTimeFormat } from 'src/filters/date'; import filter from './TicketFilter.js'; import FetchData from 'src/components/FetchData.vue'; import TicketProblems from 'src/components/TicketProblems.vue'; +import axios from 'axios'; const $props = defineProps({ id: { @@ -31,23 +32,37 @@ const entityId = computed(() => { return $props.id || route.params.id; }); const problems = ref({}); +const originalTicket = ref(); function ticketFilter(ticket) { return JSON.stringify({ clientFk: ticket.clientFk }); } +async function getClaims() { + const userFilter = { where: { refundTicketFk: entityId.value } }; + const { data } = await axios.get(`TicketRefunds`, { + params: { filter: JSON.stringify(userFilter) }, + }); + if (!data) return; + originalTicket.value = data[0]?.originalTicketFk; +} +async function getProblems() { + const { data } = await axios.get(`Tickets/${entityId.value}/getTicketProblems`); + if (!data) return; + problems.value = data[0]; +} +function getInfo() { + getClaims(); + getProblems(); +}