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

Strange behavior inserting images with browser not having the focus

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_28_STABLE

      Description

      While running acceptance tests along the past weeks I've seen this exact feature failing randomly:

      "In a lesson activity, teacher can add embedded images in questions answers and responses"
      (mod/lesson/tests/behat/questions_images.feature)

      So I did a bunch of runs, with firefox, getting the randomness in action. To see what was happening I added a "And I wait "300" seconds" step at #55 (after the "And I click on "Save image" "button" step).

      And, after some runs I was able to 100% relate the pass/failures with the fact of the browser being the frontmost application (having the focus) or not having it.

      Here there are some screenshots taken while running the "wait" I introduced artificially. Quite interesting.

      focus.png : Image properly inserted in the editor. Passes.
      unfocus.png: Image not inserted in the editor. Fails.
      unfocus_wow.png: Do you bet where the image ended? Unbelievable

      (tested with Firefox Mac & Moodle 2.8rc2)

      This is the cli output both passing and failing (to find the image):

      stronk7@~/git_moodle/testing (master %>)$ vendor/bin/behat --config /Users/stronk7/Sites/moodle_data_gittesting/master/mariadb_behat/behat/behat.yml --rerun="/tmp/rerun.log"
      Moodle 2.8rc1 (Build: 20141104), mariadb, f2e5a435a6eca7429a46390b7f133e24f645ce62
      Server OS "Darwin", Browser: "firefox"
      Started at 07-11-2014, 20:40
      ..................................................................
       
      1 escenario (1 exitosos)
      66 pasos (66 exitosos)
      1m13.874s
       
       
      stronk7@~/git_moodle/testing (master %>)$ vendor/bin/behat --config /Users/stronk7/Sites/moodle_data_gittesting/master/mariadb_behat/behat/behat.yml --rerun="/tmp/rerun.log"
      Moodle 2.8rc1 (Build: 20141104), mariadb, f2e5a435a6eca7429a46390b7f133e24f645ce62
      Server OS "Darwin", Browser: "firefox"
      Started at 07-11-2014, 20:41
      ..................................................F---------------
       
      (::) Pasos fallidos (::)
       
      01. Xpath matching locator "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" not found.
          In step `And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist'. # behat_general::should_exist()
          From scenario `questions with images in answers and responses'.                                                            # /Users/stronk7/git_moodle/testing/mod/lesson/tests/behat/questions_images.feature:7
          Of feature `In a lesson activity, teacher can add embedded images in questions answers and responses'.                     # /Users/stronk7/git_moodle/testing/mod/lesson/tests/behat/questions_images.feature
       
      1 escenario (1 fallidos)
      66 pasos (50 exitosos, 15 omitidos, 1 fallidos)
      1m8.082s
      

        Attachments

        1. focus.png
          focus.png
          111 kB
        2. unfocus_wow.png
          unfocus_wow.png
          162 kB
        3. unfocus.png
          unfocus.png
          101 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Mihail Geshoski, Peter Dias
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: