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

Modify how behat selectors are loaded

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Full behat suite
      2. Run behat suite for mod/forum/tests/behat/add_forum.feature
        1. Make a note of the time
        2. Confirm passing
      3. Open lib/behat/classes/partial_named_selector.php in your editor
      4. Comment out the foreach for customselectors in the constructor
      5. Run behat suite for mod/forum/tests/behat/add_forum.feature
        1. Confirm failure
      6. Revert the patch and re-run
      7. Run behat suite for mod/forum/tests/behat/add_forum.feature
        1. Compare time - should be marginally faster with the patch
      Show
      Full behat suite Run behat suite for mod/forum/tests/behat/add_forum.feature Make a note of the time Confirm passing Open lib/behat/classes/partial_named_selector.php in your editor Comment out the foreach for customselectors in the constructor Run behat suite for mod/forum/tests/behat/add_forum.feature Confirm failure Revert the patch and re-run Run behat suite for mod/forum/tests/behat/add_forum.feature Compare time - should be marginally faster with the patch
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-55713-master-3

      Description

      At the moment we have a set of Behat selector overrides, and these are used to find things like fields, links, buttons, etc.

      Mink has it's own in-built fields, and we override some of these.
      I'd argue that the way we're doing it is currently slightly incorrect as we take the core Mink PartialNamedSelector and we add additional xpaths to it.
      I believe we'd be better off by creating a new class extending PartialNamedSelector, and replacing the core one with it.

      This offers us several benefits:

      1. we can register custom Moodle field types as actual fields - this means that things like find_field will be able to pick up field types such as the filemanager. At the moment we do not have the ability to do this so we call find_field, and when that times out, we call find_filemanager.
      2. we can make use of the replacements system build into the NamedSelector system

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16