Wunderbyte-GmbH / moodle-mod_booking

Moodle Booking Module
https://www.wunderbyte.at
21 stars 38 forks source link

Behat Test - Booking rule - write notification in intervals #467

Open georgmaisser opened 5 months ago

georgmaisser commented 5 months ago

There is a new feature for sending out mails in intervals. We need to cover this with a behat test:

This would be a typical setting.

Bildschirmfoto 2024-04-13 um 14 42 58

When, on a fully booked option, a place frees up, we trigger this rule. All users currently on the waitinglist are affected. The user on the first place of the waitinglist will get a notification right away, once cron is has run.

In the setting in the screenshot, the interval is set to 1 minute. More typical would be 60 minutes or even 1440 minutes, but for testing we go as low as possible.

After the set interval has passed, cron job will need to be executed again. now the second person on the waitinglist will receive an e-mail, but only if the place is still free (see the setting "Not fully booked". This setting will break the execution chain, if e.g. in the meantime somebody books).

To properly test, we could cover the above setting in the following cases:

georgmaisser commented 5 months ago

It will be important in behat test when testing the interval execution to wait at least 120 secs, even when interval is set to 1 minute. The new interval will not be set right away, but only when the cron executes the task. This means that there will be an additional delay, depending on how fast cron is picking up the queued task.

semteacher commented 5 months ago

@georgmaisser

  1. The following issue occurs with settings https://screenrec.com/share/ZzjTqY7OfG
  2. From my prospective possible options image conflicts with proposed scenarios image (cannot confitrm - even manual tests require of resolving of 1.)
  3. By avaialble settings - multiple behat tests will be require to cover all combinations... OR few very long and complex. In both cases - multiple 120 sec delays will be required. So testing time will become significantly longer. Tests could be created but I have doubts if it will be possible to keep it running all the times.
georgmaisser commented 4 months ago

Add 1. I noticed this, that in this form, sometimes the wrong form fields are shown, not the ones which are saved. I think this is the only issue here. change the select, then it should be the right one.

Note: I can reproduce the issue and will fix it asap. Note again: Done, as referenced below

georgmaisser commented 4 months ago

Add 2: Yes, of course the checkboxes refer to the correct setting in the select you show in the screenshot. Please make useful tests depending on the correct selection. The checkboxes I created only refer to a specific setting which was most important to us.

Ad 3: We don't need all combinations. Make only one test which uses actually tests the interval all together. The other tests should only cover part of it (eg check if the proper event/add hoc task is created etc.).