Advanced testing techniques
Comprehensive Fixture API Reference
Complete Fixture Interface
interface IFixture<T> {
// Core properties
appHost: HTMLElement; // Root element containing your app
startPromise: Promise<void>; // Promise that resolves when app starts
stop: (dispose?: boolean) => Promise<void>; // Cleanup function
component: T; // Root component instance
container: IContainer; // DI container for registrations
platform: IPlatform; // Platform abstraction
testContext: TestContext; // Test context utilities
// Query methods
getBy<E extends HTMLElement = HTMLElement>(selector: string): E;
getAllBy<E extends HTMLElement = HTMLElement>(selector: string): E[];
queryBy<E extends HTMLElement = HTMLElement>(selector: string): E | null;
// Assertion methods
assertText(expectedText: string, options?: ITextAssertOptions): void;
assertText(selector: string, expectedText: string, options?: ITextAssertOptions): void;
assertTextContain(expectedText: string): void;
assertTextContain(selector: string, expectedText: string): void;
assertHtml(expectedHtml: string, options?: IHtmlAssertOptions): void;
assertHtml(selector: string, expectedHtml: string, options?: IHtmlAssertOptions): void;
assertAttr(selector: string, attr: string, expectedValue: string | null): void;
assertAttrNS(selector: string, namespace: string, attr: string, expectedValue: string | null): void;
assertClass(selector: string, ...expectedClasses: string[]): void;
assertClassStrict(selector: string, ...expectedClasses: string[]): void;
assertStyles(selector: string, expectedStyles: Record<string, string>): void;
assertValue(selector: string, expectedValue: string): void;
assertChecked(selector: string, expectedChecked: boolean): void;
// Event methods
trigger: IEventTrigger;
type(selector: string | HTMLElement, text: string): void;
scrollBy(selector: string | HTMLElement, options: number | ScrollOptions): void;
// Utility methods
printHtml(): string;
createEvent(type: string, init?: EventInit): Event;
hJsx(tag: string, attrs?: Record<string, any>, ...children: any[]): HTMLElement;
}Event Triggering Interface
Built-in Mock Utilities
Available Mock Classes
Using Built-in Mocks
Spy Subscriber for Observable Testing
Advanced Assertion Patterns
Custom Assertion Helpers
Using Custom Assertions
Complex Event Simulation
Drag and Drop Testing
Keyboard Navigation Testing
Form Testing Patterns
Complex Form Validation
Multi-step Form Testing
Performance and Memory Testing
Render Performance Testing
Memory Leak Detection
Integration Testing Patterns
Multi-Component Integration
Service Integration Testing
Async Testing Advanced Patterns
Testing Race Conditions
Testing Timeout Scenarios
Best Practices Summary
1. Test Organization
2. Assertion Strategies
3. Mock Management
4. Async Handling
5. Performance Considerations
Last updated
Was this helpful?