A web framework for running platform tests on Cytoscape Milestone releases for interactive sanity checks via CyREST. Check out the example webapp.
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.
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.
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
"""
If you would like to contribute to the Cytoscape platform tests, please read the information below.
To setup a local server and view the reveal.js testing slides that we have created, do the following:
Install Node.js (4.0.0 or later). We use Grunt to simplify the build process
Clone the repository
$ git clone https://github.com/cytoscape/cytoscape-platform-tests-js.git
Navigate to the folder
$ cd cytoscape-platform-tests-js
Install dependencies
$ npm install
Serve the presentation and monitor source files for changes
$ npm start
or
$ grunt serve
Open http://localhost:8000 to view the slides
You can change the port by using npm start -- --port=8001
.
To build the standalone webapp, run the build command via grunt
$ grunt build
MIT licensed