ElektraInitiative / PermaplanT

https://www.permaplant.net
BSD 3-Clause "New" or "Revised" License
16 stars 13 forks source link

E2E test "test_unhide_a_plant_by_changing_the_map_date" fails randomly. #1071

Closed badnames closed 11 months ago

badnames commented 11 months ago

Describe the Bug

There seems to be a timing issue because rendering PlantsLayerLeftToolbar takes too long. This might also be an indication of a performance issue with the mentioned component.

Steps to Reproduce the Problem

Run E2E tests in the CI Pipeline.

Expected Result

"test_unhide_a_plant_by_changing_the_map_date" completes successfully when the underlying functionality works correctly or fails otherwise.

Actual Result

"test_unhide_a_plant_by_changing_the_map_date" fails randomly even though the functionality underlying functionality seems to work correctly. After CI reruns using "jenkins build please" the E2E-Test may complete without issue even though the code has not changed.

PermaplanT version

master

Operating System

Linux (whichever version is used by our Jenkins servers)

Browser

Chrome (version determined by E2E test framework)

Versions of other relevant software/extensions

No response

Additional info/logs

+ make test-e2e

Error while deleting rows: could not translate host name "db" to address: Name or service not known

Traceback (most recent call last):

  File "/home/jenkins/workspace/PermaplanT_PR-1056/e2e/clean_db.py", line 49, in <module>

    delete_maps_with_sut(dbname, user, password, host, port)

  File "/home/jenkins/workspace/PermaplanT_PR-1056/e2e/clean_db.py", line 45, in delete_maps_with_sut

    if conn is not None:

UnboundLocalError: local variable 'conn' referenced before assignment

============================= test session starts ==============================

platform linux -- Python 3.10.6, pytest-7.4.3, pluggy-1.3.0

rootdir: /home/jenkins/workspace/PermaplanT_PR-1056/e2e

configfile: pytest.ini

testpaths: steps

plugins: metadata-3.0.0, playwright-0.4.3, xdist-3.4.0, html-4.1.1, sugar-0.9.7, rerunfailures-12.0, bdd-7.0.0, base-url-2.0.0

created: 6/6 workers

6 workers [28 items]

...........................F                                             [100%]

=================================== FAILURES ===================================

_________________ test_unhide_a_plant_by_changing_the_map_date _________________

[gw2] linux -- Python 3.10.6 /usr/bin/python3

fixturefunc = <function plant_appears at 0x7f77fd11f400>

request = <FixtureRequest for <Function test_unhide_a_plant_by_changing_the_map_date>>

kwargs = {'mpp': <e2e.pages.maps.planting.MapPlantingPage object at 0x7f77f7dc2110>}

    def call_fixture_func(

        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs

    ) -> FixtureValue:

        if is_generator(fixturefunc):

            fixturefunc = cast(

                Callable[..., Generator[FixtureValue, None, None]], fixturefunc

            )

            generator = fixturefunc(**kwargs)

            try:

                fixture_result = next(generator)

            except StopIteration:

                raise ValueError(f"{request.fixturename} did not yield a value") from None

            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)

            request.addfinalizer(finalizer)

        else:

            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)

>           fixture_result = fixturefunc(**kwargs)

/usr/local/lib/python3.10/dist-packages/_pytest/fixtures.py:902: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

steps/test_timeline.py:62: in plant_appears

    mpp.expect_plant_on_canvas("Tomato (Solanum lycopersicum)")

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <e2e.pages.maps.planting.MapPlantingPage object at 0x7f77f7dc2110>

plant_name = 'Tomato (Solanum lycopersicum)'

    def expect_plant_on_canvas(self, plant_name):

        """

        Confirms that the plant is on the canvas,

        by clicking in the middle of the canvas

        and looking at the left side bar for a delete button.

        """

>       expect(self._delete_plant_button).to_be_visible()

E       AssertionError: Locator expected to be visible

E       Actual value: None 

E       Call log:

E       LocatorAssertions.to_be_visible with timeout 30000ms

E       waiting for get_by_role("button", name="Delete Planting")

pages/maps/planting.py:259: AssertionError

----------------------------- Captured stdout call -----------------------------

Tour was already closed

- generated json file: /home/jenkins/workspace/PermaplanT_PR-1056/e2e/test-reports/cucumber.json -

- Generated html report: file:///home/jenkins/workspace/PermaplanT_PR-1056/e2e/test-reports/report.html -

=========================== short test summary info ============================

FAILED steps/test_timeline.py::test_unhide_a_plant_by_changing_the_map_date - AssertionError: Locator expected to be visible

Actual value: None 

Call log:

LocatorAssertions.to_be_visible with timeout 30000ms

waiting for get_by_role("button", name="Delete Planting")

=================== 1 failed, 27 passed in 153.46s (0:02:33) ===================

make: *** [Makefile:201: test-e2e] Error 1

script returned exit code 2
markus2330 commented 11 months ago

Thank you for reporting this problem! :heart:

4ydan commented 11 months ago

Thank you, #869 should hopefully fix this.

markus2330 commented 11 months ago

@4ydan is this now fixed?

4ydan commented 11 months ago

Yes, hopefully, reopen if u see this happen again. Fixed in #1010