-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests and refactoring of tests and added default user tests
- Loading branch information
Showing
16 changed files
with
509 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
#!/bin/bash | ||
|
||
SCRIPT=$(readlink -f "$0") | ||
SCRIPTPATH=$(dirname "$SCRIPT") | ||
cd $SCRIPTPATH | ||
pwd | ||
ROOT=$(dirname $(dirname $(dirname "$SCRIPTPATH"))) | ||
|
||
function waitForServer { | ||
dist=$1 | ||
echo -n "Starting $dist" | ||
# Give the server some time to start up. Look for a well-known | ||
# bit of text in the log file. Try at most 50 times before giving up. | ||
C=500 | ||
while : | ||
do | ||
grep ".* Ready to accept connections tcp" redis.log | ||
if [ $? -eq 0 ]; then | ||
echo " server started." | ||
break | ||
elif [ $C -gt 0 ]; then | ||
echo -n "." | ||
C=$((C-1)) | ||
sleep 1 | ||
else | ||
echo " timeout!" | ||
cat redis.log | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
set -o allexport | ||
extension=env_ | ||
source $ROOT/.$extension$WEBAPP_ENV | ||
set +o allexport | ||
|
||
TOOLS=$ROOT/tools | ||
|
||
redis_path=$SCRIPTPATH/redis_for_tests | ||
|
||
# install keycloak for tests if it is missing | ||
if [ ! -d "${redis_path}" ]; then | ||
$TOOLS/script/install_redis.sh -p $SCRIPTPATH -n redis_for_tests | ||
sleep 5 | ||
fi | ||
|
||
redis_for_tests/src/redis-server --port $REDIS_PORT > redis.log 2>&1 & | ||
waitForServer "Redis" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/frontend_celery/playwright/tests/default_user/specific/test_consensus_classify.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
from os import path | ||
import os | ||
import sys | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__))))) | ||
import utils | ||
import re | ||
#from playwright.sync_api import Page, expect, sync_playwright | ||
from flask import url_for | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))) | ||
import common.functions as functions | ||
import common.paths as paths | ||
import time | ||
from functools import partial | ||
from playwright.sync_api import expect | ||
import requests | ||
|
||
|
||
def test_consensus_classify(page, conn): | ||
# seed database | ||
user = utils.get_user() | ||
user_id = conn.get_user_id(user["username"]) | ||
|
||
# insert variants | ||
variant_id = conn.insert_variant(chr = "chr2", pos = "214730440", ref = "G", alt = "A", orig_chr = "chr2", orig_pos = "214730440", orig_ref = "G", orig_alt = "A", user_id = user_id) # chr2-214730440-G-A BARD1 | ||
|
||
# start the test | ||
utils.login(page, user) | ||
|
||
utils.nav(page.goto, utils.UNAUTHORIZED_STATI, url_for('variant.consensus_classify', variant_id = variant_id, _external = True)) |
38 changes: 0 additions & 38 deletions
38
src/frontend_celery/playwright/tests/default_user/test_variant_du.py
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/frontend_celery/playwright/tests/default_user/unspecific/test_classify.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from os import path | ||
import os | ||
import sys | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__))))) | ||
import utils | ||
import re | ||
#from playwright.sync_api import Page, expect, sync_playwright | ||
from flask import url_for | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))) | ||
import common.functions as functions | ||
import common.paths as paths | ||
import time | ||
from functools import partial | ||
from playwright.sync_api import expect | ||
import requests | ||
|
||
|
||
|
||
|
||
def test_user_select_all_schemes(page, conn): | ||
# seed database | ||
user = utils.get_user() | ||
user_id = conn.get_user_id(user["username"]) | ||
|
||
# insert variants | ||
variant_id = conn.insert_variant(chr = "chr2", pos = "214730440", ref = "G", alt = "A", orig_chr = "chr2", orig_pos = "214730440", orig_ref = "G", orig_alt = "A", user_id = user_id) # chr2-214730440-G-A BARD1 | ||
|
||
# start the test | ||
utils.login(page, user) | ||
|
||
utils.nav(page.goto, utils.GOOD_STATI, url_for('variant.classify', variant_id = variant_id, _external = True)) | ||
|
||
# test that all classification schemes are selectable | ||
classification_schemes = conn.get_classification_schemas() | ||
for classification_scheme_id in classification_schemes: | ||
classification_scheme_label = classification_schemes[classification_scheme_id]["description"] | ||
page.select_option('select#scheme', label=classification_scheme_label) | ||
|
||
# assert that all criteria are visible | ||
criteria = classification_schemes[classification_scheme_id]["criteria"] | ||
for criterium in criteria: | ||
expect(page.locator("#" + criterium)).to_have_count(1) |
44 changes: 44 additions & 0 deletions
44
src/frontend_celery/playwright/tests/read_only/specific/test_classify.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from os import path | ||
import os | ||
import sys | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__))))) | ||
import utils | ||
import re | ||
#from playwright.sync_api import Page, expect, sync_playwright | ||
from flask import url_for | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))) | ||
import common.functions as functions | ||
import common.paths as paths | ||
import time | ||
from functools import partial | ||
from playwright.sync_api import expect | ||
import requests | ||
|
||
|
||
|
||
|
||
def test_user_classify(page, conn): | ||
# seed database | ||
user = utils.get_user() | ||
user_id = conn.get_user_id(user["username"]) | ||
|
||
# insert variants | ||
variant_id = conn.insert_variant(chr = "chr2", pos = "214730440", ref = "G", alt = "A", orig_chr = "chr2", orig_pos = "214730440", orig_ref = "G", orig_alt = "A", user_id = user_id) # chr2-214730440-G-A BARD1 | ||
|
||
# start the test | ||
utils.login(page, user) | ||
|
||
utils.nav(page.goto, utils.UNAUTHORIZED_STATI, url_for('variant.classify', variant_id = variant_id, _external = True)) | ||
|
||
def test_consensus_classify(page, conn): | ||
# seed database | ||
user = utils.get_user() | ||
user_id = conn.get_user_id(user["username"]) | ||
|
||
# insert variants | ||
variant_id = conn.insert_variant(chr = "chr2", pos = "214730440", ref = "G", alt = "A", orig_chr = "chr2", orig_pos = "214730440", orig_ref = "G", orig_alt = "A", user_id = user_id) # chr2-214730440-G-A BARD1 | ||
|
||
# start the test | ||
utils.login(page, user) | ||
|
||
utils.nav(page.goto, utils.UNAUTHORIZED_STATI, url_for('variant.consensus_classify', variant_id = variant_id, _external = True)) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.