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

Add more moodle-scope selectors for behat

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      No proper testing instructions but run:

      • Straight behat:

        vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/availability/tests/behat/display_availability.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/backup/util/ui/tests/behat/duplicate_activities.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/backup/util/ui/tests/behat/restore_moodle2_courses.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/course_controls.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/move_activities.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/move_sections.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/paged_course_navigation.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/mod/book/tests/behat/create_chapters.feature

      • Or if you use MDK:

        mdk behat -r -f availability/tests/behat/display_availability.feature && mdk behat -r -f backup/util/ui/tests/behat/duplicate_activities.feature && mdk behat -r -f backup/util/ui/tests/behat/restore_moodle2_courses.feature && mdk behat -r -f course/tests/behat/course_controls.feature && mdk behat -r -f course/tests/behat/move_activities.feature && mdk behat -r -f course/tests/behat/move_sections.feature && mdk behat -r -f course/tests/behat/paged_course_navigation.feature && mdk behat -r -f mod/book/tests/behat/create_chapters.feature

      and comment if it fails, so we don't have to wait for the CI server

      Show
      No proper testing instructions but run: Straight behat: vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/availability/tests/behat/display_availability.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/backup/util/ui/tests/behat/duplicate_activities.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/backup/util/ui/tests/behat/restore_moodle2_courses.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/course_controls.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/move_activities.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/move_sections.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/course/tests/behat/paged_course_navigation.feature && vendor/bin/behat --config=/home/moodle/moodles/integration_master/moodledata_behat/behat/behat.yml /home/moodle/moodles/integration_master/moodle/mod/book/tests/behat/create_chapters.feature Or if you use MDK: mdk behat -r -f availability/tests/behat/display_availability.feature && mdk behat -r -f backup/util/ui/tests/behat/duplicate_activities.feature && mdk behat -r -f backup/util/ui/tests/behat/restore_moodle2_courses.feature && mdk behat -r -f course/tests/behat/course_controls.feature && mdk behat -r -f course/tests/behat/move_activities.feature && mdk behat -r -f course/tests/behat/move_sections.feature && mdk behat -r -f course/tests/behat/paged_course_navigation.feature && mdk behat -r -f mod/book/tests/behat/create_chapters.feature and comment if it fails, so we don't have to wait for the CI server
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-44520-master
    • Sprint:
      Team '; drop tables Sprint 2
    • Issue size:
      Medium

      Description

      Some scenarios can be improved adding more selectors, I'm thinking of:

      • Course section
      • Activity (the whole activity row including all the actions related with activities)

      For example

      diff --git a/lib/behat/classes/behat_selectors.php b/lib/behat/classes/behat_selectors.php
      index d9d9246..b7d9e65 100644
      --- a/lib/behat/classes/behat_selectors.php
      +++ b/lib/behat/classes/behat_selectors.php
      @@ -41,6 +41,7 @@ class behat_selectors {
           protected static $allowedtextselectors = array(
               'dialogue' => 'dialogue',
               'block' => 'block',
      +        'section' => 'section',
               'region' => 'region',
               'table_row' => 'table_row',
               'table' => 'table',
      @@ -55,6 +56,7 @@ class behat_selectors {
           protected static $allowedselectors = array(
               'dialogue' => 'dialogue',
               'block' => 'block',
      +        'section' => 'section',
               'region' => 'region',
               'table_row' => 'table_row',
               'link' => 'link',
      @@ -88,6 +90,9 @@ XPATH
               , 'block' => <<<XPATH
       //div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', %locator%, ' '))] | //div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]/descendant::h2[normalize-space(.) = %locator
       XPATH
      +        , 'section' => <<<XPATH
      +//li[contains(concat(' ', normalize-space(@class), ' '), ' section ')][./descendant::h3[normalize-space(.) = %locator%][contains(concat(' ', normalize-space(@class), ' '), ' sectionname ')]]
      +XPATH
               , 'region' => <<<XPATH
       //*[self::div | self::section | self::aside | self::header | self::footer][./@id = %locator%]
       XPATH
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              johno John Okely
              Reporter:
              dmonllao David Monllaó
              Peer reviewer:
              David Monllaó
              Integrator:
              Dan Poltawski
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/15