Commit b666f965 authored by Marek Ostaszewski's avatar Marek Ostaszewski

Merge branch 'tests' into 'master'

Tests

See merge request !12
parents c1584773 81568ab2
Pipeline #25044 failed with stages
in 7 minutes and 57 seconds
......@@ -5,6 +5,7 @@ before_script:
stages:
- build
- test
- deploy
build:
......@@ -29,5 +30,69 @@ deploy:
- echo "mkdir plugins-www/gsea"|sftp -P 8022 gitlab-ci@10.240.6.160
- echo "put dist/plugin.js plugins-www/gsea/"|sftp -P 8022 gitlab-ci@10.240.6.160
test:
image: tomcat:9-jdk11
stage: test
script:
- apt-get update
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- DEBIAN_FRONTEND=noninteractive apt install -y ./google-chrome-stable_current_amd64.deb
- DEBIAN_FRONTEND=noninteractive apt-get install -y maven curl unzip
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
- DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
- wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- mv chromedriver /usr/bin/chromedriver
- chown root:root /usr/bin/chromedriver
- chmod +x /usr/bin/chromedriver
- npm install
- npm run build
- mkdir /usr/local/tomcat/webapps/test
- cp dist/plugin.js /usr/local/tomcat/webapps/test/
- PLUGIN_FILE=plugin.js
- PLUGIN_MD5=($(md5sum dist/plugin.js))
- echo $PLUGIN_FILE $PLUGIN_MD5
- PLUGIN_DIR=`pwd`
- mkdir /etc/minerva/
- mkdir /etc/minerva/test
#configure database
- echo "database.driver=org.hsqldb.jdbcDriver" >>/etc/minerva/db.properties
- echo "database.dialect=org.hibernate.dialect.HSQLDialect" >>/etc/minerva/db.properties
- echo "database.uri=jdbc:hsqldb:mem:dapi" >>/etc/minerva/db.properties
- echo "database.username=sa" >>/etc/minerva/db.properties
- echo "database.password=" >>/etc/minerva/db.properties
- echo "database.connectionQuery=SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS" >>/etc/minerva/db.properties
- echo "database.pathToDataScripts=/etc/minerva/test" >>/etc/minerva/db.properties
#download test data (database and images)
- wget https://git-r3lab.uni.lu/ewa.smula/testing/raw/master/testData/generated_test_data.zip
- unzip generated_test_data.zip
- mv *.sql /etc/minerva/test
- mv map_images /usr/local/tomcat/webapps/
#fetch latest minerva (from master branch)
- cd /
- git clone -b 1016-refactor-test-framework --single-branch https://git-r3lab.uni.lu/minerva/core.git
- cd core
#build minerva and deploy it
- mvn -Dmaven.test.skip=true clean install -pl web -am
- mv web/target/*.war /usr/local/tomcat/webapps/minerva.war
- /usr/local/tomcat/bin/startup.sh
- sleep 15
- curl -X POST -d "login=admin&password=admin" --write-out %{http_code} --silent --output /dev/null -c cookie.txt http://localhost:8080/minerva/api/doLogin
- curl "http://localhost:8080/minerva/api/plugins/" --cookie cookie.txt --data "hash=$PLUGIN_MD5&url=http%3A%2F%2Flocalhost%3A8080%2Ftest%2F$PLUGIN_FILE&name=test&version=0.0.1&isPublic=false"
#run test
- cd ${PLUGIN_DIR}
- npm run test
......@@ -9,7 +9,8 @@
"build-css": "node-sass --include-path src/css src/css/styles.scss src/css/styles.css",
"build": "mkdirp dist && npm run build-css && npm run babel && browserify -t browserify-css __tmp_minerva_plugin/js/index.js | uglifyjs --compress --mangle > dist/plugin.js && npm run clean-babel",
"build-debug": "mkdirp dist && npm run build-css && npm run babel && browserify -t browserify-css __tmp_minerva_plugin/js/index.js > dist/plugin.js && npm run clean-babel",
"clean": "rimraf dist && npm run clean-babel"
"clean": "rimraf dist && npm run clean-babel",
"test": "mocha tests"
},
"author": "Marek Ostaszewski, David Hoksza",
"license": "MIT",
......
......@@ -301,10 +301,10 @@ function calculateGSEA() {
//calculate intersect
const isect = [...ovHgncNames].filter(name => mpHgncNames.has(name));
var m = mpHgncNames.size;
var k = isect.length;
var N = globals.allProteinRnaGene.length;
var n = ovHgncNames.size;
var m = mpHgncNames.size; //number of entities in the pathway (with HGNC_SYMBOL)
var k = isect.length; //number of entities in both pathway and overlay (with HGNC_SYMBOL)
var N = globals.allProteinRnaGene.length; // number of all entities (with HGNC_SYMBOL)
var n = ovHgncNames.size; //number of entities in the overlay (with HGNC_SYMBOL)
console.log('pw', pwName);
console.log('m', m);
......
......@@ -9,6 +9,7 @@ const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
// do not run in the same scope as the plugin and thus they do not have access to the Proxy. Therefore, the plugin
// exposes the proxy by attaching it as a data attribute to the main div element.
const pluginName = 'GSEA';
const pluginLabel = 'GSEA';
const minervaProxyContainerClass = pluginName + '-container';
const minervaProxyCode = `$('.${minervaProxyContainerClass}').data('minervaProxy')`;
......@@ -66,14 +67,19 @@ async function getRequest(uri) {
async function getPluginHash(){
return getRequest('http://localhost:8080/minerva/api/plugins/').then(function (pluginsResponse) {
return JSON.parse(pluginsResponse.responseText).filter(plugin => plugin.name === pluginName && plugin.isPublic)[0].hash;
let hashes = JSON.parse(pluginsResponse.responseText).filter(plugin => plugin.name === pluginLabel);
if (hashes.length === 0){
// when tested withing CI there is only one plugin, the current one and it's name is test
hashes = JSON.parse(pluginsResponse.responseText);
}
return hashes[hashes.length -1].hash;
});
}
describe('GSEA plugin', async function() {
//Some functions can take a lot of time as they need, for isntance, start MINERVA interface
this.timeout(20000);
this.timeout(40000);
let driver;
let minervaProxy;
......@@ -128,7 +134,7 @@ describe('GSEA plugin', async function() {
$('.gsea-buttons .btn-calc').click();
});
await driver.wait(until.elementLocated(By.css(`.gsea-results button`)),5000);
await driver.wait(until.elementLocated(By.css(`.gsea-results button`)));
});
let elPanelTitle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment