diff --git a/tests/requirements.txt b/tests/requirements.txt index 03d6378..f2b2ed9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -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 diff --git a/tests/scene_3d_test.py b/tests/scene_3d_test.py index ed3a5ab..cff20ad 100644 --- a/tests/scene_3d_test.py +++ b/tests/scene_3d_test.py @@ -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): diff --git a/tests/test_bibfilter.py b/tests/test_bibfilter.py index 4af8ded..9884ae5 100644 --- a/tests/test_bibfilter.py +++ b/tests/test_bibfilter.py @@ -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' \ No newline at end of file + + # 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) \ No newline at end of file