-
Notifications
You must be signed in to change notification settings - Fork 211
Zn draw tester #5140
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
Closed
Closed
Zn draw tester #5140
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b9e71a5
Bug fixes
ludogibbs 140f410
Testing ZnDraw Interface
ludogibbs 2dc6c44
Merge branch 'espressomd:python' into znDraw_tester
ludogibbs 27e9e9a
Update zn_interface.py
ludogibbs 6ea5ee4
Update zn_interface.py
ludogibbs 3fe39ae
Update zn.py
ludogibbs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,58 @@ | ||
| import unittest | ||
| import time | ||
| import espressomd.zn | ||
| from selenium import webdriver | ||
| from selenium.webdriver.common.by import By | ||
|
|
||
| system = espressomd.System(box_l=[1] * 3) | ||
| vis = espressomd.zn.Visualizer(system) | ||
| url = vis.address | ||
|
|
||
| # Default Methods | ||
| method_list = [['ConnectedParticles', 'NoneSelection', 'All', 'Invert', 'Range', 'Random', 'IdenticalSpecies', 'Neighbour'], | ||
| ['Delete', 'Rotate', 'Translate', 'Duplicate', 'ChangeType', 'AddLineParticles', | ||
| 'Wrap', 'Center', 'Replicate', 'Connect', 'NewCanvas', 'RemoveAtoms'], | ||
| ['Plane', 'Sphere', 'Box', 'Circle', 'Cone', 'Cylinder', 'Dodecahedron', 'Icosahedron', | ||
| 'Octahedron', 'Ring', 'Tetrahedron', 'Torus', 'TorusKnot', 'Rhomboid', 'Ellipsoid'], | ||
| ['Properties1D', 'DihedralAngle', 'Distance', 'Properties2D']] | ||
|
|
||
|
|
||
| def s(t=1): | ||
| time.sleep(t) | ||
|
|
||
|
|
||
| class RegisterTestCase(unittest.TestCase): | ||
| def setUp(self): | ||
| chrome_options = webdriver.ChromeOptions() | ||
| chrome_options.add_argument("headless") | ||
| self.driver = webdriver.Chrome(options=chrome_options) | ||
| self.driver.get(url) | ||
|
|
||
| def tearDown(self): | ||
| self.driver.quit() | ||
|
|
||
| def test_register(self): | ||
| next_option_names = [] | ||
| idx = 0 | ||
| driver = self.driver | ||
| buttons = driver.find_elements( | ||
| By.XPATH, '//button[@class="btn btn-outline-tertiary"]') | ||
| for button in buttons: | ||
| button.click() | ||
| s(t=0.1) | ||
| elements = driver.find_elements(By.ID, "root[method]switcher") | ||
| j = len(elements) - 1 | ||
| options = [x for x in elements[j].find_elements( | ||
| By.TAG_NAME, "option")] | ||
| option_names = [x.get_attribute("value") for x in options] | ||
| if option_names == next_option_names: | ||
| continue | ||
| else: | ||
| assert option_names == method_list[idx], f"Difference: { | ||
| set(option_names) ^ set(method_list[idx])}" | ||
| idx += 1 | ||
| next_option_names = option_names | ||
|
Comment on lines
+34
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a good chance this will break for future versions of ZnDraw for several reasons
Are there any ZnDraw extensions currently used by Espresso or within any tutorial? |
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'd recommend not using internal zndraw modules and use
from zndraw import ZnDraw.