wct-local

  • Version 2.1.7
  • Published
  • 34.1 kB
  • 10 dependencies
  • BSD-3-Clause license

Install

npm i wct-local
yarn add wct-local
pnpm add wct-local

Overview

WCT plugin that enables support for local browsers via Selenium

Index

Namespaces

namespace selenium-standalone

module 'selenium-standalone' {}

    function install

    install: (opts: InstallOpts, cb: (error?: any) => void) => void;

      function start

      start: (opts: StartOpts, cb: (error?: any) => void) => void;

        interface DriverConfig

        interface DriverConfig {}

          property arch

          arch: string;

            property baseURL

            baseURL: string;

              property version

              version: string;

                interface InstallOpts

                interface InstallOpts {}

                  property basePath

                  basePath?: string;
                  • Sets the base directory used to store the selenium standalone .jar and drivers. Defaults to current working directory + .selenium/

                  property baseURL

                  baseURL?: string;
                  • Used to find the server having the selenium or drivers files.

                  property drivers

                  drivers?: {
                  [browserName: string]: DriverConfig;
                  // chrome?: DriverConfig;
                  // ie?: DriverConfig;
                  // ... complete list?
                  };
                  • Drivers to download and install along with selenium standalone server

                  property logger

                  logger?: (message: any) => void;
                  • Will be called if provided with some debugging information about the installation process.

                  property progressCb

                  progressCb?: (
                  totalLength: number,
                  progressLength: number,
                  chunkLength: number
                  ) => void;

                    property version

                    version: string;
                    • Selenium version to install.

                    interface StartOpts

                    interface StartOpts {}

                      property basePath

                      basePath?: string;
                      • Sets the base directory used to store the selenium standalone .jar and drivers. Defaults to current working directory + .selenium/

                      property cb

                      cb?: (err: any, child: child_process.ChildProcess) => void;
                      • Called when the server is running and listening, child is the ChildProcess instance created.

                      property drivers

                      drivers?: {
                      [browserName: string]: DriverConfig;
                      // chrome?: DriverConfig;
                      // ie?: DriverConfig;
                      // ... complete list?
                      };

                        property javaArgs

                        javaArgs?: string[];
                        • seleniumJavaArgs

                        property javaPath

                        javaPath?: string;
                        • set the javaPath manually, otherwise we use which

                        property seleniumArgs

                        seleniumArgs?: string[];
                        • Arguments for the selenium server, passed directly to child_process.spawn.

                        property spawnCb

                        spawnCb?: Function;
                        • Will be called if provided as soon as the selenium child process was spawned. It may be interesting if you want to do some more debug.

                        property spawnOptions

                        spawnOptions?: child_process.SpawnOptions;
                        • Spawn options for the selenium server.

                        namespace wct

                        module 'wct' {}

                          class Context

                          class Context extends events.EventEmitter {}
                          • Exposes the current state of a WCT run, and emits events/hooks for anyone downstream to listen to.

                            Parameter options

                            Any initially specified options.

                          constructor

                          constructor(options: Config);

                            property Context

                            static Context: typeof Context;

                              property options

                              options: Config;

                                method emitHook

                                emitHook: {
                                (
                                name: 'prepare:webserver',
                                app: express.Application,
                                done: (err?: any) => void
                                ): Context;
                                (name: 'configure', done: (err?: any) => void): Context;
                                (name: 'prepare', done: (err?: any) => void): Context;
                                (name: 'cleanup', done: (err?: any) => void): Context;
                                (name: string, done: (err?: any) => void): Context;
                                (name: string, ...args: any[]): Context;
                                };
                                • Once all registered handlers have run for the hook, your callback will be triggered. If any of the handlers indicates an error state, any subsequent handlers will be canceled, and the error will be passed to the callback for the hook.

                                  Any additional arguments passed between name and done will be passed to hooks (before the callback).

                                  Parameter name

                                  Parameter done

                                  {!Context}

                                method enabledPlugins

                                enabledPlugins: () => string[];
                                • {!Array} The names of enabled plugins.

                                method hook

                                hook: (name: string, handler: Handler) => void;
                                • Registers a handler for a particular hook. Hooks are typically configured to run _before_ a particular behavior.

                                method hookLate

                                hookLate: (name: string, handler: Handler) => void;
                                • Registers a handler that will run after any handlers registered so far.

                                  Parameter name

                                  Parameter handler

                                method pluginOptions

                                pluginOptions: (name: string) => any;
                                • Parameter name

                                  {!Object}

                                method plugins

                                plugins: (done: (err: any, plugins?: Plugin[]) => void) => void;
                                • Parameter done

                                  Asynchronously loads the plugins requested by options.plugins.

                                class Plugin

                                class Plugin {}
                                • A WCT plugin. This constructor is private. Plugins can be retrieved via Plugin.get.

                                constructor

                                constructor(packageName: string, metadata: Metadata);

                                  property cliConfig

                                  cliConfig: Config;

                                    property metadata

                                    metadata: Metadata;

                                      property name

                                      name: string;

                                        property packageName

                                        packageName: string;

                                          property Plugin

                                          static Plugin: typeof Plugin;

                                            method execute

                                            execute: (context: Context, done: (message?: string) => void) => void;
                                            • Parameter context

                                              The context that this plugin should be evaluated within.

                                              Parameter done

                                            method get

                                            static get: (name: string, done: (err: any, plugin?: Plugin) => void) => void;
                                            • Retrieves a plugin by shorthand or module name (loading it as necessary).

                                              Parameter name

                                              Parameter done

                                            method shortName

                                            static shortName: (name: string) => string;
                                            • Parameter name

                                              {string} The short form of name.

                                            interface BrowserDef

                                            interface BrowserDef extends wd.Capabilities {}

                                              property deviceName

                                              deviceName?: string;

                                                property id

                                                id: number;

                                                  property sessionId

                                                  sessionId: string;

                                                    property url

                                                    url: wd.ValidHost;

                                                      interface Config

                                                      interface Config {}

                                                        property activeBrowsers

                                                        activeBrowsers: BrowserDef[];

                                                          property browserOptions

                                                          browserOptions: {
                                                          [name: string]: wd.Capabilities;
                                                          };

                                                            property clientOptions

                                                            clientOptions: {
                                                            root: string;
                                                            verbose?: boolean;
                                                            };

                                                              property enforceJsonConf

                                                              enforceJsonConf: boolean;

                                                                property expanded

                                                                expanded: boolean;

                                                                  property extraScripts

                                                                  extraScripts: string[];

                                                                    property origSuites

                                                                    origSuites?: string[];

                                                                      property output

                                                                      output: NodeJS.WritableStream;

                                                                        property persistent

                                                                        persistent: boolean;

                                                                          property plugins

                                                                          plugins:
                                                                          | (string | boolean)[]
                                                                          | {
                                                                          [key: string]:
                                                                          | {
                                                                          disabled: boolean;
                                                                          }
                                                                          | boolean;
                                                                          };

                                                                            property quiet

                                                                            quiet?: boolean;

                                                                              property registerHooks

                                                                              registerHooks: (wct: Context) => void;

                                                                                property remote

                                                                                remote?: {};

                                                                                  property root

                                                                                  root: string;

                                                                                    property sauce

                                                                                    sauce?: {};

                                                                                      property simpleOutput

                                                                                      simpleOutput?: boolean;

                                                                                        property skipCleanup

                                                                                        skipCleanup?: boolean;

                                                                                          property skipPlugins

                                                                                          skipPlugins?: boolean;

                                                                                            property skipUpdateCheck

                                                                                            skipUpdateCheck?: boolean;

                                                                                              property suites

                                                                                              suites: string[];

                                                                                                property testTimeout

                                                                                                testTimeout: number;

                                                                                                  property ttyOutput

                                                                                                  ttyOutput: boolean;

                                                                                                    property verbose

                                                                                                    verbose: boolean;

                                                                                                      property webserver

                                                                                                      webserver: {
                                                                                                      port: number;
                                                                                                      hostname: string;
                                                                                                      pathMappings: {
                                                                                                      [urlPath: string]: string;
                                                                                                      }[];
                                                                                                      urlPrefix: string;
                                                                                                      webRunnerPath?: string;
                                                                                                      webRunnerContent?: string;
                                                                                                      staticContent?: {
                                                                                                      [file: string]: string;
                                                                                                      };
                                                                                                      };

                                                                                                        interface Metadata

                                                                                                        interface Metadata {}

                                                                                                          property 'cli-options'

                                                                                                          'cli-options': Config;

                                                                                                            interface PluginInterface

                                                                                                            interface PluginInterface {}

                                                                                                              call signature

                                                                                                              (context: Context, pluginOptions: any, pluginMeta: Plugin): void;

                                                                                                                interface Stats

                                                                                                                interface Stats {}

                                                                                                                  property failing

                                                                                                                  failing?: number;

                                                                                                                    property passing

                                                                                                                    passing?: number;

                                                                                                                      property pending

                                                                                                                      pending?: number;

                                                                                                                        property status

                                                                                                                        status: string;

                                                                                                                          type Handler

                                                                                                                          type Handler = (o: {}, callback: (err: any) => void) => void;

                                                                                                                            namespace wd

                                                                                                                            module 'wd' {}

                                                                                                                              function remote

                                                                                                                              remote: (hostnameOrUrl: ValidHost) => Browser;

                                                                                                                                interface Browser

                                                                                                                                interface Browser {}

                                                                                                                                  method attach

                                                                                                                                  attach: (sessionId: string, callback: NodeCB<Capabilities>) => void;

                                                                                                                                    method configureHttp

                                                                                                                                    configureHttp: (options: { retries: number }) => void;

                                                                                                                                      method get

                                                                                                                                      get: (url: string, callback: NodeCB<void>) => void;

                                                                                                                                        method init

                                                                                                                                        init: (capabilities: Capabilities, callback: NodeCB<string>) => void;

                                                                                                                                          method on

                                                                                                                                          on: (eventName: string, handler: Function) => void;

                                                                                                                                            method quit

                                                                                                                                            quit: (callback: NodeCB<void>) => void;

                                                                                                                                              interface Capabilities

                                                                                                                                              interface Capabilities {}

                                                                                                                                                property 'moz:firefoxOptions'

                                                                                                                                                'moz:firefoxOptions'?: {
                                                                                                                                                args?: string[];
                                                                                                                                                };

                                                                                                                                                  property 'phantomjs.binary.path'

                                                                                                                                                  'phantomjs.binary.path'?: string;

                                                                                                                                                    property 'safari.options'

                                                                                                                                                    'safari.options'?: {
                                                                                                                                                    skipExtensionInstallation?: boolean;
                                                                                                                                                    };

                                                                                                                                                      property browserName

                                                                                                                                                      browserName:
                                                                                                                                                      | 'android'
                                                                                                                                                      | 'chrome'
                                                                                                                                                      | 'firefox'
                                                                                                                                                      | 'htmlunit'
                                                                                                                                                      | 'internet explorer'
                                                                                                                                                      | 'iPhone'
                                                                                                                                                      | 'iPad'
                                                                                                                                                      | 'opera'
                                                                                                                                                      | 'safari'
                                                                                                                                                      | 'phantomjs';
                                                                                                                                                      • The name of the browser being used

                                                                                                                                                      property chromeOptions

                                                                                                                                                      chromeOptions?: {
                                                                                                                                                      binary?: string;
                                                                                                                                                      args?: string[];
                                                                                                                                                      };

                                                                                                                                                        property cssSelectorsEnabled

                                                                                                                                                        cssSelectorsEnabled?: boolean;
                                                                                                                                                        • Whether the session supports CSS selectors when searching for elements.

                                                                                                                                                        property firefox_binary

                                                                                                                                                        firefox_binary?: string;

                                                                                                                                                          property handlesAlerts

                                                                                                                                                          handlesAlerts?: boolean;
                                                                                                                                                          • Whether the session can interact with modal popups, such as window.alert and window.confirm.

                                                                                                                                                          property marionette

                                                                                                                                                          marionette?: boolean;

                                                                                                                                                            property platform

                                                                                                                                                            platform?:
                                                                                                                                                            | 'WINDOWS'
                                                                                                                                                            | 'XP'
                                                                                                                                                            | 'VISTA'
                                                                                                                                                            | 'MAC'
                                                                                                                                                            | 'LINUX'
                                                                                                                                                            | 'UNIX'
                                                                                                                                                            | 'ANDROID'
                                                                                                                                                            | 'ANY';
                                                                                                                                                            • A key specifying which platform the browser should be running on.

                                                                                                                                                            property selenium

                                                                                                                                                            selenium?: {
                                                                                                                                                            server: {
                                                                                                                                                            url: string;
                                                                                                                                                            };
                                                                                                                                                            };

                                                                                                                                                              property version

                                                                                                                                                              version: string;
                                                                                                                                                              • The browser version, or the empty string if unknown.

                                                                                                                                                              property webdriver

                                                                                                                                                              webdriver?: {
                                                                                                                                                              remote: {
                                                                                                                                                              quietExceptions: boolean;
                                                                                                                                                              };
                                                                                                                                                              };

                                                                                                                                                                interface NodeCB

                                                                                                                                                                interface NodeCB<T> {}

                                                                                                                                                                  call signature

                                                                                                                                                                  (err: any, value: T): void;

                                                                                                                                                                    type ValidHost

                                                                                                                                                                    type ValidHost =
                                                                                                                                                                    | string
                                                                                                                                                                    | { hostname: string; port?: number; auth?: string; path?: string }
                                                                                                                                                                    | {
                                                                                                                                                                    host: string;
                                                                                                                                                                    port?: number;
                                                                                                                                                                    username?: string;
                                                                                                                                                                    accesskey?: string;
                                                                                                                                                                    path?: string;
                                                                                                                                                                    };

                                                                                                                                                                      Package Files (4)

                                                                                                                                                                      Dependencies (10)

                                                                                                                                                                      Dev Dependencies (0)

                                                                                                                                                                      No dev dependencies.

                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                      No peer dependencies.

                                                                                                                                                                      Badge

                                                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/wct-local.

                                                                                                                                                                      • Markdown
                                                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/wct-local)
                                                                                                                                                                      • HTML
                                                                                                                                                                        <a href="https://www.jsdocs.io/package/wct-local"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>