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

selenoid-video-api

v1.3.1

Published

Node library to manually control the selenoid video recorder

Downloads

33

Readme

selenoid-video-api

Node library to manually control a custom Selenoid video recorder

Intro

This library contains a node api to a interact with a custom Selenoid video recorder, as well as methods that easily plugs into a few Webdriver.io test hooks for easy setup.

This makes it possible to run many test suites in one go and still make separate recordings of each test case.

There is also easy integration with Allure reports to make them pretty:

Allure example

Explore the allure example here: allure-example-report-with-video

Prerequisites

  1. Install Node >= v8: How to install node
  2. Install Docker: How to install docker
  3. Pull the manual video recorder docker image
    docker image pull presidenten/selenoid-manual-video-recorder
  1. Install cm for Selenoid:
  curl -s https://aerokube.com/cm/bash | bash
  • Start selenoid with custom manual video recorder
  cm selenoid start --vnc --tmpfs 128 --args "-video-recorder-image presidenten/selenoid-manual-video-recorder"

Test the demo

  • To run the demo, make sure prerequisites 1-4 are in place, then:
  git clone https://github.com/presidenten/selenoid-video-api.git
  cd selenoid-video-api

  # Install project dependencies
  npm install

  # Install demo dependencies
  cd demo
  npm install
  • Run tests
  npm run test --silent
  • Generate allure report (optional):
  npm run allure

Then navigate to from http://localhost:8080/index.html, click on a failing test and check Execution Video in test body

  • Videos are moved to the output dir and the report dir as report attachments The library assumes that the selenoid config dir is default (~/.aerokube)
 ~/github/selenium-video-api/demo/e2e/results$ ls
  User-list-should-be-able-to-move-slider-chrome-2018-06-03--10-29.mp4
  User-list-should-be-able-to-move-slider-chrome-2018-06-03--10-29.png
  User-list-should-be-able-to-multi-select-in-dropdown-chrome-2018-06-03--10-29.mp4
  User-list-should-be-able-to-multi-select-in-dropdown-chrome-2018-06-03--10-29.png

Installation

  • Add this module to your test repo

    npm install selenoid-video-api
  • Check the example config to see how to use this module: wdio.conf.js

    (Ofcourse const selenoidVideoApi = require('../index.js'); from row 1 in the example needs to be changed to: const selenoidVideoApi = require('selenium-video-api');)

    • If you want awesome Allure reports, also check Custom settings section on how to configure the Allure reporter and make sure to install it as well
        npm install wdio-allure-reporter

Configuration

selenoidVideoApi.getWdioHooks accepts the following config, with these defaults:

  getWdioHooks({
    usingAllure = false,
    saveAllVideos = false,
    waitForVNCTime = 2000,
    videoMinTime = 500,
  })

Working with the video interface separately

tbd

Under the hood

Normally when using linking docker containers, a one way connection is specified with environment variables set in one machine so it can reach the other.

To be able to start/stop the recorder, we need a way to trigger the recorder from the browser. But it is linked to the recorder for vnc, so the browser has no knowledge of the recorder container.

This is my solution:

  • Have a middle man (this library) read env from each video recorder and make a map of the recorders name, ip and its corresponding browser ip
  • Have each spawned browser figure out its ip inside selenium during runtime
  • Have an api to trigger commands in the recorder containers, which accepts browser ip to decide which container to run commands in

For more details: