Swen670Grp1 / cytoscape-platform-tests-js

Reveal.js testing webapp for running platform tests on Cytoscape via CyREST calls
http://chianti.ucsd.edu/~bsettle/cytoscape_platform_test
MIT License
0 stars 0 forks source link

Cytoscape Platform Testing in Javascript

A web framework for running platform tests on Cytoscape Milestone releases for interactive sanity checks via CyREST. Check out the example webapp.

NOTE: If you are using a browser other than Chrome, there may be issues communicating with Cytoscape CyREST

The webapp was created as a set of reveal.js slides and tested via the Jasmine testing framework but can be implemented in any script or application.

Table of contents

Motivation

Cytoscape is intended to operate across multiple platforms (Windows, Mac, Linux, etc). On occasion, Cytoscape will exhibit unexpected behaviours on these platforms, due to differing file locations, UI implementations, installed Java versions, etc. Testing for these behaviours is a tedious process involving performing many Cytoscape tasks in the UI directly. We intend to automate this as much as possible to reduce the time involved for an individual tester to test a particular platform and configuration.

API

The CyCaller class resides in js/cycaller.js and acts as the main communicator with Cytoscape. All calls to CyREST are made via a CyCaller instance. Here is a simple script for using CyCaller:

const caller = new CyCaller()

# Clear the session
cyCaller.delete('/v1/session')

# Open a CX file
const url = 'http://chianti.ucsd.edu/~bsettle/galFiltered.cx'
cyCaller.load_file_from_url(url, function (suid) {
  console.log("SUID is " + suid")
  cyCaller.get('/v1/apply/layouts/circular/' + suid, function(){
    console.log("Layout applied")
  })
})

CyCaller currently provides the following functions:


request (method, url, data, callback)
""" Send an XMLHTTPRequest as described by the _execute method
"""

_execute (http_method, endpoint, data, callback)
""" Internal HTTP request builder which propagates parameters to the request method
"""

post (endpoint, data, callback = console.log)
""" Execute an HTTP POST request to the given endpoint. This calls _execute with http_method="POST"
"""

put (endpoint, data, callback = console.log)
""" Execute an HTTP PUT request to the given endpoint. This calls _execute with http_method="PUT"
"""

get (endpoint, callback = console.log)
""" Execute an HTTP GET request to the given endpoint. This calls _execute with http_method="GET"
"""

delete (endpoint, data, callback = console.log)
""" Execute an HTTP DELETE request to the given endpoint. This calls _execute with http_method="DELETE"
"""

load_file_from_url (url, callback)
""" Load a network file from a URL. Currently only supports CX files
"""

get_network_suid (callback)
""" Fetch the SUID of the currently selected subnetwork and pass it to the callback
"""

Developer Instructions

If you would like to contribute to the Cytoscape platform tests, please read the information below.

Full setup

To setup a local server and view the reveal.js testing slides that we have created, do the following:

  1. Install Node.js (4.0.0 or later). We use Grunt to simplify the build process

  2. Clone the repository

    $ git clone https://github.com/cytoscape/cytoscape-platform-tests-js.git
  3. Navigate to the folder

    $ cd cytoscape-platform-tests-js
  4. Install dependencies

    $ npm install
  5. Serve the presentation and monitor source files for changes

    $ npm start

    or

    $ grunt serve
  6. Open http://localhost:8000 to view the slides

    You can change the port by using npm start -- --port=8001.

  7. To build the standalone webapp, run the build command via grunt

    $ grunt build

Folder Structure

Issues

License

MIT licensed