mirror of
https://github.com/appium/appium.git
synced 2026-10-25 02:00:57 +08:00
feat: allow retrieval of basedriver version from any inheriting driver
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
} from '../protocol';
|
||||
import { PROTOCOLS, DEFAULT_BASE_PATH } from '../constants';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import commands from './commands';
|
||||
import * as helpers from './helpers';
|
||||
import log from './logger';
|
||||
@@ -20,6 +21,7 @@ B.config({
|
||||
cancellation: true,
|
||||
});
|
||||
|
||||
const BASEDRIVER_VER = require(path.resolve(__dirname, '..', '..', '..', 'package.json')).version;
|
||||
const NEW_COMMAND_TIMEOUT_MS = 60 * 1000;
|
||||
|
||||
const EVENT_SESSION_INIT = 'newSessionRequested';
|
||||
@@ -30,6 +32,12 @@ const ON_UNEXPECTED_SHUTDOWN_EVENT = 'onUnexpectedShutdown';
|
||||
|
||||
class BaseDriver extends Protocol {
|
||||
|
||||
/**
|
||||
* Make the basedriver version available so for any driver which inherits from this package, we
|
||||
* know which version of basedriver it inherited from
|
||||
*/
|
||||
static baseVersion = BASEDRIVER_VER;
|
||||
|
||||
constructor (opts = {}, shouldValidateCaps = true) {
|
||||
super();
|
||||
|
||||
|
||||
+2
-2
@@ -78,12 +78,12 @@
|
||||
"chai": "^4.1.2",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"content-disposition": "^0.5.0",
|
||||
"eslint-config-appium": "^4.0.1",
|
||||
"eslint-config-appium": "^4.7.0",
|
||||
"finalhandler": "^1.1.1",
|
||||
"gulp": "^4.0.0",
|
||||
"mocha": "^8.0.1",
|
||||
"querystring": "^0.2.0",
|
||||
"pre-commit": "^1.1.3",
|
||||
"querystring": "^0.2.0",
|
||||
"serve-static": "^1.13.1",
|
||||
"sinon": "^9.0.0"
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) {
|
||||
await d.deleteSession();
|
||||
});
|
||||
|
||||
it('should report the version of BaseDriver used', function () {
|
||||
should.exist(DriverClass.baseVersion);
|
||||
});
|
||||
|
||||
it('should return an empty status object', async function () {
|
||||
let status = await d.getStatus();
|
||||
status.should.eql({});
|
||||
|
||||
Reference in New Issue
Block a user