Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-67704

Move pendingJS checks to chained step

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Development in progress
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.4, 3.8.1, 3.9
    • Fix Version/s: None
    • Labels:
      None

      Description

      We currently do some weird things with pending js checks whereby we check too many times and can obscure failures.

      Right now we actively check for pending JS in two places:

      1. behat_hooks::before_step_javascript
      2. behat_hooks::after_step_javascript

      It's not possible to fail a step from an afterStep hook, so we also check for failures in another the I look for exceptions Step that we forcibly insert too.

      Unfortunately we got a few things wrong and this is not happening.

      What this means is that if a step is running slowly and fails the after_step_javascript hook, then it should capture that failure and display it immediately.
      Unfortunately we are also resetting the currentstepexception in the BeforeStep hook.

      As a result, it seems that what actually happens is:

      1. BeforeStep hooks are run
      2. Main step body runs
      3. We look for exceptions
      4. AfterStep hooks run including one that looks for pending JS
      5. [Repeat]

      To take a more specific example:

      1. BeforeStep hooks are run
      2. Main step body runs
      3. We look for exceptions
      4. AfterStep hooks run including one that looks for pending JS
      5. pendingJS is found. The exception is stored in self::$currentstepexception
      6. Next step starts
      7. BeforeStep hooks are run
        1. before_step_javascript wipes the current self::$currentstepexception value
        2. before_step_exception looks for JS pending again

      A couple of things can happen:

      1. The first pendingJS step fails, but the JS recovers in time for the second
      2. Both fail
      3. The first fails, but some more JS kicks off and causes the second to fail

      This also means that we could be losing some of the exception checks.

      We should move the pending JS check to be part of the Chained Step like we do for exceptions, and we should stop wiping the current exception holder in the before step hook too.

        Attachments

          Activity

            People

            Assignee:
            dobedobedoh Andrew Lyons
            Reporter:
            dobedobedoh Andrew Lyons
            Peer reviewer:
            Simey Lameze Simey Lameze
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 30 minutes
                4h 30m