DurhamARC / ManyFEWS

The Many Flood Early Warning System
GNU General Public License v3.0
7 stars 3 forks source link

Failed CI workflow due to package method deprecation #81

Closed sjmf closed 2 years ago

sjmf commented 2 years ago

The CI workflow https://github.com/DurhamARC/ManyFEWS/actions/runs/3038629345/jobs/4892573708 has failed with the following errors:

 ======================================================================
ERROR: test_alerts (webapp.tests.WebAppTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/share/miniconda/envs/anaconda-client-env/lib/python3.9/unittest/mock.py", line 1336, in patched
    return func(*newargs, **newkeywargs)
  File "/home/runner/work/ManyFEWS/ManyFEWS/manyfews/webapp/tests.py", line 222, in test_alerts
    self.selenium.find_element_by_tag_name("body").send_keys(Keys.END)
AttributeError: 'WebDriver' object has no attribute 'find_element_by_tag_name'

======================================================================
ERROR: test_users (webapp.tests.WebAppTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/ManyFEWS/ManyFEWS/manyfews/webapp/tests.py", line 135, in test_users
    reset_button = self.selenium.find_element_by_class_name("btn-secondary")
AttributeError: 'WebDriver' object has no attribute 'find_element_by_class_name'

----------------------------------------------------------------------

The reason for this is that the referenced methods, find_element_by_class_name and find_element_by_tag_name were deprecated and removed in Selinum v4.3.0. (see this StackOverflow post).

This is related to issue #44 (use conda-lock), as the failure would not have occurred if the package version for Selenium had been pinned.

There are two ways to address this issue: pin the version of selinum at a lower version number (e.g. 4.2.0) or update the function calls in the test code to driver.find_element("name", "q"). This is probably preferred in combination with pinning the Selinum version at the latest version.

sjmf commented 2 years ago

Fixed in commit 9fb1c05!