mirror of
https://github.com/appium/appium.git
synced 2026-10-16 20:32:05 +08:00
eb5ce47b17
- appium@3.8.0 - @appium/base-driver@10.8.1 - @appium/base-plugin@3.3.5 - @appium/docutils@3.0.1 - @appium/driver-test-support@3.0.1 - @appium/eslint-config-appium-ts@3.2.6 - @appium/execute-driver-plugin@7.0.1 - @appium/fake-driver@6.2.4 - @appium/fake-plugin@4.4.1 - @appium/images-plugin@5.0.1 - @appium/logger@2.0.12 - @appium/opencv@5.0.1 - @appium/oxc-config@1.1.2 - @appium/plugin-test-support@3.0.1 - @appium/relaxed-caps-plugin@3.0.1 - @appium/storage-plugin@2.0.1 - @appium/strongbox@2.0.1 - @appium/support@7.2.8 - @appium/types@1.7.1 - @appium/universal-xml-plugin@3.0.1
@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