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

Behat Activity creation name matching not precise enough in non-js case

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      wip-mdl-50259
    • Workaround:
      Hide

      Add @javascript before all the test scenarios.

      Show
      Add @javascript before all the test scenarios.
    • Testing Instructions:
      1. Run behat with ~@javascript tag
      2. Modify step in "An automatic subscription forum can have discussions unsubscribed from" scenario to create "Fo" activity and make sure it fails.

      Description

      Behat lets you use the following syntax to create an activity:

      And I add a "Forum" to section "1" and I fill the form with:
      

      If the activity name in quotes is a subset of another activity name which comes before it alphabetically e.g. "Aardvark Forum" then the Behat code can create the wrong type of activity and break the tests.

      This only happens in the non-javascript code flow. Adding @javascript to the test scenario will avoid this problem.

      This can be tested with a default moodle set of modules by trying the following line in a behat test:

      And I add a "Fo" to section "1" and I fill the form with:
      

      "Fo" here matches both "Forum" and "Folder", in the non-javascript case it will create a Folder as it partially matches, and it comes first alphabetically.

      If you put @javascript before the test then the test fails (which is probably the expected behaviour) since it expects an exact text match and there is no activity type called "Fo".

        Attachments

          Activity

            People

            Assignee:
            rajeshtaneja Rajesh Taneja
            Reporter:
            bawjaws David Scotson
            Peer reviewer:
            Ankit Agarwal Ankit Agarwal
            Integrator:
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Tester:
            Jetha Chan Jetha Chan
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              6/Jul/15