@badisi/wdio-harness (英语)
🔬 网络司机 支持角构件测试工具.
组件测试工具
元件牵引是让测试通过支持的API与元件交互的类. 每个带子的API与一个组件的相互作用 和用户的一样 通过使用取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取取 利用组件的想法来自 页次 目标 用于集成测试的图案.
安装
npm install @badisi/wdio-harness --save-dev
yarn add @badisi/wdio-harness --dev
使用量
方法
createHarnessEnvironment(rootElement)- 从给定的元素( 默认对正体) 获取 HarnessLoader 实例getHarness(harnessType, element)- 从给定的组件Harness类和元素中寻找牵引物实例getHarness(harnessType)- 从特定组件Harness类中寻找牵引物getHarness(query)- 从给定的Harness Predicate中寻找一个牵引物getAllHarnesses(query)- 动作像得到Harness, 但返回一系列的拉带实例waitForAngular()- 等待Angular完成靴子夹
示例
import '@angular/compiler'; // required since Angular v21
import { MatDatepickerInputHarness } from '@angular/material/datepicker/testing';
import { getHarness } from '@badisi/wdio-harness';
describe('Angular Material Harness', () => {
beforeEach(async () => {
await browser.url('http://localhost:4200');
});
it('MatDatePicker', async () => {
const datepicker = await getHarness(MatDatepickerInputHarness.with({ selector: '#demo-datepicker-input' }));
await datepicker.setValue('9/27/1954');
expect(await datepicker.getValue()).withContext('Date should be 9/27/1954').toBe('9/27/1954');
await datepicker.openCalendar();
const calendar = await datepicker.getCalendar();
await calendar.next();
await calendar.selectCell({ text: '20' });
expect(await datepicker.getValue()).withContext('Date should be 10/20/1954').toBe('10/20/1954');
});
});
更多实例 这里。 。 。 .
发展
见 开发者文件。 。 。 .
捐款
想帮忙吗?
要提交错误, 提供一些代码或改进文档吗 ? 不错!
但是,请先读一下指南 捐款,并了解提交程序、编码规则和其他.
> 行为守则
请阅读并遵循 行为守则 帮助我保持这个项目的开放性和包容性.