Compare commits

..

39 Commits

Author SHA1 Message Date
Jun Pataleta a2fe75a270 Moodle release 3.9.9 2021-07-29 10:01:07 +08:00
Ilya Tregubov 6b632fef09 weekly release 3.9.8+ 2021-07-28 16:48:25 +02:00
Ilya Tregubov bc3e140d8b Merge branch 'install_39_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_39_STABLE 2021-07-28 16:48:25 +02:00
Jun Pataleta b53f12d8c9 Merge branch 'MDL-72203-39' of git://github.com/mickhawkins/moodle into MOODLE_39_STABLE 2021-07-28 11:27:48 +08:00
AMOS bot f9c700eb9f Automatically generated installer lang files 2021-07-28 00:07:44 +00:00
Michael Hawkins 0d3495e6b2 MDL-72203 curl: Improve redirect unit testing and update upgrade.txt
lib/upgrade.txt was updated to reflect the fact that all cURL redirects
will be emulated.
2021-07-27 23:27:02 +08:00
David Mudrák 72eac30148 MDL-72203 curl: Remove duplicate unit tests for emulated redirects
Before, we had each redirect test duplicated: one for the native
redirects via native cURL, second for our emulated implementation. Now
all redirects are always emulated so there is no need to have them
tested twice.
2021-07-27 23:22:21 +08:00
David Mudrák e19f451723 MDL-72203 curl: Check each URL in redirect chain to see if it is blocked
The security problem here was that only the first and the last URL in
the redirect chain was checked by the security helper. This patch forces
the curl wrapper to always emulate cURL redirects and check every
redirect URL in the chain before actually visiting it.
2021-07-27 23:22:21 +08:00
David Mudrák db0073291b MDL-72203 curl: Warn if someone actually started to use $maxredirects
The new parameter of curl_security_helper::url_is_blocked() introduced
in MDL-71916 became part of the API. Even if we reverted it quickly,
someone can use a released Moodle version that has that parameter in
place. For that reason and also to avoid potential troubles in the
future (e.g. when yet another argument would be added to this method),
we need to make it clear that the second parameter of this method should
never be used again.

Poor $maxredirects, you did not live long with us. Oh well.
2021-07-27 23:22:21 +08:00
David Mudrák 984e3fc510 MDL-72203 curl: Revert original fix of redirects to blocked URLs
This reverts the original fix introduced in MDL-71916. It introduced an
extra native cURL call inside curl_security_helper to check if the given
URL triggers a redirect to a blocked URL or not.

Shortly after the release, a couple of regressions were reported as a
result of the integrated solution. It was agreed to revert the fix and
progress with implementing an alternative approach.
2021-07-27 23:22:21 +08:00
Ilya Tregubov 698142b1f5 Merge branch 'MDL-72179-39' of git://github.com/andrewnicols/moodle into MOODLE_39_STABLE 2021-07-27 12:39:02 +02:00
Andrew Nicols 8669b0ebb7 MDL-72179 behat: Make use of page resolvers 2021-07-24 18:56:38 +08:00
Andrew Nicols 2204ea8afe MDL-72179 behat: Add page resolvers for activity roles/perms 2021-07-23 20:44:26 +08:00
Andrew Nicols 142e12bee7 MDL-72179 behat: Add page resolver for activity names 2021-07-23 20:32:44 +08:00
Andrew Nicols 2bdebbf6e7 MDL-72179 behat: Add activity editing page resolution 2021-07-23 20:32:15 +08:00
Andrew Nicols f47ec5d0a9 MDL-72179 behat: Fix page resolvers to remove ambiguity
The simple pattern matches were conflicting in some situations. To make
this backwards compatable we need to convert it to a Regex pattern match
instead, and provide the quoted and unquoted variants.
2021-07-23 20:31:45 +08:00
Andrew Nicols 52da2d6eaa MDL-72179 behat: Correct course category page resolving
There were two issues here:
* I am on the [categoryname] category page page (duplicated page)
* the wrong URL was being used

Since an incorrect URL was used I felt it safe to rename the step from
'category page page' to 'category page'.
2021-07-23 20:28:15 +08:00
Andrew Nicols 78b0f6e204 MDL-72179 behat: Lowercase all page instance resolvers 2021-07-23 20:28:14 +08:00
Andrew Nicols 7030fa5972 MDL-72179 behat: Improve core page resolvers
This commit makes the following improvements to core page resolverss:
* allows for mixed case naming (course, Course, etc.)
* allows fields other than the idnumber to be specified:
** course: idnumber, shortname, fullname
** course category: idnumber, name

Whilst some of these fields are not unique, they will typically be
unique in most test scenarios. Where they are not then the idnumber
should be used in preference.
2021-07-23 20:28:10 +08:00
Ilya Tregubov 2bd53efc1b weekly release 3.9.8+ 2021-07-23 11:31:05 +02:00
Ilya Tregubov 9ccb3a2af9 Merge branch 'install_39_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_39_STABLE 2021-07-23 11:31:04 +02:00
AMOS bot 3354f46fd6 Automatically generated installer lang files 2021-07-22 00:07:52 +00:00
Ilya Tregubov 9fb1e3d300 Merge branch 'MDL-72125-39' of git://github.com/andrewnicols/moodle into MOODLE_39_STABLE 2021-07-21 08:02:52 +02:00
Andrew Nicols e4b11bf852 MDL-72125 mod_assign: Use assign submission data generators 2021-07-21 07:37:59 +08:00
Andrew Nicols 28cf3f9119 MDL-72125 mod_assign: Add data generator for assign submissions 2021-07-20 21:38:47 +08:00
Andrew Nicols 1a885a1756 MDL-72125 testing: Make global $CFG available when including generators
This will remove the requirement to add the global $CFG call to the top
of generator scripts.
2021-07-20 21:38:47 +08:00
Andrew Nicols 753035e090 MDL-72125 behat: Add get_activity_id() behat generators helper 2021-07-20 21:38:46 +08:00
Andrew Nicols cb98541563 MDL-72125 testing: Set a default idnumber when creating activities
The activity generator currently requires an idnumber when creating
activities, but this is not a requirement when creating the same
activity through the UI. The requirement comes because we want to
provide a way to refer to activities in subsequent steps.

This commit modifies the behaviour such that the generator uses the name
of the activity as the default idnumber.

This has two  main benefits:
1. it simplfies generation of activities; and
2. it makes the language used when writing behat tests much more natural.

With this change, steps will refer to the activity by its idnumber/title
in all cases, rather than sometimes by an idnumber which bears no
relevance to the title.
2021-07-20 21:38:46 +08:00
Andrew Nicols 2729301721 MDL-72125 testing: Add helper to run generators as a user 2021-07-20 21:38:46 +08:00
abgreeve 54a2d7df22 weekly release 3.9.8+ 2021-07-16 10:16:44 +08:00
abgreeve 59f97a627f Merge branch 'install_39_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_39_STABLE 2021-07-16 10:16:43 +08:00
AMOS bot 362c67f84d Automatically generated installer lang files 2021-07-16 00:07:46 +00:00
Eloy Lafuente (stronk7) cbe5ec5a51 Merge branch 'MDL-72139-39' of git://github.com/cescobedo/moodle into MOODLE_39_STABLE 2021-07-14 14:50:10 +02:00
cescobedo 201eff4d98 MDL-72139 core_message: Fix encoding UTF-8 in prevent unclosed tags 2021-07-14 07:41:33 +02:00
Sara Arjona 22e52ebb55 Merge branch 'MDL-71782_39' of https://github.com/stronk7/moodle into MOODLE_39_STABLE 2021-07-13 16:44:53 +02:00
Jun Pataleta 493d3c218e Merge branch 'MDL-72036-39' of git://github.com/sarjona/moodle into MOODLE_39_STABLE 2021-07-13 16:04:57 +08:00
Sara Arjona 97ff875c83 MDL-72036 atto_h5p: Random error with external URL
After a major upgrade was done in h5p.com, some random errors appeared
in the "H5P options are ignored for H5P URLs" scenario.
They have been fixed replacing the URL for different (which should
load quicker). As we're checking external content, no other improvement
can be done on the Moodle site.
2021-07-13 08:37:57 +02:00
AMOS bot 8a5601722d Automatically generated installer lang files 2021-07-11 00:07:43 +00:00
Eloy Lafuente (stronk7) c8d12c3217 MDL-71782 behat: Ensure page after saving changes is there
A similar approach was followed @ MDL-67935, although the
case doesn't seem to be the same.

In any case, it's curious that all local execution are
100% passing and only CIs fail so often. Just guessing if,
maybe, there is some Chrome version factor around (we
are running older, sticky, versions @ CIs.
2021-07-10 15:51:07 +02:00
205 changed files with 3033 additions and 3720 deletions
+1
View File
@@ -0,0 +1 @@
mod/forum/tests/behat/forum_subscriptions_default.feature
@@ -48,7 +48,7 @@ Feature: Verify that all form fields values can be get and set
And the "Unenrol users" select box should not contain "Baker"
And the "Unenrol users" select box should not contain "President, Baker"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test this one"
And I am on the "Test this one" "wiki activity" page
And I press "Create page"
# Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values".
When I set the following fields to these values:
@@ -61,8 +61,7 @@ Feature: Verify that all form fields values can be get and set
# Checkbox - Checking "I set the field" and "The field matches value" ticked.
And I set the field "Force format" to "1"
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And the field "Force format" matches value "1"
@@ -70,8 +69,7 @@ Feature: Verify that all form fields values can be get and set
# Checkbox - Checking "I set the field" and "The field matches value" unticked.
And I set the field "Force format" to ""
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And the field "Force format" matches value ""
@@ -80,8 +78,7 @@ Feature: Verify that all form fields values can be get and set
And I set the following fields to these values:
| Force format | 1 |
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And the following fields match these values:
@@ -92,8 +89,7 @@ Feature: Verify that all form fields values can be get and set
And I set the following fields to these values:
| Force format | |
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I am on the "Test this one" "wiki activity" page
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And the following fields match these values:
@@ -115,20 +111,21 @@ Feature: Verify that all form fields values can be get and set
| Wiki name | Test this one baby |
| Default format | HTML |
And I press "Cancel"
And I am on "Course 1" course homepage
# Radio - Checking "I set the field" and "the field matches value".
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Test choice name |
| Description | Test choice description |
| Allow choice to be updated | Yes |
| Option 1 | one |
| Option 2 | two |
| Option 3 | three |
And I follow "Test choice name"
And I set the field "one" to "1"
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| intro | Test choice description |
| name | Test choice name |
| option | Option 1, Option 2, Option 3 |
| section | 1 |
| allowupdate | 1 |
And I am on the "Test choice name" "choice activity" page
And I set the field "Option 1" to "1"
And I press "Save my choice"
And the field "one" matches value "1"
And the field "two" matches value ""
And the field "Option 1" matches value "1"
And the field "Option 2" matches value ""
# Check if field xpath set/match works.
And I am on "Course 1" course homepage
And I navigate to "Edit settings" in current page administration
@@ -174,31 +171,23 @@ Feature: Verify that all form fields values can be get and set
And I press "Cancel"
# Advanced checkbox requires real browser to allow uncheck to work. MDL-58681. MDL-55386.
# Advanced checkbox - Checking "I set the field" and "The field matches value" ticked.
And I am on "Course 1" course homepage
And I follow "Test this one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test choice name" "choice activity editing" page
And I set the field "Display description on course page" to "1"
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test choice name" "choice activity editing" page
And the field "Display description on course page" matches value "1"
And the field "Display description on course page" does not match value ""
# Advanced checkbox - Checking "I set the field" and "The field matches value" unticked.
And I set the field "Display description on course page" to ""
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test choice name" "choice activity editing" page
And the field "Display description on course page" matches value ""
And the field "Display description on course page" does not match value "1"
# Advanced checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" ticked.
And I set the following fields to these values:
| Display description on course page | 1 |
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test choice name" "choice activity editing" page
And the following fields match these values:
| Display description on course page | 1 |
And the following fields do not match these values:
@@ -207,9 +196,7 @@ Feature: Verify that all form fields values can be get and set
And I set the following fields to these values:
| Display description on course page | |
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test choice name" "choice activity editing" page
And the following fields match these values:
| Display description on course page | |
And the following fields do not match these values:
@@ -0,0 +1,85 @@
@tool @tool_behat
Feature: Use core page resolvers for the I am on the page steps
In order to write tests correctly
As a developer
I need to have steps which take me straight to a page
Scenario Outline: When I am on an instance
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And the following "course" exists:
| fullname | Economics 101 |
| shortname | ECON101 |
| idnumber | 2021-econ101 |
And the following "activity" exists:
| course | ECON101 |
| activity | forum |
| name | Fundamentals of Economics |
| idnumber | fundamentalsofeconomics |
And I log in as "admin"
When I am on the <identifier> <type> page
Then I should see "<shouldsee>"
Examples:
| description | identifier | type | shouldsee |
| Course Category idnumber | CAT1 | category | Add a new course |
| Course Category name | "Cat 1" | Category | Add a new course |
| Course Full name | "Economics 101" | course | Fundamentals of Economics |
| Course Short name | ECON101 | COURSE | Fundamentals of Economics |
| Course idnumber | "2021-econ101" | Course | Fundamentals of Economics |
| Forum idnumber | fundamentalsofeconomics | Activity | Add a new discussion |
| Generic activity editing | fundamentalsofeconomics | "Activity editing" | Updating: Forum |
| Forum name | "Fundamentals of Economics" | "Forum activity" | Add a new discussion |
| Forum name editing | "Fundamentals of Economics" | "Forum activity editing" | Updating: Forum |
| Forum name permissions | "Fundamentals of Economics" | "Forum activity permissions" | Permissions in Forum: Fun |
| Forum name roles | "Fundamentals of Economics" | "Forum activity roles" | Assign roles in Forum: Fun |
Scenario Outline: When I am on an instance logged in as
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And the following "course" exists:
| fullname | Economics 101 |
| shortname | ECON101 |
| idnumber | 2021-econ101 |
And the following "activity" exists:
| course | ECON101 |
| activity | forum |
| name | Fundamentals of Economics |
| idnumber | fundamentalsofeconomics |
When I am on the <identifier> <type> page logged in as admin
Then I should see "<shouldsee>"
Examples:
| description | identifier | type | shouldsee |
| Course Category idnumber | CAT1 | category | Add a new course |
| Course Category name | "Cat 1" | Category | Add a new course |
| Course Full name | "Economics 101" | course | Fundamentals of Economics |
| Course Short name | ECON101 | COURSE | Fundamentals of Economics |
| Course idnumber | "2021-econ101" | Course | Fundamentals of Economics |
| Forum idnumber | fundamentalsofeconomics | Activity | Add a new discussion |
| Generic activity editing | fundamentalsofeconomics | "Activity editing" | Updating: Forum |
| Forum name | "Fundamentals of Economics" | "Forum activity" | Add a new discussion |
| Forum name editing | "Fundamentals of Economics" | "Forum activity editing" | Updating: Forum |
| Forum name permissions | "Fundamentals of Economics" | "Forum activity permissions" | Permissions in Forum: Fun |
| Forum name roles | "Fundamentals of Economics" | "Forum activity roles" | Assign roles in Forum: Fun |
Scenario Outline: When I am on a named page
Given I log in as "admin"
When I am on the <identifier> page
Then I should see "<shouldsee>"
Examples:
| description | identifier | shouldsee |
| Admin page | "Admin notifications" | Check for available updates |
| Home page | Homepage | Recently accessed courses |
Scenario Outline: When I am on a named page logged in as
When I am on the <identifier> page logged in as admin
Then I should see "<shouldsee>"
Examples:
| description | identifier | shouldsee |
| Admin page | "Admin notifications" | Check for available updates |
| Home page | Homepage | Recently accessed courses |
@@ -24,9 +24,7 @@ Feature: See the competencies for an activity on the course competencies page.
| activity | name | intro | course | idnumber | completion | completionview |
| page | PageName1 | PageDesc1 | C1 | PAGE1 | 1 | 1 |
| page | PageName2 | PageDesc2 | C1 | PAGE2 | 1 | 1 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I am on the "Course 1" course page logged in as admin
And I follow "Competencies"
And I press "Add competencies to course"
And "Competency picker" "dialogue" should be visible
@@ -36,9 +34,7 @@ Feature: See the competencies for an activity on the course competencies page.
And "Competency picker" "dialogue" should be visible
And I select "Test-Comp2" of the competency tree
And I click on "Add" "button" in the "Competency picker" "dialogue"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I follow "Expand all"
And I set the field "Course competencies" to "Test-Comp1"
And I press "Save and return to course"
@@ -46,10 +42,8 @@ Feature: See the competencies for an activity on the course competencies page.
@javascript
Scenario: Go to the competency course competencies page.
When I log in as "student1"
And I am on site homepage
And I follow "Course 1"
And I follow "Competencies"
Given I am on the "Course 1" course page logged in as student1
When I follow "Competencies"
Then I should see "Test-Comp1"
And I should see "Test-Comp2"
And I set the field "Filter competencies by resource or activity" to "PageName1"
@@ -64,12 +58,5 @@ Feature: See the competencies for an activity on the course competencies page.
@javascript
Scenario: None course competencies page.
When I log in as "student1"
And I am on site homepage
And I follow "Course 1"
And I follow "PageName1"
Then I should see "Test page content"
And I am on site homepage
And I follow "Course 1"
And I follow "PageName1"
When I am on the PageName1 "page activity" page logged in as student1
Then I should see "Test page content"
@@ -42,9 +42,7 @@ Feature: Backup user data
| Feedback for the response 'True'. | So you think it is true |
| Feedback for the response 'False'. | So you think it is false |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Quiz 1"
When I am on the "Quiz 1" "quiz activity" page logged in as student1
And I press "Attempt quiz now"
And I click on "True" "radio" in the "First question" "question"
And I click on "False" "radio" in the "Second question" "question"
@@ -48,10 +48,10 @@ Feature: Confirm that conditions on completion no longer cause a bug
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
And I set the field with xpath "//div[contains(concat(' ', normalize-space(@class), ' '), ' availability-item ')][preceding-sibling::div]//select[@name='cm']" to "Page2"
And I press "Save and return to course"
And I should see "Not available unless:" in the ".activity.glossary" "css_element"
Then I should see "Not available unless:" in the ".activity.glossary" "css_element"
And I should see "The activity Page1 is marked complete" in the ".activity.glossary" "css_element"
And I should see "The activity Page2 is marked complete" in the ".activity.glossary" "css_element"
And I follow "TestGlossary"
# Behat will automatically check there is no error on this page.
Then I should see "TestGlossary"
And I am on the TestGlossary "glossary activity" page
And I should see "TestGlossary"
@@ -86,13 +86,12 @@ Feature: availability_grade
And I set the field "Minimum grade percentage (inclusive)" to "10"
And I press "Save and return to course"
And I log out
# Log in as student without a grade yet.
When I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "A1" "assign activity" page logged in as student1
# Do the assignment.
And I follow "A1"
And I click on "Add submission" "button"
And I set the field "Online text" to "Q"
And I click on "Save changes" "button"
@@ -103,14 +102,12 @@ Feature: availability_grade
And I should not see "P3" in the "region-main" "region"
And I should not see "P4" in the "region-main" "region"
And I should see "A1" in the "region-main" "region"
And I log out
# Log back in as teacher.
When I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
When I am on the "A1" "assign activity" page logged in as teacher1
# Give the assignment 40%.
And I follow "A1"
And I navigate to "View all submissions" in current page administration
# Pick the grade link in the row that has s@example.com in it.
And I click on "Grade" "link" in the "s@example.com" "table_row"
@@ -118,11 +115,10 @@ Feature: availability_grade
And I click on "Save changes" "button"
And I press "OK"
And I click on "Edit settings" "link"
And I log out
# Log back in as student.
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
# Check pages are visible.
Then I should see "P2" in the "region-main" "region"
@@ -95,8 +95,7 @@ Feature: availability_profile
And I click on "Save and return to course" "button"
# Edit it again and check the setting still works.
When I follow "P1"
And I navigate to "Edit settings" in current page administration
When I am on the P1 "page activity editing" page
And I expand all fieldsets
Then the field "User profile field" matches value "Super field"
And the field "Value to compare against" matches value "Bananaman"
+5 -5
View File
@@ -51,18 +51,18 @@ Feature: Award badges based on activity completion
And I log out
Scenario: Student earns a badge using activity completion, but does not get passing grade
When I log in as "student1"
Given I log in as "student1"
And I am on "Course 1" course homepage
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And I follow "Test quiz name"
When I am on the "Test quiz name" "quiz activity" page
And I press "Re-attempt quiz"
And I set the field "False" to "1"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
And I log out
Then I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "Badges > Manage badges" in current page administration
And I follow "Course Badge"
And I should see "Recipients (1)"
Then I should see "Recipients (1)"
@@ -27,9 +27,7 @@ Feature: Course overview block show users their progress on courses
Then I should not see "0%" in the "Course overview" "block"
Scenario: User complete activity and verify his progress
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test choice 1"
Given I am on the "Test choice 1" "choice activity" page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
@@ -40,8 +38,8 @@ Feature: Course overview block show users their progress on courses
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should see "0%" in the "Course overview" "block"
And I am on "Course 1" course homepage
And I follow "Test choice 1"
And I am on the "Test choice 1" "choice activity" page
And I follow "Dashboard" in the user menu
And I click on "All (except removed from view)" "button" in the "Course overview" "block"
And I should see "100%" in the "Course overview" "block"
@@ -19,7 +19,7 @@ Feature: The private files block allows users to store files privately in moodle
| page | C1 | page1 | Test page name | Test page description |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test page name"
And I am on the "Test page name" "page activity" page
And I add the "Private files" block
And I should see "No files available" in the "Private files" "block"
When I follow "Manage private files..."
@@ -16,24 +16,20 @@ Feature: The recently accessed items block allows users to easily access their m
| user | course | role |
| student1 | C1 | student |
| student1 | C2 | student |
And I log in as "admin"
And I am on "Course 1" course homepage
And I turn editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
And I log out
And the following "activity" exists:
| course | C1 |
| activity | forum |
| idnumber | Test forum name |
| name | Test forum name |
And I log in as "student1"
When I press "Customise this page"
And I press "Customise this page"
And I add the "Recently accessed items" block
Scenario: User has not accessed any item
Then I should see "No recent items" in the "Recently accessed items" "block"
Scenario: User has accessed some items
Given I am on "Course 1" course homepage
When I follow "Test forum name"
Given I change window size to "large"
When I am on the "Test forum name" "forum activity" page
And I follow "Dashboard" in the user menu
And I change window size to "large"
Then I should see "Test forum name" in the "Recently accessed items" "block"
@@ -36,12 +36,10 @@ Feature: Restrict activity availability through date conditions
| x[year] | 2037 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
Then I should see "Available from 31 December 2037"
And "Test assignment 1" "link" should not exist in the "page" "region"
And "Test assignment 1" activity should be dimmed
And "Test assignment 1" "link" should not exist
And I log out
@javascript
Scenario: Show activity hidden to students when available until date is in past
@@ -60,6 +58,5 @@ Feature: Restrict activity availability through date conditions
And I click on ".availability-item .availability-eye img" "css_element"
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Then I should not see "Test assignment 2"
When I am on the "Course 1" course page logged in as student1
Then I should not see "Test assignment 2" in the "page" "region"
@@ -17,13 +17,16 @@ Feature: Restrict activity availability through grade conditions
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And the following "activity" exists:
| course | C1 |
| activity | assign |
| idnumber | Grade assignment |
| name | Grade assignment |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And I am on the "Course 1" course page logged in as teacher1
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Grade assignment |
| Description | Grade this assignment to revoke restriction on restricted assignment |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
# Adding the page like this because id_availableform_enabled needs to be clicked to trigger the action.
And I add a "Page" to section "2"
And I expand all fieldsets
@@ -31,15 +34,15 @@ Feature: Restrict activity availability through grade conditions
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
And I click on "min" "checkbox"
And I set the following fields to these values:
| Name | Test page name |
| Description | Restricted page, till grades in Grade assignment is at least 20% |
| Page content | Test page contents |
| id | Grade assignment |
| minval | 20 |
| Name | Test page name |
| Description | Restricted page, till grades in Grade assignment is at least 20% |
| Page content | Test page contents |
| id | Grade assignment |
| minval | 20 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
Then I should see "Not available unless: You achieve a required score in Grade assignment"
And "Test page name" activity should be dimmed
And "Test page name" "link" should not exist
@@ -50,9 +53,8 @@ Feature: Restrict activity availability through grade conditions
And I press "Save changes"
And I should see "Submitted for grading"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Grade assignment"
And I am on the "Grade assignment" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student First" "table_row"
And I set the following fields to these values:
@@ -61,7 +63,7 @@ Feature: Restrict activity availability through grade conditions
And I press "OK"
And I follow "Edit settings"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And "Test page name" activity should be visible
And I should not see "Not available unless: You achieve a required score in Grade assignment"
@@ -76,16 +76,14 @@ Feature: Restrict sections availability through completion or grade conditions
And I am on "Course 1" course homepage
Then I should see "Not available unless: You achieve a required score in Grade assignment"
And "Test page name" activity should be hidden
And I follow "Grade assignment"
And I am on the "Grade assignment" "assign activity" page
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
And I press "Save changes"
And I should see "Submitted for grading"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Grade assignment"
And I am on the "Grade assignment" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student First" "table_row"
And I set the following fields to these values:
@@ -94,7 +92,6 @@ Feature: Restrict sections availability through completion or grade conditions
And I press "OK"
And I follow "Edit settings"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" Course page logged in as student1
And "Test page name" activity should be visible
And I should not see "Not available unless: You achieve a required score in Grade assignment"
@@ -8,32 +8,26 @@ Feature: Edit completion settings of an activity
Given the following "courses" exist:
| fullname | shortname | enablecompletion |
| Course 1 | C1 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1" and I fill the form with:
| Name | TestPage |
| Description | x |
| Page content | x |
| Completion tracking | 2 |
| Require view | 1 |
And I am on "Course 1" course homepage
And the following "activities" exist:
| activity | course | idnumber | intro | name | completion | completionview |
| page | C1 | p1 | x | TestPage | 2 | 1 |
Scenario: Completion is not locked when the activity has not yet been viewed
Given I click on "Edit settings" "link" in the "TestPage" activity
Given I am on the TestPage "Page Activity editing" page logged in as admin
When I expand all fieldsets
Then I should see "Completion tracking"
And I should not see "Completion options locked"
Scenario: Completion is locked after the activity has been viewed
Given I follow "TestPage"
When I follow "Edit settings"
Given I am on the TestPage "Page Activity" page logged in as admin
When I am on the TestPage "Page Activity editing" page
And I expand all fieldsets
Then I should see "Completion options locked"
@javascript
Scenario: Pressing the unlock button allows the user to edit completion settings
Given I follow "TestPage"
When I navigate to "Edit settings" in current page administration
Given I am on the TestPage "Page Activity" page logged in as admin
When I am on the TestPage "Page Activity editing" page
And I expand all fieldsets
And I press "Unlock completion options"
Then I should see "Completion options unlocked"
@@ -45,8 +39,8 @@ Feature: Edit completion settings of an activity
@javascript
Scenario: Even when completion is locked, the user can still set the date
Given I follow "TestPage"
When I navigate to "Edit settings" in current page administration
Given I am on the TestPage "Page Activity" page logged in as admin
And I am on the TestPage "Page Activity editing" page
And I expand all fieldsets
When I click on "id_completionexpected_enabled" "checkbox"
And I set the field "id_completionexpected_year" to "2013"
@@ -45,9 +45,7 @@ Feature: Activity navigation involving activities with access restrictions
@javascript
Scenario: Activity navigation involving activities with access restrictions
Given I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Page 1"
Given I am on the "Page 1" "page activity" page logged in as student1
Then I should see "Page 2" in the "#next-activity-link" "css_element"
# Activity that has access restriction should not show up in the dropdown.
And the "Jump to..." select box should not contain "Page 3"
@@ -56,7 +54,7 @@ Feature: Activity navigation involving activities with access restrictions
And I should see "Page 2" in the "#prev-activity-link" "css_element"
And the "Jump to..." select box should not contain "Page 3"
# Navigate to Page 2.
And I follow "Page 2"
And I click on "Page 2" "link" in the "page-content" "region"
# Since Page 2 has now been viewed and deemed completed, Page 3 can now be accessed.
And I should see "Page 3" in the "#next-activity-link" "css_element"
And the "Jump to..." select box should contain "Page 3"
-38
View File
@@ -1346,44 +1346,6 @@ class behat_course extends behat_base {
return $this->getSession()->getPage()->findButton(get_string('turneditingoff')) ? true : false;
}
/**
* Returns the id of the category with the given idnumber.
*
* Please note that this function requires the category to exist. If it does not exist an ExpectationException is thrown.
*
* @param string $idnumber
* @return string
* @throws ExpectationException
*/
protected function get_category_id($idnumber) {
global $DB;
try {
return $DB->get_field('course_categories', 'id', array('idnumber' => $idnumber), MUST_EXIST);
} catch (dml_missing_record_exception $ex) {
throw new ExpectationException(sprintf("There is no category in the database with the idnumber '%s'", $idnumber),
$this->getSession());
}
}
/**
* Returns the id of the course with the given idnumber.
*
* Please note that this function requires the category to exist. If it does not exist an ExpectationException is thrown.
*
* @param string $idnumber
* @return string
* @throws ExpectationException
*/
protected function get_course_id($idnumber) {
global $DB;
try {
return $DB->get_field('course', 'id', array('idnumber' => $idnumber), MUST_EXIST);
} catch (dml_missing_record_exception $ex) {
throw new ExpectationException(sprintf("There is no course in the database with the idnumber '%s'", $idnumber),
$this->getSession());
}
}
/**
* Returns the category node from within the listing on the management page.
*
+2 -5
View File
@@ -20,15 +20,12 @@ Feature: Managers can create courses
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Latest announcements" block
Then "Latest announcements" "block" should exist
And I follow "Announcements"
And I am on the Announcements "forum activity" page
And "Add a new topic" "link" should exist
And "Subscription mode > Forced subscription" "link" should not exist in current page administration
And "Subscription mode > Forced subscription" "text" should exist in current page administration
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Announcements"
And I am on the Announcements "forum activity" page logged in as student1
And "Add a new topic" "link" should not exist
And "Forced subscription" "text" should exist in current page administration
@@ -20,8 +20,7 @@ Feature: View subfolders in a course in-line
| Name | Test folder |
| Display folder contents | On a separate page |
| Show subfolders expanded | |
And I should see "Test folder"
And I follow "Test folder"
And I am on the "Test folder" "folder activity" page
And I press "Edit"
And I press "Create folder"
And I set the field "New folder name" to "Test subfolder 1"
@@ -32,7 +31,7 @@ Feature: View subfolders in a course in-line
Scenario: Add a folder with two subfolders - view on separate page
Given I am on "Course 1" course homepage
And I should not see "Test subfolder 1"
And I follow "Test folder"
And I am on the "Test folder" "folder activity" page
And I should see "Test subfolder 1"
And I press "Edit"
And I press "Create folder"
@@ -41,13 +40,13 @@ Feature: View subfolders in a course in-line
And I press "Save changes"
When I am on "Course 1" course homepage
Then I should not see "Test subfolder 2"
And I follow "Test folder"
And I am on the "Test folder" "folder activity" page
And I should see "Test subfolder 2"
Given I navigate to "Edit settings" in current page administration
And I am on the "Test folder" "folder activity editing" page
And I set the field "Show subfolders expanded" to "1"
When I am on "Course 1" course homepage
Then I should not see "Test subfolder 2"
And I follow "Test folder"
And I am on the "Test folder" "folder activity" page
And I should see "Test subfolder 2"
@javascript
@@ -63,8 +62,7 @@ Feature: View subfolders in a course in-line
And I press "Save and return to course"
Then I should see "Test subfolder 1"
And I should not see "Test sub subfolder"
Given I open "Test folder" actions menu
When I click on "Edit settings" "link" in the "Test folder" activity
And I am on the "Test folder" "folder activity editing" page
And I set the field "Show subfolders expanded" to "1"
And I press "Save and return to course"
Then I should see "Test subfolder 1"
@@ -24,10 +24,7 @@ Feature: Render H5P content using filters
@javascript @external
Scenario: Render an external H5P content URL.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
Given I am on the PageName1 "page activity editing" page logged in as teacher1
And I set the field "Page content" to "<div>Go for it</div>https://moodle.h5p.com/content/1290772960722742119/embed"
When I click on "Save and display" "button"
And I wait until the page is ready
@@ -36,10 +33,7 @@ Feature: Render H5P content using filters
@javascript
Scenario: Add an external H5P content URL in a link with the URL. Should be rendered.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
Given I am on the PageName1 "page activity editing" page logged in as teacher1
# This content won't be displayed, so this scenario shouldn't be labeled as external.
And I set the field "Page content" to "<a href='https://moodle.h5p.com/content/1290772960722742119/embed'>https://moodle.h5p.com/content/1290772960722742119/embed</a>"
When I click on "Save and display" "button"
@@ -48,10 +42,7 @@ Feature: Render H5P content using filters
Then I should see "Lorum ipsum"
Scenario: Add an external H5P content URL in a link with text. Shouldn't be rendered.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
Given I am on the PageName1 "page activity editing" page logged in as teacher1
# This content won't be displayed, so this scenario shouldn't be labeled as external.
And I set the field "Page content" to "<a href='https://moodle.h5p.com/content/1290772960722742119/embed'>Here you are the content</a>"
When I click on "Save and display" "button"
@@ -67,8 +58,7 @@ Feature: Render H5P content using filters
| Name | ipsumFile |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
@@ -85,9 +75,7 @@ Feature: Render H5P content using filters
Then I should see "Lorum ipsum"
And I switch to the main frame
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I am on the PageName1 "page activity" page logged in as student1
# Switch to iframe created by filter
And I switch to "h5p-iframe" class iframe
# Switch to iframe created by embed.php page
@@ -104,8 +92,7 @@ Feature: Render H5P content using filters
| Name | ipsumFile |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
@@ -129,8 +116,7 @@ Feature: Render H5P content using filters
| Name | ipsumFileTeacher |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
@@ -153,8 +139,7 @@ Feature: Render H5P content using filters
| Name | ipsumFile |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName2"
And I navigate to "Edit settings" in current page administration
And I am on the PageName2 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
@@ -172,9 +157,7 @@ Feature: Render H5P content using filters
And I should see "Lorum ipsum"
And I switch to the main frame
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I am on the PageName1 "page activity" page logged in as teacher1
# Switch to iframe created by filter
And I switch to "h5p-iframe" class iframe
# Switch to iframe created by embed.php page
@@ -50,7 +50,8 @@ Feature: Marking guides can be created and edited
@javascript
Scenario: Deleting criterion and comment
# Deleting criterion
When I go to "Test assignment 1 name" advanced grading definition page
When I am on "Course 1" course homepage
And I go to "Test assignment 1 name" advanced grading definition page
And I click on "Delete criterion" "button" in the "Guide criterion B" "table_row"
And I press "Yes"
And I press "Save"
@@ -59,7 +60,8 @@ Feature: Marking guides can be created and edited
And I should see "WARNING: Your marking guide has a maximum grade of 70 points"
But I should not see "Guide criterion B"
# Deleting a frequently used comment
When I go to "Test assignment 1 name" advanced grading definition page
When I am on "Course 1" course homepage
And I go to "Test assignment 1 name" advanced grading definition page
And I click on "Delete comment" "button" in the "Comment 3" "table_row"
And I press "Yes"
And I press "Save"
@@ -91,9 +93,7 @@ Feature: Marking guides can be created and edited
Then I should see "80" in the "Student 1" "table_row"
And I log out
# Viewing it as a student.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as student1
And I should see "80" in the ".feedback" "css_element"
And I should see "Marking guide test description" in the ".feedback" "css_element"
And I should see "Very good"
@@ -70,9 +70,7 @@ Feature: Rubrics can be created and edited
And I should see "35" in the "Student 1" "table_row"
And I log out
# Viewing it as a student.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as student1
And I should see "35" in the ".feedback" "css_element"
And I should see "Rubric test description" in the ".feedback" "css_element"
And I should see "In general... work harder..."
@@ -80,8 +78,7 @@ Feature: Rubrics can be created and edited
And the level with "20" points is selected for the rubric criterion "Criterion 1"
And the level with "5" points is selected for the rubric criterion "Criterion 3"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as teacher1
# Editing a rubric definition without regrading students.
And I go to "Test assignment 1 name" advanced grading definition page
And "Save as draft" "button" should not exist
@@ -93,9 +90,7 @@ Feature: Rubrics can be created and edited
And I press "Continue"
And I log out
# Check that the student still sees the grade.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as student1
And I should see "35" in the ".feedback" "css_element"
And the level with "20" points is selected for the rubric criterion "Criterion 1"
And I log out
@@ -110,30 +105,23 @@ Feature: Rubrics can be created and edited
And I press "Continue"
And I log out
# Check that the student doesn't see the grade.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as student1
And I should see "35" in the ".feedback" "css_element"
And the level with "20" points is not selected for the rubric criterion "Criterion 1"
And I log out
# Regrade student.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as teacher1
And I go to "Student 1" "Test assignment 1 name" activity advanced grading page
And I should see "The rubric definition was changed after this student had been graded. The student can not see this rubric until you check the rubric and update the grade."
And I save the advanced grading form
And I log out
# Check that the student sees the grade again.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as student1
And I should see "31.82" in the ".feedback" "css_element"
And the level with "20" points is not selected for the rubric criterion "Criterion 1"
# Hide all rubric info for students
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as teacher1
And I go to "Test assignment 1 name" advanced grading definition page
And I set the field "Allow users to preview rubric (otherwise it will only be displayed after grading)" to ""
And I set the field "Display rubric description during evaluation" to ""
@@ -145,9 +133,7 @@ Feature: Rubrics can be created and edited
And I press "Continue"
And I log out
# Students should not see anything.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I am on the "Test assignment 1 name" "assign activity" page logged in as student1
And I should not see "Criterion 1" in the ".submissionstatustable" "css_element"
And I should not see "Criterion 2" in the ".submissionstatustable" "css_element"
And I should not see "Criterion 3" in the ".submissionstatustable" "css_element"
@@ -14,12 +14,14 @@ Feature: Reuse my rubrics in other activities
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 name |
| Description | Test assignment 1 description |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment 1 name | Test assignment 1 description | C1 | 1 | assign1 |
| assign | Test assignment 2 name | Test assignment 2 description | C1 | 1 | assign1 |
And I am on the "Test assignment 1 name" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| Grading method | Rubric |
And I press "Save and return to course"
And I go to "Test assignment 1 name" advanced grading definition page
And I set the following fields to these values:
| Name | Assignment 1 rubric |
@@ -29,11 +31,10 @@ Feature: Reuse my rubrics in other activities
| Criterion 2 | Level 21 | 21 | Level 22 | 22 | Level 3 | 23 |
| Criterion 3 | Level 31 | 31 | Level 32 | 32 | | |
And I press "Save rubric and make it ready"
And I am on "Course 1" course homepage
When I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 2 name |
| Description | Test assignment 2 description |
And I am on the "Test assignment 2 name" "assign activity editing" page
And I set the following fields to these values:
| Grading method | Rubric |
And I press "Save and return to course"
And I set "Test assignment 2 name" activity to use "Assignment 1 rubric" grading form
Then I should see "Ready for use"
And I should see "Criterion 1"
@@ -44,7 +45,6 @@ Feature: Reuse my rubrics in other activities
And I should see "Criterion 1"
And I should see "Criterion 2"
And I should see "Criterion 3"
And I press "Cancel"
@javascript
Scenario: A teacher can reuse one of his/her previously created rubrics, with Javascript enabled
@@ -28,16 +28,13 @@ Feature: We can change what we are viewing on the grader report
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name 1"
And I am on the "Test assignment name 1" "assign activity" page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission for assignment 1 |
And I press "Save changes"
Then I should see "Submitted for grading"
And I am on "Course 1" course homepage
And I follow "Test assignment name 2"
And I am on the "Test assignment name 2" "assign activity" page
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission for assignment 2 |
@@ -55,7 +52,7 @@ Feature: We can change what we are viewing on the grader report
@javascript
Scenario: View and minimise the grader report containing hidden activities
And I am on "Course 1" course homepage with editing mode on
When I am on "Course 1" course homepage with editing mode on
And I open "Test assignment name 2" actions menu
And I click on "Hide" "link" in the "Test assignment name 2" activity
And I am on "Course 1" course homepage
@@ -83,7 +80,7 @@ Feature: We can change what we are viewing on the grader report
@javascript
Scenario: View and minimise the grader report containing hidden activities without the 'moodle/grade:viewhidden' capability
And I am on "Course 1" course homepage with editing mode on
When I am on "Course 1" course homepage with editing mode on
And I open "Test assignment name 2" actions menu
And I click on "Hide" "link" in the "Test assignment name 2" activity
And I log out
@@ -30,9 +30,7 @@ Feature: We can bulk insert grades for students in a course
| assign | C1 | a4 | Test assignment four | Submit nothing! |
Scenario: I can bulk insert grades and check their override flags for grade view.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment one"
Given I am on the "Test assignment one" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -71,9 +69,7 @@ Feature: We can bulk insert grades for students in a course
And the field "Override for Student 4" matches value "1"
Scenario: I can bulk insert grades and check their override flags for user view.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment two"
Given I am on the "Test assignment two" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -103,8 +99,7 @@ Feature: We can bulk insert grades for students in a course
And the field "Override for Test assignment four" matches value "1"
Scenario: I can not update grades if the value is out of bounds.
Given I log in as "teacher1"
And I am on "Course 1" course homepage
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Test assignment one"
And I set the field "Perform bulk insert" to "1"
+18 -26
View File
@@ -11,8 +11,8 @@ Feature: We can change the grading type and maximum grade point values
| fullname | shortname | category | format |
| Course 1 | C1 | 0 | topics |
Given the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | assign1| Test Assignment 1 | Test Assignment 1 |
| activity | course | idnumber | name | intro |
| assign | C1 | assign1 | Test Assignment 1 | Test Assignment 1 |
And I log in as "admin"
And I navigate to "Grades > General settings" in site administration
And I set the following fields to these values:
@@ -23,9 +23,8 @@ Feature: We can change the grading type and maximum grade point values
@javascript
Scenario: Validate that switching the type of grading used correctly disables input form elements
When I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
Then the "Scale" "select" should be disabled
And the "Maximum grade" "field" should be enabled
@@ -39,46 +38,42 @@ Feature: We can change the grading type and maximum grade point values
@javascript
Scenario: Create an activity with a maximum grade point value less than the system maximum
When I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "point"
And I set the field "grade[modgrade_point]" to "600"
And I press "Save and display"
And I navigate to "Edit settings" in current page administration
And I am on the "Test Assignment 1" "assign activity editing" page
Then the field "grade[modgrade_point]" matches value "600"
And the "Scale" "select" should be disabled
And I press "Save and return to course"
@javascript
Scenario: Create an activity with a scale as the grade type
When I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "Separate and Connected ways of knowing"
And I press "Save and display"
And I navigate to "Edit settings" in current page administration
And I am on the "Test Assignment 1" "assign activity editing" page
Then the field "grade[modgrade_scale]" matches value "Separate and Connected ways of knowing"
And the "Maximum grade" "field" should be disabled
And I press "Save and return to course"
@javascript
Scenario: Create an activity with no grade as the grade type
When I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "None"
And I press "Save and display"
And I navigate to "Edit settings" in current page administration
And I am on the "Test Assignment 1" "assign activity editing" page
And the "Scale" "select" should be disabled
And the "Maximum grade" "field" should be disabled
And I press "Save and return to course"
Scenario: Create an activity with a maximum grade point value higher than the system maximum
When I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
And I set the field "grade[modgrade_point]" to "20000"
And I press "Save and display"
@@ -86,9 +81,8 @@ Feature: We can change the grading type and maximum grade point values
And I press "Cancel"
Scenario: Create an activity with a valid maximum grade point and then change the system maximum to be lower
When I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "point"
And I set the field "grade[modgrade_point]" to "600"
And I press "Save and display"
@@ -96,9 +90,7 @@ Feature: We can change the grading type and maximum grade point values
And I set the following fields to these values:
| Grade point maximum | 100 |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I am on the "Test Assignment 1" "assign activity editing" page
And I press "Save and display"
Then I should see "Invalid grade value. This must be an integer between 1 and 100"
And I press "Cancel"
@@ -23,8 +23,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I navigate to "Grades > Grade category settings" in site administration
And I set the field "Available aggregation types" to "Weighted mean of grades"
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Assignment 1"
And I am on the "Assignment 1" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "80"
@@ -59,8 +58,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
@javascript
Scenario: Confirm overridden course total does not get regraded when activity grade is changed
Given I am on "Course 1" course homepage
And I follow "Assignment 1"
Given I am on the "Assignment 1" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "90"
+1 -4
View File
@@ -43,10 +43,7 @@ Feature: View gradebook when scales are used
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory |
| assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "EN Letterscale"
@@ -39,10 +39,7 @@ Feature: View gradebook when single item scales are used
| assign | C1 | a1 | Test assignment one | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment one"
And I navigate to "Edit settings" in current page administration
And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "EN Singleitem"
+1
View File
@@ -29,5 +29,6 @@
defined('MOODLE_INTERNAL') || die();
$string['parentlanguage'] = '';
$string['thisdirection'] = 'ltr';
$string['thislanguage'] = 'Afrikaans';
+2 -2
View File
@@ -45,6 +45,6 @@ $string['invalidmd5'] = 'La variable de comprobación era incorrecta - inténtel
$string['missingrequiredfield'] = 'Falta algún campo necesario';
$string['remotedownloaderror'] = '<p>Falló la descarga del componente a su servidor. Se recomienda verificar los ajustes del proxy, extensión PHP cURL.</p>
<p>Debe descargar el <a href="{$a->url}">{$a->url}</a> archivo manualmente, copiarlo en "{$a->dest}" en su servidor y descomprimirlo allí.</p>';
$string['wrongdestpath'] = 'Ruta de destino errónea.';
$string['wrongsourcebase'] = 'Base de fuente de URL errónea.';
$string['wrongdestpath'] = 'Ruta de destino errónea';
$string['wrongsourcebase'] = 'Base de URL de origen errónea';
$string['wrongzipfilename'] = 'Nombre de fichero ZIP incorrecto';
+32
View File
@@ -0,0 +1,32 @@
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle installer
*
* Do not edit this file manually! It contains just a subset of strings
* needed during the very first steps of installation. This file was
* generated automatically by export-installer.php (which is part of AMOS
* {@link http://docs.moodle.org/dev/Languages/AMOS}) using the
* list of strings defined in /install/stringnames.txt.
*
* @package installer
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['thislanguage'] = 'Hornjoserbsski';
+4 -2
View File
@@ -33,7 +33,7 @@ $string['admindirname'] = 'Rendszergazda-könyvtár';
$string['availablelangs'] = 'Elérhető nyelvek listája';
$string['chooselanguagehead'] = 'Nyelv kiválasztása';
$string['chooselanguagesub'] = 'Válasszon nyelvet a telepítéshez! Ez lesz a portál alapbeállítás szerinti nyelve, de később módosíthatja.';
$string['clialreadyconfigured'] = 'A config.php már létezik, a portál telepítéséhez használja az admin/cli/install_database.php állományt.';
$string['clialreadyconfigured'] = 'A config.php már létezik, a Moodle portálra telepítéséhez használja az admin/cli/install_database.php állományt.';
$string['clialreadyinstalled'] = 'A config.php már létezik, a portál frissítéséhez használja az admin/cli/upgrade.php állományt.';
$string['cliinstallheader'] = 'A Moodle {$a} parancssori telepítő programja';
$string['databasehost'] = 'Az adatbázis gazdagépe';
@@ -56,7 +56,9 @@ $string['pathshead'] = 'Útvonalak megerősítése';
$string['pathsrodataroot'] = 'Az adatok gyökérkönyvtára nem írható.';
$string['pathsroparentdataroot'] = 'A felettes könyvtár ({$a->parent}) nem írható. A telepítő nem tudja létrehozni az adatkönyvtárat ({$a->dataroot}).';
$string['pathssubadmindir'] = 'Egy pár webes gazdagép esetén az /admin speciális URL pl. a vezérlőpanel eléréséhez. Ez ütközik a Moodle admin oldalainak standard helyével. Javítás: a telepítésben nevezze át a rendszergazda könyvtárát, az új nevet pedig írja be ide. Például: <em>moodleadmin</em>. Ezzel helyrehozhatók a Moodle rendszergazdai hivatkozásai.';
$string['pathssubdataroot'] = 'Szüksége van egy helyre, ahol a Moodle mentheti a feltöltött állományokat. Ez a könyvtár a webszerver felhasználója (általában \'nobody\' vagy \'apache\') számára legyen mind olvasható, MIND ÍRHATÓ. Ha nem létezik, a telepítő megpróbálja létrehozni.';
$string['pathssubdataroot'] = 'Szüksége van egy helyre, ahol a Moodle mentheti a feltöltött állományokat. Ez a könyvtár a webszerver felhasználója (általában \'www-data\', \'nobody\' vagy \'apache\') számára legyen mind olvasható, mind írható.
A könyvtár a webről közvetlenül nem lehet elérhető.
Ha nem létezik, a telepítő megpróbálja létrehozni.';
$string['pathssubdirroot'] = 'Teljes útvonal a Moodle telepítéséhez. ';
$string['pathssubwwwroot'] = 'A Moodle elérésére használandó teljes webcím. A Moodle egyszerre több címről nem érhető el. Ha portálja több címet használ, a jelen cím kivételével az összeshez állandó
átirányítást kell beállítania. Ha portálja mind intranetről, mind az internetről elérhető, a nyilvános címet itt adja meg, a DNS-t pedig úgy állítsa be, hogy az intranetről a nyilvános cím is elérhető legyen. Ha a cím hibás, módosítsa böngészőjében a webcímet, hogy a telepítés egy másik értékkel induljon újra.';
+12 -1
View File
@@ -108,7 +108,7 @@ class behat_core_generator extends behat_generator_base {
'activities' => [
'singular' => 'activity',
'datagenerator' => 'activity',
'required' => ['activity', 'idnumber', 'course'],
'required' => ['activity', 'course'],
'switchids' => ['course' => 'course', 'gradecategory' => 'gradecat', 'grouping' => 'groupingid'],
],
'blocks' => [
@@ -377,6 +377,17 @@ class behat_core_generator extends behat_generator_base {
}
}
if (!array_key_exists('idnumber', $data)) {
$data['idnumber'] = $data['name'];
if (strlen($data['name']) > 100) {
throw new Exception(
"Activity '{$activityname}' cannot be used as the default idnumber. " .
"The idnumber has a max length of 100 chars. " .
"Please manually specify an idnumber."
);
}
}
// We split $data in the activity $record and the course module $options.
$cmoptions = array();
$cmcolumns = $DB->get_columns('course_modules');
@@ -368,6 +368,25 @@ abstract class behat_generator_base {
return $id;
}
/**
* Gets the course cmid for the specified activity based on the activity's idnumber.
*
* Note: this does not check the module type, only the idnumber.
*
* @throws Exception
* @param string $idnumber
* @return int
*/
protected function get_activity_id(string $idnumber) {
global $DB;
if (!$id = $DB->get_field('course_modules', 'id', ['idnumber' => $idnumber])) {
throw new Exception('The specified activity with idnumber "' . $idnumber . '" could not be found.');
}
return $id;
}
/**
* Gets the group id from it's idnumber.
* @throws Exception
@@ -512,4 +531,46 @@ abstract class behat_generator_base {
}
return $id;
}
/**
* Get a coursemodule from an activity name or idnumber.
*
* @param string $activity
* @param string $identifier
* @return cm_info
*/
protected function get_cm_by_activity_name(string $activity, string $identifier): cm_info {
global $DB;
$coursetable = new \core\dml\table('course', 'c', 'c');
$courseselect = $coursetable->get_field_select();
$coursefrom = $coursetable->get_from_sql();
$cmtable = new \core\dml\table('course_modules', 'cm', 'cm');
$cmfrom = $cmtable->get_from_sql();
$acttable = new \core\dml\table($activity, 'act', 'act');
$actselect = $acttable->get_field_select();
$actfrom = $acttable->get_from_sql();
$sql = <<<EOF
SELECT cm.id as cmid, {$courseselect}, {$actselect}
FROM {$cmfrom}
INNER JOIN {$coursefrom} ON c.id = cm.course
INNER JOIN {modules} m ON m.id = cm.module AND m.name = :modname
INNER JOIN {$actfrom} ON cm.instance = act.id
WHERE cm.idnumber = :idnumber OR act.name = :name
EOF;
$result = $DB->get_record_sql($sql, [
'modname' => $activity,
'idnumber' => $identifier,
'name' => $identifier,
], MUST_EXIST);
$course = $coursetable->extract_from_result($result);
$instancedata = $acttable->extract_from_result($result);
return get_fast_modinfo($course)->get_cm($result->cmid);
}
}
+133
View File
@@ -1437,4 +1437,137 @@ EOF;
$timeout = self::get_real_timeout(30) * 1000 * $factor;
$driver->getWebDriver()->getCommandExecutor()->setRequestTimeout($timeout);
}
/**
* Get the course category id from an identifier.
*
* The category idnumber, and name are checked.
*
* @param string $identifier
* @return int|null
*/
protected function get_category_id(string $identifier): ?int {
global $DB;
$sql = <<<EOF
SELECT id
FROM {course_categories}
WHERE idnumber = :idnumber
OR name = :name
EOF;
$result = $DB->get_field_sql($sql, [
'idnumber' => $identifier,
'name' => $identifier,
]);
return $result ?: null;
}
/**
* Get the course id from an identifier.
*
* The course idnumber, shortname, and fullname are checked.
*
* @param string $identifier
* @return int|null
*/
protected function get_course_id(string $identifier): ?int {
global $DB;
$sql = <<<EOF
SELECT id
FROM {course}
WHERE idnumber = :idnumber
OR shortname = :shortname
OR fullname = :fullname
EOF;
$result = $DB->get_field_sql($sql, [
'idnumber' => $identifier,
'shortname' => $identifier,
'fullname' => $identifier,
]);
return $result ?: null;
}
/**
* Get the activity course module id from its idnumber.
*
* Note: Only idnumber is supported here, not name at this time.
*
* @param string $identifier
* @return cm_info|null
*/
protected function get_course_module_for_identifier(string $identifier): ?cm_info {
global $DB;
$coursetable = new \core\dml\table('course', 'c', 'c');
$courseselect = $coursetable->get_field_select();
$coursefrom = $coursetable->get_from_sql();
$cmtable = new \core\dml\table('course_modules', 'cm', 'cm');
$cmfrom = $cmtable->get_from_sql();
$sql = <<<EOF
SELECT {$courseselect}, cm.id as cmid
FROM {$cmfrom}
INNER JOIN {$coursefrom} ON c.id = cm.course
WHERE cm.idnumber = :idnumber
EOF;
$result = $DB->get_record_sql($sql, [
'idnumber' => $identifier,
]);
if ($result) {
$course = $coursetable->extract_from_result($result);
return get_fast_modinfo($course)->get_cm($result->cmid);
}
return null;
}
/**
* Get a coursemodule from an activity name or idnumber.
*
* @param string $activity
* @param string $identifier
* @return cm_info
*/
protected function get_cm_by_activity_name(string $activity, string $identifier): cm_info {
global $DB;
$coursetable = new \core\dml\table('course', 'c', 'c');
$courseselect = $coursetable->get_field_select();
$coursefrom = $coursetable->get_from_sql();
$cmtable = new \core\dml\table('course_modules', 'cm', 'cm');
$cmfrom = $cmtable->get_from_sql();
$acttable = new \core\dml\table($activity, 'act', 'act');
$actselect = $acttable->get_field_select();
$actfrom = $acttable->get_from_sql();
$sql = <<<EOF
SELECT cm.id as cmid, {$courseselect}, {$actselect}
FROM {$cmfrom}
INNER JOIN {$coursefrom} ON c.id = cm.course
INNER JOIN {modules} m ON m.id = cm.module AND m.name = :modname
INNER JOIN {$actfrom} ON cm.instance = act.id
WHERE cm.idnumber = :idnumber OR act.name = :name
EOF;
$result = $DB->get_record_sql($sql, [
'modname' => $activity,
'idnumber' => $identifier,
'name' => $identifier,
], MUST_EXIST);
$course = $coursetable->extract_from_result($result);
$instancedata = $acttable->extract_from_result($result);
return get_fast_modinfo($course)->get_cm($result->cmid);
}
}
+12 -28
View File
@@ -55,15 +55,20 @@ class curl_security_helper extends curl_security_helper_base {
];
/**
* Checks whether the given URL is blacklisted by checking its address and port number against the black/white lists.
* Checks whether the given URL is blocked by checking its address and port number against the block/allow lists.
* The behaviour of this function can be classified as strict, as it returns true for URLs which are invalid or
* could not be parsed, as well as those valid URLs which were found in the blacklist.
* could not be parsed, as well as those valid URLs which were found in the list of blocked ones.
*
* @param string $urlstring the URL to check.
* @param int $maxredirects Optional number of maximum redirects to follow - prevents infinite recursion.
* @return bool true if the URL is blacklisted or invalid and false if the URL is not blacklisted.
* @param int $notused There used to be an optional parameter $maxredirects for a short while here, not used any more.
* @return bool true if the URL is blocked or invalid and false if the URL is not blocked.
*/
public function url_is_blocked($urlstring, $maxredirects = 3) {
public function url_is_blocked($urlstring, $notused = null) {
if ($notused !== null) {
debugging('The $maxredirects parameter of curl_security_helper::url_is_blocked() has been dropped!', DEBUG_DEVELOPER);
}
// If no config data is present, then all hosts/ports are allowed.
if (!$this->is_enabled()) {
return false;
@@ -86,30 +91,9 @@ class curl_security_helper extends curl_security_helper_base {
}
if ($parsed['port'] && $parsed['host']) {
// Check the host and port against the allow/block entries, and that we have not run out of redirects.
if ($this->host_is_blocked($parsed['host']) || $this->port_is_blocked($parsed['port']) || $maxredirects < 1) {
return true;
}
// Check if the host has a redirect in place, without following it.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlstring);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_exec($ch);
$curlinfo = curl_getinfo($ch);
$redirecturl = $curlinfo['redirect_url'];
if (!$redirecturl) {
return false;
}
// Recursively check redirects, until final URL checked, redirects to a blocked host/port, or has too many redirects.
$maxredirects--;
return $this->url_is_blocked($redirecturl, $maxredirects);
// Check the host and port against the allow/block entries.
return $this->host_is_blocked($parsed['host']) || $this->port_is_blocked($parsed['port']);
}
return true;
}
@@ -21,11 +21,8 @@ Feature: Add h5ps to Atto
@javascript @external
Scenario: Insert an embedded h5p
Given I log in as "admin"
And I change window size to "large"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
Given I change window size to "large"
And I am on the PageName1 "page activity editing" page logged in as admin
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290772960722742119"
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
@@ -42,9 +39,7 @@ Feature: Add h5ps to Atto
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
@@ -57,11 +52,8 @@ Feature: Add h5ps to Atto
@javascript
Scenario: Test an invalid url
Given I log in as "admin"
And I change window size to "large"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
Given I change window size to "large"
And I am on the PageName1 "page activity editing" page logged in as admin
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
# This is not a real external URL, so this scenario shouldn't be labeled as external.
And I set the field with xpath "//input[@data-region='h5pfile']" to "ftp://moodle.h5p.com/content/1290772960722742119"
@@ -75,10 +67,7 @@ Feature: Add h5ps to Atto
| capability | permission | role | contextlevel | reference |
| atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
| moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
When I navigate to "Edit settings" in current page administration
When I am on the PageName1 "page activity editing" page logged in as teacher1
Then "Insert H5P" "button" should not exist
@javascript
@@ -86,10 +75,7 @@ Feature: Add h5ps to Atto
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| atto/h5p:addembed | Prohibit | editingteacher | Course | C1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
When I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page logged in as teacher1
And I click on "Insert H5P" "button"
Then I should not see "H5P URL" in the "Insert H5P" "dialogue"
And I should see "H5P file upload" in the "Insert H5P" "dialogue"
@@ -100,10 +86,7 @@ Feature: Add h5ps to Atto
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "PageName1"
When I navigate to "Edit settings" in current page administration
When I am on the PageName1 "page activity editing" page logged in as teacher1
And I click on "Insert H5P" "button"
Then I should not see "H5P file upload" in the "Insert H5P" "dialogue"
And I should see "H5P URL" in the "Insert H5P" "dialogue"
@@ -115,9 +98,7 @@ Feature: Add h5ps to Atto
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/drag.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
# H5P file content
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
@@ -151,9 +132,7 @@ Feature: Add h5ps to Atto
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
@@ -205,22 +184,17 @@ Feature: Add h5ps to Atto
@javascript @external
Scenario: H5P options are ignored for H5P URLs
Given I log in as "admin"
And I change window size to "large"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
Given I change window size to "large"
And I am on the PageName1 "page activity editing" page logged in as admin
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290752078589054689"
And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1291366510035871129"
And I click on "H5P options" "link"
And I click on "Embed button" "checkbox"
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
And I wait until the page is ready
When I click on "Save and display" "button"
Then ".h5p-placeholder" "css_element" should exist
And I wait until the page is ready
And I switch to "h5pcontent" iframe
And I should see "History of strawberries"
And I should see "Far far away"
And I should not see "Embed"
And I switch to the main frame
And I navigate to "Edit settings" in current page administration
@@ -241,9 +215,7 @@ Feature: Add h5ps to Atto
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
And I am on "Course 1" course homepage
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
@@ -253,9 +225,7 @@ Feature: Add h5ps to Atto
And I wait until the page is ready
And I click on "Save and display" "button"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "PageName1"
When I am on the PageName1 "page activity" page logged in as student1
Then I switch to "h5pcontent" iframe
And I switch to "h5p-iframe" class iframe
And I should see "reveal"
+35 -16
View File
@@ -3063,7 +3063,7 @@ class curl {
public $error;
/** @var int error code */
public $errno;
/** @var bool use workaround for open_basedir restrictions, to be changed from unit tests only! */
/** @var bool Perform redirects at PHP level instead of relying on native cURL functionality. Always true now. */
public $emulateredirects = null;
/** @var array cURL options */
@@ -3160,9 +3160,13 @@ class curl {
$this->proxy = false;
}
if (!isset($this->emulateredirects)) {
$this->emulateredirects = ini_get('open_basedir');
}
// All redirects are performed at PHP level now and each one is checked against blocked URLs rules. We do not
// want to let cURL naively follow the redirect chain and visit every URL for security reasons. Even when the
// caller explicitly wants to ignore the security checks, we would need to fall back to the original
// implementation and use emulated redirects if open_basedir is in effect to avoid the PHP warning
// "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir". So it is better to simply
// ignore this property and always handle redirects at this PHP wrapper level and not inside the native cURL.
$this->emulateredirects = true;
// Curl security setup. Allow injection of a security helper, but if not found, default to the core helper.
if (isset($settings['securityhelper']) && $settings['securityhelper'] instanceof \core\files\curl_security_helper_base) {
@@ -3471,8 +3475,8 @@ class curl {
// Set options.
foreach($this->options as $name => $val) {
if ($name === 'CURLOPT_FOLLOWLOCATION' and $this->emulateredirects) {
// The redirects are emulated elsewhere.
if ($name === 'CURLOPT_FOLLOWLOCATION') {
// All the redirects are emulated at PHP level.
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
continue;
}
@@ -3644,8 +3648,12 @@ class curl {
}
}
// If curl security is enabled, check the URL against the blacklist before calling curl_exec.
// Note: This will only check the base url. In the case of redirects, the blacklist is also after the curl_exec.
if (empty($this->emulateredirects)) {
// Just in case someone had tried to explicitly disable emulated redirects in legacy code.
debugging('Attempting to disable emulated redirects has no effect any more!', DEBUG_DEVELOPER);
}
// If curl security is enabled, check the URL against the list of blocked URLs before calling the first curl_exec.
if (!$this->ignoresecurity && $this->securityhelper->url_is_blocked($url)) {
$this->error = $this->securityhelper->get_blocked_url_string();
return $this->error;
@@ -3668,16 +3676,14 @@ class curl {
$this->errno = curl_errno($curl);
// Note: $this->response and $this->rawresponse are filled by $hits->formatHeader callback.
// In the case of redirects (which curl blindly follows), check the post-redirect URL against the blacklist entries too.
if (intval($this->info['redirect_count']) > 0 && !$this->ignoresecurity
&& $this->securityhelper->url_is_blocked($this->info['url'])) {
$this->reset_request_state_vars();
$this->error = $this->securityhelper->get_blocked_url_string();
curl_close($curl);
return $this->error;
if (intval($this->info['redirect_count']) > 0) {
// For security reasons we do not allow the cURL handle to follow redirects on its own.
// See setting CURLOPT_FOLLOWLOCATION in {@see self::apply_opt()} method.
throw new coding_exception('Internal cURL handle should never follow redirects on its own!',
'Reported number of redirects: ' . $this->info['redirect_count']);
}
if ($this->emulateredirects and $this->options['CURLOPT_FOLLOWLOCATION'] and $this->info['http_code'] != 200) {
if ($this->options['CURLOPT_FOLLOWLOCATION'] && $this->info['http_code'] != 200) {
$redirects = 0;
while($redirects <= $this->options['CURLOPT_MAXREDIRS']) {
@@ -3711,6 +3717,12 @@ class curl {
if (isset($this->info['redirect_url'])) {
if (preg_match('|^https?://|i', $this->info['redirect_url'])) {
$redirecturl = $this->info['redirect_url'];
} else {
// Emulate CURLOPT_REDIR_PROTOCOLS behaviour which we have set to (CURLPROTO_HTTP | CURLPROTO_HTTPS) only.
$this->errno = CURLE_UNSUPPORTED_PROTOCOL;
$this->error = 'Redirect to a URL with unsuported protocol: ' . $this->info['redirect_url'];
curl_close($curl);
return $this->error;
}
}
if (!$redirecturl) {
@@ -3740,6 +3752,13 @@ class curl {
}
}
if (!$this->ignoresecurity && $this->securityhelper->url_is_blocked($redirecturl)) {
$this->reset_request_state_vars();
$this->error = $this->securityhelper->get_blocked_url_string();
curl_close($curl);
return $this->error;
}
curl_setopt($curl, CURLOPT_URL, $redirecturl);
$ret = curl_exec($curl);
+3 -3
View File
@@ -48,7 +48,7 @@ class behat_core_form extends behat_question_base {
* @throws Exception with a meaningful error message if the specified page cannot be found.
*/
protected function resolve_page_url(string $page): moodle_url {
switch ($page) {
switch (strtolower($page)) {
default:
throw new Exception('Unrecognised core_form page type "' . $page . '."');
}
@@ -70,8 +70,8 @@ class behat_core_form extends behat_question_base {
* @throws Exception with a meaningful error message if the specified page cannot be found.
*/
protected function resolve_page_instance_url(string $type, string $identifier): moodle_url {
switch ($type) {
case 'Fixture':
switch (strtolower($type)) {
case 'fixture':
return new moodle_url('/lib/form/tests/fixtures/' .
clean_param($identifier, PARAM_ALPHAEXT) . '.php');
@@ -31,18 +31,19 @@ Feature: Using the activity grade form element
| Scale | Disappointing, Good, Very good, Excellent |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| forum | Test forum name | Test forum description | C1 | forum1 |
And I am on the "Test forum name" "forum activity editing" page logged in as teacher1
And I set the following fields to these values:
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Aggregate type | Average of ratings |
| scale[modgrade_type] | Point |
| scale[modgrade_point] | 100 |
| Group mode | No groups |
And I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I press "Save and return to course"
And I am on the "Test forum name" "forum activity editing" page
When I expand all fieldsets
Then I should not see "Some grades have already been awarded, so the grade type"
And I set the field "scale[modgrade_type]" to "Scale"
@@ -89,21 +90,17 @@ Feature: Using the activity grade form element
| scale[modgrade_scale] | ABCDEF |
| Group mode | No groups |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test forum name"
And I am on the "Test forum name" "forum activity" page logged in as student1
And I click on "Add a new discussion topic" "link"
And I set the following fields to these values:
| Subject | Discussion subject |
| Message | Discussion message |
And I press "Post to forum"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test forum name"
And I am on the "Test forum name" "forum activity" page logged in as teacher1
And I follow "Discussion subject"
And I set the field "rating" to "D"
And I follow "Test forum name"
And I am on the "Test forum name" "forum activity" page
And I navigate to "Edit settings" in current page administration
When I expand all fieldsets
Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed"
@@ -138,8 +135,7 @@ Feature: Using the activity grade form element
| Description | Test assignment description |
| grade[modgrade_type] | Scale |
| grade[modgrade_scale] | ABCDEF |
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade" to "C"
@@ -156,33 +152,30 @@ Feature: Using the activity grade form element
And the field "grade[modgrade_scale]" matches value "ABCDEF"
Scenario: Attempting to change the maximum grade when ratings exist
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| forum | Test forum name | Test forum description | C1 | forum1 | 1 |
And I am on the "Test forum name" "forum activity editing" page logged in as teacher1
And I set the following fields to these values:
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Aggregate type | Average of ratings |
| scale[modgrade_type] | Point |
| scale[modgrade_point] | 100 |
| Group mode | No groups |
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test forum name"
And I am on the "Test forum name" "forum activity" page logged in as student1
And I click on "Add a new discussion topic" "link"
And I set the following fields to these values:
| Subject | Discussion subject |
| Message | Discussion message |
And I press "Post to forum"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test forum name"
And I am on the "Test forum name" "forum activity" page logged in as teacher1
And I follow "Discussion subject"
And I set the field "rating" to "100"
And I press "Rate"
And I follow "Test forum name"
And I am on the "Test forum name" "forum activity" page
And I navigate to "Edit settings" in current page administration
When I expand all fieldsets
Then I should see "You cannot change the type, as grades already exist for this item."
@@ -192,13 +185,11 @@ Feature: Using the activity grade form element
@javascript
Scenario: Attempting to change the maximum grade when no rescaling option has been chosen
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| course | C1 |
| activity | assign |
| name | Test assign name |
And I am on the "Test assign name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50"
@@ -57,4 +57,33 @@ abstract class component_generator_base {
*/
public function reset() {
}
/**
* Set the current user during data generation.
*
* This should be avoided wherever possible, but in some situations underlying code will insert data as the current
* user.
*
* @param stdClass $user
*/
protected function set_user(?stdClass $user = null): void {
global $CFG, $DB;
if ($user === null) {
$user = (object) [
'id' => 0,
'mnethostid' => $CFG->mnet_localhost_id,
];
} else {
$user = clone($user);
unset($user->description);
unset($user->access);
unset($user->preference);
}
// Ensure session is empty, as it may contain caches and user-specific info.
\core\session\manager::init_empty_session();
\core\session\manager::set_user($user);
}
}
+3
View File
@@ -103,6 +103,9 @@ EOD;
* @return component_generator_base or rather an instance of the appropriate subclass.
*/
public function get_plugin_generator($component) {
// Note: This global is included so that generator have access to it.
// CFG is widely used in require statements.
global $CFG;
list($type, $plugin) = core_component::normalize_component($component);
$cleancomponent = $type . '_' . $plugin;
if ($cleancomponent != $component) {
+1 -2
View File
@@ -240,8 +240,7 @@ Feature: Initials bar
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled |
| assign | C1 | assign1 | TestAssignment | Test assignment description | 0 | 0 |
And I am on the "assign1" "Activity" page logged in as "admin"
And I navigate to "Edit settings" in current page administration
And I am on the "assign1" "assign Activity editing" page logged in as "admin"
And I expand all fieldsets
And I set the field "Completion tracking" to "1"
And I click on "Save and return to course" "button"
+81 -19
View File
@@ -543,7 +543,9 @@ class behat_navigation extends behat_base {
*
* For pages belonging to core, the 'core > ' bit is omitted.
*
* @When I am on the :page page
* @When /^I am on the (?<page>[^ "]*) page$/
* @When /^I am on the "(?<page>[^"]*)" page$/
*
* @param string $page the component and page name.
* E.g. 'Admin notifications' or 'core_user > Preferences'.
* @throws Exception if the specified page cannot be determined.
@@ -561,7 +563,11 @@ class behat_navigation extends behat_base {
* but with the advantage that you go straight to the desired page, without
* having to wait for the Dashboard to load.
*
* @When I am on the :page page logged in as :username
* @When /^I am on the (?<page>[^ "]*) page logged in as (?<username>[^ "]*)$/
* @When /^I am on the "(?<page>[^"]*)" page logged in as (?<username>[^ "]*)$/
* @When /^I am on the (?<page>[^ "]*) page logged in as "(?<username>[^ "]*)"$/
* @When /^I am on the "(?<page>[^"]*)" page logged in as "(?<username>[^ "]*)"$/
*
* @param string $page the type of page. E.g. 'Admin notifications' or 'core_user > Preferences'.
* @param string $username the name of the user to log in as. E.g. 'admin'.
* @throws Exception if the specified page cannot be determined.
@@ -622,7 +628,11 @@ class behat_navigation extends behat_base {
*
* For pages belonging to core, the 'core > ' bit is omitted.
*
* @When I am on the :identifier :type page
* @When /^I am on the (?<identifier>[^ "]*) (?<type>[^ "]*) page$/
* @When /^I am on the "(?<identifier>[^"]*)" "(?<type>[^"]*)" page$/
* @When /^I am on the (?<identifier>[^ "]*) "(?<type>[^"]*)" page$/
* @When /^I am on the "(?<identifier>[^"]*)" (?<type>[^ "]*) page$/
*
* @param string $identifier identifies the particular page. E.g. 'Test quiz'.
* @param string $type the component and page type. E.g. 'mod_quiz > View'.
* @throws Exception if the specified page cannot be determined.
@@ -640,7 +650,15 @@ class behat_navigation extends behat_base {
* but with the advantage that you go straight to the desired page, without
* having to wait for the Dashboard to load.
*
* @When I am on the :identifier :type page logged in as :username
* @When /^I am on the (?<identifier>[^ "]*) (?<type>[^ "]*) page logged in as (?<username>[^ "]*)$/
* @When /^I am on the "(?<identifier>[^"]*)" "(?<type>[^"]*)" page logged in as (?<username>[^ "]*)$/
* @When /^I am on the (?<identifier>[^ "]*) "(?<type>[^"]*)" page logged in as (?<username>[^ "]*)$/
* @When /^I am on the "(?<identifier>[^"]*)" (?<type>[^ "]*) page logged in as (?<username>[^ "]*)$/
* @When /^I am on the (?<identifier>[^ "]*) (?<type>[^ "]*) page logged in as "(?<username>[^"]*)"$/
* @When /^I am on the "(?<identifier>[^"]*)" "(?<type>[^"]*)" page logged in as "(?<username>[^"]*)"$/
* @When /^I am on the (?<identifier>[^ "]*) "(?<type>[^"]*)" page logged in as "(?<username>[^"]*)"$/
* @When /^I am on the "(?<identifier>[^"]*)" (?<type>[^ "]*) page logged in as "(?<username>[^"]*)"$/
*
* @param string $identifier identifies the particular page. E.g. 'Test quiz'.
* @param string $type the component and page type. E.g. 'mod_quiz > View'.
* @param string $username the name of the user to log in as. E.g. 'student'.
@@ -697,10 +715,17 @@ class behat_navigation extends behat_base {
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
*
* Recognised page names are:
* | Page type | Identifier meaning | description |
* | Category page | category idnumber | List of courses in that category. |
* | Course | course shortname | Main course home pag |
* | Activity | activity idnumber | Start page for that activity |
* | Page type | Identifier meaning | description |
* | Category | category idnumber | List of courses in that category. |
* | Course | course shortname | Main course home pag |
* | Activity | activity idnumber | Start page for that activity |
* | Activity editing | activity idnumber | Edit settings page for that activity |
* | [modname] Activity | activity name or idnumber | Start page for that activity |
* | [modname] Activity editing | activity name or idnumber | Edit settings page for that activity |
*
* Examples:
*
* When I am on the "Welcome to ECON101" "forum activity" page logged in as student1
*
* @param string $type identifies which type of page this is, e.g. 'Category page'.
* @param string $identifier identifies the particular page, e.g. 'test-cat'.
@@ -710,33 +735,70 @@ class behat_navigation extends behat_base {
protected function resolve_core_page_instance_url(string $type, string $identifier): moodle_url {
global $DB;
$type = strtolower($type);
switch ($type) {
case 'Category page':
$categoryid = $DB->get_field('course_categories', 'id', ['idnumber' => $identifier]);
case 'category':
$categoryid = $this->get_category_id($identifier);
if (!$categoryid) {
throw new Exception('The specified category with idnumber "' . $identifier . '" does not exist');
}
return new moodle_url('/course/category.php', ['id' => $categoryid]);
return new moodle_url('/course/index.php', ['categoryid' => $categoryid]);
case 'Course':
$courseid = $DB->get_field_select('course', 'id', 'shortname = ?', [$identifier], IGNORE_MISSING);
case 'course':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/course/view.php', ['id' => $courseid]);
case 'Activity':
$cm = $DB->get_record('course_modules', ['idnumber' => $identifier], 'id, course', IGNORE_MISSING);
case 'activity':
$cm = $this->get_course_module_for_identifier($identifier);
if (!$cm) {
throw new Exception('The specified activity with idnumber "' . $identifier . '" does not exist');
}
$modinfo = get_fast_modinfo($cm->course);
return $modinfo->cms[$cm->id]->url;
return $cm->url;
default:
throw new Exception('Unrecognised core page type "' . $type . '."');
case 'activity editing':
$cm = $this->get_course_module_for_identifier($identifier);
if (!$cm) {
throw new Exception('The specified activity with idnumber "' . $identifier . '" does not exist');
}
return new moodle_url('/course/modedit.php', [
'update' => $cm->id,
]);
}
$parts = explode(' ', $type);
if (count($parts) > 1) {
if ($parts[1] === 'activity') {
$modname = $parts[0];
$cm = $this->get_cm_by_activity_name($modname, $identifier);
if (count($parts) == 2) {
// View page.
return new moodle_url($cm->url);
}
if ($parts[2] === 'editing') {
// Edit settings page.
return new moodle_url('/course/modedit.php', ['update' => $cm->id]);
}
if ($parts[2] === 'roles') {
// Locally assigned roles page.
return new moodle_url('/admin/roles/assign.php', ['contextid' => $cm->context->id]);
}
if ($parts[2] === 'permissions') {
// Permissions page.
return new moodle_url('/admin/roles/permissions.php', ['contextid' => $cm->context->id]);
}
}
}
throw new Exception('Unrecognised core page type "' . $type . '."');
}
/**
+1 -3
View File
@@ -12,9 +12,7 @@ Feature: Any day / month / year combination in date form elements works ok.
And the following "activity" exist:
| activity | name | intro | course | idnumber |
| assign | Assignment 01 | Assign activity to test some dates | C1 | assign01 |
Given I am on the "C1" "Course" page logged in as "admin"
And I follow "Assignment 01"
And I navigate to "Edit settings" in current page administration
And I am on the "Assignment 01" "assign activity editing" page logged in as admin
And I expand all fieldsets
And I set the field "Due date" to "<initial_date>"
And I set the field "Due date" to "<final_date>"
+5 -6
View File
@@ -31,12 +31,11 @@ Feature: Override permissions on a context
Then "Add announcementsmod/forum:addnews" row "Prohibited" column of "permissions" table should contain "Student"
Scenario: Module capabilities overrides
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Forum 1 |
And I follow "Forum 1"
And I navigate to "Permissions" in current page administration
Given the following "activity" exists:
| course | C1 |
| activity | forum |
| name | Forum 1 |
And I am on the "Forum 1" "forum activity permissions" page logged in as admin
When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row"
And I press "Student"
Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student"
+45 -93
View File
@@ -262,7 +262,6 @@ class core_filelib_testcase extends advanced_testcase {
public function test_curl_redirects() {
global $CFG;
// Test full URL redirects.
$testurl = $this->getExternalTestFileUrl('/test_redir.php');
$curl = new curl();
@@ -273,6 +272,7 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame(2, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
// All redirects are emulated now. Enabling "emulateredirects" explicitly does not have effect.
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?redir=2", array(), array('CURLOPT_MAXREDIRS'=>2));
@@ -282,6 +282,17 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame(2, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
// All redirects are emulated now. Attempting to disable "emulateredirects" explicitly causes warning.
$curl = new curl();
$curl->emulateredirects = false;
$contents = $curl->get("$testurl?redir=2", array(), array('CURLOPT_MAXREDIRS' => 2));
$response = $curl->getResponse();
$this->assertDebuggingCalled('Attempting to disable emulated redirects has no effect any more!');
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(2, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
// This test was failing for people behind Squid proxies. Squid does not
// fully support HTTP 1.1, so converts things to HTTP 1.0, where the name
// of the status code is different.
@@ -301,21 +312,6 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame('', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?redir=3", array(), array('CURLOPT_FOLLOWLOCATION'=>0));
$response = $curl->getResponse();
$this->assertSame($responsecode302, reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(302, $curl->info['http_code']);
$this->assertSame('', $contents);
$curl = new curl();
$contents = $curl->get("$testurl?redir=2", array(), array('CURLOPT_MAXREDIRS'=>1));
$this->assertSame(CURLE_TOO_MANY_REDIRECTS, $curl->get_errno());
$this->assertNotEmpty($contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?redir=2", array(), array('CURLOPT_MAXREDIRS'=>1));
$this->assertSame(CURLE_TOO_MANY_REDIRECTS, $curl->get_errno());
$this->assertNotEmpty($contents);
@@ -332,28 +328,6 @@ class core_filelib_testcase extends advanced_testcase {
@unlink($tofile);
$curl = new curl();
$curl->emulateredirects = true;
$tofile = "$CFG->tempdir/test.html";
@unlink($tofile);
$fp = fopen($tofile, 'w');
$result = $curl->get("$testurl?redir=1", array(), array('CURLOPT_FILE'=>$fp));
$this->assertTrue($result);
fclose($fp);
$this->assertFileExists($tofile);
$this->assertSame('done', file_get_contents($tofile));
@unlink($tofile);
$curl = new curl();
$tofile = "$CFG->tempdir/test.html";
@unlink($tofile);
$result = $curl->download_one("$testurl?redir=1", array(), array('filepath'=>$tofile));
$this->assertTrue($result);
$this->assertFileExists($tofile);
$this->assertSame('done', file_get_contents($tofile));
@unlink($tofile);
$curl = new curl();
$curl->emulateredirects = true;
$tofile = "$CFG->tempdir/test.html";
@unlink($tofile);
$result = $curl->download_one("$testurl?redir=1", array(), array('filepath'=>$tofile));
@@ -363,6 +337,39 @@ class core_filelib_testcase extends advanced_testcase {
@unlink($tofile);
}
/**
* Test that redirects to blocked hosts are blocked.
*/
public function test_curl_blocked_redirect() {
$this->resetAfterTest();
$testurl = $this->getExternalTestFileUrl('/test_redir.php');
// Block a host.
// Note: moodle.com is the URL redirected to when test_redir.php has the param extdest=1 set.
set_config('curlsecurityblockedhosts', 'moodle.com');
// Redirecting to a non-blocked host should resolve.
$curl = new curl();
$contents = $curl->get("{$testurl}?redir=2");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
// Redirecting to the blocked host should fail.
$curl = new curl();
$blockedstring = $curl->get_security()->get_blocked_url_string();
$contents = $curl->get("{$testurl}?redir=1&extdest=1");
$this->assertSame($blockedstring, $contents);
$this->assertSame(0, $curl->get_errno());
// Redirecting to the blocked host after multiple successful redirects should also fail.
$curl = new curl();
$contents = $curl->get("{$testurl}?redir=3&extdest=1");
$this->assertSame($blockedstring, $contents);
$this->assertSame(0, $curl->get_errno());
}
public function test_curl_relative_redirects() {
// Test relative location redirects.
$testurl = $this->getExternalTestFileUrl('/test_relative_redir.php');
@@ -375,15 +382,6 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get($testurl);
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
// Test different redirect types.
$testurl = $this->getExternalTestFileUrl('/test_relative_redir.php');
@@ -396,24 +394,6 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame('done', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?type=301");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
$curl = new curl();
$contents = $curl->get("$testurl?type=302");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?type=302");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
@@ -430,24 +410,6 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame('done', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?type=303");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
$curl = new curl();
$contents = $curl->get("$testurl?type=307");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?type=307");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
@@ -462,16 +424,6 @@ class core_filelib_testcase extends advanced_testcase {
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
$curl = new curl();
$curl->emulateredirects = true;
$contents = $curl->get("$testurl?type=308");
$response = $curl->getResponse();
$this->assertSame('200 OK', reset($response));
$this->assertSame(0, $curl->get_errno());
$this->assertSame(1, $curl->info['redirect_count']);
$this->assertSame('done', $contents);
}
public function test_curl_proxybypass() {
+4
View File
@@ -1,6 +1,10 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.9.9 ===
* For security reasons, filelib has been updated so all requests now use emulated redirects.
For this reason, manually disabling emulateredirects will no longer have any effect (and will generate a debugging message).
=== 3.9.7 ===
* The signature of the get_context_name() function in the abstract class context and all extending classes (such as context_course)
has been extended. The new parameter allows the to get the name without escaped characters.
+13 -11
View File
@@ -840,18 +840,20 @@ class helper {
public static function prevent_unclosed_html_tags(
string $message,
bool $removebody = false
) : string
{
$html = '';
if (!empty($message)) {
$doc = new DOMDocument();
@$doc->loadHTML($message);
$html = $doc->getElementsByTagName('body')->item(0)->C14N(false, true);
if ($removebody) {
// Remove <body> element added in C14N function.
$html = preg_replace('~<(/?(?:body))[^>]*>\s*~i', '', $html);
}
) : string {
$html = '';
if (!empty($message)) {
$doc = new DOMDocument();
$olderror = libxml_use_internal_errors(true);
$doc->loadHTML('<?xml version="1.0" encoding="UTF-8" ?>' . $message);
libxml_clear_errors();
libxml_use_internal_errors($olderror);
$html = $doc->getElementsByTagName('body')->item(0)->C14N(false, true);
if ($removebody) {
// Remove <body> element added in C14N function.
$html = preg_replace('~<(/?(?:body))[^>]*>\s*~i', '', $html);
}
}
return $html;
}
@@ -24,23 +24,17 @@ Feature: Notification popover unread notifications
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
# This should generate a notification.
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I log out
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
Scenario: Notification popover shows correct unread count
When I log in as "student1"
+3
View File
@@ -214,6 +214,9 @@ class core_message_helper_testcase extends advanced_testcase {
'Empty html' => [
'', '', false
],
'Check encoding UTF-8 is working' => [
'<body><h1>Title</h1><p>السلام عليكم</p></body>', '<body><h1>Title</h1><p>السلام عليكم</p></body>', false
],
];
}
}
@@ -20,19 +20,12 @@ Feature: In an assignment, teachers can provide feedback comments on student sub
@javascript
Scenario: Teachers should be able to add and remove feedback comments via the quick grading interface
Given the following "activities" exist:
| activity | course | idnumber | name | assignsubmission_onlinetext_enabled | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment1 | 1 | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment1"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment1"
| activity | course | name | assignsubmission_onlinetext_enabled | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name | 1 | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
Then I click on "Quick grading" "checkbox"
And I set the field "Feedback comments" to "Feedback from teacher."
@@ -18,42 +18,37 @@ Feature: In an assignment, teacher can annotate PDF files during grading
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignfeedback_editpdf_enabled | 1 |
| assignfeedback_comments_enabled | 1 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 102400 |
| maxfilessubmission | 2 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf, mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf |
And I log in as "admin"
And I am on site homepage
And I navigate to "Plugins > Activity modules > Assignment > Feedback plugins > Annotate PDF" in site administration
And I upload "pix/help.png" file to "" filemanager
And I upload "pix/docs.png" file to "" filemanager
When I press "Save changes"
Then I should see "Changes saved"
And I press "Save changes"
And I should see "Changes saved"
And I follow "Test ghostscript path"
And I should see "The ghostscript path appears to be OK"
And I am on site homepage
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I should see "Page 1 of 3"
Then I should see "Page 1 of 3"
And I click on ".navigate-next-button" "css_element"
And I should see "Page 2 of 3"
And I click on ".stampbutton" "css_element"
@@ -102,29 +97,25 @@ Feature: In an assignment, teacher can annotate PDF files during grading
| grouping | group |
| G1 | G1 |
| G1 | G2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
| Students submit in groups | Yes |
| Grouping for student groups | G1 |
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I press "Save changes"
Then I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_editpdf_enabled | 1 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 102400 |
| maxfilessubmission | 2 |
| teamsubmission | 1 |
| grouping | G1 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 2" "table_row"
And I click on "Grade" "link" in the "Student 2" "table_row"
@@ -26,28 +26,22 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
| user | group |
| student1 | G1 |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 1 |
| Students submit in groups | Yes |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
| assignsubmission_file_maxsizebytes | 102400 |
| assignfeedback_editpdf_enabled | 1 |
| submissiondrafts | 0 |
| teamsubmission | 1 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I wait for the complete PDF to load
@@ -65,28 +59,22 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
And I press "OK"
And I click on "Edit settings" "link"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
When I follow "View annotated PDF..."
Then I should see "Annotate PDF"
And I wait until the page is ready
And I click on "Close" "button"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should not see "View annotated PDF..."
@javascript
Scenario: Submit a PDF file as a student and annotate the PDF as a teacher and all students in the group get a copy of the annotated PDF.
Given I press "Save changes"
And I click on "OK" "button"
And I am on "Course 1" course homepage
And I should see "The changes to the grade and feedback were saved"
And I am on the "Test assignment name" Activity page
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
When I follow "View annotated PDF..."
And I change window size to "large"
Then I should see "Annotate PDF"
@@ -94,7 +82,6 @@ Feature: In a group assignment, teacher can annotate PDF files for all users
And I wait until the page is ready
And I click on "Close" "button"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should see "View annotated PDF..."
@@ -18,33 +18,26 @@ Feature: In an assignment, teacher can view the feedback for a previous attempt.
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your PDF file |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
| Additional attempts | Manually |
| Maximum attempts | Unlimited |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.pdf"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| maxattempts | 0 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 102400 |
| assignfeedback_editpdf_enabled | 1 |
| submissiondrafts | 0 |
| attemptreopenmethod | manual |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf, mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Submitted for grading" "table_row"
And I should see "Page 1 of 3"
Then I should see "Page 1 of 3"
And I click on ".navigate-next-button" "css_element"
And I should see "Page 2 of 3"
And I click on ".stampbutton" "css_element"
@@ -25,32 +25,24 @@ Feature: In an assignment, teacher can submit feedback files during grading
| user | group |
| student1 | G1 |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your PDF file |
| Maximum number of uploaded files | 2 |
| Students submit in groups | Yes |
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
And I set the field "assignfeedback_file_enabled" to "1"
And I press "Save and display"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I upload "mod/assign/feedback/file/tests/fixtures/submission.txt" file to "File submissions" filemanager
And I press "Save changes"
And I should see "Submitted for grading"
And I should see "submission.txt"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
| assignsubmission_file_maxsizebytes | 1024 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| maxfilessubmission | 2 |
| teamsubmission | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | mod/assign/feedback/file/tests/fixtures/submission.txt |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I click on "Grade" "link" in the ".submissionlinks" "css_element"
And I upload "mod/assign/feedback/file/tests/fixtures/feedback.txt" file to "Feedback files" filemanager
@@ -61,14 +53,10 @@ Feature: In an assignment, teacher can submit feedback files during grading
And I click on "OK" "button"
And I click on "Course 1" "link" in the "[data-region=assignment-info]" "css_element"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should see "feedback.txt"
And I log out
When I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
Then I should not see "feedback.txt"
@javascript
@@ -77,12 +65,8 @@ Feature: In an assignment, teacher can submit feedback files during grading
And I click on "OK" "button"
And I click on "Course 1" "link" in the "[data-region=assignment-info]" "css_element"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should see "feedback.txt"
And I log out
When I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as student2
Then I should see "feedback.txt"
@@ -22,11 +22,9 @@ Feature: In an assignment, limit submittable file types
@javascript
Scenario: File types validation for an assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1388534400 | 0 | 1 | 1 | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes |
| assign | C1 | Test assignment name | 1388534400 | 0 | 1 | 1 | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
When I set the field "Accepted file types" to "image/png;doesntexist;.anything;unreal/mimetype;nodot"
And I press "Save and display"
@@ -46,11 +44,9 @@ Feature: In an assignment, limit submittable file types
@javascript @_file_upload
Scenario: Uploading permitted file types for an assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1388534400 | 0 | 1 | 3 | 0 | image/png,spreadsheet,.xml,.txt |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | Test assignment name | 1388534400 | 0 | 1 | 3 | 0 | image/png,spreadsheet,.xml,.txt |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I should see "Accepted file types"
And I should see "Image (PNG)"
@@ -67,11 +63,9 @@ Feature: In an assignment, limit submittable file types
@javascript @_file_upload
Scenario: No filetypes allows all
Given the following "activities" exist:
| activity | course | idnumber | name | intro | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1388534400 | 0 | 1 | 2 | 0 | |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | duedate | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | assignsubmission_file_maxfiles | assignsubmission_file_maxsizebytes | assignsubmission_file_filetypes |
| assign | C1 | Test assignment name | 1388534400 | 0 | 1 | 2 | 0 | |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I should not see "Accepted file types"
And I upload "lib/tests/fixtures/gd-logo.png" file to "File submissions" filemanager
@@ -0,0 +1,69 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once("{$CFG->dirroot}/mod/assign/tests/generator/assignsubmission_subplugin_generator.php");
/**
* Online Text assignment submission subplugin data generator.
*
* @package assignsubmission_file
* @category test
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class assignsubmission_file_generator extends assignsubmission_subplugin_generator {
/**
* Add submission data in the correct format for a call to `assign::save_submission()` from a table containing
* submission data for a single activity.
*
* Data should be added to the $submission object passed into the function.
*
* @param stdClass $submission The submission record to be modified
* @param assign $assign The assignment being submitted to
* @param array $data The data received
*/
public function add_submission_data(stdClass $submission, assign $assign, array $data): void {
global $CFG;
if (array_key_exists('file', $data)) {
$files = explode(',', $data['file']);
$itemid = file_get_unused_draft_itemid();
$fs = get_file_storage();
foreach ($files as $filepath) {
// All paths are relative to $CFG->dirroot.
$filepath = trim($filepath);
$filepath = "{$CFG->dirroot}/{$filepath}";
$filename = basename($filepath);
$fs->create_file_from_pathname((object) [
'itemid' => $itemid,
'contextid' => context_user::instance($submission->userid)->id,
'component' => 'user',
'filearea' => 'draft',
'filepath' => '/',
'filename' => $filename,
], $filepath);
}
$submission->files_filemanager = $itemid;
$submission->file_editor = [
'itemid' => $itemid,
];
}
}
}
@@ -0,0 +1,47 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once("{$CFG->dirroot}/mod/assign/tests/generator/assignsubmission_subplugin_generator.php");
/**
* Online Text assignment submission subplugin data generator.
*
* @package assignsubmission_onlinetext
* @category test
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class assignsubmission_onlinetext_generator extends assignsubmission_subplugin_generator {
/**
* Add submission data in the correct format for a call to `assign::save_submission()` from a table containing
* submission data for a single activity.
*
* Data should be added to the $submission object passed into the function.
*
* @param stdClass $submission The submission record to be modified
* @param assign $assign The assignment being submitted to
* @param array $data The data received
*/
public function add_submission_data(stdClass $submission, assign $assign, array $data): void {
if (array_key_exists('onlinetext', $data)) {
$submission->onlinetext_editor = [
'itemid' => file_get_unused_draft_itemid(),
'text' => $data['onlinetext'],
'format' => FORMAT_HTML,
];
}
}
}
@@ -9,35 +9,29 @@ Feature: In an assignment, students start a new attempt based on their previous
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| attemptreopenmethod | manual |
| hidegrader | 1 |
| submissiondrafts | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Additional attempts | Manually |
| Hide grader identity from students | Yes |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -46,16 +40,14 @@ Feature: In an assignment, students start a new attempt based on their previous
And I press "OK"
And I click on "Edit settings" "link"
And I log out
Then I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I should not see "Teacher 1"
When I am on the "Test assignment name" Activity page logged in as student1
Then I should not see "Teacher 1"
And I press "Add a new attempt based on previous submission"
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I should see "I'm the student first submission"
@@ -89,29 +81,24 @@ Feature: In an assignment, students start a new attempt based on their previous
| student2 | G1 |
| student3 | G2 |
| student4 | G2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Additional attempts | Manually |
| Maximum attempts | 3 |
| Group mode | Separate groups |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| attemptreopenmethod | manual |
| submissiondrafts | 0 |
| groupmode | 1 |
| teamsubmission | 1 |
| hidegrader | 1 |
| maxattempts | 3 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
@@ -129,18 +116,15 @@ Feature: In an assignment, students start a new attempt based on their previous
And I click on "Go" "button" confirming the dialogue
And I should not see "The grades were not saved because someone has modified one or more records more recently than when you loaded the page."
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student3
And I should see "This is attempt 1 ( 3 attempts allowed )."
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's 3 group 2 first attempt |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And "Student 1" row "Status" column of "generaltable" table should contain "Reopened"
And "Student 2" row "Status" column of "generaltable" table should contain "Reopened"
@@ -153,18 +137,16 @@ Feature: In an assignment, students start a new attempt based on their previous
And I press "OK"
And I follow "Assignment: Test assignment name"
And I log out
And I log in as "student4"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student4
And I should see "This is attempt 2 ( 3 attempts allowed )."
And I press "Add a new attempt"
And I set the following fields to these values:
| Online text | I'm the student's 4 group 2 second attempt |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I select "Group 2" from the "group" singleselect
And I click on "Grade" "link" in the ".submissionlinks" "css_element"
And I should see "2" in the "#id_attemptsettings" "css_element"
@@ -1,7 +1,7 @@
@mod @mod_assign
Feature: Switch role does not cause an error message in assignsubmission_comments
Background:
Scenario: I switch role to student and an error doesn't occur
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
@@ -11,15 +11,14 @@ Feature: Switch role does not cause an error message in assignsubmission_comment
And the following "course enrolments" exist:
| course | user | role |
| C1 | teacher1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment |
| Description | This is the description text |
| Students submit in groups | Yes |
Scenario: I switch role to student and an error doesn't occur
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment |
| intro | This is the description text |
| teamsubmission | 1 |
| submissiondrafts | 0 |
And I am on the "C1" Course page logged in as teacher1
When I follow "Switch role to..." in the user menu
And I press "Student"
And I follow "Test assignment"
@@ -22,48 +22,43 @@ Feature: Assign reset
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
Scenario: Use course reset to clear all attempt data
When I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
Then I should see "Submitted for grading"
Given the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as student1
And I should see "Submitted for grading"
And I should see "I'm the student first submission"
And I should see "Not graded"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Submitted for grading"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
When I navigate to "Reset" in current page administration
And I set the following fields to these values:
| Delete all submissions | 1 |
And I press "Reset course"
And I press "Continue"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page
And I navigate to "View all submissions" in current page administration
Then I should not see "Submitted for grading"
@javascript
Scenario: Use course reset to remove user overrides.
When I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
@@ -88,7 +83,7 @@ Feature: Assign reset
Then I should not see "Sam1 Student1"
Scenario: Use course reset to remove group overrides.
When I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
@@ -113,7 +108,7 @@ Feature: Assign reset
Then I should not see "Group 1"
Scenario: Use course reset to reset blind marking assignment.
Given I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| blindmarking | 1 |
@@ -30,21 +30,19 @@ Feature: Assign group override
| student2 | G2 |
| student3 | G1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | assign1 | 1 |
| activity | name | intro | course | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | 1 |
Scenario: Add, modify then delete a group override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Group overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
| Override group | Group 1 |
| Due date | ##1 Jan 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "Edit" "link" in the "Group 1" "table_row"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "Edit" "link" in the "Group 1" "table_row"
And I set the following fields to these values:
| Due date | ##1 Jan 2030 08:00## |
And I press "Save"
@@ -54,17 +52,15 @@ Feature: Assign group override
And I should not see "Group 1"
Scenario: Duplicate a user override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Group overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
| Override group | Group 1 |
| Due date | ##1 Jan 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "copy" "link"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "copy" "link"
And I set the following fields to these values:
| Override group | Group 2 |
| Due date | ##1 Jan 2030 08:00## |
@@ -73,10 +69,8 @@ Feature: Assign group override
And I should see "Group 2"
Scenario: Allow a group to have a different due date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | disabled |
| Due date | ##1 Jan 2000 08:00## |
@@ -101,10 +95,8 @@ Feature: Assign group override
And I should see "Wednesday, 1 January 2020, 8:00"
Scenario: Allow a group to have a different cut off date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | disabled |
@@ -129,10 +121,8 @@ Feature: Assign group override
And I should see "You have not made a submission yet."
Scenario: Allow a group to have a different start date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | ##1 January 2030 08:00## |
@@ -159,10 +149,8 @@ Feature: Assign group override
@javascript
Scenario: Add both a user and group override and verify that both are applied correctly
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | ##1 January 2040 08:00## |
@@ -204,12 +192,10 @@ Feature: Assign group override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "Group overrides" in current page administration
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
Then I should see "No groups you can access."
And the "Add group override" "button" should be disabled
@@ -219,15 +205,13 @@ Feature: Assign group override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "group members" exist:
| user | group |
| teacher1 | G1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "Group overrides" in current page administration
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "Group overrides" in current page administration
And I press "Add group override"
Then the "Override group" select box should contain "Group 1"
And the "Override group" select box should not contain "Group 2"
@@ -238,14 +222,12 @@ Feature: Assign group override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "group members" exist:
| user | group |
| teacher1 | G1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I am on the "Assignment 2" Activity page logged in as admin
And I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
@@ -257,9 +239,8 @@ Feature: Assign group override
| Allow submissions from | ##1 January 2020 08:00## |
And I press "Save"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
When I am on the "Assignment 2" Activity page logged in as teacher1
And I navigate to "Group overrides" in current page administration
Then I should see "Group 1" in the ".generaltable" "css_element"
And I should not see "Group 2" in the ".generaltable" "css_element"
+22 -20
View File
@@ -1,7 +1,7 @@
@mod @mod_assign @javascript
@mod @mod_assign
Feature: When a Teacher hides an assignment from view for students it should consistently indicate it is hidden.
Scenario: Grade multiple students on one page
Background: Grade multiple students on one page
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
@@ -13,26 +13,28 @@ Feature: When a Teacher hides an assignment from view for students it should con
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test hidden assignment |
And I open "Test hidden assignment" actions menu
And I choose "Hide" in the open action menu
And I follow "Test hidden assignment"
And I should see "Test hidden assignment"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test hidden assignment |
| visible | 0 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test visible assignment |
Scenario: A teacher can view a hidden assignment
When I am on the "Test hidden assignment" Activity page logged in as teacher1
Then I should see "Test hidden assignment"
And I should see "Yes" in the "Hidden from students" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "2" and I fill the form with:
| Assignment name | Test visible assignment |
And I follow "Test visible assignment"
And I should see "Test visible assignment"
Scenario: A teacher can view a visible assignment
Given I am on the "Test visible assignment" Activity page logged in as teacher1
Then I should see "Test visible assignment"
And I should see "No" in the "Hidden from students" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
Scenario: A student cannot view a hidden assignment
And I am on the "C1" Course page logged in as student1
And I should not see "Test hidden assignment"
And I should see "Test visible assignment"
And I log out
@@ -6,36 +6,34 @@ Feature: Assignment with no calendar capabilites
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "admin"
And I am on "Course 1" course homepage
| user | course | role |
| teacher1 | C1 | editingteacher |
And I am on the "C1" Course page logged in as admin
And I navigate to "Users > Permissions" in current page administration
And I override the system permissions of "Teacher" role with:
| capability | permission |
| moodle/calendar:manageentries | Prohibit |
And I log out
| capability | permission |
| moodle/calendar:manageentries | Prohibit |
Scenario: Editing an assignment
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
Given the following "activities" exist:
| activity | name | intro | course | section |
| assign | Test assignment name | Test assignment description | C1 | 1 |
And I am on the "Test assignment name" Activity page
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | ##1 January 2017## |
| Due date | ##1 February 2017## |
| Cut-off date | ##2 February 2017## |
| Remind me to grade by | ##1 March 2017## |
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | ##1 January 2018## |
@@ -19,22 +19,20 @@ Feature: Assign user override
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | assign1 | 1 |
| activity | name | intro | course | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | 1 |
@javascript
Scenario: Add, modify then delete a user override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "User overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |
| Due date | ##first day of January 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "Edit" "link" in the "Sam1 Student1" "table_row"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "Edit" "link" in the "Sam1 Student1" "table_row"
And I set the following fields to these values:
| Due date | ##first day of January 2030 08:00## |
And I press "Save"
@@ -45,17 +43,15 @@ Feature: Assign user override
@javascript
Scenario: Duplicate a user override
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "User overrides" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
| Override user | Student1 |
| Due date | ##2020-01-01 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I click on "copy" "link"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I click on "copy" "link"
And I set the following fields to these values:
| Override user | Student2 |
| Due date | ##2030-01-01 08:00## |
@@ -65,10 +61,8 @@ Feature: Assign user override
@javascript
Scenario: Allow a user to have a different due date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | disabled |
| Due date | ##1 Jan 2000 08:00## |
@@ -80,7 +74,7 @@ Feature: Assign user override
| Override user | Student1 |
| Due date | ##1 Jan 2020 08:00## |
And I press "Save"
And I should see "Wednesday, 1 January 2020, 8:00"
Then I should see "Wednesday, 1 January 2020, 8:00"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
@@ -94,10 +88,8 @@ Feature: Assign user override
@javascript
Scenario: Allow a user to have a different cut off date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | disabled |
@@ -123,10 +115,8 @@ Feature: Assign user override
@javascript
Scenario: Allow a user to have a different start date
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
Given I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Due date | disabled |
| Allow submissions from | ##1 January 2030 08:00## |
@@ -155,12 +145,10 @@ Feature: Assign user override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "User overrides" in current page administration
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
Then I should see "No groups you can access."
And the "Add user override" "button" should be disabled
@@ -170,8 +158,8 @@ Feature: Assign user override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@@ -181,10 +169,8 @@ Feature: Assign user override
| teacher1 | G1 |
| student1 | G1 |
| student2 | G2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "User overrides" in current page administration
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
And I press "Add user override"
Then the "Override user" select box should contain "Sam1 Student1, student1@example.com"
And the "Override user" select box should not contain "Sam2 Student2, student2@example.com"
@@ -196,8 +182,8 @@ Feature: Assign user override
| capability | permission | role | contextlevel | reference |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | assign2 | 1 |
| activity | name | intro | course | groupmode |
| assign | Assignment 2 | Assignment 2 description | C1 | 1 |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@@ -207,9 +193,7 @@ Feature: Assign user override
| teacher1 | G1 |
| student1 | G1 |
| student2 | G2 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I am on the "Assignment 2" Activity page logged in as admin
And I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
@@ -221,18 +205,15 @@ Feature: Assign user override
| Allow submissions from | ##first day of January 2015 08:00## |
And I press "Save"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment 2"
And I navigate to "User overrides" in current page administration
And I am on the "Assignment 2" Activity page logged in as teacher1
When I navigate to "User overrides" in current page administration
Then I should see "Student1" in the ".generaltable" "css_element"
And I should not see "Student2" in the ".generaltable" "css_element"
But I should not see "Student2" in the ".generaltable" "css_element"
@javascript
Scenario: Create a user override when the assignment is not available to the student
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test assignment name"
Given I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And I set the field "Availability" to "Hide from students"
@@ -6,56 +6,42 @@ Feature: Bulk remove submissions
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 0 |
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@javascript
Scenario: Bulk remove submissions should remove the data that was submitted
Given I log in as "admin"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
And I log in as "admin"
And I set the following system permissions of "Teacher" role:
| capability | permission |
| mod/assign:editothersubmission | Allow |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
@@ -65,45 +51,30 @@ Feature: Bulk remove submissions
Then I should not see "I'm the student1 submission"
And I should not see "I'm the student2 submission"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student1 submission"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should not see "I'm the student2 submission1"
@javascript
Scenario: Bulk remove submissions should be unavailable if the user is missing the editing submission capability
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
@@ -113,45 +84,33 @@ Feature: Bulk remove submissions
@javascript
Scenario: Notification should be displayed when non-group users are selected for submission bulk removal
in separate group mode
Given I log in as "admin"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
And I log in as "admin"
And I set the following system permissions of "Teacher" role:
| capability | permission |
| mod/assign:editothersubmission | Allow |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
And I set the field "selectall" to "1"
When I set the field "operation" to "Remove submission"
And I click on "Go" "button" confirming the dialogue
Then I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
And I should see "The submission of Student 1 cannot be removed"
@@ -159,44 +118,30 @@ Feature: Bulk remove submissions
@javascript
Scenario: Bulk remove submission when group users are added to the bulk
removing submissions process in separate group mode
removing submissions process in separate group mode
Given the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G1 |
| user | group |
| student1 | G1 |
| student2 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
| Test assignment name | student2 | I'm the student2 submission |
And I log in as "admin"
And I set the following system permissions of "Teacher" role:
| capability | permission |
| mod/assign:editothersubmission | Allow |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "I'm the student1 submission"
And I should see "I'm the student2 submission"
+17 -25
View File
@@ -17,28 +17,21 @@ Feature: In an assignment, teachers can edit a students submission inline
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -57,9 +50,8 @@ Feature: In an assignment, teachers can edit a students submission inline
And I should see "I'm the teacher feedback" in the "Student 1" "table_row"
And I should see "empty.txt" in the "Student 1" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as student1
And I should see "Submitted for grading" in the "Submission status" "table_row"
And I should see "Graded" in the "Grading status" "table_row"
And I should see "I'm the student first submission" in the "Online text" "table_row"
@@ -20,18 +20,19 @@ Feature: Check that the assignment grade can not be input in a wrong format.
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
Then I navigate to "View all submissions" in current page administration
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50,,6"
And I press "Save changes"
And I should see "The grade provided could not be understood: 50,,6"
Then I should see "The grade provided could not be understood: 50,,6"
@javascript
Scenario: Error in the decimal separator .
@@ -49,15 +50,16 @@ Feature: Check that the assignment grade can not be input in a wrong format.
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
Then I navigate to "View all submissions" in current page administration
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50..6"
And I press "Save changes"
And I should see "The grade provided could not be understood: 50..6"
Then I should see "The grade provided could not be understood: 50..6"
+22 -20
View File
@@ -18,15 +18,16 @@ Feature: Check that the assignment grade can be updated correctly
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
| name | course | idnumber |
| Group 1 | C1 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
Then I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50"
@@ -54,16 +55,17 @@ Feature: Check that the assignment grade can be updated correctly
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Use marking workflow | Yes |
| Students submit in groups | Yes |
| Group mode | No groups |
When I follow "Test assignment name"
Then I navigate to "View all submissions" in current page administration
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| markingworkflow | 1 |
| submissiondrafts | 0 |
| teamsubmission | 1 |
| groupmode | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "50"
And I set the field "Notify students" to "0"
@@ -72,4 +74,4 @@ Feature: Check that the assignment grade can be updated correctly
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I navigate to "View all submissions" in current page administration
And "Student 1" row "Grade" column of "generaltable" table should contain "50.00"
Then "Student 1" row "Grade" column of "generaltable" table should contain "50.00"
@@ -19,26 +19,19 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignfeedback_comments_enabled | 1 |
| Additional attempts | Manually |
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignfeedback_comments_enabled | 1 |
| submissiondrafts | 0 |
| attemptreopenmethod | manual |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student2 | I'm the student first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 2" "table_row"
And I set the following fields to these values:
@@ -49,14 +42,12 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
And I click on "OK" "button"
And I click on "Edit settings" "link"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should see "I'm the teacher first feedback" in the "Feedback comments" "table_row"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 2" "table_row"
And I click on "View a different attempt" "link"
@@ -69,10 +60,9 @@ Feature: In an assignment, teachers can edit feedback for a students previous su
And I click on "OK" "button"
And I click on "Edit settings" "link"
And I log out
Then I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I should see "I'm the teacher second feedback" in the "Feedback comments" "table_row"
And I am on the "Test assignment name" Activity page logged in as student2
Then I should see "I'm the teacher second feedback" in the "Feedback comments" "table_row"
And I should see "50.00"
And I click on ".mod-assign-history-link" "css_element"
And I should not see "I'm the teacher second feedback" in the "Feedback comments" "table_row"
@@ -14,25 +14,18 @@ Feature: In an assignment, the administrator can edit students' submissions
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| groupmode | No groups |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as admin
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I choose "Edit submission" in the open action menu
+11 -12
View File
@@ -17,18 +17,17 @@ Feature: In an assignment, students can upload files for assessment
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 0 |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 0 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 1000000 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"
+13 -14
View File
@@ -21,16 +21,17 @@ Feature: In an assignment, teachers can filter displayed submissions by assigned
| student1 | C1 | student |
| student2 | C1 | student |
| marker1 | C1 | teacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Use marking workflow | Yes |
| Use marking allocation | Yes |
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| markingworkflow | 1 |
| markingallocation | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "allocatedmarker" to "Marker 1"
@@ -38,10 +39,8 @@ Feature: In an assignment, teachers can filter displayed submissions by assigned
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page
And I navigate to "View all submissions" in current page administration
And I set the field "markerfilter" to "Marker 1"
Then I should see "Student 1"
@@ -25,8 +25,7 @@ Feature: In an assignment, teachers can change filters in the grading app
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| idnumber | assign |
| name | Test assignment name & |
| description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
@@ -35,21 +34,15 @@ Feature: In an assignment, teachers can change filters in the grading app
@javascript
Scenario: Set filters in the grading table and see them in the grading app
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given I am on the "Test assignment name &" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "allocatedmarker" to "Marker 1"
And I set the field "workflowstate" to "In marking"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name &" Activity page
And I navigate to "View all submissions" in current page administration
And I set the field "filter" to "Not submitted"
And I set the field "markerfilter" to "Marker 1"
@@ -61,21 +54,15 @@ Feature: In an assignment, teachers can change filters in the grading app
@javascript
Scenario: Set filters in the grading app and see them in the grading table
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given I am on the "Test assignment name &" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "allocatedmarker" to "Marker 1"
And I set the field "workflowstate" to "In marking"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name &" Activity page
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I click on "[data-region=user-filters]" "css_element"
+38 -77
View File
@@ -21,30 +21,21 @@ Feature: View the grading status of an assignment
@javascript
Scenario: View the grading status for an assignment with marking workflow enabled
# Add the assignment.
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Online text | 1 |
| Use marking workflow | Yes |
And I log out
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| markingworkflow | 1 |
| assignfeedback_comments_enabled | 1 |
| assignsubmission_onlinetext_enabled | 1 |
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test assignment name"
Then I should not see "Feedback"
And I should see "Not marked" in the "Grading status" "table_row"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
# Mark the submission.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Not marked" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -57,23 +48,17 @@ Feature: View the grading status of an assignment
And I set the field "Feedback comments" to "Great job! Lol, not really."
And I set the field "Notify students" to "0"
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I should see "In review" in the "Student 1" "table_row"
And I log out
# View the grading status as a student.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "In review" in the "Grading status" "table_row"
And I should not see "Great job! Lol, not really."
And I log out
# Mark the submission again but set the marking workflow to 'Released'.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "In review" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -87,16 +72,12 @@ Feature: View the grading status of an assignment
And I should see "Released" in the "Student 1" "table_row"
And I log out
# View the grading status as a student.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "Released" in the "Grading status" "table_row"
And I should see "Great job! Lol, not really."
And I log out
# Now, change the status from 'Released' to 'In marking' (this will remove the grade from the gradebook).
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Released" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -104,9 +85,7 @@ Feature: View the grading status of an assignment
And I set the field "Marking workflow state" to "In marking"
And I set the field "Notify students" to "0"
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I should see "In marking" in the "Student 1" "table_row"
# The grade should also remain displayed as it's stored in the assign DB tables, but the final grade should be empty.
@@ -116,34 +95,24 @@ Feature: View the grading status of an assignment
And I click on "Change filters" "link"
And I set the field "Workflow filter" to "In review"
And I should see "0 of 0"
And I follow "Test assignment name"
And I log out
@javascript
Scenario: View the grading status for an assignment with marking workflow disabled
# Add the assignment.
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Online text | 1 |
And I log out
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignfeedback_comments_enabled | 1 |
| markingworkflow | 0 |
| assignsubmission_onlinetext_enabled | 1 |
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I should not see "Feedback"
And I should see "Not graded" in the "Grading status" "table_row"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student first submission |
# Mark the submission.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should not see "Graded" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -156,30 +125,24 @@ Feature: View the grading status of an assignment
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I should see "Graded" in the "Student 1" "table_row"
And I log out
# View the grading status as a student.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "Graded" in the "Grading status" "table_row"
And I should see "Great job! Lol, not really."
And I log out
# Student makes a subsequent submission.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I press "Edit submission"
And I set the following fields to these values:
| Online text | I'm the student's second submission |
And I press "Save changes"
And I log out
# Teacher marks the submission again after noticing the 'Graded - follow-up submission received'.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Graded - follow-up submission received" in the "Student 1" "table_row"
And I wait "10" seconds
@@ -190,14 +153,12 @@ Feature: View the grading status of an assignment
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I should see "Graded" in the "Student 1" "table_row"
And I log out
# View the grading status as a student again.
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "Graded" in the "Grading status" "table_row"
And I should see "Even better job! Really."
And I log out
+16 -26
View File
@@ -30,11 +30,9 @@ Feature: Grant an extension to an offline student
@javascript
Scenario: Granting an extension to an offline assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Grant extension"
@@ -43,19 +41,16 @@ Feature: Grant an extension to an offline student
And I press "Save changes"
Then I should see "Extension granted until:" in the "Student 1" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should see "Extension due date"
@javascript @_alert
Scenario: Granting extensions to an offline assignment (batch action)
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I set the field "operation" to "Grant extension"
@@ -75,19 +70,16 @@ Feature: Grant an extension to an offline student
And I should see "Extension granted until:" in the "Student 5" "table_row"
And I should see "Extension granted until:" in the "Student 6" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should see "Extension due date"
@javascript
Scenario: Validating that extension date is after due date
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Grant extension"
@@ -105,11 +97,9 @@ Feature: Grant an extension to an offline student
@javascript @_alert
Scenario: Granting extensions to an offline assignment (batch action)
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate |
| assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I set the field "operation" to "Grant extension"
+104 -139
View File
@@ -26,14 +26,14 @@ Feature: Group assignment submissions
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Students submit in groups | Yes |
| Group mode | No groups |
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| teamsubmission | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "//tr[contains(., 'Student 0')][contains(., 'Default group')]" "xpath_element" should exist
And "//tr[contains(., 'Student 1')][contains(., 'Default group')]" "xpath_element" should exist
@@ -48,12 +48,14 @@ Feature: Group assignment submissions
And I set the following fields to these values:
| Group mode | Separate groups |
And I press "Save and display"
And I navigate to "Users > Groups" in current page administration
And I add "Student 0 (student0@example.com)" user to "Group 1" group members
And I add "Student 1 (student1@example.com)" user to "Group 1" group members
And the following "group members" exist:
| user | group |
| student0 | G1 |
| student1 | G1 |
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "View all submissions" in current page administration
And I set the field "Separate groups" to "Group 1"
And "//tr[contains(., 'Student 0')][contains(., 'Group 1')]" "xpath_element" should exist
And "//tr[contains(., 'Student 1')][contains(., 'Group 1')]" "xpath_element" should exist
And I should not see "Student 2"
@@ -89,45 +91,32 @@ Feature: Group assignment submissions
| user | group |
| student1 | G1 |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Group mode | No groups |
| Require group to make submission | No |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| preventsubmissionnotingroup | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 3" row "Status" column of "generaltable" table should not contain "Submitted for grading"
And "Student 4" row "Status" column of "generaltable" table should not contain "Submitted for grading"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student3 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page
And I navigate to "View all submissions" in current page administration
And "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
@@ -160,29 +149,23 @@ Feature: Group assignment submissions
| user | group |
| student1 | G1 |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Additional attempts | Manually |
| Group mode | No groups |
| Require group to make submission | No |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| attemptreopenmethod | manual |
| requireallteammemberssubmit | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -240,57 +223,38 @@ Feature: Group assignment submissions
| grouping | group |
| GG1 | G1 |
| GG1 | G2 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
| Grouping for student groups | Grouping 1 |
| Group mode | Separate groups |
| Require group to make submission | No |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's 1 submission |
And I press "Save changes"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's 3 submission |
And I press "Save changes"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's 5 submission |
And I press "Save changes"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
# Groupmode 1 = Separate Groups
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| attemptreopenmethod | manual |
| requireallteammemberssubmit | 0 |
| groupmode | 1 |
| teamsubmissiongroupingid | GG1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's 1 submission |
| Test assignment name | student3 | I'm the student's 3 submission |
| Test assignment name | student5 | I'm the student's 5 submission |
And I am on the "Test assignment name" Activity page logged in as admin
And I should see "3" in the "Groups" "table_row"
And I should see "3" in the "Submitted" "table_row"
When I set the field "Separate groups" to "Group 1"
And I press "Go"
When I select "Group 1" from the "Separate groups" singleselect
Then I should see "1" in the "Groups" "table_row"
And I should see "1" in the "Submitted" "table_row"
And I set the field "Separate groups" to "Group 2"
And I press "Go"
When I select "Group 2" from the "Separate groups" singleselect
And I should see "1" in the "Groups" "table_row"
And I should see "1" in the "Submitted" "table_row"
And I set the field "Separate groups" to "Group 3"
And I press "Go"
When I select "Group 3" from the "Separate groups" singleselect
And I should see "1" in the "Groups" "table_row"
And I should see "1" in the "Submitted" "table_row"
@@ -315,42 +279,43 @@ Feature: Group assignment submissions
| user | group |
| student1 | G1 |
| student2 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Test assignment description |
| submissiondrafts | 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| attemptreopenmethod | manual |
| requireallteammemberssubmit | 0 |
# Groupmode 0 = No Groups
| groupmode | 0 |
| preventsubmissionnotingroup | 0 |
| submissiondrafts | 0 |
| teamsubmission | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Require students to click the submit button | Yes |
| Students submit in groups | Yes |
| Group mode | No groups |
| Require group to make submission | No |
| Require all group members submit | No |
And I am on "Course 1" course homepage
And I add the "Activities" block
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I click on "Assignments" "link" in the "Activities" "block"
And I should see "Submitted for grading"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student2
And I click on "Assignments" "link" in the "Activities" "block"
And I should see "Submitted for grading"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
+25 -36
View File
@@ -17,29 +17,25 @@ Feature: Hide grader identities identity from students
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
# Set up the test assignment
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 0 |
| assignsubmission_file_enabled | 1 |
| Maximum number of uploaded files | 2 |
| Hide grader identity from students | 0 |
And I log out
# Upload to the test assignment
And I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
When I press "Add submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"
And I log out
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| teamsubmission | 1 |
| asignsubmission_onlinetext_enabled | 0 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 2 |
| assignsubmission_file_maxsizebytes | 1000000 |
| assignfeedback_comments_enabled | 1 |
| hidegrader | 0 |
And the following "mod_assign > submission" exists:
| assign | Test assignment name |
| user | student1 |
| file | lib/tests/fixtures/empty.txt |
# Grade the submission and leave feedback
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should not see "Graded" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -54,10 +50,8 @@ Feature: Hide grader identities identity from students
@javascript
Scenario: Hidden grading is disabled.
When I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
And I should see "Graded" in the "Grading status" "table_row"
Given I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Graded" in the "Grading status" "table_row"
And I should see "Catch for us the foxes."
And I should see "Teacher" in the "Graded by" "table_row"
And I log out
@@ -65,19 +59,16 @@ Feature: Hide grader identities identity from students
@javascript
Scenario: Hidden grading is enabled.
# Enable the hidden grader option
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
Given I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
And I set the field "Hide grader identity from students" to "1"
And I press "Save and return to course"
And I log out
# Check the student doesn't see the grader's identity
And I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
And I should see "Graded" in the "Grading status" "table_row"
When I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Graded" in the "Grading status" "table_row"
And I should see "Catch for us the foxes."
And I should not see "Graded by"
And I log out
@@ -87,9 +78,7 @@ Feature: Hide grader identities identity from students
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| mod/assign:showhiddengrader | Allow | student | Course | C1 |
When I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as student1
And I should see "Graded" in the "Grading status" "table_row"
And I should see "Catch for us the foxes."
And I should see "Teacher" in the "Graded by" "table_row"
@@ -17,19 +17,17 @@ Feature: In an assignment, students can add and edit text online
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is more than 10 words. 1 2 3 4 5 6 7 8 9 10. |
@@ -64,17 +62,15 @@ Feature: In an assignment, students can add and edit text online
| student1 | C1 | student |
And the following config values are set as admin:
| autosavefrequency | 1 | editor_atto |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | text submission |
+23 -33
View File
@@ -44,22 +44,19 @@ Feature: Outcome grading
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| Outcome Test | 1 |
| Assignment name | Test assignment name |
| ID number | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| Outcome Test | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I press "Add submission"
And I set the following fields to these values:
| Online text | My online text |
And I press "Save changes"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 0" "table_row"
And I set the following fields to these values:
@@ -67,7 +64,7 @@ Feature: Outcome grading
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
When I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row"
And I should not see "Outcome Test: Excellent" in the "Student 1" "table_row"
@@ -82,40 +79,35 @@ Feature: Outcome grading
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And the following "group members" exist:
| user | group |
| student0 | G1 |
| student1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I add "Student 0 (student0@example.com)" user to "Group 1" group members
And I add "Student 1 (student1@example.com)" user to "Group 1" group members
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| Students submit in groups | Yes |
| Group mode | No groups |
| Outcome Test | 1 |
| Assignment name | Test assignment name |
| Description | Test assignment description |
| ID number | Test assignment name |
| assignsubmission_onlinetext_enabled | 1 |
| Students submit in groups | Yes |
| Group mode | No groups |
| Outcome Test | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I press "Add submission"
And I set the following fields to these values:
| Online text | My online text |
And I press "Save changes"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 0" "table_row"
And I set the following fields to these values:
| Outcome Test: | Excellent |
| Apply grades and feedback to entire group | Yes |
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row"
And I should see "Outcome Test: Excellent" in the "Student 1" "table_row"
@@ -125,9 +117,7 @@ Feature: Outcome grading
| Outcome Test: | Disappointing |
| Apply grades and feedback to entire group | No |
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I am on the "Test assignment name" "assign activity" page
And I navigate to "View all submissions" in current page administration
And I should see "Outcome Test: Excellent" in the "Student 0" "table_row"
And I should see "Outcome Test: Disappointing" in the "Student 1" "table_row"
+6 -10
View File
@@ -16,22 +16,18 @@ Feature: In an assignment, page titles are informative
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | ants1 | History of ants | Tell me the history of ants | 1 |
| activity | course | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | History of ants | Tell me the history of ants | 1 |
Scenario: I view an assignment as a student and take an action
When I log in as "student1"
And I am on "Course 1" course homepage
Then I follow "History of ants"
And "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
When I am on the "History of ants" Activity page logged in as student1
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
And I press "Add submission"
And "title[text() = 'C1: History of ants - Edit submission']" "xpath_element" should exist in the "head" "css_element"
Scenario: I view an assignment as a teacher and take an action
When I log in as "teacher1"
And I am on "Course 1" course homepage
Then I follow "History of ants"
And "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
When I am on the "History of ants" Activity page logged in as teacher1
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
And I navigate to "View all submissions" in current page administration
And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -21,51 +21,45 @@ Feature: Prevent or allow assignment submission changes
@javascript
Scenario: Preventing changes and allowing them again
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
And I press "Save changes"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as student1
And I press "Edit submission"
And I set the following fields to these values:
| Online text | I'm the student submission and he/she edited me |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Prevent submission changes"
Then I should see "Submission changes not allowed"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And "Edit submission" "button" should not exist
And I should see "This assignment is not accepting submissions"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Allow submission changes"
And I should not see "Submission changes not allowed"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "This assignment is not accepting submissions"
And I press "Edit submission"
And I set the following fields to these values:
@@ -76,41 +70,26 @@ Feature: Prevent or allow assignment submission changes
@javascript @_alert
Scenario: Preventing changes and allowing them again (batch action)
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 | 0 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled |
| assign | C1 | Test assignment name | Test assignment description | 1 | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
| Test assignment name | student2 | I'm the student2 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
When I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I click on "Go" "button" confirming the dialogue
Then I should see "Submission changes not allowed" in the "Student 1" "table_row"
And I should see "Submission changes not allowed" in the "Student 2" "table_row"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should not see "Edit submission"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I set the field "selectall" to "1"
And I set the field "id_operation" to "Unlock submissions"
@@ -118,9 +97,8 @@ Feature: Prevent or allow assignment submission changes
And I should not see "Submission changes not allowed" in the "Student 1" "table_row"
And I should not see "Submission changes not allowed" in the "Student 2" "table_row"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I press "Edit submission"
And I set the following fields to these values:
| Online text | I'm the student2 submission and he/she edited me |
+13 -20
View File
@@ -17,27 +17,20 @@ Feature: In an assignment, teachers grade multiple students on one page
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| intro | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I wait until the page is ready
When I click on "Grade" "link" in the "Student 1" "table_row"
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
+20 -23
View File
@@ -23,16 +23,14 @@ I should be able to create an assignment with a due date relative to the course
| student2 | C1 | student | ##yesterday## |
# One assignment, valid for 2 months.
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | Test assignment description | C1 | assign0 | 1 |##first day of -4 months## | ##last day of -3 months## |
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | name | course | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | C1 | 1 | ##first day of -4 months## | ##last day of -3 months## |
When I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Assignment is overdue by:" in the "Time remaining" "table_row"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should not see "Assignment is overdue by:" in the "Time remaining" "table_row"
And I log out
@@ -40,26 +38,25 @@ I should be able to create an assignment with a due date relative to the course
Given the following config values are set as admin:
| enablecourserelativedates | 1 |
And the following "courses" exist:
| fullname | shortname | category | groupmode | relativedatesmode | startdate |
| Course 1 | C1 | 0 | 1 | 1 | ##first day of 4 months ago## |
| fullname | shortname | category | groupmode | relativedatesmode | startdate |
| Course 1 | C1 | 0 | 1 | 1 | ##first day of 4 months ago## |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "course enrolments" exist:
# Two students, one started 4 months ago and one yesterday.
| user | course | role | timestart |
| teacher1 | C1 | editingteacher | ##first day of 4 months ago## |
| student1 | C1 | student | ##first day of 4 months ago## |
| student2 | C1 | student | ##yesterday## |
| user | course | role | timestart |
| teacher1 | C1 | editingteacher | ##first day of 4 months ago## |
| student1 | C1 | student | ##first day of 4 months ago## |
| student2 | C1 | student | ##yesterday## |
# One assignment, valid for 2 months.
And the following "activities" exist:
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | Test assignment description | C1 | assign0 | 1 |##first day of 4 months ago## | ##last day of 3 months ago## |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | name | course | assignsubmission_onlinetext_enabled | timeopen | duedate |
| assign | Test assignment name | C1 | 1 | ##first day of 4 months ago## | ##last day of 3 months ago## |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I should see "after course start" in the "Due date" "table_row"
And I should see "Calculated for each student" in the "Time remaining" "table_row"
When I navigate to "View all submissions" in current page administration
@@ -26,105 +26,85 @@ Feature: Remove a submission
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
Given the following "group members" exist:
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G1 |
@javascript
Scenario: Remove a submission should remove the data that was submitted
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Remove submission"
When I follow "Remove submission"
And I click on "Continue" "button"
Then I should not see "I'm the student submission"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student submission"
@javascript
Scenario: Remove a group submission should remove the data from all group members
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| Students submit in groups | Yes |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| teamsubmission | 1 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Remove submission"
When I follow "Remove submission"
And I click on "Continue" "button"
Then I should not see "I'm the student submission"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student2
And I should not see "I'm the student submission"
@javascript
Scenario: A student can remove their own submission
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student submission |
And I am on the "Test assignment name" Activity page logged in as student1
And I click on "Remove submission" "button"
And I click on "Continue" "button"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
Then I should not see "I'm the student submission"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as student1
And I should not see "I'm the student submission"
@@ -19,26 +19,20 @@ Feature: Submissions are unlocked when a new attempt is given
@javascript
Scenario: A locked submission should unlock when a new attempt is automatically given.
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| Additional attempts | Automatically until pass |
| Grade to pass | 50 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| attemptreopenmethod | untilpass |
| gradepass | 50 |
| submissiondrafts | 0 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
And I follow "Prevent submission changes"
@@ -53,30 +47,23 @@ Feature: Submissions are unlocked when a new attempt is given
@javascript
Scenario: A locked submission should unlock when a new attempt is manually given.
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| Additional attempts | Manually |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student1 submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
Given the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| attemptreopenmethod | manual |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student1 submission |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I open the action menu in "Student 1" "table_row"
When I open the action menu in "Student 1" "table_row"
And I follow "Prevent submission changes"
And I should see "Submission changes not allowed"
Then I should see "Submission changes not allowed"
And I open the action menu in "Student 1" "table_row"
And I follow "Allow another attempt"
Then I should see "Reopened"
And I should see "Reopened"
And I should not see "Submission changes not allowed"
@@ -21,12 +21,13 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
And I follow "Test assignment name"
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "40"
+21 -39
View File
@@ -22,7 +22,6 @@ Feature: Set availability dates for an assignment
| activity | assign |
| course | C1 |
| name | Assignment name |
| idnumber | assign |
| description | Assignment description |
| assignsubmission_file_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
@@ -30,26 +29,21 @@ Feature: Set availability dates for an assignment
| submissiondrafts | 0 |
Scenario: Student cannot submit an assignment prior to the 'allow submissions from' date
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to tomorrow at noon.
And I set the field "Allow submissions from" to "##tomorrow noon##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Assignment name"
When I am on the "Assignment name" Activity page logged in as student1
Then "Add submission" "button" should not exist
And I should see "This assignment will accept submissions from"
And I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##"
Scenario: Student can see the assignment's due date in the course calendar
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to the first day of this month at noon.
@@ -60,17 +54,15 @@ Feature: Set availability dates for an assignment
And I turn editing mode on
And I add the "Calendar" block
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I follow "This month"
When I hover over day "2" of this month in the calendar
Then I should see "C1: Assignment name is due"
@_file_upload
Scenario: Student can submit an assignment before the due date
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to now.
@@ -79,9 +71,8 @@ Feature: Set availability dates for an assignment
And I set the field "Due date" to "##+2 days 5 hours 30 minutes##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
When I am on the "Assignment name" Activity page logged in as student1
And I should see "##+2 days 5 hours 30 minutes##%A, %d %B %Y##" in the "Due date" "table_row"
And I should see "2 days 5 hours" in the "Time remaining" "table_row"
And "Add submission" "button" should exist
@@ -90,18 +81,15 @@ Feature: Set availability dates for an assignment
When I press "Save changes"
Then I should see "Submitted for grading" in the "Submission status" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as teacher1
And I should see "1" in the "Submitted" "table_row"
And I navigate to "View all submissions" in current page administration
And I should see "Submitted for grading" in the "Student 1" "table_row"
@_file_upload
Scenario: Student can submit an assignment after the due date and the submission is marked as late
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to 3 days ago.
@@ -112,9 +100,8 @@ Feature: Set availability dates for an assignment
And I set the field "Cut-off date" to "##tomorrow noon##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as student1
And I should see "##2 days 5 hours 30 minutes ago##%A, %d %B %Y##" in the "Due date" "table_row"
And I should see "Assignment is overdue by: 2 days 5 hours" in the "Time remaining" "table_row"
And "Add submission" "button" should exist
@@ -124,18 +111,15 @@ Feature: Set availability dates for an assignment
Then I should see "Submitted for grading" in the "Submission status" "table_row"
And I should see "Assignment was submitted 2 days 5 hours late" in the "Time remaining" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as teacher1
And I should see "1" in the "Submitted" "table_row"
And I navigate to "View all submissions" in current page administration
And I should see "Submitted for grading" in the "Student 1" "table_row"
And I should see "2 days 5 hours late" in the "Student 1" "table_row"
Scenario: Student cannot submit an assignment after the cut-off date
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
Given I am on the "Assignment name" Activity page logged in as teacher1
And I navigate to "Edit settings" in current page administration
And I follow "Expand all"
# Set 'Allow submissions from' to 3 days ago.
@@ -146,14 +130,12 @@ Feature: Set availability dates for an assignment
And I set the field "Cut-off date" to "##yesterday noon##"
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Assignment name"
When I am on the "Assignment name" Activity page logged in as student1
Then "Add submission" "button" should not exist
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Assignment name"
And I am on the "Assignment name" Activity page logged in as teacher1
And I should see "0" in the "Submitted" "table_row"
And I navigate to "View all submissions" in current page administration
And I should see "No submission" in the "Student 1" "table_row"
@@ -17,32 +17,23 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
# Add the assignment.
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Online text | 1 |
| File submissions | 0 |
| Use marking workflow | Yes |
| Anonymous submissions | Yes |
And I log out
# Add a submission.
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "Test assignment name"
Then I should not see "Feedback"
And I should see "Not marked" in the "Grading status" "table_row"
And I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student's first submission |
And I press "Save changes"
And I log out
And the following "activity" exists:
| activity | assign |
| course | C1 |
| name | Test assignment name |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| assignfeedback_comments_enabled | 1 |
| teamsubmission | 1 |
| markingworkflow | 1 |
| blindmarking | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name | student1 | I'm the student's first submission |
# Mark the submission.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I should see "Not marked" in the "I'm the student's first submission" "table_row"
And I click on "Grade" "link" in the "I'm the student's first submission" "table_row"
@@ -79,8 +70,8 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
And I set the field "Grading action" to "Reveal student identities"
And I press "Continue"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I navigate to "User report" in the course gradebook
Then I should see "50"
And I should see "Great job! Lol, not really."
@@ -107,8 +98,8 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
And I navigate to "View all submissions" in current page administration
And I should see "Released" in the "Student 1" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "C1" Course page logged in as student1
And I navigate to "User report" in the course gradebook
Then I should see "50"
And I should see "Great job! Lol, not really."
@@ -19,11 +19,9 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Student comments an assignment submission
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled |
| assign | C1 | Test assignment name | 1 |
And I am on the "Test assignment name" Activity page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student submission |
@@ -47,16 +45,14 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Teacher can comment on an offline assignment
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name | 0 | 0 | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
When I set the following fields to these values:
| Grade out of 100 | 50 |
| Feedback comments | I'm the teacher feedback |
| Grade out of 100 | 50 |
| Feedback comments | I'm the teacher feedback |
And I press "Save changes"
And I press "OK"
And I click on "Edit settings" "link"
@@ -67,11 +63,9 @@ Feature: In an assignment, students can comment in their submissions
Scenario: Teacher can comment on assignments with a zero grade
Given the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 0 | 0 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
| activity | course | name | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name | 0 | 0 | 1 |
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "View all submissions" in current page administration
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
@@ -11,11 +11,11 @@ Feature: Submit assignment without group
| Course 2 | C2 | 0 | 1 |
| Course 3 | C3 | 0 | 1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | preventsubmissionnotingroup | teamsubmission |
| assign | C1 | assign1 | Allow default group | Test assignment description | 1 | 0 | 1 |
| assign | C1 | assign2 | Require group membership | Test assignment description | 1 | 1 | 1 |
| assign | C2 | assign2 | Require group membership | Test assignment description | 1 | 1 | 1 |
| assign | C3 | assign2 | Require group membership | Test assignment description | 1 | 1 | 1 |
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | preventsubmissionnotingroup | teamsubmission |
| assign | C1 | c1assign1 | Allow default group | Test assignment description | 1 | 0 | 1 |
| assign | C1 | c1assign2 | Require group membership | Test assignment description | 1 | 1 | 1 |
| assign | C2 | c2assign1 | Require group membership | Test assignment description | 1 | 1 | 1 |
| assign | C3 | c3assign1 | Require group membership | Test assignment description | 1 | 1 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
@@ -44,9 +44,7 @@ Feature: Submit assignment without group
| student3 | GC31 |
| student3 | GC32 |
# Student 1 can only submit assignment in course 2.
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Allow default group"
When I am on the "c1assign1" "assign activity" page logged in as student1
Then I should not see "Not a member of any group"
And I should not see "This assignment requires submission in groups. You are not a member of any group"
And I should see "Nothing has been submitted for this assignment"
@@ -57,14 +55,12 @@ Feature: Submit assignment without group
And I press "Submit assignment"
And I press "Continue"
And I should see "Submitted for grading"
And I am on "Course 1" course homepage
And I follow "Require group membership"
And I am on the "c1assign2" "assign activity" page
And I should see "Not a member of any group"
And I should see "This assignment requires submission in groups. You are not a member of any group"
And I should see "Nothing has been submitted for this assignment"
And I should not see "Add submission"
And I am on "Course 2" course homepage
And I follow "Require group membership"
And I am on the "c2assign1" "assign activity" page
And I should not see "Not a member of any group"
And I should see "Nothing has been submitted for this assignment"
And I press "Add submission"
@@ -76,18 +72,13 @@ Feature: Submit assignment without group
And I should see "Submitted for grading"
And I log out
# Student 2 should see submitted for grading.
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "Allow default group"
And I am on the "c1assign1" "assign activity" page logged in as student2
And I should see "Submitted for grading"
And I am on "Course 2" course homepage
And I follow "Require group membership"
And I am on the "c2assign1" "assign activity" page
And I should see "Submitted for grading"
And I log out
# Teacher should see student 1 and student 2 has submitted assignment.
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Allow default group"
And I am on the "c1assign1" "assign activity" page logged in as teacher1
And I should see "1" in the "Groups" "table_row"
And I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I navigate to "View all submissions" in current page administration
@@ -95,8 +86,7 @@ Feature: Submit assignment without group
And I should see "Default group" in the "Student 2" "table_row"
And I should see "Submitted for grading" in the "Student 1" "table_row"
And I should see "Submitted for grading" in the "Student 2" "table_row"
And I am on "Course 1" course homepage
And I follow "Require group membership"
And I am on the "c1assign2" "assign activity" page
And I should see "0" in the "Groups" "table_row"
And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I navigate to "View all submissions" in current page administration
@@ -104,8 +94,7 @@ Feature: Submit assignment without group
And I should see "Not a member of any group, so unable to make submissions." in the "Student 2" "table_row"
And I should not see "Submitted for grading" in the "Student 1" "table_row"
And I should not see "Submitted for grading" in the "Student 2" "table_row"
And I am on "Course 2" course homepage
And I follow "Require group membership"
And I am on the "c2assign1" "assign activity" page
And I should see "1" in the "Groups" "table_row"
And I should not see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I navigate to "View all submissions" in current page administration
@@ -115,17 +104,13 @@ Feature: Submit assignment without group
And I should see "Submitted for grading" in the "Student 2" "table_row"
And I log out
# Test student 3 (in multiple groups) should not be able to submit.
And I log in as "student3"
And I am on "Course 3" course homepage
And I follow "Require group membership"
And I am on the "c3assign1" "assign activity" page logged in as student3
And I should see "Member of more than one group"
And I should see "The assignment requires submission in groups. You are a member of more than one group."
And I should see "Nothing has been submitted for this assignment"
And I should not see "Add submission"
And I log out
And I log in as "teacher1"
And I am on "Course 3" course homepage
And I follow "Require group membership"
And I am on the "c3assign1" "assign activity" page logged in as teacher1
And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I navigate to "View all submissions" in current page administration
And I should see "Member of more than one group, so unable to make submissions." in the "Student 3" "table_row"
@@ -155,9 +140,7 @@ Feature: Submit assignment without group
| user | group |
| student1 | G1 |
| student2 | G2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Allow default group"
When I am on the "Allow default group" "assign activity" page logged in as teacher1
Then I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I should not see "The setting 'Students submit in groups' is enabled and some users are either not a member of any group, or are a member of more than one group. Please be aware that these students will submit as members of the 'Default group'."
@@ -185,9 +168,7 @@ Feature: Submit assignment without group
And the following "group members" exist:
| user | group |
| student1 | G1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Allow default group"
When I am on the "Allow default group" "assign activity" page logged in as teacher1
Then I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I should see "The setting 'Students submit in groups' is enabled and some users are either not a member of any group, or are a member of more than one group. Please be aware that these students will submit as members of the 'Default group'."
@@ -217,8 +198,6 @@ Feature: Submit assignment without group
| student1 | G1 |
| student2 | G1 |
| student2 | G2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Allow default group"
When I am on the "Allow default group" "assign activity" page logged in as teacher1
Then I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions."
And I should see "The setting 'Students submit in groups' is enabled and some users are either not a member of any group, or are a member of more than one group. Please be aware that these students will submit as members of the 'Default group'."
@@ -0,0 +1,37 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Online Text assignment submission subplugin data generator.
*
* @package mod_assign
* @category test
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class assignsubmission_subplugin_generator extends testing_module_generator {
/**
* Add submission data in the correct format for a call to `assign::save_submission()` from a table containing
* submission data for a single activity.
*
* Data should be added to the $submission object passed into the function.
*
* @param stdClass $submission The submission record to be modified
* @param assign $assign The assignment being submitted to
* @param array $data The data received
*/
abstract public function add_submission_data(stdClass $submission, assign $assign, array $data): void;
}
@@ -0,0 +1,52 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Behat data generator for mod_assign.
*
* @package mod_assign
* @category test
* @copyright 2021 Andrew Lyons
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_assign_generator extends behat_generator_base {
/**
* Get a list of the entities that Behat can create using the generator step.
*
* @return array
*/
protected function get_creatable_entities(): array {
return [
'submissions' => [
'singular' => 'submission',
'datagenerator' => 'submission',
'required' => ['assign', 'user'],
'switchids' => ['assign' => 'assignid', 'user' => 'userid'],
],
];
}
/**
* Get the assignment CMID using an activity idnumber.
*
* @param string $idnumber
* @return int The cmid
*/
protected function get_assign_id(string $idnumber): int {
return $this->get_activity_id($idnumber);
}
}
+69
View File
@@ -26,6 +26,13 @@ defined('MOODLE_INTERNAL') || die();
*/
class mod_assign_generator extends testing_module_generator {
/**
* Create a new instance of the assignment activity.
*
* @param array|stdClass|null $record
* @param array|null $options
* @return stdClass
*/
public function create_instance($record = null, array $options = null) {
$record = (object)(array)$record;
@@ -51,6 +58,10 @@ class mod_assign_generator extends testing_module_generator {
'markingallocation' => 0,
);
if (property_exists($record, 'teamsubmissiongroupingid')) {
$record->teamsubmissiongroupingid = $this->get_grouping_id($record->teamsubmissiongroupingid);
}
foreach ($defaultsettings as $name => $value) {
if (!isset($record->{$name})) {
$record->{$name} = $value;
@@ -59,4 +70,62 @@ class mod_assign_generator extends testing_module_generator {
return parent::create_instance($record, (array)$options);
}
/**
* Create an assignment submission.
*
* @param array $data
*/
public function create_submission(array $data): void {
global $USER;
$currentuser = $USER;
$user = \core_user::get_user($data['userid']);
$this->set_user($user);
$submission = (object) [
'userid' => $user->id,
];
[$course, $cm] = get_course_and_cm_from_cmid($data['assignid'], 'assign');
$context = context_module::instance($cm->id);
$assign = new assign($context, $cm, $course);
foreach ($assign->get_submission_plugins() as $plugin) {
$pluginname = $plugin->get_type();
if (array_key_exists($pluginname, $data)) {
$plugingenerator = $this->datagenerator->get_plugin_generator("assignsubmission_{$pluginname}");
$plugingenerator->add_submission_data($submission, $assign, $data);
}
}
$assign->save_submission((object) $submission, $notices);
$this->set_user($currentuser);
}
/**
* Gets the grouping id from it's idnumber.
*
* @throws Exception
* @param string $idnumber
* @return int
*/
protected function get_grouping_id(string $idnumber): int {
global $DB;
// Do not fetch grouping ID for empty grouping idnumber.
if (empty($idnumber)) {
return null;
}
if (!$id = $DB->get_field('groupings', 'id', ['idnumber' => $idnumber])) {
if (is_numeric($idnumber)) {
return $idnumber;
}
throw new Exception('The specified grouping with idnumber "' . $idnumber . '" does not exist');
}
return $id;
}
}
+2 -6
View File
@@ -24,9 +24,7 @@ Feature: Edited book chapters handle tags correctly
| student1 | C1 | student |
Scenario: Book chapter edition of custom tags works as expected
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test book"
Given I am on the "Test book" "book activity" page logged in as teacher1
And I set the following fields to these values:
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
@@ -50,9 +48,7 @@ Feature: Edited book chapters handle tags correctly
And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3"
And I press "Continue"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test book"
And I am on the "Test book" "book activity" page logged in as teacher1
And I open the autocomplete suggestions list
And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element"
And I should see "OT2" in the ".form-autocomplete-suggestions" "css_element"
+6 -5
View File
@@ -9,12 +9,13 @@ Feature: In a book, verify log entries
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And I log in as "admin"
And the following "activity" exists:
| course | C1 |
| activity | book |
| name | Test book |
And I am on the "Course 1" course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
When I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about dreams! |
And I follow "Test book"
And I am on the "Test book" "book activity" page
And I set the following fields to these values:
| Chapter title | First chapter |
| Content | First chapter |
@@ -16,16 +16,16 @@ Feature: Book activity chapter visibility management
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about dreams! |
And I follow "Test book"
And the following "activity" exists:
| course | C1 |
| activity | book |
| name | Test book |
And I am on the "Test book" "book activity" page logged in as teacher1
And I set the following fields to these values:
| Chapter title | First chapter |
| Content | First chapter |
And I press "Save changes"
And I turn editing mode on
And I click on "Add new chapter after \"First chapter\"" "link"
And I set the following fields to these values:
| Chapter title | Second chapter |
@@ -53,9 +53,8 @@ Feature: Book activity chapter visibility management
Scenario: Show/hide chapters and subchapters
When I follow "Hide chapter \"2. Second chapter\""
And I follow "Hide chapter \"2. Third chapter\""
And I am on the "Test book" "book activity" page
And I turn editing mode off
And I am on "Course 1" course homepage
And I follow "Test book"
Then the "class" attribute of "a[title='Second chapter']" "css_element" should contain "dimmed_text"
And the "class" attribute of "a[title='Third chapter']" "css_element" should contain "dimmed_text"
And I turn editing mode on
@@ -70,13 +69,11 @@ Feature: Book activity chapter visibility management
And I should see "Fourth chapter" in the ".book_content" "css_element"
And I follow "Exit book"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test book"
And I am on the "Test book" "book activity" page logged in as student1
And I should not see "Second chapter" in the "Table of contents" "block"
And I should not see "Third chapter" in the "Table of contents" "block"
And I follow "Next"
And I should see "Fourth chapter" in the ".book_content" "css_element"
And I follow "Exit book"
And I follow "Test book"
And I am on the "Test book" "book activity" page
And I should see "First chapter" in the ".book_content" "css_element"

Some files were not shown because too many files have changed in this diff Show More