-
Notifications
You must be signed in to change notification settings - Fork 20
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
[WIP] Unit Test for dashboard #672
Conversation
Contributes to unit testing by applying a UI component to exit the dialog box and allowing selenium to continue testing the application
Initially these were added to convert user input to the correct type in order to be compatible with simulation. However, upon commenting these out for the sake of unit testing compatibility, it was found that the simulation is still functional with user inputs and does not need any conversion of user values. There is potential for underlying problems that have yet to be found.
script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
working_directory = os.path.join(script_dir, "../../../src/python/impactx") | ||
working_directory = os.path.normpath(working_directory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to generalize this so it:
- runs in CTests from the build directory
- runs when copied in a package manager with external installs
tests/python/dashboard/util.py
Outdated
working_directory = os.path.normpath(working_directory) | ||
|
||
return subprocess.Popen( | ||
["python", "-m", "dashboard"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run this locally, this literally opens a browser window for me.
Is there a way to run this headless?
Mark the test as skipped if `seleniumbase` is not available.
# Check if "Simulation complete" message is printed | ||
xterm_content = sb.get_text("#xterm_component") | ||
assert "Simulation complete." in xterm_content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently buggy and offering flaky results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternative method implemented by having unit test interact with phase space projections, which indirectly mean simulation ran properly.
time.sleep(10) | ||
|
||
try: | ||
with SB() as sb: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying if this prevents that the unit test on Linux/macOS opens a browser:
with SB() as sb: | |
with SB(headless=True) as sb: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indirectly assures user that sim ran successfully.
for more information, see https://pre-commit.ci
changed hardcoded 'python' command to 'sys.executable' and also initialized app_process
Adjusted function to retry upon failure until timeout has reached max time.
for more information, see https://pre-commit.ci
Continued in #706 |
This PR introduces the first unit test for the ImpactX dashboard, leveraging the SeleniumBase library to simulate a simulation run by a user with the GUI.
Key Features
Issues
Dependency on Running Dashboard:The current implementation requires the ImpactX dashboard to run in a separate terminal before executing the test viapytest
.Can investigate to potentially have dashboard be launched within the test itself.Unit test is flaky with passing/failing, unsure if this is due to code error or error in pytest implementation. Need to investigate. Started occurring after the implementation of subprocess.Checklist
Resolves #667