mirror of
https://github.com/appium/appium.git
synced 2026-10-17 04:41:24 +08:00
3afce5b748
- appium@4.0.0-beta.4 - @appium/base-driver@11.0.0-beta.3 - @appium/base-plugin@4.0.0-beta.3 - @appium/docutils@4.0.0-beta.3 - @appium/driver-test-support@4.0.0-beta.3 - @appium/execute-driver-plugin@8.0.0-beta.4 - @appium/fake-driver@7.0.0-beta.4 - @appium/fake-plugin@5.0.0-beta.4 - @appium/http-server@1.0.0-beta.3 - @appium/images-plugin@6.0.0-beta.4 - @appium/logger@3.0.0-beta.2 - @appium/opencv@6.0.0-beta.3 - @appium/oxc-config@2.0.0-beta.2 - @appium/plugin-test-support@4.0.0-beta.4 - @appium/relaxed-caps-plugin@4.0.0-beta.4 - @appium/schema@2.0.0-beta.2 - @appium/storage-plugin@3.0.0-beta.4 - @appium/support@8.0.0-beta.3 - @appium/types@2.0.0-beta.3 - @appium/universal-xml-plugin@4.0.0-beta.4
@appium/plugin-test-support
Testing utilities for Appium plugins
This package is for plugin authors to help test their plugins.
Usage
For E2E Tests
The pluginE2EHarness method configures a server and driver for testing via setup/teardown callbacks.
This example uses WebdriverIO to communicate with a test Appium server.
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});
})
});
License
Apache-2.0