mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-06 17:08:10 +00:00
fix(e2e): fill api_token in nodes tests so submit button is enabled
The Add Node button requires both api_url AND api_token to be non-empty before it enables. Both validation tests were only filling api_url, leaving the button permanently disabled and timing out after 30s. Add a dummy api_token fill in each test so the button enables and the form submits — the backend then correctly rejects the invalid URL.
This commit is contained in:
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- **Added:** `isValidStackName`, `isValidRemoteUrl`, `isPathWithinBase` extracted to `backend/src/utils/validation.ts` for reuse and testability.
|
||||
|
||||
### Fixed
|
||||
- **Fixed:** E2E nodes tests (`nodes.spec.ts`) were permanently timing out because the "Add Node" submit button requires both `api_url` and `api_token` to be non-empty before it enables. The tests filled the URL fields but not `api_token`, leaving the button disabled for the full 30 s timeout. Fixed by filling `#node-api-token` with a dummy value in both validation tests so the button enables and the form can be submitted — the backend then correctly rejects the invalid URL and surfaces the expected error toast.
|
||||
- **Fixed:** ESLint CI step now passes with zero errors — replaced all `any` type annotations with proper types or `unknown` casts, fixed unused catch variables, suppressed `react-refresh/only-export-components` on files that intentionally export both a component and a hook/constant (contexts, badge, button), added file-level `eslint-disable` on animate-ui third-party primitives, and added `eslint-disable-next-line react-hooks/set-state-in-effect` for the LogViewer state reset pattern.
|
||||
- **Fixed:** Four empty `catch {}` blocks in `EditorLayout` (mark-all-read, delete notification, clear-all notifications, image update fetch) now surface errors via `toast.error()` instead of silently swallowing them.
|
||||
- **Fixed:** `ErrorBoundary` component existed but was not connected — it now wraps the root `<App />` in `main.tsx`, catching crashes in any context provider or route component.
|
||||
|
||||
@@ -40,6 +40,8 @@ test.describe('Node management', () => {
|
||||
|
||||
await page.locator('#node-name').fill('bad-node');
|
||||
await page.locator('#node-api-url').fill('http://localhost:6379');
|
||||
// api_token is required to enable the submit button; use a dummy value since we're testing URL validation
|
||||
await page.locator('#node-api-token').fill('dummy-token');
|
||||
// Use .last() to target the dialog submit button, not the trigger
|
||||
await page.getByRole('button', { name: /add node/i }).last().click();
|
||||
|
||||
@@ -51,6 +53,8 @@ test.describe('Node management', () => {
|
||||
|
||||
await page.locator('#node-name').fill('bad-url-node');
|
||||
await page.locator('#node-api-url').fill('not-a-url-at-all');
|
||||
// api_token is required to enable the submit button; use a dummy value since we're testing URL validation
|
||||
await page.locator('#node-api-token').fill('dummy-token');
|
||||
await page.getByRole('button', { name: /add node/i }).last().click();
|
||||
|
||||
await expect(page.getByText(/valid url|invalid url/i)).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
Reference in New Issue
Block a user