Skip to content
Snippets Groups Projects
Commit 53378b70 authored by David Hoksza's avatar David Hoksza
Browse files

tests + ci

parent ba7ae4cf
No related branches found
No related tags found
No related merge requests found
Pipeline #24602 failed
......@@ -5,6 +5,7 @@ before_script:
stages:
- build
- test
- deploy
build:
......@@ -30,3 +31,69 @@ deploy:
- echo "mkdir plugins-www/disease-associations" | sftp -P 8022 gitlab-ci@10.240.6.160
- echo "put dist/plugin.js plugins-www/disease-associations/" | 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
......@@ -117,7 +117,7 @@ describe("disease-association plugin", async function() {
await driver.wait(until.elementLocated(By.css(`.disease-input-group .input-disease`)),5000);
});
describe("Parkinson's disease", function () {
describe("Parkinson's disease by EFO", function () {
before(async function () {
const input = driver.findElement(By.css('.disease-input-group .input-disease'));
input.sendKeys('parkinson');
......@@ -205,12 +205,38 @@ describe("disease-association plugin", async function() {
assert.equal(cnt, 2);
});
});
})
});
})
describe("Parkinson's disease by OMIM", function () {
before(async function () {
await driver.executeScript(function(){
$('.disease-input-group input.omim').click();
});
await wait(500);
await driver.executeScript(function(){
$('.disease-input-group .input-disease').val('');
});
await wait(100);
driver.findElement(By.css('.disease-input-group .input-disease')).sendKeys('168601');
await wait(500);
driver.executeScript(function () {
$('.disease-associations-container button.btn-search').click();
});
await driver.wait(until.elementLocated(By.css('.associations-content .bootstrap-table td')), 10000);
await wait(500);
});
describe("variation", function () {
it("should have SNCA associated", async function () {
const cnt = await driver.executeScript(function () {
return $('table.variation-table td:contains("SNCA")').length
});
assert.equal(cnt, 1);
});
});
});
after(async function finishWebDriver() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment