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

Automate MDLQA-95 - A teacher can organise questions into question categories

    Details

    • Testing Instructions:
      Hide

      You will need to change the file paths below. They all require JS so you will need Selenium running.

      vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --tags @core_question

      vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --name "Move a question between categories via the question page"

      vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --name "Move a question between categories via the question settings page"

      vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --name "Delete a question category"

      Show
      You will need to change the file paths below. They all require JS so you will need Selenium running. vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --tags @core_question vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --name "Move a question between categories via the question page" vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --name "Move a question between categories via the question settings page" vendor/bin/behat --config=/home/andrew/Desktop/tempdata/moodledata/behat/behat/behat.yml --name "Delete a question category"
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-42286_behat
    • Sprint:
      FRONTEND Sprint 6
    • Sprint:
      FRONTEND Sprint 6

      Description

      As described in MDLQA-95, a teacher can organise questions into question categories

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            andyjdavis Andrew Davis added a comment -

            Trying to get some help with this. I've spent way too long on it already. https://github.com/andyjdavis/moodle/compare/master...MDL-42286_behat

            My current points of mysterious not working-ness have comments in caps next to them. Nothing below has been tested yet.

            Show
            andyjdavis Andrew Davis added a comment - Trying to get some help with this. I've spent way too long on it already. https://github.com/andyjdavis/moodle/compare/master...MDL-42286_behat My current points of mysterious not working-ness have comments in caps next to them. Nothing below has been tested yet.
            Hide
            phalacee Jason Fowler added a comment -

            #And I expand "Course administration" node #NODE EXPANSION FAILS, DONT KNOW WHY
            – Are you sure the node isn't already expanded? It was for the test I was doing on my own issue.

            And I select "New Category 1 (1)" from "category" # CANNOT FIND THE CATEGORY, DONT KNOW WHY
            – I see nothing where a category named "New Category 1 (1)" was created, only "New Category 1" and "New Category 2"

            And I click on "Select" in the "which is false?" "table_row" #UNDEFINED STEP APPARENTLY
            – should be:
            And I click on "Select" "link/button/checkbox/radio" in the "which is false?" "table_row"

            Show
            phalacee Jason Fowler added a comment - #And I expand "Course administration" node #NODE EXPANSION FAILS, DONT KNOW WHY – Are you sure the node isn't already expanded? It was for the test I was doing on my own issue. And I select "New Category 1 (1)" from "category" # CANNOT FIND THE CATEGORY, DONT KNOW WHY – I see nothing where a category named "New Category 1 (1)" was created, only "New Category 1" and "New Category 2" And I click on "Select" in the "which is false?" "table_row" #UNDEFINED STEP APPARENTLY – should be: And I click on "Select" "link/button/checkbox/radio" in the "which is false?" "table_row"
            Hide
            andyjdavis Andrew Davis added a comment - - edited

            I just skipped the node expansion.

            The "New Category 1 (1)" is because the category contains one course. I was able to resolve this by making the new categories top level categories. Previously they were sub categories and the text in the select box is indented by prepending it with a variable number of spaces which is why it wasn't matching.

            The checkbox is still an issue. I can't see anything to match on. Using the title doesn't seem to work. Both the ID and the name contain the ID from the database so I'm not sure I can predict it. If I do a css selector I can't select the row. If I select the row there is nothing to identify the input. A core code change may be required.

            <td class="checkbox">
            <input title="Select" type="checkbox" name="q7" id="checkq7" value="1">
            </td>

            Show
            andyjdavis Andrew Davis added a comment - - edited I just skipped the node expansion. The "New Category 1 (1)" is because the category contains one course. I was able to resolve this by making the new categories top level categories. Previously they were sub categories and the text in the select box is indented by prepending it with a variable number of spaces which is why it wasn't matching. The checkbox is still an issue. I can't see anything to match on. Using the title doesn't seem to work. Both the ID and the name contain the ID from the database so I'm not sure I can predict it. If I do a css selector I can't select the row. If I select the row there is nothing to identify the input. A core code change may be required. <td class="checkbox"> <input title="Select" type="checkbox" name="q7" id="checkq7" value="1"> </td>
            Hide
            andyjdavis Andrew Davis added a comment -

            I now have the checkbox in the table working with some help from David.

            I have noticed two awesome problems. One I resolved, one is still pending.

            1) If an instruction in a feature file is being reported as not being valid despite you having triple checked it go to the end of the line, press enter, retype it EXACTLY then delete the original line. It will now work.

            2) From the scenario "Move a question between categories via the question settings page"

            + And I uncheck "Use this category"
            + And I select "New Category 2" from "Save in category"

            When I do this myself unchecking that checkbox causes "Save in category" to become enabled. I can then change the value. When behat/selenium does it "Save in category" remains disabled, somehow is still able to change the value in the disabled select box however the change is not saved so I suspect was not really made (although you can see the change happen in the UI).

            Show
            andyjdavis Andrew Davis added a comment - I now have the checkbox in the table working with some help from David. I have noticed two awesome problems. One I resolved, one is still pending. 1) If an instruction in a feature file is being reported as not being valid despite you having triple checked it go to the end of the line, press enter, retype it EXACTLY then delete the original line. It will now work. 2) From the scenario "Move a question between categories via the question settings page" + And I uncheck "Use this category" + And I select "New Category 2" from "Save in category" When I do this myself unchecking that checkbox causes "Save in category" to become enabled. I can then change the value. When behat/selenium does it "Save in category" remains disabled, somehow is still able to change the value in the disabled select box however the change is not saved so I suspect was not really made (although you can see the change happen in the UI).
            Hide
            dmonllao David Monllaó added a comment -

            Hi Andrew,

            About 2) today we were talking with Rajesh about the same behaviour, probably there is a listener waiting for a onclick which is not triggered when we check checkboxes (checkboxes can also be checked using the space bar) what you can probably do to force the "Save in category" to be enabled is to replace the uncheck for a *I click on "Use this category" "checkbox". By the way, I don't know the specifics of the feature, but non of the waits should be necessary, only when waiting for AJAX responses (and even that will not be necessary after MDL-41030)

            Show
            dmonllao David Monllaó added a comment - Hi Andrew, About 2) today we were talking with Rajesh about the same behaviour, probably there is a listener waiting for a onclick which is not triggered when we check checkboxes (checkboxes can also be checked using the space bar) what you can probably do to force the "Save in category" to be enabled is to replace the uncheck for a *I click on "Use this category" "checkbox". By the way, I don't know the specifics of the feature, but non of the waits should be necessary, only when waiting for AJAX responses (and even that will not be necessary after MDL-41030 )
            Hide
            andyjdavis Andrew Davis added a comment - - edited

            Using click instead of uncheck made it work. The waits were only for debug purposes.

            Show
            andyjdavis Andrew Davis added a comment - - edited Using click instead of uncheck made it work. The waits were only for debug purposes.
            Hide
            andyjdavis Andrew Davis added a comment -

            Putting this up for peer review. I'll back port it once that is done.

            Show
            andyjdavis Andrew Davis added a comment - Putting this up for peer review. I'll back port it once that is done.
            Hide
            dmonllao David Monllaó added a comment -

            Hi Andrew,

            Looks good, only a couple of comments about it:

            Show
            dmonllao David Monllaó added a comment - Hi Andrew, Looks good, only a couple of comments about it: The commit message should include the MDLQA that is converting There are many unnecessary blank lines, comments are allowed if there is something rare to comment about, but we should try to keep the tests as much as a list of steps as possible, not like php code, as they are specification files "in theory" https://github.com/andyjdavis/moodle/compare/master...MDL-42286_behat#diff-de5a14a029422ee8642bc5e9c5a0c706R40 is there are reason to have this lines commented or can we remove them?
            Hide
            andyjdavis Andrew Davis added a comment -

            Fixed all that and added a 2.5 version. Putting this up for integration.

            Show
            andyjdavis Andrew Davis added a comment - Fixed all that and added a 2.5 version. Putting this up for integration.
            Hide
            poltawski Dan Poltawski added a comment -

            While testing this I was finding that on the big multi-editor page was not loading the editors properly for me. Then when I switched to switch completely it was working..

            I wonder if we might be hitting the limitations of the php web server..

            Show
            poltawski Dan Poltawski added a comment - While testing this I was finding that on the big multi-editor page was not loading the editors properly for me. Then when I switched to switch completely it was working.. I wonder if we might be hitting the limitations of the php web server..
            Hide
            poltawski Dan Poltawski added a comment -

            Integrated to master and 25 - thanks Andrew.

            Show
            poltawski Dan Poltawski added a comment - Integrated to master and 25 - thanks Andrew.
            Hide
            rajeshtaneja Rajesh Taneja added a comment -

            Thanks Andrew,

            Behat passed without any failure...

            Passing...

            Show
            rajeshtaneja Rajesh Taneja added a comment - Thanks Andrew, Behat passed without any failure... Passing...
            Hide
            damyon Damyon Wiese added a comment -

            Here lies 52 bugs.
            All fixed or swept under a rug.
            If they come back one day,
            To our dismay,
            We all will feel quite un-smug.

            Thanks for the reporting/fixing/testing on this issue. It has been sent upstream.

            Show
            damyon Damyon Wiese added a comment - Here lies 52 bugs. All fixed or swept under a rug. If they come back one day, To our dismay, We all will feel quite un-smug. Thanks for the reporting/fixing/testing on this issue. It has been sent upstream.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            FYI: related MDLQA-95 has been moved from MDLQA-1 to MDLQA-5249 (bag of behat-converted tests). Thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - FYI: related MDLQA-95 has been moved from MDLQA-1 to MDLQA-5249 (bag of behat-converted tests). Thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Nov/13

                  Agile