@ appium/ plugin- test- support
测试公用事业 辅料 插件
此软件包供插件作者帮助测试其插件.
使用量
E2E测试
这个 pluginE2EHarness 方法配置服务器和驱动程序,通过设置/调用回调进行测试.
此示例使用 网络司机 用测试 Appium 服务器进行通信.
import {pluginE2EHarness} from '@appium/plugin-test-support';
import {remote} from 'webdriverio';
describe('MyPlugin', function() {
let port: number;
let hostname: string;
const {setup, teardown} = pluginE2EHarness({
serverArgs: SOME_EXTRA_SERVER_ARGS,
port: 31337,
host: '127.0.0.1',
appiumHome: process.env.APPIUM_HOME, // best practice: use a temp dir instead
driverName: 'fake', // driver to test with
driverSource: 'local', // use "local" unless you want appium to install from npm every time
driverSpec: FAKE_DRIVER_DIR, // path to local driver working copy or installation
pluginName: 'MyPlugin', // your plugin
pluginSource: 'local', // use "local" for this
pluginSpec: THIS_PLUGIN_DIR, // dir of this plugin's `package.json`
});
before(async function () {
const {server} = await setup();
const address = server.address();
port = address.port;
hostname = address.address;
});
after(async function () {
await teardown();
});
it('should use my plugin', async function() {
// at this point, the Appium server will be running with the plugin/driver combination of your
// choosing
const browser = await remote({port, hostname});
})
});
许可证
阿帕奇 - 2.0