@atomic-testing/core

中文文档
0.104.0发布于 2026/08/20MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 1.6万

Core library for atomic-testing

原始使用文档
文档目录3 节
  1. Key Features
  2. Example
  3. Public API & stability

@atomic-testing/core

NPM version NPM license

Core utilities that power the entire Atomic Testing ecosystem. The package defines the primitives used to model scenes, locate elements and interact with components across different test environments.

Fastest start: run npm create atomic-testing@latest to scaffold a working test setup — runner config, an example component, its ScenePart and a passing test — into an existing project.

Atomic Testing is designed to offer a consistent way to interact with third-party or first-party components across DOM and end-to-end tests. The core focuses on reusability, composability, and adaptability so the same tests can run in React, Vue, Playwright, Cypress and more.

Key Features

  • Component Drivers – programmatically interact with UI components. Drivers expose high level actions like clicking a button or reading a value.
  • Locators – find elements using helpers such as byDataTestId or byRole.
  • Scene Parts – describe the pieces of a page or widget as a map of drivers.
  • Test Engine – renders a scene and provides access to all defined parts so tests can remain agnostic to the underlying framework.

Example

import { TextFieldDriver, ButtonDriver } from '@atomic-testing/component-driver-mui-v6';
import { byDataTestId, ScenePart } from '@atomic-testing/core';
import { createTestEngine } from '@atomic-testing/react-19';

import { Login } from './Login';

const loginScenePart = {
  username: { locator: byDataTestId('username'), driver: TextFieldDriver },
  password: { locator: byDataTestId('password'), driver: TextFieldDriver },
  submit: { locator: byDataTestId('submit'), driver: ButtonDriver },
} satisfies ScenePart;

const engine = createTestEngine(<Login />, loginScenePart);
await engine.parts.username.setValue('alice');
await engine.parts.password.setValue('secret');
await engine.parts.submit.click();
await engine.cleanUp();

Refer to the documentation for detailed guides and more examples. A complete signup form example can be found under examples/example-mui-signup-form.

Public API & stability

The stable surface of this package is its . barrel exports, frozen under SemVer and machine-checked by the committed API Extractor report at etc/core.api.md. Exports tagged @internal are not part of that guarantee. See the 1.0 API freeze & evolution policy.

版本与发布记录

@atomic-testing/core 共发布 102 个版本,首次发布于 2023/03/08;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.104.0latest2026/08/202 个月前
0.103.02026/08/182 个月前
0.102.02026/08/172 个月前
0.101.02026/08/073 个月前
0.100.02026/08/023 个月前
0.99.02026/07/223 个月前

关于 @atomic-testing/core 的常见问题

@atomic-testing/core 是什么?

Core library for atomic-testing

如何安装 @atomic-testing/core?

在项目目录运行 npm install @atomic-testing/core,或使用 pnpm add / yarn add / bun add。

@atomic-testing/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@atomic-testing/core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@atomic-testing/core 可以商用吗?

@atomic-testing/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@atomic-testing/core 的下载量有多少?

根据 npm 官方下载统计,@atomic-testing/core 在 2026/10/07 – 2026/11/05 这 30 天内被下载 16,397 次,日均约 547 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@atomic-testing/core 还在维护吗?

最新版本 0.104.0 发布于 2026/08/20(2 个月前);至今共发布 102 个版本,其中过去 12 个月发布了 22 个;首次发布于 2023/03/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。