# TuilUser

Source: /tuil/docs/reference/packages/testing-ink/api/tuil-user
Locale: en

class exported by @mwillbanks/tuil-testing-ink.



{/* Generated by tooling/docs/generate-reference.ts. */}

## class [#class]

Public class exported by `@mwillbanks/tuil-testing-ink`.

```ts
export class TuilUser {
  constructor(
    readonly write: (input: string) => void,
    readonly ready: Promise<void>,
  ) {}

  async press(keys: string): Promise<void> {
    await this.ready;
    this.write(keySequences[keys] ?? keys);
    await Bun.sleep(50);
  }

  async type(value: string): Promise<void> {
    await this.ready;
    for (const character of value) {
      this.write(character);
      await Bun.sleep(0);
    }
    await Bun.sleep(50);
  }
}
```

## Members [#members]

| Member          | Type                               | Required | Description                                                             | Related types |
| --------------- | ---------------------------------- | -------- | ----------------------------------------------------------------------- | ------------- |
| `__constructor` | `any`                              | Yes      | The `__constructor` member uses the `any` contract.                     | —             |
| `press`         | `(keys: string) => Promise<void>`  | Yes      | The `press` member uses the `(keys: string) => Promise<void>` contract. | —             |
| `type`          | `(value: string) => Promise<void>` | Yes      | The `type` member uses the `(value: string) => Promise<void>` contract. | —             |

## Parameters [#parameters]

This declaration has no public members.

## Returns [#returns]

This declaration does not return a value.

## Throws [#throws]

No thrown errors are documented for this declaration.

## Related types [#related-types]

No package-local related types.

## Source [#source]

[View the secondary source reference](https://github.com/mwillbanks/tuil/blob/main/packages/testing-ink/src/index.ts)

## Package [#package]

[@mwillbanks/tuil-testing-ink](/tuil/docs/reference/packages/testing-ink)
