npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@openfin/automation-cli

v1.3.0

Published

CLI for running automation tests within the OpenFin ecosystem

Downloads

387

Readme

Automation CLI

This package contains a command line application that can be used to run automation tests within the OpenFin ecosystem.

The CLI is run by providing the location of the OpenFin application manifest and a set of test files.

During the execution of the CLI it will retrieve the required OpenFin runtimes as well as the correct version of the chromedriver to use with the runtime.

The CLI can also run in offline more where the OpenFin runtimes and chromedriver are already expected to be available locally. An offline-versions.json file is also expected to exist in the storage folder to define the real version numbers for labelled runtimes (see example below)

Currently Jasmine, Mocha and Jest are provided as in-built test runners.

When the test frameworks run they will automatically determine if your tests are written with JavaScript and TypeScript and behave accordingly.

The CLI process will exit with code 1 if any of the tests failed.

Installation

Run npm i @openfin/automation-cli.

Command Line Options

🚀 OpenFin Automation v1.2.0

Usage: of-automation [options] <manifestUrl <string>> <testGlobs <string>>

Run Automation Tests using Chrome Driver with an OpenFin UI

Arguments:
  manifestUrl <string>              The url of the manifest to load, can be http|https|file|none
  testGlobs <string>                Globs pointing to the tests to run, semi-colon separate for additional folders

Options:
  -V, --version                     output the version number
  --logLevel <level>                The log level for the webdriver (choices: "debug", "silent", default: "silent")
  --devToolsPort <number>           The port to run the dev tools on (default: 9090)
  --chromeDriverPort <number>       The port to run the chromedriver on (default: 4444)
  --storageFolder <path>            The path to store any downloaded or offline data (default: "./storage/")
  --offline                         In offline mode no resources are retrieved, they are expected to be in the storageFolder
  --testTimeout <number>            The timeout in seconds for running tests (default: 120)
  --testFailCount <number>          Will exit the tests after given number of failures, 0 will allow all failures (default: 0)
  --defaultRuntimeVersion <string>  The OpenFin runtime version to use if not specified in manifest (default: "stable")
  --framework <mocha>               The test framework to run the tests with (choices: "mocha", "jasmine", "jest", default: "mocha")
  --reporter <file.json>            Additional runner config to be passed to frameworks
  --driver <node>                   The webdriver used to access the runtime (choices: "node", "selenium", default: "node")
  --workspace <version>             The workspace version to use e.g. 9.2.5 for the DOS settings (default: "stable")
  --notifications <version>         The notifications version to use e.g. 1.20.2 for the DOS settings (default: "stable")
  --chromeDriverOverride <version>  Override the version of chromedriver e.g. 113
  --closeRuntime <mode>             When to close OpenFin runtimes in the workflow (choices: "never", "start", "end", "both", default: "both")
  --dos <file.json>                 Provide a custom DOS file to use when running tests
  --screenshotFolder <path>         The path to store any screen shots that have been taken (default: "./reports/screenshots/")
  --verbosity <mode>                What to display from the runner output (choices: "all", "none", "results", default: "all")
  --hooks <file>                    A file which contains global setup and teardown hooks (default: "./automation-hooks.{js,ts}")
  -h, --help                        display help for command

Helper packages

Any tests that you write can make use of two helper packages @openfin/automation-helpers and @openfin/automation-native which provide features to aid in interacting with OpenFin.

Example tests

There are JavaScript/TypeScript examples in the Workspace Starter repo

There are .NET examples in the C# Starter repo

CI Environments

The CLI can be used to run tests in a headless CI environment such as GitHub Actions, it requires a windows platform to be executed on.

Reporter config

To provide an additional reporter output for a test framework you can specify a reporter config file e.g. --reporter mocha.reporter.json. You must install the necessary npm package in the node_modules where you are running the tests from.

Some examples for each framework are.

Mocha

npm install mochawesome
{
    "reporter": "mochawesome",
    "options": {
        "reportDir": "./reports/mocha/",
        "reportFilename": "report.html",
        "html": true,
        "json": false
    }
}

Jasmine

npm install jasmine-pretty-html-reporter
{
    "reporter": "Reporter",
    "module": "jasmine-pretty-html-reporter",
    "options": {
        "path": "./reports/jasmine"
    }
}

Jest

npm install jest-html-reporters
{
    "reporter": "jest-html-reporters",
    "options": {
        "publicPath": "./reports/jest",
        "filename": "report.html"
    }
}

Execution example

Assuming your manifest is already being served at http://localhost:8080/manifest.fin.json and your files are stored in ./tests.

of-automation http://localhost:8080/manifest.fin.json ./tests/**/*.spec.js

You should see a summary similar to that shown below:

🚀 OpenFin Automation v1.2.0

  ⚙️  Manifest Url http://localhost:8080/manifest.fin.json
  ⚙️  Test Glob Path ./tests/**/*.spec.js
  ⚙️  Log Level silent
  ⚙️  Dev Tools Port 9090
  ⚙️  Chrome Driver Port 4444
  ⚙️  Test Framework mocha
  ⚙️  Test Timeout 120
  ⚙️  Default Runtime Version stable
  ⚙️  Storage Folder ./storage/
  ⚙️  Offline false
_______________________________________________________

➡️  Loading manifest
   http://localhost:8080/manifest.fin.json

  ✅  Manifest loaded
_______________________________________________________

➡️  Resolving OpenFin runtime version
   Version 32.114.76.20

  ✅  Final Runtime version 32.114.76.20
_______________________________________________________

➡️  Get Chrome Driver
   Version 114

  ✅  Chrome Driver already exists .\storage\chromedriver\114\chromedriver.exe
_______________________________________________________

➡️  Creating temp profile directory
   .\tmp\\openfin-test-1651745687443

  ✅  Directory created
_______________________________________________________

➡️  Cleaning up OpenFin instances

  ✅  Cleanup instances complete
_______________________________________________________

➡️  Querying Desktop Owner Settings

  ✅  Writing Temporary Desktop Owner Settings .\tmp\\openfin-dos-1651745687531.json
  ✅  Setting Desktop Owner Setting file:\\\.\tmp\\openfin-dos-1651745687531.json
  ✅  Current Desktop Owner Setting http://localhost:5081/api/dos/openfin
_______________________________________________________

➡️  Running OpenFin
   C:\Users\marty\AppData\Local\OpenFin\OpenFinRVM.exe

  ✅  Args --config=http://localhost:8080/manifest.fin.json,--working-dir="C:\Users\user\AppData\Local\OpenFin",--runtime-arguments="--remote-debugging-port=9090"
  ✅  OpenFinRVM Process 22084
_______________________________________________________

➡️  Starting Chrome Driver
   .\storage\chromedriver\96\chromedriver.exe port 4444

  ✅  Chrome Driver Process 20880
  ✅  Waiting for Chrome Driver to be ready

Starting ChromeDriver 114.0.5615.49 (bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936}) on port 4444
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
_______________________________________________________

➡️  Running Tests using Mocha
   Version 10.2.0

  Register with Home

    ✔ The title should be set
    ✔ The runtime version should be set
    ✔ Can open the home window (7263ms)
    ✔ Can search in the home window (1392ms)
    ✔ Can select entries in the home window by index (2077ms)
    ✔ Can select entries in the home window by id (2045ms)
    ✔ Can open the home window filters
    ✔ Can get the filter ids
    ✔ Set a filter by index
    ✔ Set a filter by id
    ✔ Can close the home window filters (3035ms)
    ✔ Can check selected entry content
    ✔ Can open an entry in the home window (1036ms)
    ✔ Can clear entries in the home window (1670ms)
    ✔ Can close the home window (640ms)
    ✔ Can perform operation in the interop window (2069ms)

  16 passing (21s)

_______________________________________________________

➡️  Cleaning Up

  ✅  Closing Chrome Driver
  ✅  Restoring DOS
  ✅  Setting Desktop Owner Setting http://localhost:5081/api/dos/openfin
  ✅  Removing temporary DOS Settings
  ✅  Cleaning up OpenFin instances
  ✅  Cleanup instances complete
  ✅  Removing temp data directory .\tmp\\openfin-test-1651745687443
_______________________________________________________

😀  Successfully ran the tests

offline-versions.json

Example file for offline-versions.json required if running in offline mode.

{
    "stable": "32.114.76.10",
    "release-candidate": "32.114.76.10",
    "beta": "32.114.76.10",
    "canary": "34.116.78.17",
    "stable-v32": "32.114.76.10",
    "stable-v31": "31.112.75.7",
    "stable-v30": "30.110.74.16",
    "stable-v29": "29.108.73.19",
    "stable-v28": "28.106.72.17",
    "stable-v27": "27.104.71.29",
    "stable-v26": "26.102.71.10",
    "stable-v25": "25.100.70.4",
    "stable-v24": "24.98.69.10",
    "stable-v23": "23.96.68.7",
    "stable-v22": "22.94.67.8",
    "stable-v21": "21.93.65.4",
    "stable-v20": "20.91.64.4",
    "stable-v19": "19.89.61.8",
    "stable-v18": "18.87.57.42",
    "stable-v17": "17.85.55.40",
    "stable-v16": "16.83.53.27",
    "stable-v15": "15.80.50.34",
    "stable-v14": "14.78.48.16",
    "stable-v13": "13.76.45.15",
    "stable-v12": "12.69.43.22",
    "stable-v11": "11.69.42.29",
    "stable-v10": "10.66.41.18",
    "stable-v9": "9.61.38.43",
    "stable-v8": "8.56.30.71",
    "stable-v7": "7.53.23.23",
    "stable-v6": "6.49.21.24"
}

OpenFin Debugging

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

Related Packages