@ 9l/ playwright 游戏
本地 Playwright 设置 9条跑道。 。 。 .
这个 n9l 固定设备提供 step 自然语言 goal 方法。 。 .
保留普通的"Playwright"断言以确立预期的行为. 一个目标
完成后不验证该行为.
安装
发表于 无数字 :
npm install --save-dev @9l/[email protected] @playwright/[email protected]
npm exec playwright install chromium
对合格的运行时间使用节点24(节点22最低),Playwright 1.61.1
通过1.64.1和铬。 amd64/arm64上的macOS、Linux和Windows为
合格跑道目标(0.2.0CLI的窗户)。 对等范围是 @playwright/test >=1.61.1 <2; CI 限定
1.61.1至1.64.1(1.61.1、1.62.0、1.62.1.)的每份出版物,
1.63.0、1.64.0和1.64.1。 后期版本和其他浏览器引擎安装
但却不合格.
前进 9l 还需要可执行文件。 使用
CLI 安装指南
用于提供或从源头安装Go 1.27.3或更新.
此 npm 软件包没有安装 Go 或
捆绑跑者、浏览器或主机服务。 不需要平台账户.
使用
import {test, expect} from '@9l/playwright';
test('checkout confirms one order', async ({page, n9l}) => {
await page.goto('http://localhost:3000/checkout');
await n9l.step('place order', async () => {
await page.getByRole('button', {name: 'Place order'}).click();
await expect(page.getByRole('status')).toHaveText('Order confirmed');
});
});
启动示例应用程序, 然后通过 Go 引擎运行选中的 spec :
9l run tests/checkout.spec.ts --sdk --format json
使用 --pass-env NAME 用于明确批准的应用程序设置。 浏览器
手柄和目标参数值留在工人中;供应商证书保留
进入 n9l fixture 需要由 --sdk。 。 。 .
现有的 Playwright 规格和配置仍然可以独立使用.
自然语言目标使用有限观察控制和打入动作 预算和保守的停止政策。 见 目标合同 财务报告和审定财务报表 SDK桥。 。 。 . 现场提供者准确性,独立的行为核查,经核实的回放, iOS和Android设备超出以下所列范围不是合格特性.
安卓(实验)
Android目标驱动自有仿真器或附着的手机通过
App 3.8.0和UiAutomator2 8.7.0,同分 app 固定网络
目标用途。 它在API 35模拟器和一款Android 17电话上获得资格;
见 Android 设置和资格限制。 。 。 .
-
安装匹配的 0.6.0 CLI 和
@9l/playwright合并(见 安装, (中文(简体) ), 和固定的自动化工具,一次,在你的项目之外:npm install --prefix ~/.9l/android-tools --save-exact --ignore-scripts \ [email protected] [email protected]对于另一个位置, 设定
NINELIVES_ANDROID_TOOLS。 。 。 . -
检查一下主持人 医生报告 Java, SDK, 构建工具, AVD, 设备 和被钉住的工具,各有一个固定点:
9l doctor --android -
在共享目标固定中构造驱动程序并命名 Playwright 项目
android:<alias>数字 :import {createTargetTest} from '@9l/playwright'; import {androidTargetDriver} from '@9l/playwright/android'; export const test = createTargetTest({ native: target => androidTargetDriver({ appId: target.appId, avd: 'Pixel_API_35', apk: 'build/app.apk', apkSHA256: '<digest>', appPackage: 'com.example.app', activity: '.MainActivity', }), });// playwright.config.ts import {defineConfig} from '@playwright/test'; export default defineConfig({ // A cold emulator boot fits in open()'s 180-second bound, which needs // a test timeout above Playwright's 30-second default. timeout: 240_000, // 9l owns attempts: a Playwright retry is refused. retries: 0, projects: [{name: 'android:app'}], }); -
通过引擎运行,转发驱动程序依赖的变量.
9l run仅通过固定环境进行测试:9l run tests/login.spec.ts --sdk --target android:app \ --pass-env ANDROID_HOME,JAVA_HOME,NINELIVES_ANDROID_TOOLS前进
ANDROID_SDK_ROOT, (中文(简体) ),ANDROID_AVD_HOME或者说HOMEBREW_PREFIX如果 您的 SDK 或 AVD 是通过它们找到的.9l doctor --android说哪一个.
驱动程序在会话时持有设备唯一的 UI 自定义连接
打开了,所以一个光谱面 adb shell uiautomator dump 返回无。 使用
代之以固定的操作,和 app.deviceSerial() 用于其他adb命令.
许可证
阿帕奇2.0 (英语). 软件包包括 LICENSE 财务报告和审定财务报表 NOTICE。 。 。 .