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

Behat ElementNotFoundException message wording - duplicate not found

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requirements

      • Ability to find, amend and run Behat scenario files locally.

      Testing

      1. Find a Behat scenario that makes use of the And I navigate to "..." in site administration step. 
        • For instance, there is one in admin/tests/behat/purge_caches.feature: "And I navigate to "Development > Purge caches" in site administration"
      2. Edit this .feature file and change the path to the admin page to a non-existing one (i.e. "Development > Purge cachesX").
      3. Run that edited Behat scenario. 

        mdk behat -r -n "Purge selected caches without selecting any caches"

      4. TEST: Check that the Behat error reads like
        Link "..." not found.
        and not
        Link "..." not found on the page not found.

       

      Show
      Requirements Ability to find, amend and run Behat scenario files locally. Testing Find a Behat scenario that makes use of the And I navigate to "..." in site administration step.  For instance, there is one in admin/tests/behat/purge_caches.feature: " And I navigate to "Development > Purge caches" in site administration " Edit this .feature file and change the path to the admin page to a non-existing one (i.e. "Development > Purge cachesX"). Run that edited Behat scenario.  mdk behat -r -n "Purge selected caches without selecting any caches" TEST : Check that the Behat error reads like Link "..." not found. and not Link "..." not found on the page not found.  
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull from Repository:
    • Pull 3.7 Branch:
      MDL-68048-37-behatnotfound
    • Pull 3.8 Branch:
      MDL-68048-38-behatnotfound
    • Pull Master Branch:
      MDL-68048-master-behatnotfound

      Description

      I just noticed an error message as a result of the thrown ElementNotFoundException that reads like "Page administration menu is not found not found." (note the duplicate "not found").

      This is because we throw the exception via a call like

      $exception = new ElementNotFoundException($this->getSession(), 'Page administration menu is not found');
      

      but then then Behat\Mink\Exception\ElementNotFoundException::__construct() adds its own parts to the message, including:

       $message .= ' not found.';
      

      When throwing the ElementNotFoundException exception, the type parameter should only mention the element type, not be the full sentence.

        Attachments

          Activity

            People

            Assignee:
            mudrd8mz David Mudrák (@mudrd8mz)
            Reporter:
            mudrd8mz David Mudrák (@mudrd8mz)
            Peer reviewer:
            Simey Lameze
            Integrator:
            Sara Arjona (@sarjona)
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Mar/20

                Time Tracking

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