diff --git a/apps/toldo-app/package-lock.json b/apps/toldo-app/package-lock.json index d29cb14..8fbb091 100644 --- a/apps/toldo-app/package-lock.json +++ b/apps/toldo-app/package-lock.json @@ -22,6 +22,7 @@ }, "devDependencies": { "@capacitor/cli": "^6.2.1", + "@playwright/test": "^1.64.1", "@testing-library/vue": "^8.1.0", "@types/node": "^24.19.2", "@vitejs/plugin-vue": "^6.0.10", @@ -948,6 +949,21 @@ "url": "https://github.com/sponsors/oxc-project" } }, + "node_modules/@playwright/test": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz", + "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==", + "dev": true, + "dependencies": { + "playwright": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/@rolldown/binding-android-arm-eabi": { "version": "1.2.15", "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz", @@ -4039,6 +4055,33 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/playwright": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz", + "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==", + "dev": true, + "dependencies": { + "playwright-core": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz", + "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/plist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.1.tgz", diff --git a/apps/toldo-app/package.json b/apps/toldo-app/package.json index d9a3f10..b2a1df2 100644 --- a/apps/toldo-app/package.json +++ b/apps/toldo-app/package.json @@ -8,7 +8,8 @@ "build": "vite build", "preview": "vite preview", "test": "vitest", - "test:run": "vitest run" + "test:run": "vitest run", + "test:e2e": "playwright test" }, "dependencies": { "@capacitor/android": "^6.2.1", @@ -25,6 +26,7 @@ }, "devDependencies": { "@capacitor/cli": "^6.2.1", + "@playwright/test": "^1.64.1", "@testing-library/vue": "^8.1.0", "@types/node": "^24.19.2", "@vitejs/plugin-vue": "^6.0.10", diff --git a/apps/toldo-app/playwright.config.ts b/apps/toldo-app/playwright.config.ts new file mode 100644 index 0000000..8fa49e7 --- /dev/null +++ b/apps/toldo-app/playwright.config.ts @@ -0,0 +1,9 @@ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + testDir: './tests/e2e', + timeout: 30_000, + use: { baseURL: 'http://127.0.0.1:4173', trace: 'on-first-retry' }, + webServer: { command: 'npm run dev -- --host 127.0.0.1 --port 4173', url: 'http://127.0.0.1:4173', reuseExistingServer: true }, + projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'], launchOptions: { executablePath: '/usr/bin/chromium' } } }, { name: 'mobile', use: { ...devices['Pixel 5'], launchOptions: { executablePath: '/usr/bin/chromium' } } }], +}); diff --git a/apps/toldo-app/src/__tests__/critical-flow.test.ts b/apps/toldo-app/src/__tests__/critical-flow.test.ts new file mode 100644 index 0000000..7307559 --- /dev/null +++ b/apps/toldo-app/src/__tests__/critical-flow.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from 'vitest'; +import { ExportImportService } from '@toldo/services'; + +describe('contratos de operación y respaldo', () => { + it('exporta jornadas junto con los datos operativos', () => { + const service = new ExportImportService(); + const result = service.exportAll({ + productores: [], productos: [], movimientosInventario: [], ventas: [], ventaLineas: [], + gastos: [], ajustes: [], cuadres: [], jornadas: [{ id: 'day-1' } as any], + }); + expect(result.data.jornadas).toHaveLength(1); + expect(service.import(result).data.jornadas?.[0].id).toBe('day-1'); + }); + + it('acepta respaldos v1 sin jornadas y los migra al contrato actual', () => { + const legacy = { + schemaVersion: 1, appVersion: '0.0.1', exportedAt: new Date().toISOString(), + data: { productores: [], productos: [], movimientosInventario: [], ventas: [], ventaLineas: [], gastos: [], ajustes: [], cuadres: [] }, + }; + expect(new ExportImportService().import(legacy).data.jornadas).toEqual([]); + }); +}); diff --git a/apps/toldo-app/src/components/Layout.vue b/apps/toldo-app/src/components/Layout.vue index 9f41603..b34d70a 100644 --- a/apps/toldo-app/src/components/Layout.vue +++ b/apps/toldo-app/src/components/Layout.vue @@ -1,21 +1,16 @@ + + diff --git a/apps/toldo-app/src/plugins/vuetify.ts b/apps/toldo-app/src/plugins/vuetify.ts index e8f6c06..3bff534 100644 --- a/apps/toldo-app/src/plugins/vuetify.ts +++ b/apps/toldo-app/src/plugins/vuetify.ts @@ -14,6 +14,12 @@ export default createVuetify({ primary: '#2d5f3b', secondary: '#4a7c59', accent: '#6b8e23', + surface: '#fffdf8', + background: '#f5f7f2', + info: '#286c7a', + }, + variables: { + 'border-radius-root': '12px', }, }, }, diff --git a/apps/toldo-app/src/style.css b/apps/toldo-app/src/style.css index 527d4fb..ae505a2 100644 --- a/apps/toldo-app/src/style.css +++ b/apps/toldo-app/src/style.css @@ -17,7 +17,7 @@ font: 18px/145% var(--sans); letter-spacing: 0.18px; - color-scheme: light dark; + color-scheme: light; color: var(--text); background: var(--bg); font-synthesis: none; @@ -52,6 +52,8 @@ body { margin: 0; + min-width: 320px; + background: #f5f7f2; } h1, @@ -156,17 +158,7 @@ code { } } -#app { - width: 1126px; - max-width: 100%; - margin: 0 auto; - text-align: center; - border-inline: 1px solid var(--border); - min-height: 100svh; - display: flex; - flex-direction: column; - box-sizing: border-box; -} +#app { min-height: 100svh; } #center { display: flex; diff --git a/apps/toldo-app/src/views/Ajustes.vue b/apps/toldo-app/src/views/Ajustes.vue index 6efb8e9..acc9673 100644 --- a/apps/toldo-app/src/views/Ajustes.vue +++ b/apps/toldo-app/src/views/Ajustes.vue @@ -1,6 +1,7 @@