Skip to content
Merged
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
4 changes: 2 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# Pin down pytest
pytest==7.4.4
dash[dev,testing]>=1.3.1
chromedriver-binary==80.0.3987.106.0
# chromedriver-binary==80.0.3987.106.0
pytest-mock==3.2.0
flaky==3.7.0
pytest-sugar==0.9.4
pytest-sugar>=1.0.0

31 changes: 18 additions & 13 deletions tests/scene_3d_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,26 +213,31 @@ def test_color_rendering(self):

def test_scene_switcher(self):
# check if adding a new scene clean the old one
dropdown = self.dash_duo.find_element('#demo-dropdown input', timeout=10)
dropdown.send_keys('Scene2')
dropdown.send_keys(Keys.ENTER)
time.sleep(1)
# dropdown = self.dash_duo.find_element('#demo-dropdown input')
# dropdown = self.dash_duo.wait_for_element('#demo-dropdown', timeout=10)
# dropdown.send_keys('Scene2')
# dropdown.send_keys(Keys.ENTER)
# time.sleep(1)
self.dash_duo.select_dcc_dropdown('#demo-dropdown', value='Scene2')
# but there are 2 visible spheres, try to understand the path :/
self.scene.check_path(1)
dropdown.send_keys('Scene1')
dropdown.send_keys(Keys.ENTER)
time.sleep(1)
# dropdown.send_keys('Scene1')
# dropdown.send_keys(Keys.ENTER)
# time.sleep(1)
self.dash_duo.select_dcc_dropdown('#demo-dropdown', value='Scene1')
self.scene.check_path(7)
# this will add new elements, as the name of the scene is different
dropdown.send_keys('Scene3')
dropdown.send_keys(Keys.ENTER)
time.sleep(1)
# dropdown.send_keys('Scene3')
# dropdown.send_keys(Keys.ENTER)
# time.sleep(1)
self.dash_duo.select_dcc_dropdown('#demo-dropdown', value='Scene3')
# investigate... this seems fine with webgl and
self.scene.check_path(343)
# test incorrect scene
dropdown.send_keys('Scene4')
dropdown.send_keys(Keys.ENTER)
time.sleep(1)
# dropdown.send_keys('Scene4')
# dropdown.send_keys(Keys.ENTER)
# time.sleep(1)
self.dash_duo.select_dcc_dropdown('#demo-dropdown', value='Sceneˋ')
self.scene.check_path(343)

# def test_camera_state(self):
Expand Down
11 changes: 9 additions & 2 deletions tests/test_bibfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,12 @@ def test_bibfilter(dash_duo):
dash_duo.find_element('.mpc-bib-filter-input').clear()
assert len(dash_duo.find_elements('.mpc-bib-card')) == 2
dash_duo.find_element('.mpc-sort-button').click()
first_result = dash_duo.find_elements('.mpc-bib-card')[0]
assert first_result.find_element_by_css_selector('.mpc-publication-button').text == 'Physical Review X, 2015'

# leave the old testing code here:
# problem: the test become flacky when there is race condition between Python script and DOM
# first_result = dash_duo.find_elements('.mpc-bib-card')[0]
# first_result = dash_duo.find_element('.mpc-bib-card .mpc-publication-button').text
# assert first_result == 'Physical Review X, 2015'

selector = ".mpc-bib-card:nth-of-type(1) .mpc-publication-button"
dash_duo.wait_for_text_to_equal(selector, 'Physical Review X, 2015', timeout=10)