@jest-environment-browserstack/plugins
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@jest-environment-browserstack/plugins

Provides the abstract classes needed for implementing a plugin.

A plugin is a wrapper on top of the W3C WebDriver API used in jest-environment-browserstack for interacting with Browserstack.

Usage

npm install --save @jest-environment-browserstack/plugins

In your plugin:

import { WebDriver, Builder } from 'my-selenium-webdriver';
import { BrowserCapability, PluginDriver, Driver, LogTypes } from '@jest-environment-browserstack/plugins';

export class SeleniumWebDriver extends Driver<WebDriver> {
  async build(capabilities?: BrowserCapability): Promise<WebDriver> {
    // init your module
  }

  async quit(): Promise<boolean> {
    // your module teardown
  }
}

export class PluginSeleniumWebDriver extends PluginDriver<SeleniumWebDriver> {
  async createWdDriver(capabilities?: BrowserCapability, hubUrl?: string): Promise<SeleniumWebDriver> {
    // create your driver instance and return it for the test
  }
}

Inside the core, we use the Reflect API to determine which object contains the createWdDriver method.

Bugs / Improvements

Feel free to report an issue in case you found a bug or something which could be improved. PR are more than welcome !

/@jest-environment-browserstack/plugins/

    Package Sidebar

    Install

    npm i @jest-environment-browserstack/plugins

    Weekly Downloads

    3

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    10.6 kB

    Total Files

    12

    Last publish

    Collaborators

    • taktakpeops