Giter Club home page Giter Club logo

selenoid-video-api's Introduction

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:

selenoid-video-api's People

Contributors

presidenten avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.