bihealth / sodar-server

SODAR: System for Omics Data Access and Retrieval
https://github.com/bihealth/sodar-server
MIT License
14 stars 3 forks source link

Sporadic UI test failures in test_stats_deleted_superuser() #1995

Closed mikkonie closed 1 month ago

mikkonie commented 2 months ago

The UI test case landingzones.tests.test_ui.TestProjectZoneView.test_stats_deleted_superuser() produces occasional failures in CI.

This is most likely just a basic test timing issue similar to ones I've fixed in the past. I'll have a look at it for v0.15.1. Alas, since it will take time to verify a fix has worked, I'm tagging this ongoing for now.

mikkonie commented 2 months ago

Dump of failure:

Traceback (most recent call last):
  File "/home/runner/work/sodar-server/sodar-server/landingzones/tests/test_ui.py", line 381, in test_stats_deleted_superuser
    zone_status = self.selenium.find_element(
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 830, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".sodar-lz-zone-status"}
  (Session info: chrome=128.0.6613.113)
mikkonie commented 2 months ago

This is a weird one, as the crash happens while attempting to access an element rendered on the server side. It's also very hard to debug in non-headless mode in dev, as this only happens very occasionally.

I added a wait for the element before the point of failure, let's see if this works.

mikkonie commented 2 months ago

Ok, so my first fix attempt didn't work.

Looking at landingzones.js, an odd thing caught my eye:

statusTd.removeClass();
statusTd.addClass(statusStyles[zoneStatus] + ' text-white');

This looks like we remove all classes including sodar-lz-zone-status, but then we don't re-add it once we update the status value. This could explain the test failing, if we hit the selenium check after the point of the first update when the class has been removed.

I'll fix this and see if it helps.

mikkonie commented 2 months ago

Fix added, I'll keep this ticket open until I've observed the test failures to have stopped.

mikkonie commented 1 month ago

I have not witnessed these failures anymore since the recent fixes. Hence, I consider this closed.