> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quiesco.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quiesco

> 面向 Expo App 的灰盒端到端测试，覆盖 iOS、Android 和 Web，可由 Vitest、Jest、Cucumber 或任何 Node.js 测试运行器驱动。

App 的 e2e 构建里有一个小小的 agent，它会在 App 空闲时通知测试运行器——没有待处理的网络请求、定时器、React 渲染或动画——因此测试既不用 sleep，也不用轮询。同一套测试无需修改，即可在 iOS 模拟器、Android 模拟器和浏览器（Chromium、Firefox、WebKit）中运行。Vitest（推荐）、Jest 和 Cucumber 都有现成的集成（`@quiesco/vitest`、`@quiesco/jest`、`@quiesco/cucumber`；见[测试运行器](https://docs.quiesco.dev/zh/runners.md)）。

```ts theme={null}
import { test } from '@quiesco/vitest';

test('a new todo appears at the top of the list', async ({ app }) => {
  // 直接设置状态，无需操作 UI
  await app.backdoor('loginAs', 'a@example.com');

  // 等到 App 空闲后再点击
  await app.tap('add-todo');

  await app.type('todo-title', 'Buy milk');
  await app.tap({ role: 'button', text: 'Save' });
  await app.expectText({ id: 'todo-item', index: 0 }, 'Buy milk');
});
```

## 特性

* **自动同步**——网络、定时器、React 调度器、idle 回调、原生转场动画，以及基于帧稳定性的兜底机制（[工作原理](https://docs.quiesco.dev/zh/sync.md)）。同步超时时会指出仍在忙碌的是什么。
* **真实输入**——通过 `@quiesco/native`（iOS / Android）或 Playwright（Web）注入触摸和文本；回调模式（`js`）无需原生代码即可工作。
* **快速重置**——每个测试开始前执行软重置（存储、你的重置钩子、重新挂载），通常约 200 ms；`@hard-reset` 会重新启动 App。
* **后门**——在测试中直接设置状态，无需操作 UI（`app.backdoor('loginAs', …)`）。
* **生产环境零残留**——没有 `EXPO_PUBLIC_QUIESCO=1` 时，agent 会被替换为空实现的桩，原生模块也会从构建中排除（由 CI 检查）。

## 入门

> [card] [快速上手](https://docs.quiesco.dev/zh/quickstart.md)
>
> 从新建 Expo App 到在 Web、iOS 和 Android 上跑通一个测试。

> [card] [教程](https://docs.quiesco.dev/zh/tutorial.md)
>
> 一步步为一个小型待办 App 编写测试，并在每个平台上运行。

> [card] [测试运行器](https://docs.quiesco.dev/zh/runners.md)
>
> Vitest（推荐）、Jest 或 Cucumber。

> [card] [API 参考](https://docs.quiesco.dev/zh/api.md)
>
> Driver（`app`）、匹配器、App 内 API、配置和错误。

## 包

| 包 | 说明 |
| - | - |
| `quiesco` | CLI：`init`、`build`、`test`（带进度条）、`ui`、`list`、`doctor`、`tree`、`devices`（[CLI](https://docs.quiesco.dev/zh/cli.md)） |
| `@quiesco/agent` | App 内的 agent：元素查询、同步跟踪器、操作、重置、后门；用于 Metro 的 `withQuiesco()` |
| `@quiesco/native` | 在 iOS / Android 上注入真实触摸和文本输入的 Expo 模块（仅限 e2e 构建） |
| `@quiesco/expo-plugin` | Config plugin：从生产构建中排除原生模块，在 e2e 构建中允许本地连接 |
| `@quiesco/core` | host 端：WebSocket 服务器、`Driver`（测试中的 `app`）、会话、iOS / Android 设备提供者。与运行器无关 |
| `@quiesco/vitest` | Vitest：带 `app` fixture 的 `test`、`quiesco()` 配置、`quiescoPlugin()` |
| `@quiesco/jest` | Jest：带 Quiesco 测试环境的 preset、全局 `quiesco` |
| `@quiesco/cucumber` | cucumber-js World（`this.app`）和生命周期钩子 |
| `@quiesco/web` | Web 设备提供者（Playwright 库） |
| `@quiesco/ui` | `quiesco ui` 背后的[测试 UI](https://docs.quiesco.dev/zh/ui.md) |
| `@quiesco/steps` | 可选的中文、日文和英文通用步骤——仅用于原型验证（[步骤](https://docs.quiesco.dev/zh/steps.md)） |
| `@quiesco/protocol` | agent 与 host 端共用的类型和常量 |

源码以 MIT 许可证发布在 [GitHub](https://github.com/h2nology/quiesco) 上。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.