Wunderbyte-GmbH / moodle-local_shopping_cart

Other
4 stars 6 forks source link

User credits persists in behat test (potential cache issue) #76

Closed semteacher closed 3 months ago

semteacher commented 5 months ago

The following issue registered for the behat tests:

Image

Image

Analysis show that it caused by:

Image

at this step balance == remainingcredit == 0 but once we tried to set data

Image

by getting data from cache - remainingcredits has been restored to previous value I have tried to fix this way

Image

but it does not work for some reasons...

Potential problem - it could "renew" credits for the same user after being paid back.

Manually I was unable reproduce that case. But I still worried if I missed something during manual tests...

by now - 5 behat tests fails at 1st run because of above issue but than all passed OK during 2nd run...

Image

Temporary decisioin by @georgmaisser: "leave it for now. It's a reminder that we should look into this once again."

PS: I have created a custom step to reset credits cache It works OK and no behat error. But it destroy credit cache explicitly and in test only... So - original issue not solved yet.

semteacher commented 3 months ago

General workflow improved in https://github.com/Wunderbyte-GmbH/moodle-local_shopping_cart/commit/af6f7b888270203f27e250c0211e2a4917e7f3f1 But in case of Behat tests special "remedy" required at the end of the last test which use credits

    ## Force credits to 0 to avoid potential issues in other tests
    And the following "local_shopping_cart > user credits" exist:
      | user  | credit | currency |
      | user1 | 0     | EUR      |
    And I log out