@openfin/automation-helpers
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Automation Helpers

This package contains helper methods which can be use in automation testing to interact with the OpenFin ecosystem.

They should be used in a test runner that has webdriver capabilities e.g. @openfin/automation-cli

Installation

Run npm i @openfin/automation-helpers.

Code examples

These examples use chai as the testing framework, but you can choose any framework you like.

Access the OpenFin system runtime

import { expect } from "chai";
import { OpenFinProxy, WebDriver } from "@openfin/automation-helpers";

describe('Test Suite', () => {
    it('The runtime version should be set', async () => {
        const fin = await OpenFinProxy.fin();
        const runtimeVersion = await fin.System.getVersion();

        expect(runtimeVersion).to.equal('26.102.70.16');
    });
});

Search for a value in the Home component

import { expect } from "chai";
import { OpenFinHome } from "@openfin/automation-helpers";

describe('Test Suite', () => {
    it('Can search in the Home component', async () => {
        await OpenFinHome.search("basic");
        await WebDriver.sleep(1000);

        const ids = await OpenFinHome.searchResultIds();

        expect(ids.length).equal(2);
        expect(ids[0]).equal("basic-interop-view");
        expect(ids[1]).equal("basic-fdc3-view");
    });
});

Use WebDriver command to interact with a window

import { expect } from "chai";
import { WebDriver } from "@openfin/automation-helpers";

describe('Test Suite', () => {
    it('Can perform operation in the interop window', async () => {
        await WebDriver.switchToWindow("title", "Interop Instrument Selection");

        const elem = await WebDriver.findElementByPath("//h1");
        await elem.setHTML("My New Title");

        const elem2 = await WebDriver.findElementByPath("//h1");
        const value = await elem2.getHTML();
        expect(value).eq("My New Title");

        await WebDriver.sleep(2000);
    });
});

OpenFin Debugging

For more information on debugging in OpenFin see https://developers.openfin.co/of-docs/docs/debugging

Related Packages

Readme

Keywords

Package Sidebar

Install

npm i @openfin/automation-helpers

Weekly Downloads

157

Version

1.2.0

License

SEE LICENSE IN LICENSE.MD

Unpacked Size

131 kB

Total Files

36

Last publish

Collaborators

  • michalzz
  • ameet-openfin
  • jmransegnola
  • marek_openfin
  • yoge-openfin
  • nil.ffej
  • gilesstevenson-openfin
  • eheyder
  • newaz.sharif
  • efraim-herstic
  • royhafin
  • openfincolinhu
  • openfin-johans
  • alan15008
  • openfin-ci-gh
  • hina-khalid
  • ife-dev1
  • mjosling
  • elliott.burr
  • vsaw3
  • gallak-openfin
  • galim.kaudinov
  • hzhi0209
  • andy.westacott
  • __tomasz__
  • cameronopenfin
  • jennrondeau
  • dhilan
  • benstubbington
  • davidcoxon-of
  • openfin-jeff
  • gouthamc
  • hannahmcmillen
  • xyopenfin
  • smocarski
  • eugeneross-openfin
  • imansuri
  • manamiueda
  • sakibahmad
  • shahossain
  • openfinbrandon
  • pierrebaize
  • noyangunday
  • michaelmcoates
  • johnmandia-openfin
  • rdepena
  • tgoc99
  • wenjunche
  • harsimran.openfin.singh
  • luiemilio
  • licui3936
  • connormccafferty
  • adam.saland
  • openfin-ci
  • chrishobsonexpero
  • richbrowne-openfin
  • azizyok
  • openfin-gavin
  • oblarg