mirror of
https://github.com/appium/appium.git
synced 2026-10-18 13:41:26 +08:00
e648569dfb
- appium@3.6.0 - @appium/base-driver@10.7.2 - @appium/base-plugin@3.3.3 - @appium/docutils@2.5.2 - @appium/driver-test-support@2.0.1 - @appium/eslint-config-appium-ts@3.2.4 - @appium/execute-driver-plugin@6.0.7 - @appium/fake-driver@6.2.2 - @appium/fake-plugin@4.3.3 - @appium/images-plugin@4.2.8 - @appium/logger@2.0.10 - @appium/opencv@4.1.7 - @appium/oxc-config@1.1.0 - @appium/plugin-test-support@2.0.1 - @appium/relaxed-caps-plugin@2.2.5 - @appium/schema@1.3.0 - @appium/semantic-release-config@1.1.0 - @appium/storage-plugin@1.1.8 - @appium/strongbox@1.1.3 - @appium/support@7.2.6 - @appium/tsconfig@1.2.0 - @appium/types@1.6.0 - @appium/universal-xml-plugin@2.1.7
@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