webdriver-manager-replacement
Version:
webdriver-manager-replacement
92 lines (91 loc) • 4 kB
TypeScript
/// <reference types="node" />
import * as childProcess from 'child_process';
import { JsonObject } from './utils/http_utils';
import { ProviderClass, ProviderConfig, ProviderInterface } from './provider';
export declare class Chromium extends ProviderClass implements ProviderInterface {
cacheFileName: string;
cacheVersionFileName: string;
cacheStorageFileName: string;
compressedBinaryFileName: string;
configFileName: string;
ignoreSSL: boolean;
osType: string;
osArch: string;
outDir: string;
proxy: string;
maxVersion: string;
constructor(config?: ProviderConfig);
private makeDirectory;
/**
* Step 1: Download the json file that contains all the releases by OS. Each
* OS will have a list of release versions. The requested body will also be
* written to the out directory.
*
* The requested url is https://omahaproxy.appspot.com/all.json. Some other
* urls include a timestamped csv https://omahaproxy.appspot.com/history.
* @return Promise of the all-json file.
*/
downloadAllJson(): Promise<JsonObject>;
/**
* Step 2: From the all-json object, make a request that matches the major
* version requested. The requested body will also be written to file in the
* out directory.
*
* An example of a requsted url is
* https://omahaproxy.appspot.com/deps.json?version=72.0.3626.81
* @param allJson The all-json object.
* @param majorVersion The major version, this must be a whole number.
*/
downloadVersionJson(allJson: JsonObject, majorVersion: string): Promise<JsonObject>;
/**
* Step 3: From the downloaded-version-json object, get the revision number.
* This is the "chromium_base_position" and make a request to the storage
* bucket. If the returned value is {"kind": "storage#objects"}, then
* decrement the revision number.
*
* An example is the chromium_base_position revision number (612437).
* https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o?delimiter=/&prefix=Linux_x64/612437/
* returns {"kind": "storage#objects"}.
*
* We keep decrementing the number until we reach 612434 where there is a list
* of items.
* @param downloadJson The download-version-json object.
* @param majorVersion The major version, this must be a whole number.
*/
downloadStorageObject(downloadJson: JsonObject, majorVersion: string): Promise<JsonObject>;
/**
* Step 4: Get the download url for the chromium zip. Unzipping the zip file
* directory. The folders and binaries uncompressed are different for each OS.
* The following is examples of each OS:
*
* downloads/
* |- chrome-linux/chrome
* |- chrome-mac/Chromium.app
* |- chrome-win/chrome.exe
*
* @param storageObject The download-storage-json object
* @param majorVersion The major version, this must be a whole number.
*/
downloadUrl(storageObject: JsonObject, majorVersion: string): Promise<void>;
updateBinary(_: string, majorVersion?: string): Promise<void>;
getBinaryPath(version?: string): string | null;
getStatus(): string | null;
cleanFiles(): string;
}
/**
* Helps translate the os type and arch to the download name associated
* with composing the download link.
* @param ostype The operating stystem type.
* @param osarch The chip architecture.
* @returns The download name associated with composing the download link.
*/
export declare function osHelper(ostype: string, osarch: string): string;
/**
* A command line to run. Example 'npm start', the task='npm' and the
* opt_arg=['start']
* @param task The task string.
* @param optArg Optional task args.
* @param optIo Optional io arg. By default, it should log to console.
* @returns The child process.
*/
export declare function spawnProcess(task: string, optArg?: string[], optIo?: string): childProcess.SpawnSyncReturns<Buffer>;