Component Harnesses
Locate, query and interact with NeuralUI controls without depending on their internal DOM.
Public imports
Import harnesses from the dedicated testing entry point. It covers all 71 interactive public entry points; application bundles never include harnesses unless test code imports them.
import {
NeuAutocompleteHarness,
NeuButtonHarness,
NeuCheckboxHarness,
NeuDateInputHarness,
NeuDialogHarness,
NeuInputHarness,
NeuNumberInputHarness,
NeuSelectHarness,
NeuSwitchHarness,
NeuTableHarness,
} from '@neural-ui/core/testing';TestBed
Use the Angular CDK Testbed environment for component and integration tests.
const loader = TestbedHarnessEnvironment.loader(fixture);
const input = await loader.getHarness(NeuInputHarness);
await input.setValue('Ada');
expect(await input.getValue()).toBe('Ada');Vitest
The same asynchronous harness contract works with Angular's Vitest runner.
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { NeuButtonHarness } from '@neural-ui/core/testing';
it('submits with the public contract', async () => {
const button = await loader.getHarness(NeuButtonHarness.with({ text: /save/i }));
expect(await button.isDisabled()).toBe(false);
await button.click();
});Playwright
At the browser boundary, prefer roles and accessible names; the showcase keeps these selectors aligned with the harness contract.
import { test, expect } from '@playwright/test';
test('uses accessible selectors at the browser boundary', async ({ page }) => {
await page.goto('/en/components/input');
await page.getByRole('textbox', { name: 'Name' }).fill('Ada');
await expect(page.getByRole('textbox', { name: 'Name' })).toHaveValue('Ada');
});Stable testing contract
All 71 interactive public entry points expose a harness. Harness locators are public API and are checked in the Angular 19–22 package matrix; the remaining 19 entry points (17 non-interactive components plus the url-state and testing utilities) are explicitly not applicable. Internal markup may evolve without forcing consumer test rewrites.