mirror of
https://github.com/appium/appium.git
synced 2026-10-17 04:41:24 +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/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