# [API](/api/) › @qwik.dev/qwik/testing

## child

```typescript
child: HTMLElement;
```

## createDocument

Create emulated `Document` for server environment. Does not implement the full browser `document` and `window` API. This api may be removed in the future.

```typescript
export declare function createDocument(opts?: MockDocumentOptions): Document;
```

| Parameter | Type | Description |
| --- | --- | --- |
| opts | MockDocumentOptions | _(Optional)_ |

**Returns:**

Document

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/document.ts)

## createDOM

CreatePlatform and CreateDocument

```typescript
createDOM: (input?: { html?: string }) =>
  Promise<{
    render: (
      jsxElement: JSXOutput,
    ) => Promise<import("@qwik.dev/core").RenderResult>;
    screen: HTMLElement;
    userEvent: (
      queryOrElement: string | Element | keyof HTMLElementTagNameMap | null,
      eventNameCamel: string | keyof WindowEventMap,
      eventPayload?: any,
    ) => Promise<Event | null>;
  }>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| \{ html } | (not declared) | _(Optional)_ |
| input | \{ html?: string; } | _(Optional)_ |

**Returns:**

Promise&lt;\{ render: (jsxElement: JSXOutput) =&gt; Promise&lt;import("@qwik.dev/core").RenderResult&gt;; screen: HTMLElement; userEvent: (queryOrElement: string \| Element \| keyof HTMLElementTagNameMap \| null, eventNameCamel: string \| keyof WindowEventMap, eventPayload?: any) =&gt; Promise&lt;Event \| null&gt;; }&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/library.ts)

## document

```typescript
document: MockDocument;
```

## domRender

```typescript
export declare function domRender(
  jsx: JSXOutput,
  opts?: {
    debug?: boolean;
  },
): Promise<{
  document: Document;
  container: import("@qwik.dev/core").ClientContainer;
  vNode: _VNode | null;
  getStyles: () => Record<string, string | string[]>;
}>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| jsx | JSXOutput |  |
| opts | \{ debug?: boolean; } | _(Optional)_ |

**Returns:**

Promise&lt;\{ document: Document; container: import("@qwik.dev/core").ClientContainer; vNode: \_VNode \| null; getStyles: () =&gt; Record&lt;string, string \| string[]&gt;; }&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/rendering.unit-util.tsx)

## ElementFixture

Creates a simple DOM structure for testing components.

By default `EntityFixture` creates:

```html
<host q:view="./component_fixture.noop">
  <child></child>
</host>
```

```typescript
export declare class ElementFixture
```

| Constructor | Modifiers | Description |
| --- | --- | --- |
| (constructor)(options) |  | Constructs a new instance of the `ElementFixture` class |

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [child](#elementfixture-child) |  | HTMLElement |  |
| [document](#elementfixture-document) |  | MockDocument |  |
| [host](#elementfixture-host) |  | HTMLElement |  |
| [parent](#elementfixture-parent) |  | HTMLElement |  |
| [superParent](#elementfixture-superparent) |  | HTMLElement |  |
| [window](#elementfixture-window) |  | MockWindow |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/element-fixture.ts)

## emulateExecutionOfQwikFuncs

```typescript
export declare function emulateExecutionOfQwikFuncs(document: Document): void;
```

| Parameter | Type | Description |
| --- | --- | --- |
| document | Document |  |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/rendering.unit-util.tsx)

## expectDOM

```typescript
export declare function expectDOM(
  actual: Element,
  expected: string,
): Promise<void>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| actual | Element |  |
| expected | string |  |

**Returns:**

Promise&lt;void&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/expect-dom.tsx)

## getTestPlatform

```typescript
export declare function getTestPlatform(): TestPlatform;
```

**Returns:**

TestPlatform

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/platform.ts)

## host

```typescript
host: HTMLElement;
```

## InOrderAuto

```typescript
export interface InOrderAuto
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| maximumChunk? |  | number | _(Optional)_ |
| maximumInitialChunk? |  | number | _(Optional)_ |
| strategy |  | 'auto' |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## InOrderDirect

```typescript
export interface InOrderDirect
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| strategy |  | 'direct' |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## InOrderDisabled

```typescript
export interface InOrderDisabled
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| strategy |  | 'disabled' |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## InOrderStreaming

```typescript
export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
```

**References:** [InOrderAuto](#inorderauto), [InOrderDisabled](#inorderdisabled), [InOrderDirect](#inorderdirect)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## OutOfOrderStreaming

```typescript
export type OutOfOrderStreaming = boolean;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## parent

```typescript
parent: HTMLElement;
```

## ssrRenderToDom

```typescript
export declare function ssrRenderToDom(
  jsx: JSXOutput,
  opts?: {
    debug?: boolean;
    raw?: boolean;
    qwikLoader?: boolean;
    containerTagName?: string;
    statePrewarm?: number | false;
    stream?: StreamWriter;
    streaming?: StreamingOptions;
    resume?: boolean;
    onBeforeResume?: (document: Document) => void;
    transformError?: (error: unknown) => Error | undefined | null | void;
  },
): Promise<{
  container: _DomContainer;
  document: Document;
  vNode: _VNode | null;
  getStyles: () => Record<string, string | string[]>;
}>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| jsx | JSXOutput |  |
| opts | \{ debug?: boolean; raw?: boolean; qwikLoader?: boolean; containerTagName?: string; statePrewarm?: number \\| false; stream?: StreamWriter; streaming?: [StreamingOptions](#streamingoptions); resume?: boolean; onBeforeResume?: (document: Document) => void; transformError?: (error: unknown) => Error \\| undefined \\| null \\| void; } | _(Optional)_ |

**Returns:**

Promise&lt;\{ container: \_DomContainer; document: Document; vNode: \_VNode \| null; getStyles: () =&gt; Record&lt;string, string \| string[]&gt;; }&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/rendering.unit-util.tsx)

## StreamingOptions

```typescript
export interface StreamingOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| inOrder? |  | [InOrderStreaming](#inorderstreaming) | _(Optional)_ |
| outOfOrder? |  | [OutOfOrderStreaming](#outoforderstreaming) | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts)

## superParent

```typescript
superParent: HTMLElement;
```

## trigger

Trigger an event in unit tests on an element. Needs to be kept in sync with the Qwik Loader event dispatching.

Events can be either case sensitive element-scoped events or scoped kebab-case.

Future deprecation candidate.

```typescript
export declare function trigger(
  root: Element,
  queryOrElement: string | Element | keyof HTMLElementTagNameMap | null,
  eventName: string,
  eventPayload?: any,
  options?: {
    waitForIdle?: boolean;
  },
): Promise<Event | null>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| root | Element |  |
| queryOrElement | string \\| Element \\| keyof HTMLElementTagNameMap \\| null |  |
| eventName | string |  |
| eventPayload | any | _(Optional)_ |
| options | \{ waitForIdle?: boolean; } | _(Optional)_ |

**Returns:**

Promise&lt;Event \| null&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/element-fixture.ts)

## vnode_fromJSX

```typescript
export declare function vnode_fromJSX(jsx: JSXOutput): {
  vParent: _ElementVNode | _VirtualVNode;
  vNode: _VNode | null;
  document: _QDocument;
  container: ClientContainer;
};
```

| Parameter | Type | Description |
| --- | --- | --- |
| jsx | JSXOutput |  |

**Returns:**

\{ vParent: \_ElementVNode \| \_VirtualVNode; vNode: \_VNode \| null; document: \_QDocument; container: ClientContainer; }

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/vdom-diff.unit-util.ts)

## waitForDrain

Wait for the scheduler to drain.

This is useful when testing async code.

```typescript
export declare function waitForDrain(container: Container): Promise<void>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| container | Container | The application container. |

**Returns:**

Promise&lt;void&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/util.ts)

## walkJSX

```typescript
export declare function walkJSX(
  jsx: JSXOutput,
  apply: {
    enter: (jsx: JSXNodeInternal) => void;
    leave: (jsx: JSXNodeInternal) => void;
    text: (text: _Stringifiable) => void;
  },
): void;
```

| Parameter | Type | Description |
| --- | --- | --- |
| jsx | JSXOutput |  |
| apply | \{ enter: (jsx: JSXNodeInternal) => void; leave: (jsx: JSXNodeInternal) => void; text: (text: \_Stringifiable) => void; } |  |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/vdom-diff.unit-util.ts)

## window

```typescript
window: MockWindow;
```
