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

Behat "should exist in the" step exceptions are hard to understand

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-76399-401
    • Hide
      1. Edit tag/tests/behat/edit_tag.feature
      2. Make the following change:

        -   Then "Cat" "text" should exist in the ".breadcrumb" "css_element"
        +    Then "Cat" "button" should exist in the ".breadcrumb" "css_element"
        

      3. Execute the following scenario:

        $ php admin/tool/behat/cli/run.php --name="User with tag editing capability can change tag description"
        

      4. Confirm the following is printed under "Failed steps":

        Button matching locator "Cat" in the "'.breadcrumb' css_element" not found. (Behat\Mink\Exception\ElementNotFoundException)
        

      Show
      Edit tag/tests/behat/edit_tag.feature Make the following change: - Then "Cat" "text" should exist in the ".breadcrumb" "css_element" + Then "Cat" "button" should exist in the ".breadcrumb" "css_element" Execute the following scenario: $ php admin/tool/behat/cli/run.php --name="User with tag editing capability can change tag description" Confirm the following is printed under "Failed steps": Button matching locator "Cat" in the "'.breadcrumb' css_element" not found. (Behat\Mink\Exception\ElementNotFoundException)

    Description

      Specifically this change to the message of the thrown exception, done as part of MDL-76169 leads to the following if the step fails:

      001 Scenario: Verify breadcrumbs in manage roles tab                               # /var/www/html/admin/roles/tests/behat/siteadmin_roles_breadcrumbs.feature:10
            When "Define roles" "button" should exist in the ".breadcrumb" "css_element" # /var/www/html/admin/roles/tests/behat/siteadmin_roles_breadcrumbs.feature:12
              Button matching locator "Define roles not found in the '.breadcrumb' css_element}" not found. (Behat\Mink\Exception\ElementNotFoundException)
      

      It initially caught my eye because of the stray closing curly bracket in the output, but there are also issues with trying to read that string. Odd quotation mark placement, and duplication of the "not found" content make it quite difficult to parse:

      Button matching locator "Define roles not found in the '.breadcrumb' css_element}" not found.
      

      Note I know the language is difficult to get perfect due to the structure of the placeholders in the base ElementNotFoundException class, but I think we can improve it a bit

      Attachments

        1. 311.png
          311.png
          141 kB
        2. 39.png
          39.png
          168 kB
        3. 400.png
          400.png
          141 kB
        4. 401.png
          401.png
          139 kB
        5. Master.png
          Master.png
          140 kB

        Activity

          People

            pholden Paul Holden
            pholden Paul Holden
            Mikel Martín Corrales Mikel Martín Corrales
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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

                Clockify

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