Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/gui tests #113

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions massdash/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
@click.option('--verbose', '-v', is_flag=True, help="Enables verbose mode.")
@click.option('--perf', '-t', is_flag=True, help="Enables measuring and tracking of performance.")
@click.option('--perf_output', '-o', default='MassDash_Performance_Report.txt', type=str, help="Name of the performance report file to writeout to.")
def main(verbose, perf, perf_output):
def main(verbose, perf, perf_output):
main_helper(verbose, perf, perf_output)

def main_helper(verbose, perf, perf_output):
###########################
## Logging
LOGGER.name = 'MassDashGUIMain'
Expand Down Expand Up @@ -164,4 +166,5 @@ def main(verbose, perf, perf_output):
st.sidebar.image(OPENMS_LOGO)

if __name__ == "__main__":
main()
# Note this is configured this way for tests
main_helper(False, False, 'MassDash_Performance_Report.txt')
44 changes: 44 additions & 0 deletions test/test_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from streamlit.testing.v1 import AppTest
from massdash.util import find_git_directory
from pathlib import Path
import pytest

GUI_DIR = str(find_git_directory(Path(__file__).resolve()).parent / 'massdash' / 'gui.py')

@pytest.fixture
def at():
at = AppTest(GUI_DIR, default_timeout=60)
at.session_state.clicked = {'load_toy_dataset_xic_data':False, 'load_toy_dataset_raw_data':False, 'load_toy_dataset_search_results_analysis':False}
at.session_state.workflow = None
return at

def test_welcome_screen(at):
at.run()
assert not at.exception

def test_extracted_data_example(at):
at.session_state.workflow = 'xic_data'
at.session_state.clicked['load_toy_dataset_xic_data'] = True
at.run()
assert not at.exception

def test_raw_data_example(at):
at.session_state.workflow = 'raw_data'
at.session_state.clicked['load_toy_dataset_raw_data'] = True
at.run()
assert not at.exception

def test_raw_data_im_example(at):
at.session_state.workflow = 'raw_data'
at.session_state.clicked['load_toy_dataset_raw_data_im'] = True
at.run()
assert not at.exception

# Fails currently
'''
def test_search_results_analysis_example(at):
at.session_state.workflow = 'search_results_analysis'
at.session_state.clicked['load_toy_dataset_search_results_analysis'] = True
at.run()
assert not at.exception
'''
Loading