A browser based plugin simulation tool to aid development and testing of Cordova applications
Clone or download
Pull request Compare This branch is 81 commits ahead, 1 commit behind sgrebnov:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
docs
src
.gitignore
.jshintrc
LICENSE
README.md
RELEASENOTES.md
npm-shrinkwrap.json
package.json

README.md

A browser based plugin simulation tool to aid development and testing of Cordova applications.

Note that this is currently a work in progress / prototype! It still lacks a bunch of functionality, and may be quite buggy.

It is somewhat based on Apache Ripple™, but aims to improve it in the following ways:

  1. Separates the simulation UI from the app (to improve the debugging experience, and allow for using modern browser developer tools). This also protects the UI from a misbehaving app.
  2. Allows plugins to define their own simulation UI.

Installation

npm install -g cordova-simulate

Usage

CLI

From the command line anywhere within a Cordova project, enter the following:

simulate [<platform>] [--target=<browser>] 

Where:

  • platform is any Cordova platform that has been added to your project. Defaults to browser.
  • browser is the name of the browser to launch your app in. Can be any of the following: chrome, chromium, edge, firefox, ie, opera, safari. Defaults to chrome.

API

You can also require('cordova-simulate') and launch a simulation via the API:

var simulate = require('cordova-simulate');
simulate(opts);

Where opts is an object with the following properties (all optional):

  • platform - any Cordova platform that has been added to your project. Defaults to browser.
  • target - the name of the browser to launch your app in. Can be any of the following: chrome, chromium, edge, firefox, ie, opera, safari. Defaults to chrome.
  • port - the desired port for the server to use. Defaults to 8000.
  • dir - the directory to launch from (where it should look for a Cordova project). Defaults to cwd.

What it does

Cordova simulate will launch your app in the browser, and open a second browser window displaying UI that allows you to control how plugins in your application work.

This preview version currently includes built-in support for the following Cordova plugins:

It also allows for plugins to define their own UI. To add simulation support to a plugin, follow these steps:

  1. Clone the cordova-simulate git repository (git clone https://github.com/TimBarham/cordova-simulate.git), as it contains useful example code (see src/plugins).
  2. Add your plugin UI code to your plugin in src/simulation. Follow the file naming conventions seen in the built-in plugins.