GithubHelp home page GithubHelp logo

pinkdiamond1 / zemu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zondax/zemu

0.0 1.0 0.0 3.34 MB

Ledger Nano Emulation/testing framework

License: Apache License 2.0

JavaScript 2.20% TypeScript 97.80%

zemu's Introduction

Zondax Zemu Testing Framework

License npm version GithubActions

We appreciate any contributions to this effort!

We recommend using the npmjs package in order to receive updates/fixes.

This project is under active development - API and usage guidelines are very likely to change

Overview

Integration and end-to-end testing of Ledger Apps is a manual and time consuming process. We believe that the Ledger apps ecosystem is lacking an adequate approach with respect to testing. The Zemu Framework is our solution for this problem. We stand on the shoulders of the giant greenknot’s speculos.

Zemu is an emulation and testing framework for Ledger Nano S/X devices.

Features

  • Minimal configuration + Docker based
  • Speculous/Qemu based emulation
  • Easy JS API
    • Mocha / Jest compatible
    • Parallelized testing
    • Abstracted device control (buttons, reset, etc.)
    • Screenshots + comparisons
  • Debugging (support for CLion and vscode, even mixed C/Rust)
  • Used by Zondax in multiple apps

QuickStart

Zemu class provides access and control to your emulated Ledger app running on a docker container.

Basic testing code:

jest.setTimeout(20000);

test("demo", async () => {
  //Create Zemu object. Pass the path to your .elf file
  const sim = new Zemu("/ledger-demo/app/bin/");
  //Create an instance of your Ledger-js app
  try {
    const demoJSApp = new DemoApp(sim.getTransport());
    //Start simulator. A new docker container instance will be created.
    await sim.start({});
    //Do your tests
  ...
    //Finally, close the simulator. This will stop and remove the container.
  } finally {
    await sim.close();
  }
});

Basic control commands examples:**

  • Take a screenshot and save it:
    await sim.snapshot("tests/snapshots/0.png")

  • Send "click left":
    await sim.clickLeft()

  • Send "click right":
    await sim.clickRight()

  • Send "click both":
    await sim.clickBoth()

  • Wait some time:
    await Zemu.sleep(500) //Time in [ms]

zemu's People

Contributors

apaillier-ledger avatar carlosala avatar chcmedeiros avatar dependabot[bot] avatar emmanuelm41 avatar ftheirs avatar ioansflt avatar jleni avatar karrq avatar neithanmo avatar raynaudoe avatar rllola avatar sherlock1982 avatar tamtamhero avatar

Watchers

 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.