Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 1.77 KB

README.md

File metadata and controls

55 lines (45 loc) · 1.77 KB

Octo

A standalone wrapper for Selenium webdriver that provides extra utility actions for the driver.

Installing

npm install octo-driver --save-dev

Features

  • Retry handling at the command level.
  • Types with Typescript.
  • Signaling across browsers.
  • Async/Await.

Pre-requisites

It's important to know that Octo ONLY wraps the WebDriver instance portion of selenium-webdriver. This makes it so you can easily plug into any existing test runner or builder of your choosing.

import Octo from 'octo-driver';

function build(): WebDriver {
  const build = new selenium.Builder();
  return build.forBrowser('chrome').build();
}

const driver = new Octo(build());

Example

Extending a Page Object.

import { WebDriver } from 'selenium-webdriver';
import Octo from 'octo-driver';
import env from '../env';

export class BasePage extends Octo {
  public baseURL = env.urls.homepage;
  public sitemap = {
    home: '/',
  };
  public DOM = {
    wrapper: 'body'
  };
  constructor(private driver: WebDriver) {
    super(driver);
  }

  public async load(page: string = this.sitemap.home): Promise<void> {
    await super.go(`${this.baseURL}${page}`);
    await super.waitForDisplayed(this.DOM.wrapper);
    return;
  }

}

Why Octo?

This project was heavily inspired from a blog post written by Uber called Rescued by Octopus. In this post they demonstrated the complex user scenarios and inner device communication that their test have to complete in order the confirm end-to-end app functionality. The name was taken from the project at Uber and made to solve similar issues using NodeJS while also adding extra utility.