Giter VIP home page Giter VIP logo

ink-waterfall's Introduction

Readme

ci-result ci-duration

This project contains end-to-end tests for this pipeline:

ink! ➜
   cargo-contract ➜
             canvas-ui || polkadot-js ➜
                                 canvas-node

How the tests in this repository work

  • They build the ink! examples using cargo-contract.
  • The resulting .contract file is deployed on a local blockchain instance of canvas-node.
  • The deployment is done using either the canvas-ui or polkadot-js.
  • This is done by emulating browser interactions in Firefox (clicking, uploading, …).
  • After successful deployment more browser interactions with the contract are conducted, in order to assert that the contract behaves as expected.
  • The master branch of all these components is used.

Required dependencies

For the UI either the canvas-ui or the polkadot-js UI is an optional requirement. By default the published versions of those projects are used (https://paritytech.github.io/canvas-ui, https://polkadot.js.org/apps/#/).

Run it locally

export INK_EXAMPLES_PATH=/path/to/ink/examples/
canvas --tmp --dev > /tmp/canvas.log 2>&1 &

# By default you will see the Firefox GUI and the
# tests interacting with it.
cargo test 

# …you can also start the tests headless though, then
# you won't see anything.
cargo test --features headless

# Handy for debugging:

# You can prevent the test suite from closing the browser
# window. Then you can still interact with the browser after
# the test failed/succeeded. 
export WATERFALL_CLOSE_BROWSER=false

# Setting the number of parallel jobs to `1` makes it easier
# to follow the tests interacting with the browser.
cargo test --jobs 1

By default, the canvas-ui published at https://paritytech.github.io/canvas-ui (i.e. the gh-pages branch) will be used. But you can also use a local instance:

git clone --depth 1 https://github.com/paritytech/canvas-ui.git
cd canvas-ui/
yarn install
yarn start > /tmp/canvas-ui.log 2>&1 &
cd ..

# Check that the UI is ready and a `200 OK` is returned.
curl -I http://localhost:3000/

export UI_URL="http://localhost:3000"
cargo test

If you want to use the polkadot-js UI instead you need to supply --features polkadot-js-ui to cargo test.

Environment variables

  • INK_EXAMPLES_PATH ‒ Path to the ink! examples folder. Must be set.
  • UI_URL ‒ URL of the UI to use. Defaults to the live interface for the chosen UI.
  • WATERFALL_CLOSE_BROWSER ‒ Do not close browser window at the end of a test run. Defaults to true. Set it to false to prevent closing .
  • WATERFALL_SKIP_CONTRACT_BUILD ‒ Do not build the contracts, re-use existing artifacts from their target folder. Defaults to false. Set it to true to skip building.
  • CANVAS_PORT ‒ Port under which the canvas-node is running. Defaults to 9944.
  • RUST_LOG ‒ Use RUST_LOG=info to get output on what the tests are doing.

Known issue

The tooltips which show the result of a contract upload or contract transaction (ExtrinsicSuccess, …) disappear after some time. When too many UI tests are run at the same time the tooltips might disappear before the test is finished processing them.

The test will then fail with a NoSucheElement error, indicating that the DOM element is no longer available. The easiest fix for this is to limit the number of concurrent test threads via e.g. cargo test --jobs 4.

ink-waterfall's People

Contributors

cmichi avatar

Watchers

James Cloos 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.