A coding agent could develop this repo's Go packages and could not develop the application: every path to running YellowJacket ended in a blocking GTK window, so 265 bound methods, 46 events, 33 component directories and 13 stores had exactly one form of verification available — `tsc --noEmit`. The unlock is that `wails dev`'s dev server on :34115 serves the real frontend with the real generated bindings against the same Go backend a desktop window attaches to, so a plain Chromium under Xvfb gets a fully functional app. Four test tiers now exist, cheapest first: - `make ui-test` — 313 Vitest tests in a real browser in ~2 s, no app, no backend, no display. Works because `frontend/wailsjs/` is a pure passthrough to `window.go`/`window.runtime`, so faking just those two globals runs the real bindings and the real store code. - `make test` — services in-process, asserting on the payload the frontend would receive, via a new `events.Emit` wrapper. - `make dev-headless` + `playwright-cli` — the real app, driven interactively, with an event bridge on `window.__yjEvents` and a dev-only control surface at `/__test/`. - `make e2e` — 19 of those flows frozen as Playwright specs. `events.Emit(ctx, …)` replaces all 35 direct `runtime.EventsEmit` call sites: wails' `getEvents` `log.Fatalf`s on any context without its runtime, so those paths could not run under test and a background worker could take the app down. Four packages had each hand-rolled the same guard; nine more guarded on `ctx != nil`, which does not help. `TestNoDirectRuntimeEmits` fails the build on a new one. Fixtures are generated, not committed (`make testdata`), and seeds are built by *running the app* — never by hand-writing config and DB rows, which would be a second description of a valid YJ_HOME. `.gitea/workflows/ci.yml` is the first workflow here that tests anything; the other three only package, so `gitea_ci` reported only packaging jobs and misled anyone asking whether a push was healthy. Both jobs were prototyped to green in a bare ubuntu:24.04 container before the YAML was written, which immediately caught `make lint` linting three configurations that nothing builds: all three passes omitted `webkit2_41`, so wails resolved webkit2gtk-4.0 — which Arch still ships and Ubuntu 24.04 dropped. Operational instructions live in `.pi/skills/yellowjacket-dev/`, measured discoveries in `.planning/NOTES.md`, and architecture in `CLAUDE.md` — split by tense, not by topic, because a topical split gives every new fact two plausible homes. `make skill-check` fails a commit if the skill cites a make target that does not exist.
179 lines
5.8 KiB
TypeScript
179 lines
5.8 KiB
TypeScript
/**
|
|
* Every custom element in the tree, mounted against an empty backend.
|
|
*
|
|
* This is deliberately shallow: it asserts each component renders
|
|
* *something* and logs no error, which is the state an agent's change
|
|
* most often breaks and which nothing else here would notice. Depth
|
|
* belongs in the per-component specs and in e2e; breadth belongs here,
|
|
* because 46 elements is more than anyone will write specs for.
|
|
*/
|
|
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
|
|
|
// One import per component module, so a component that fails to even
|
|
// load is a failure here rather than a silent absence.
|
|
import '@components/artist-details/artist-details';
|
|
import '@components/artists-view/artists-view';
|
|
import '@components/audio-player/audio-player';
|
|
import '@components/audio-player/controls/player-controls';
|
|
import '@components/audio-player/seekbar/seek-bar';
|
|
import '@components/audio-player/volume-control/volume-control';
|
|
import '@components/autotag-view/autotag-view';
|
|
import '@components/combobox/combobox';
|
|
import '@components/config-page/config-page';
|
|
import '@components/config-page/config-field';
|
|
import '@components/config-page/config-section';
|
|
import '@components/config-page/download-clients';
|
|
import '@components/config-page/shortcut-capture';
|
|
import '@components/cover-grid/cover-grid';
|
|
import '@components/cover-grid/album-dropdown';
|
|
import '@components/download-picker/download-picker';
|
|
import '@components/download-picker/candidate-row';
|
|
import '@components/downloads-view/downloads-view';
|
|
import '@components/duplicate-tracks-dialog/duplicate-tracks-dialog';
|
|
import '@components/explore-album-details/explore-album-details';
|
|
import '@components/explore-artist-details/explore-artist-details';
|
|
import '@components/explore-view/explore-view';
|
|
import '@components/first-run-wizard/first-run-wizard';
|
|
import '@components/genre-details/genre-details';
|
|
import '@components/genres-view/genres-view';
|
|
import '@components/jobs/job-details-drawer';
|
|
import '@components/jobs/job-indicator';
|
|
import '@components/jobs/job-log-view';
|
|
import '@components/jobs/job-row';
|
|
import '@components/jobs/jobs-view';
|
|
import '@components/library-filter/library-filter';
|
|
import '@components/library-status-indicator/library-status-indicator';
|
|
import '@components/now-playing/now-playing';
|
|
import '@components/phantom-resolver/phantom-resolver';
|
|
import '@components/playlist-details/playlist-details';
|
|
import '@components/playlist-picker/playlist-picker';
|
|
import '@components/playlist-view/playlist-view';
|
|
import '@components/queue-panel/queue-panel';
|
|
import '@components/search-bar/search-bar';
|
|
import '@components/sidebar/app-sidebar';
|
|
import '@components/smart-playlist-details/smart-playlist-details';
|
|
import '@components/smart-playlist-editor/smart-playlist-editor';
|
|
import '@components/top-results-row/top-results-row';
|
|
import '@components/track-details/track-details';
|
|
import '@components/track-info/track-info';
|
|
import '@components/track-list/track-list';
|
|
|
|
import { flush, stub } from '@test/support/harness';
|
|
import { fixture } from '@test/support/render';
|
|
|
|
/** Every element the app registers, in registration order. */
|
|
const TAGS = [
|
|
'album-dropdown',
|
|
'app-sidebar',
|
|
'artist-details',
|
|
'artists-view',
|
|
'audio-player',
|
|
'autotag-view',
|
|
'candidate-row',
|
|
'config-field',
|
|
'config-page',
|
|
'config-section',
|
|
'cover-grid',
|
|
'download-clients',
|
|
'download-picker',
|
|
'downloads-view',
|
|
'duplicate-tracks-dialog',
|
|
'explore-album-details',
|
|
'explore-artist-details',
|
|
'explore-view',
|
|
'first-run-wizard',
|
|
'genre-details',
|
|
'genres-view',
|
|
'job-details-drawer',
|
|
'job-indicator',
|
|
'job-log-view',
|
|
'job-row',
|
|
'jobs-view',
|
|
'library-filter',
|
|
'library-status-indicator',
|
|
'now-playing',
|
|
'phantom-resolver',
|
|
'player-controls',
|
|
'playlist-details',
|
|
'playlist-picker',
|
|
'playlist-view',
|
|
'queue-panel',
|
|
'search-bar',
|
|
'seek-bar',
|
|
'shortcut-capture',
|
|
'smart-playlist-details',
|
|
'smart-playlist-editor',
|
|
'top-results-row',
|
|
'track-details',
|
|
'track-info',
|
|
'track-list',
|
|
'volume-control',
|
|
'yj-combobox',
|
|
];
|
|
|
|
/**
|
|
* An empty-but-valid backend. Unstubbed bindings resolve undefined,
|
|
* which is not what Go sends — an empty list is.
|
|
*/
|
|
function stubEmptyBackend(): void {
|
|
const emptyLists = [
|
|
'library.Library.GetAllTracks',
|
|
'library.Library.GetAllAlbums',
|
|
'library.Library.GetAllArtists',
|
|
'library.Library.GetAllGenresWithCounts',
|
|
'library.Library.GetAllLibrariesWithTrackCounts',
|
|
'playlist.Service.GetAllPlaylists',
|
|
'playlist.Service.GetAllPlaylistsWithTracks',
|
|
'playlist.Service.GetDefaultPlaylistTrackPaths',
|
|
'jobs.Service.GetJobs',
|
|
'download.Service.ListProviders',
|
|
'download.Service.ListDownloads',
|
|
'download.Service.ListRequests',
|
|
'download.Service.ProviderKinds',
|
|
];
|
|
|
|
for (const path of emptyLists) stub(path, []);
|
|
|
|
stub('config.Config.GetShortcuts', {});
|
|
stub('config.Config.GetDownloadPreferences', {});
|
|
stub('config.Config.GetThemeAccentColor', '#ffd43b');
|
|
stub('config.Config.GetThemeBackgroundShade', 'dark');
|
|
}
|
|
|
|
describe('every component mounts on an empty library', () => {
|
|
let errors: unknown[][] = [];
|
|
|
|
beforeEach(() => {
|
|
stubEmptyBackend();
|
|
errors = [];
|
|
vi.spyOn(console, 'error').mockImplementation((...args: unknown[]) => {
|
|
errors.push(args);
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
it('registers every element it defines', () => {
|
|
const missing = TAGS.filter((tag) => !customElements.get(tag));
|
|
|
|
expect(missing).toEqual([]);
|
|
});
|
|
|
|
for (const tag of TAGS) {
|
|
it(`<${tag}> renders without logging an error`, async () => {
|
|
const el = await fixture(tag);
|
|
|
|
await flush();
|
|
await el.updateComplete;
|
|
|
|
expect({ tag, root: el.shadowRoot !== null, errors }).toEqual({
|
|
tag,
|
|
root: true,
|
|
errors: [],
|
|
});
|
|
});
|
|
}
|
|
});
|