import Macroable from '@poppinss/macroable'; import { type Component } from '../../component.js'; import { type ComponentConstructor, type ComponentEffects, type ComponentSnapshot } from '../../types.js'; import { ComponentState } from './component_state.js'; import { type HttpContext } from '@adonisjs/core/http'; import { type ApplicationService, type HttpRouterService } from '@adonisjs/core/types'; import { type Testable } from './testable.js'; import { type MakesAssertions } from './makes_assertions.js'; import { type TestsValidation } from '../support_validation/tests_validation.js'; import { type TestsRedirects } from '../support_redirects/tests_redirects.js'; import { type TestsEvents } from '../support_events/tests_events.js'; import { type TestsJs } from '../support_js_evaluation/tests_js.js'; /** * Type helper to convert MakesAssertions methods to return ChainableTest */ type ChainableAssertions = { [K in keyof T]: T[K] extends (...args: infer Args) => any ? (...args: Args) => ChainableTest : T[K]; }; /** * Chainable promise wrapper for fluent testing API * Allows method chaining on asynchronous test operations */ export declare class ChainableTest implements PromiseLike { readonly promise: Promise; constructor(promise: Promise); then(onfulfilled?: ((value: Testable) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; finally(onfinally?: (() => void) | undefined | null): PromiseLike; mount(...params: any[]): ChainableTest; set(propertyName: string, value: any): ChainableTest; call(method: string, ...params: any[]): ChainableTest; toggle(propertyName: string): ChainableTest; get(propertyName: string): Promise; snapshot(): Promise; effects(): Promise; html(): Promise; instance(): Promise; } export interface ChainableTest extends ChainableAssertions, ChainableAssertions, ChainableAssertions, ChainableAssertions, ChainableAssertions { } export declare class BaseTestable extends Macroable { #private; constructor(componentClass: ComponentConstructor, app: ApplicationService, router: HttpRouterService, ctx: HttpContext); get mountParams(): any[]; get state(): ComponentState; /** * Initialize the component with mount lifecycle */ mount(...params: any[]): ChainableTest; /** * Set a component property value */ set(propertyName: string, value: any): ChainableTest; /** * Call a component method */ call(method: string, ...params: any[]): ChainableTest; /** * Toggle a boolean property */ toggle(propertyName: string): ChainableTest; /** * Re-render the component without changing any property * PHP parity: refresh() */ refresh(): ChainableTest; /** * Get a component property value */ get(propertyName: string): any; /** * Get the current component snapshot */ snapshot(): ComponentSnapshot; /** * Get the current component effects */ effects(): ComponentEffects; /** * Get the rendered HTML */ html(): string; /** * Get the component instance */ instance(): Component; /** * Get the component state */ getState(): ComponentState; hasMethod(obj: any, methodName: string): boolean; } export {};