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

Behat ElementNotFoundException message wording - duplicate not found

    XMLWordPrintable

Details

    • MOODLE_38_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-68048-master-behatnotfound
    • 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.  

    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

            mudrd8mz David Mudrák (@mudrd8mz)
            mudrd8mz David Mudrák (@mudrd8mz)
            Simey Lameze Simey Lameze
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.