mirror of
https://github.com/appium/appium.git
synced 2026-10-18 21:51:37 +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/driver-test-support
Testing utilities for Appium drivers
This package is for driver authors to help test their drivers.
Usage
Helpers
These are just some helpers (mainly for E2E tests):
import {TEST_HOST, getTestPort, createAppiumURL} from '@appium/driver-test-support';
import assert from 'node:assert';
describe('TEST_HOST', function() {
it('should be localhost', function() {
assert.strictEqual(TEST_HOST, '127.0.0.1');
});
});
describe('getTestPort()', function() {
it('should get a free test port', async function() {
const port = await getTestPort();
assert.ok(port > 0);
});
});
describe('createAppiumURL()', function() {
const urlFor = createAppiumURL(TEST_HOST, 31337);
it('should create a "new session" URL', function() {
assert.strictEqual(urlFor('', 'session'), `http://${TEST_HOST}:31337/session`);
});
it('should create a URL for a session command', function() {
const sessionId = '12345';
assert.strictEqual(
urlFor(sessionId, 'moocow'),
`http://${TEST_HOST}:31337/session/${sessionId}/moocow`
);
});
});
Installation
npm install @appium/driver-test-support --save-dev
License
Apache-2.0