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

Behat: JS exception in few steps because page don't load JS.

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Run following feature and make sure selenium logs don't throw Exception "M is not defined".

      1. grade/export/txt/tests/behat/export.feature
      2. admin/tool/monitor/tests/behat/subscription.feature
      Show
      Run following feature and make sure selenium logs don't throw Exception "M is not defined". grade/export/txt/tests/behat/export.feature admin/tool/monitor/tests/behat/subscription.feature
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull Master Branch:
      wip-mdl-48063

      Description

      Some behat steps test pages which don't have JS.
      Before and after step behat checks for JS to be loaded via behat_hooks::wait_for_pending_js() and throw following exception.

      Caused by: org.openqa.selenium.WebDriverException: M is not defined
      Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
      System info: host: 'loganberry.local', ip: '172.20.243.233', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10', java.version: '1.7.0_40'
      Driver info: driver.version: unknown
        at <anonymous class>.anonymous(http://localhost/im_2/grade/export/txt/export.php line 68 > Function:1:1)
        at <anonymous class>.handleEvaluateEvent(http://localhost/im_2/grade/export/txt/export.php:68:11)
      14:52:23.640 WARN - Exception: M is not defined
      Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
      System info: host: 'loganberry.local', ip: '172.20.243.233', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10', java.version: '1.7.0_40'
      Driver info: driver.version: unknown
      14:52:23.660 INFO - Executing: [find elements: By.xpath: //html/descendant-or-self::*[contains(., 'B-')][count(descendant::*[contains(., 'B-')]) = 0]])
      14:52:23.667 INFO - Done: [find elements: By.xpath: //html/descendant-or-self::*[contains(., 'B-')][count(descendant::*[contains(., 'B-')]) = 0]]
      14:52:23.669 INFO - Executing: [find element: By.xpath: (//html/descendant-or-self::*[contains(., 'B-')][count(descendant::*[contains(., 'B-')]) = 0])[1]])
      14:52:23.678 INFO - Done: [find element: By.xpath: (//html/descendant-or-self::*[contains(., 'B-')][count(descendant::*[contains(., 'B-')]) = 0])[1]]
      14:52:23.679 INFO - Executing: [is displayed: 88 [[FirefoxDriver: firefox on MAC (0b6902d0-711d-1d47-9217-1acca847c877)] -> xpath: //html/descendant-or-self::*[contains(., 'Student,1')][count(descendant::*[contains(., 'Student,1')]) = 0]]])
      14:52:23.685 INFO - Done: [is displayed: 88 [[FirefoxDriver: firefox on MAC (0b6902d0-711d-1d47-9217-1acca847c877)] -> xpath: //html/descendant-or-self::*[contains(., 'Student,1')][count(descendant::*[contains(., 'Student,1')]) = 0]]]
      14:52:23.694 INFO - Executing: [find elements: By.xpath: //div[@data-rel='fatalerror'] | //div[@data-rel='debugging'] | //div[@data-rel='phpdebugmessage'] | (//*[contains(., ': call to ')])[1]])
      14:52:23.703 INFO - Done: [find elements: By.xpath: //div[@data-rel='fatalerror'] | //div[@data-rel='debugging'] | //div[@data-rel='phpdebugmessage'] | (//*[contains(., ': call to ')])[1]]
      14:52:23.707 INFO - Executing: [execute script: return (M && M.util && M.util.pending_js && !Boolean(M.util.pending_js.length)) && (document.readyState === "complete") ? "" : M.util.pending_js.join(":");, []])
      14:52:24.185 WARN - Exception thrown
      org.openqa.selenium.WebDriverException: M is not defined
      Command duration or timeout: 7 milliseconds
      Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
      System info: host: 'loganberry.local', ip: '172.20.243.233', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10', java.version: '1.7.0_40'
      Session ID: 0b6902d0-711d-1d47-9217-1acca847c877
      Driver info: org.openqa.selenium.firefox.FirefoxDriver
      Capabilities [{platform=MAC, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=32.0.3}]
        at sun.reflect.GeneratedConstructorAccessor18.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
        at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
        at sun.reflect.GeneratedMeth
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/May/15