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

Behat: should_not_exist function does not work correctly

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MDL-70726-master
    • Hide

      Regression tests

      1. Ensure that Behat continues to pass

      Integration tests

      1. Open admin/tool/behat/tests/behat/keyboard.feature in your editor
      2. Find the first `I click on "Log in" "link"` line
      3. After that line add:

        Then "Username" "field" should not exist
        

      4. Run the test
        1. Confirm that there is a failure because the "Username" field does exist
      Show
      Regression tests Ensure that Behat continues to pass Integration tests Open admin/tool/behat/tests/behat/keyboard.feature in your editor Find the first ` I click on "Log in" "link" ` line After that line add: Then "Username" "field" should not exist Run the test Confirm that there is a failure because the "Username" field does exist

      The function should_not_exist in lib/tests/behat/behat_general.php is not worked correctly.

      The Behat step related to this function: @Then /^"(?P<element_string>(?:[^"]|
      "))" "(?P<selector_string>[^"])" should not exist will be always passed even the element is exist.

       

      It's just a simple fix, remove the return in the try block will fix the issue.

      https://github.com/moodle/moodle/blob/7fa836cf3680c1d041daae6dd5bad4c246b5f85f/lib/tests/behat/behat_general.php#L1012

            jbthong Thong Bui
            HuongNV Huong Nguyen
            Andrew Lyons Andrew Lyons
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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