From 7fdef49b8cde9f448a525e73334a113e5b0e26c1 Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Sat, 16 May 2026 20:20:36 +0200 Subject: [PATCH] feat(settings): wire ANALYSIS_BACKGROUND into landing loader and add CI notes --- app/routes/__tests__/landing.settings.test.ts | 8 ++++ app/routes/landing.tsx | 6 +++ docs/ci-notes.md | 4 ++ prisma/dev.db | Bin 40960 -> 40960 bytes test-results/.last-run.json | 6 +-- .../error-context.md | 45 ------------------ 6 files changed, 20 insertions(+), 49 deletions(-) create mode 100644 app/routes/__tests__/landing.settings.test.ts create mode 100644 docs/ci-notes.md delete mode 100644 test-results/e2e-settings-admin-can-view-settings-page/error-context.md diff --git a/app/routes/__tests__/landing.settings.test.ts b/app/routes/__tests__/landing.settings.test.ts new file mode 100644 index 0000000..e0093f8 --- /dev/null +++ b/app/routes/__tests__/landing.settings.test.ts @@ -0,0 +1,8 @@ +import { test, expect } from 'vitest'; +import { settingsService } from '../../lib/settings.server'; + +test('landing loader respects ANALYSIS_BACKGROUND', async () => { + await settingsService.set('ANALYSIS_BACKGROUND', { enabled: true }, 'test'); + const val = await settingsService.get('ANALYSIS_BACKGROUND'); + expect(val).toEqual({ enabled: true }); +}); diff --git a/app/routes/landing.tsx b/app/routes/landing.tsx index 9e6d39c..cab12b0 100644 --- a/app/routes/landing.tsx +++ b/app/routes/landing.tsx @@ -1,6 +1,12 @@ import { Link } from "react-router"; import Navbar from "../components/Navbar"; import AlpacaAccountInfo from "../components/AlpacaAccountInfo"; +import { settingsService } from '~/lib/settings.server'; + +export async function loader() { + const analysisBackground = (await settingsService.get('ANALYSIS_BACKGROUND')) ?? { enabled: false }; + return { analysisBackground }; +} export default function Landing() { return ( diff --git a/docs/ci-notes.md b/docs/ci-notes.md new file mode 100644 index 0000000..0a0a45c --- /dev/null +++ b/docs/ci-notes.md @@ -0,0 +1,4 @@ +# CI Notes + +- Run `npx prisma migrate deploy` in CI. +- Ensure ADMIN_TOKEN is set in environment for admin APIs. diff --git a/prisma/dev.db b/prisma/dev.db index 39c77bbc2dee2e5bd0ffbf8ff7aafae56fccf20f..fce1f88528c0942713be8b11ac336a77472a23ed 100644 GIT binary patch delta 169 zcmZoTz|?SnX@WH4&xtb5j6XLfEQ#k};y=g0e~$mzX2FC*{1W2K#*B`Bjy{pWp26`> zj?UihLH?nBE=-%BWkR_Zhh delta 85 zcmZoTz|?SnX@WH4kBKtQj6XIeEQx1h> admin can view settings page -- Location: tests\e2e\settings.spec.ts:3:1 - -# Error details - -``` -Error: expect(locator).toBeVisible() failed - -Locator: locator('text=Settings') -Expected: visible -Timeout: 5000ms -Error: element(s) not found - -Call log: - - Expect "toBeVisible" with timeout 5000ms - - waiting for locator('text=Settings') - -``` - -```yaml -- main: - - heading "404" [level=1] - - paragraph: The requested page could not be found. -``` - -# Test source - -```ts - 1 | import { test, expect } from '@playwright/test'; - 2 | - 3 | test('admin can view settings page', async ({ page }) => { - 4 | await page.goto('http://localhost:5173/settings'); -> 5 | await expect(page.locator('text=Settings')).toBeVisible(); - | ^ Error: expect(locator).toBeVisible() failed - 6 | }); - 7 | -``` \ No newline at end of file