From ba257fd489e06ad3280d5f05272b1a44c6f8c8ca Mon Sep 17 00:00:00 2001 From: David Date: Tue, 15 Sep 2026 11:37:50 +0200 Subject: [PATCH] Add end-to-end tests for proforma customer selection and persistence - Implement tests to verify that the selected customer is retained when creating a proforma. - Add functionality to change the customer and ensure the change is persisted. - Include tests to confirm the customer change and refresh the recipient name. - Test cancellation of customer change to ensure the previous customer remains selected. --- .../pages/company-details-settings-page.tsx | 8 +- .../services/proforma-updater.test.ts | 2 +- .../proformas/services/proforma-updater.ts | 2 +- .../change-status/ui/change-status-dialog.tsx | 5 +- .../proforma-create-initial-info-card.tsx | 2 +- .../ui/blocks/proforma-totals-summary.tsx | 2 +- ...proforma-update-customer-change-dialog.tsx | 13 +- .../ui/editors/proforma-payment-editor.tsx | 2 +- .../ui/editors/proforma-settings-editor.tsx | 2 +- .../editors/proforma-update-header-editor.tsx | 2 +- .../proforma-update-recipient-editor.tsx | 3 +- .../ui/editors/proforma-update-tax-editor.tsx | 2 +- ...ompany-verifactu-configuration-section.tsx | 2 +- .../company-verifactu-defaults-section.tsx | 2 +- .../company-verifactu-status-section.tsx | 2 +- .../customer-additional-config-fields.tsx | 2 +- .../ui/editor/customer-address-editor.tsx | 2 +- .../ui/editor/customer-basic-info-editor.tsx | 2 +- .../ui/editor/customer-contact-fields.tsx | 2 +- .../ui/editor/customer-fiscal-editor.tsx | 2 +- .../web/shared/ui/supplier-editor-form.tsx | 8 +- packages/rdx-ui/package.json | 12 +- .../src/components/editor-page/rdx-panel.tsx | 4 +- packages/rdx-ui/src/components/pdf-viewer.tsx | 2 +- packages/rdx-ui/src/components/rdx-badge.tsx | 2 +- packages/shadcn-ui/components.json | 4 +- packages/shadcn-ui/package.json | 7 +- packages/shadcn-ui/src/components/form.tsx | 76 +- packages/shadcn-ui/src/styles/globals.css | 16 +- pnpm-lock.yaml | 1725 +---------------- .../proformas/proforma-customer.spec.ts | 104 + 31 files changed, 249 insertions(+), 1772 deletions(-) create mode 100644 tests/e2e/customer-invoices/proformas/proforma-customer.spec.ts diff --git a/modules/companies/src/web/settings/company-details/ui/pages/company-details-settings-page.tsx b/modules/companies/src/web/settings/company-details/ui/pages/company-details-settings-page.tsx index 5e884a7c..f1fe427c 100644 --- a/modules/companies/src/web/settings/company-details/ui/pages/company-details-settings-page.tsx +++ b/modules/companies/src/web/settings/company-details/ui/pages/company-details-settings-page.tsx @@ -98,7 +98,7 @@ export const CompanyDetailsSettingsPage = () => { > } + icon={} title={t("settings.companyDetails.sections.general.title")} variant="plain" > @@ -148,7 +148,7 @@ export const CompanyDetailsSettingsPage = () => { } + icon={} title={t("settings.companyDetails.sections.contact.title")} variant="plain" > @@ -198,7 +198,7 @@ export const CompanyDetailsSettingsPage = () => { } + icon={} title="Dirección fiscal" variant="plain" > @@ -238,7 +238,7 @@ export const CompanyDetailsSettingsPage = () => { } + icon={} title={t("settings.companyDetails.sections.paymentTerm.title")} variant="plain" > diff --git a/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.test.ts b/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.test.ts index 07b8d36a..b4267535 100644 --- a/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.test.ts +++ b/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.test.ts @@ -157,7 +157,7 @@ test("update registra customer y recipient en una sola mutación Audit", async ( city: Maybe.some(unwrap(City.create("Madrid"))), postalCode: Maybe.some(unwrap(PostalCode.create("28001"))), province: Maybe.some(unwrap(Province.create("Madrid"))), - country: Maybe.some(unwrap(Country.create("ES"))), + countryCode: Maybe.some(unwrap(Country.create("ES"))), }, }), } as never, diff --git a/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.ts b/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.ts index 699c452d..259b3f3b 100644 --- a/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.ts +++ b/modules/customer-invoices/src/api/application/proformas/services/proforma-updater.ts @@ -213,7 +213,7 @@ export class ProformaUpdater implements IProformaUpdater { city: customer.address.city, postalCode: customer.address.postalCode, province: customer.address.province, - country: customer.address.country, + country: customer.address.countryCode, }); if (recipientResult.isFailure) { diff --git a/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx b/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx index ab07233d..68832d9d 100644 --- a/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx +++ b/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx @@ -13,6 +13,7 @@ import { ArrowRightIcon, CheckIcon, LockIcon } from "lucide-react"; import { useEffect, useMemo, useState } from "react"; import { useTranslation } from "../../../i18n"; +import { ProformaStatusBadge } from "../../list/ui/components"; import { PROFORMA_STATUS, type ProformaStatus } from "../../shared"; import type { ChangeProformaStatusTarget } from "../entities"; import { @@ -49,7 +50,7 @@ const StatusBadge = ({ status }: { status: ProformaStatus }) => { getProformaStatusColor(status) )} > - + {t(`catalog.proformas.status.${status}.label`)} ); @@ -149,7 +150,7 @@ export const ChangeProformaStatusDialog = ({ {t("proformas.change_proforma_status_dialog.current_status", "Estado actual")} - + {orderedAvailableStatuses.length === 0 ? ( diff --git a/modules/customer-invoices/src/web/proformas/create/ui/blocks/proforma-create-initial-info-card.tsx b/modules/customer-invoices/src/web/proformas/create/ui/blocks/proforma-create-initial-info-card.tsx index 2a487ed7..18cc6a8e 100644 --- a/modules/customer-invoices/src/web/proformas/create/ui/blocks/proforma-create-initial-info-card.tsx +++ b/modules/customer-invoices/src/web/proformas/create/ui/blocks/proforma-create-initial-info-card.tsx @@ -44,7 +44,7 @@ export const ProformaCreateInitialInfoCard = ({ return ( } + icon={} title={t("proformas.create.initial_info.title", "Información inicial")} variant="card" > diff --git a/modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-totals-summary.tsx b/modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-totals-summary.tsx index d18373f5..9dd1121e 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-totals-summary.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-totals-summary.tsx @@ -52,7 +52,7 @@ export const ProformaTotalsSummary = ({ className={className} description={t("proformas.update.totals.description")} disabled={disabled} - icon={} + icon={} title={t("proformas.update.totals.title", "Totales")} > diff --git a/modules/customer-invoices/src/web/proformas/update/ui/components/proforma-update-customer-change-dialog.tsx b/modules/customer-invoices/src/web/proformas/update/ui/components/proforma-update-customer-change-dialog.tsx index 466e7b3f..a1b93d0a 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/components/proforma-update-customer-change-dialog.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/components/proforma-update-customer-change-dialog.tsx @@ -172,12 +172,21 @@ export const ProformaUpdateCustomerChangeDialog = ({ - {status === "compatible" ? ( -