MDL-63399 behat: update existing tests to use the better download steps

Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
This commit is contained in:
Simey Lameze 2024-07-04 13:43:27 +01:00
parent 5e4fd26115
commit 3ac7a2f6c5
21 changed files with 83 additions and 34 deletions

View File

@ -5,16 +5,18 @@ Feature: I can download a preset
| name |
| Custom preset |
@javascript
Scenario: Custom preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Custom preset" "table_row"
Then following "Download" "link" in the "Custom preset" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Custom preset" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Custom preset |
@javascript
Scenario: Core preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Starter" "table_row"
Then following "Download" "link" in the "Starter" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Starter" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Starter |

View File

@ -55,7 +55,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
@ -90,7 +91,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Export all of my personal data" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
@ -128,7 +130,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "200000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
@ -187,7 +190,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "172000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
@ -231,7 +235,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "180000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
@javascript
Scenario: Filter before export data for a user and download it in the view request action
@ -264,4 +269,5 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "180000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |

View File

@ -148,7 +148,8 @@ Feature: Manage analytics models
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
And I choose "Export" in the open action menu
And I click on "Actions" "link" in the "Students at risk of not meeting the course completion conditions" "table_row"
And following "Export" should download between "100" and "500" bytes
And following "Export" should download a file that:
| Contains file in zip | model-config.json |
Scenario: Check invalid site elements
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"

View File

@ -291,7 +291,6 @@ Feature: Users can view and manage data presets
And I should see "This is a short text"
Then "Use this preset" "button" should exist
@javascript
Scenario: Teachers can export any saved preset
Given I am on the "Mountain landscapes" "data activity" page logged in as teacher1
When I follow "Presets"
@ -300,10 +299,12 @@ Feature: Users can view and manage data presets
# The teacher should be able to export any saved preset.
And I open the action menu in "Saved preset by teacher1" "table_row"
Then I should see "Export"
And following "Export" "link" in the "Saved preset by teacher1" "table_row" should download between "1" and "5000" bytes
And following "Export" in the "Saved preset by teacher1" "table_row" should download a file that:
| Contains file in zip | preset.xml |
And I open the action menu in "Saved preset 1" "table_row"
And I should see "Export"
And following "Export" "link" in the "Saved preset 1" "table_row" should download between "1" and "5000" bytes
And following "Export" in the "Saved preset 1" "table_row" should download a file that:
| Contains file in zip | preset.xml |
@javascript @_file_upload
Scenario Outline: Admins and Teachers can load a preset from a file

View File

@ -36,5 +36,8 @@ Feature: Files added in folder activity are visible in the recent activity block
And "//img[@alt='empty.txt']" "xpath_element" should exist
And "//img[contains(@src, 'preview=tinyicon')]" "xpath_element" should exist
# Confirm files are downloadable
And following "empty.txt" should download between "1" and "3000" bytes
And following "gd-logo.png" should download between "1" and "3000" bytes
And following "empty.txt" should download a file that:
| Has mimetype | text/plain |
| Contains text | empty file for testing purposes |
And following "gd-logo.png" should download a file that:
| Has mimetype | image/png |

View File

@ -44,5 +44,6 @@ Feature: Create a glossary entry.
# Confirm you can download attachment from student's entry as teacher
When I am on the "Test glossary" "glossary activity" page logged in as teacher1
Then I should see "Entry 1"
And I should see "musicians.xml"
And following "musicians.xml" should download between "1" and "3000" bytes
And following "musicians.xml" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Paul McCartney |

View File

@ -26,7 +26,9 @@ Feature: Test exporting questions using Aiken format.
When I am on the "Course 1" "core_question > course question export" page logged in as "teacher1"
And I set the field "id_format_aiken" to "1"
When I press "Export questions to file"
Then following "click here" should download between "68" and "70" bytes
Then following "click here" should download a file that:
| Has mimetype | text/plain |
| Contains text | Which is the oddest number? |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -31,7 +31,9 @@ Feature: Test importing questions from GIFT format.
And I am on the "Course 1" "core_question > course question export" page
And I set the field "id_format_gift" to "1"
And I press "Export questions to file"
And following "click here" should download between "1500" and "1800" bytes
And following "click here" should download a file that:
| Has mimetype | text/plain |
| Contains text | What's between orange and green in the spectrum? |
@javascript @_file_upload
Scenario: import a GIFT file which specifies the category

View File

@ -34,7 +34,10 @@ Feature: Test importing questions from Moodle XML format.
And I set the field "id_format_xml" to "1"
And I set the field "Export category" to "TrueFalse"
And I press "Export questions to file"
Then following "click here" should download between "17042" and "18874" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Moodle acronym (True) |
| Contains text in xml element | Moodle acronym (False) |
@javascript @_file_upload
Scenario: import some multiple choice questions from Moodle XML format

View File

@ -26,7 +26,9 @@ Feature: Test exporting drag and drop onto image questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "18500" and "24864" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Drag onto image |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -26,7 +26,9 @@ Feature: Test exporting drag and drop markers questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "233700" and "233950" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Drag markers |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -26,7 +26,9 @@ Feature: Test exporting drag and drop into text questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
And following "click here" should download between "1550" and "1700" bytes
And following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Drag to text |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -25,7 +25,9 @@ Feature: Test exporting Description questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "650" and "900" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | description-001 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -27,7 +27,11 @@ Feature: Test exporting Essay questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "3000" and "3500" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | essay-001 |
| Contains text in xml element | essay-002 |
| Contains text in xml element | essay-003 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -32,7 +32,9 @@ Feature: Import and export select missing words questions
And I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
And following "click here" should download between "1650" and "1800" bytes
And following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Select missing words 001 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -25,7 +25,9 @@ Feature: Test exporting Matching questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1600" and "1750" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | matching-001 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -26,7 +26,10 @@ Feature: Test exporting Multiple choice questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "3900" and "4100" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Multi-choice-001 |
| Contains text in xml element | Multi-choice-002 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -26,7 +26,10 @@ Feature: Test exporting Numerical questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "3650" and "3750" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Numerical-001 |
| Contains text in xml element | Numerical-002 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -21,11 +21,13 @@ Feature: Test exporting Ordering questions
| questioncategory | qtype | name | template |
| Test questions | ordering | Moodle | moodle |
Scenario: Export a Matching question
Scenario: Export a ordering question
When I am on the "Course 1" "core_question > course question export" page logged in as teacher1
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1700" and "2350" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Moodle |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -25,7 +25,9 @@ Feature: Test exporting Short answer questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1200" and "1450" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | shortanswer-001 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout

View File

@ -25,7 +25,9 @@ Feature: Test exporting True/False questions
When I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1000" and "1200" bytes
Then following "click here" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | true-false-001 |
# If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout