Skip to content

Commit

Permalink
MDL-56630 behat: Click on link in specificed block/region
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja committed Nov 8, 2016
1 parent 1fd6b25 commit dc90838
Show file tree
Hide file tree
Showing 55 changed files with 216 additions and 183 deletions.
10 changes: 5 additions & 5 deletions admin/tool/behat/tests/behat/get_and_set_fields.feature
Expand Up @@ -60,9 +60,9 @@ Feature: Verify that all form fields values can be get and set
| HTML format | Student page contents |
And I press "Save"
Then I should see "Student page contents" in the "region-main" "region"
And I follow "Edit"
And I click on "Edit" "link" in the "Administration" "block"
# Select (multi-select) - Checking "I set the field".
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
# Checkbox - Checking "I set the field".
And I set the field "Display description on course page" to "1"
Expand All @@ -75,7 +75,7 @@ Feature: Verify that all form fields values can be get and set
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
# Checkbox - Checking "the field matches value" and "the following fields match these values".
And the following fields match these values:
| Display description on course page | 1 |
Expand All @@ -91,7 +91,7 @@ Feature: Verify that all form fields values can be get and set
# Select (simple) - Checking "I set the field".
And I set the field "Group mode" to "Separate groups"
And I press "Save and display"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And the following fields match these values:
| Default format | NWiki |
| Group mode | Separate groups |
Expand Down Expand Up @@ -158,7 +158,7 @@ Feature: Verify that all form fields values can be get and set
And the "available[day]" "field" should be enabled
And the field "deadline[enabled]" matches value "1"
And I press "Save and display"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And the field "available[enabled]" matches value "1"
And the "available[day]" "field" should be enabled
And the field "deadline[enabled]" matches value "1"
Expand Down
Expand Up @@ -115,7 +115,7 @@ Feature: availability_grade

# Give the assignment 40%.
And I follow "A1"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
# 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"
And I set the field "Grade out of 100" to "40"
Expand Down
2 changes: 1 addition & 1 deletion completion/tests/behat/restrict_activity_by_grade.feature
Expand Up @@ -56,7 +56,7 @@ Feature: Restrict activity availability through grade conditions
And I am on site homepage
And I follow "Course 1"
And I follow "Grade assignment"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student First" "table_row"
And I set the following fields to these values:
| Grade | 21 |
Expand Down
Expand Up @@ -93,7 +93,7 @@ Feature: Restrict sections availability through completion or grade conditions
And I am on site homepage
And I follow "Course 1"
And I follow "Grade assignment"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student First" "table_row"
And I set the following fields to these values:
| Grade | 21 |
Expand Down
8 changes: 4 additions & 4 deletions course/tests/behat/activities_edit_completion.feature
Expand Up @@ -35,24 +35,24 @@ Feature: Edit completion settings of an activity
@javascript
Scenario: Pressing the unlock button allows the user to edit completion settings
Given I follow "TestPage"
When I follow "Edit settings"
When I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I press "Unlock completion options"
Then I should see "Completion options unlocked"
And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
And I press "Save and display"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
Then the field "Completion tracking" matches value "Students can manually mark the activity as completed"

@javascript
Scenario: Even when completion is locked, the user can still set the date
Given I follow "TestPage"
And I follow "Edit settings"
When I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
When I click on "id_completionexpected_enabled" "checkbox"
And I set the field "id_completionexpected_year" to "2013"
And I press "Save and display"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
Then the field "id_completionexpected_year" matches value "2013"
2 changes: 1 addition & 1 deletion grade/grading/form/guide/tests/behat/edit_guide.feature
Expand Up @@ -87,7 +87,7 @@ Feature: Marking guides can be created and edited
And I press "Ok"
And I follow "Edit settings"
And I follow "Test assignment 1 name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
# Checking that the user grade is correct.
Then I should see "80" in the "Student 1" "table_row"
And I log out
Expand Down
24 changes: 21 additions & 3 deletions grade/grading/tests/behat/behat_grading.php
Expand Up @@ -49,7 +49,13 @@ public function i_go_to_advanced_grading_page($activityname) {

$this->execute('behat_general::click_link', $this->escape($activityname));

$this->execute('behat_general::click_link', get_string('gradingmanagement', 'grading'));
$this->execute('behat_general::i_click_on_in_the',
array(
get_string('gradingmanagement', 'grading'),
'link',
'Administration',
'block'
));
}

/**
Expand Down Expand Up @@ -86,7 +92,13 @@ public function i_go_to_activity_advanced_grading_page($userfullname, $activityn

$this->execute('behat_general::click_link', $this->escape($activityname));

$this->execute('behat_general::click_link', $this->escape(get_string('viewgrading', 'assign')));
$this->execute('behat_general::i_click_on_in_the',
array(
get_string('viewgrading', 'mod_assign'),
'link',
'Administration',
'block'
));

$this->execute('behat_general::i_click_on_in_the',
array(
Expand Down Expand Up @@ -157,7 +169,13 @@ public function i_save_the_advanced_grading_form() {
$this->execute('behat_forms::press_button', 'Ok');
$this->execute('behat_general::i_click_on', array($this->escape(get_string('editsettings')), 'link'));
$this->execute('behat_forms::press_button', get_string('cancel'));
$this->execute('behat_general::i_click_on', array($this->escape(get_string('viewgrading', 'mod_assign')), 'link'));
$this->execute('behat_general::i_click_on_in_the',
array(
get_string('viewgrading', 'mod_assign'),
'link',
'Administration',
'block'
));
}

/**
Expand Down
Expand Up @@ -33,7 +33,7 @@ Feature: We can bulk insert grades for students in a course
Given I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment one"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Grade out of 100 | 50 |
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: We can bulk insert grades for students in a course
Given I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment two"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Grade out of 100 | 50 |
Expand Down
20 changes: 10 additions & 10 deletions grade/tests/behat/grade_point_maximum.feature
Expand Up @@ -25,7 +25,7 @@ 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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
Then the "Scale" "select" should be disabled
Expand All @@ -41,44 +41,44 @@ 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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And 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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And 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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "None"
And I press "Save and display"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
And I set the field "grade[modgrade_point]" to "20000"
Expand All @@ -88,7 +88,7 @@ Feature: We can change the grading type and maximum grade point values

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 follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "point"
And I set the field "grade[modgrade_point]" to "600"
Expand All @@ -100,7 +100,7 @@ Feature: We can change the grading type and maximum grade point values
And I am on site homepage
And I follow "Course 1"
And I follow "Test Assignment 1"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
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"
4 changes: 2 additions & 2 deletions grade/tests/behat/grade_scales.feature
Expand Up @@ -44,12 +44,12 @@ Feature: View gradebook when scales are used
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment one"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "Letterscale"
And I press "Save and display"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade" to "A"
And I press "Save changes"
Expand Down
4 changes: 2 additions & 2 deletions grade/tests/behat/grade_single_item_scales.feature
Expand Up @@ -38,12 +38,12 @@ Feature: View gradebook when single item scales are used
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment one"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "Singleitem"
And I press "Save and display"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade" to "A"
And I press "Save changes"
Expand Down
12 changes: 6 additions & 6 deletions lib/form/tests/behat/modgrade_validation.feature
Expand Up @@ -111,7 +111,7 @@ Feature: Using the activity grade form element
# Try saving the form and visiting it back to verify that everything is working ok.
And I press "Save and display"
And I should not see "When selecting a ratings aggregate type you must also select"
And I click on "Edit settings" "link"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And the field "Aggregate type" matches value "Average of ratings"
And the field "scale[modgrade_type]" matches value "Scale"
Expand Down Expand Up @@ -142,17 +142,17 @@ Feature: Using the activity grade form element
| grade[modgrade_scale] | ABCDEF |
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade" to "C"
And I press "Save changes"
And I press "Ok"
And I click on "Edit settings" "link"
And I click on "Edit settings" "link" in the "Administration" "block"
When I expand all fieldsets
Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed"
# Try saving the form and visiting it back to verify everything is working ok.
And I press "Save and display"
And I click on "Edit settings" "link"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And the field "grade[modgrade_type]" matches value "Scale"
And the field "grade[modgrade_scale]" matches value "ABCDEF"
Expand Down Expand Up @@ -202,11 +202,11 @@ Feature: Using the activity grade form element
| Description | Test assignment description |
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
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 press "Save changes"
And I press "Ok"
And I click on "Edit settings" "link"
And I click on "Edit settings" "link" in the "Administration" "block"
When I expand all fieldsets
Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
2 changes: 1 addition & 1 deletion mod/assign/feedback/file/tests/behat/feedback_file.feature
Expand Up @@ -34,7 +34,7 @@ Feature: In an assignment, teacher can submit feedback files during grading
| Maximum number of uploaded files | 2 |
| Students submit in groups | Yes |
And I follow "Test assignment name"
And I follow "Edit settings"
And I click on "Edit settings" "link" in the "Administration" "block"
And I follow "Expand all"
And I set the field "assignfeedback_file_enabled" to "1"
And I press "Save and display"
Expand Down
6 changes: 3 additions & 3 deletions mod/assign/tests/behat/allow_another_attempt.feature
Expand Up @@ -38,7 +38,7 @@ Feature: In an assignment, students start a new attempt based on their previous
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Allow another attempt | 1 |
Expand All @@ -55,7 +55,7 @@ Feature: In an assignment, students start a new attempt based on their previous
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I should see "I'm the student first submission"

Expand Down Expand Up @@ -112,7 +112,7 @@ Feature: In an assignment, students start a new attempt based on their previous
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
When I follow "View all submissions"
When I click on "View all submissions" "link" in the "Administration" "block"
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 contain "No submission"
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/tests/behat/comment_inline.feature
Expand Up @@ -40,7 +40,7 @@ Feature: In an assignment, teachers can edit a students submission inline
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Grade out of 100 | 50 |
Expand All @@ -50,7 +50,7 @@ Feature: In an assignment, teachers can edit a students submission inline
And I press "Ok"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "View all submissions" "link" in the "Administration" "block"
Then I should see "50.00" in the "Student 1" "table_row"
And I should see "Submitted for grading" in the "Student 1" "table_row"
And I should see "Graded" in the "Student 1" "table_row"
Expand Down
Expand Up @@ -28,7 +28,7 @@ Feature: Check that the assignment grade can not be input in a wrong format.
| Description | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
Then I follow "View all submissions"
Then I click on "View all submissions" "link" in the "Administration" "block"
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"
Expand Down Expand Up @@ -58,7 +58,7 @@ Feature: Check that the assignment grade can not be input in a wrong format.
| Description | Test assignment description |
| Use marking workflow | Yes |
When I follow "Test assignment name"
Then I follow "View all submissions"
Then I click on "View all submissions" "link" in the "Administration" "block"
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"
Expand Down

0 comments on commit dc90838

Please sign in to comment.