Merge branch 'MDL-45192_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Sam Hemelryk 2014-05-26 13:23:02 +12:00
commit 1912b5aa92
2 changed files with 73 additions and 3 deletions

View File

@ -282,6 +282,18 @@ class behat_general extends behat_base {
$node->click();
}
/**
* Clicks the specified element and confirms the expected dialogue.
*
* @When /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" confirming the dialogue$/
* @throws ElementNotFoundException Thrown by behat_base::find
* @param string $link
*/
public function i_click_on_confirming_the_dialogue($element, $selectortype) {
$this->i_click_on($element, $selectortype);
$this->accept_currently_displayed_alert_dialog();
}
/**
* Click on the element of the specified type which is located inside the second element.
*

View File

@ -4,8 +4,7 @@ Feature: Prevent or allow assignment submission changes
As a teacher
I need to prevent or allow student submission at any time
@javascript
Scenario: Preventing changes and allowing them again
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
@ -13,11 +12,16 @@ Feature: Prevent or allow assignment submission changes
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
| student2 | C1 | student |
@javascript
Scenario: Preventing changes and allowing them again
Given 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:
@ -69,3 +73,57 @@ Feature: Prevent or allow assignment submission changes
| Online text | I'm the student submission edited again |
And I press "Save changes"
And I should see "I'm the student submission edited again"
@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 follow "Course 1"
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 follow "Course 1"
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 follow "Course 1"
And I follow "Test assignment name"
When I follow "View/grade all submissions"
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 follow "Course 1"
And I follow "Test assignment name"
And I should not see "Edit submission"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View/grade all submissions"
And I set the field "selectall" to "1"
And I set the field "id_operation" to "Unlock submissions"
And I click on "Go" "button" confirming the dialogue
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 follow "Course 1"
And I follow "Test assignment name"
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 |
And I press "Save changes"
And I log out