Skip to content

Commit

Permalink
MDL-58265 core_test: replace I turn editing on steps
Browse files Browse the repository at this point in the history
Also remove few more unnecessary steps that redirects behat to
site home page to actually get to the course.

Part of MDL-55611 epic.
  • Loading branch information
lameze authored and Damyon Wiese committed Apr 3, 2017
1 parent 3353cfd commit fdeeaff
Show file tree
Hide file tree
Showing 458 changed files with 1,697 additions and 2,148 deletions.
3 changes: 1 addition & 2 deletions admin/roles/tests/behat/override_roles_highlighting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ Feature: Highlight non-inherited permissions
| fullname | shortname |
| Course fullname | C_shortname |
And I log in as "admin"
And I am on site homepage

@javascript
Scenario: Override a permission
Given I am on course page "Course fullname"
Given I am on "Course fullname" course homepage
And I navigate to "Users > Permissions" in current page administration
And I select "Manager (0)" from the "roleid" singleselect
And I click on "Prohibit" "radio" in the "View added and updated modules in recent activity block" "table_row"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ Feature: Manage availability conditions

# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
And I click on "Hide" "icon" in the "Restriction by grade" "table_row"
And I am on site homepage
And I am on course page "Course 1"
And I turn editing mode on
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1"
And I expand all fieldsets
And I click on "Add restriction..." "button"
Expand Down
30 changes: 15 additions & 15 deletions admin/tool/behat/tests/behat/data_generators.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Feature: Set up contextual data for tests
| Grouping 1 | C1 | GG1 |
| Grouping 2 | C1 | GG2 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
Then I should see "Group 1"
And I should see "Group 2"
Expand Down Expand Up @@ -86,7 +86,7 @@ Feature: Set up contextual data for tests
| mod/forum:editanypost | Allow | student | Course | C1 |
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I set the field "Advanced role override" to "Student (1)"
Then "mod/forum:editanypost" capability has "Allow" permission
Expand All @@ -106,7 +106,7 @@ Feature: Set up contextual data for tests
| user | course | role |
| student1 | C1 | student |
When I log in as "student1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"

Scenario: Add role assigns
Expand Down Expand Up @@ -142,20 +142,20 @@ Feature: Set up contextual data for tests
Then "Edit settings" "link" should exist in current page administration
And I log out
And I log in as "user2"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And "Turn editing on" "link" should exist in current page administration
And I log out
And I log in as "user3"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And "Turn editing on" "link" should exist in current page administration
And I log out
And I log in as "user4"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And "Turn editing on" "link" should exist in current page administration
And I log out
And I log in as "user5"
And I should see "You are logged in as"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I should see "You can not enrol yourself in this course."

Scenario: Add modules
Expand Down Expand Up @@ -193,7 +193,7 @@ Feature: Set up contextual data for tests
| activity | name | intro | course | idnumber | grade |
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
Then I should see "Test assignment name"
# Assignment 2.2 module type is disabled by default
# And I should see "Test assignment22 name"
Expand Down Expand Up @@ -254,7 +254,7 @@ Feature: Set up contextual data for tests
| grouping | group |
| GG1 | G1 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
Then the "groups" select box should contain "Group 1 (1)"
And the "groups" select box should contain "Group 2 (1)"
Expand Down Expand Up @@ -313,7 +313,7 @@ Feature: Set up contextual data for tests
| Grade sub category 2 | C1 | Grade category 1 |
When I log in as "admin"
And I am on course index
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
Then I should see "Grade category 1"
And I should see "Grade sub category 2"
Expand All @@ -336,7 +336,7 @@ Feature: Set up contextual data for tests
| Test Grade Item 2 | C1 | Grade category 1 |
| Test Grade Item 3 | C1 | Grade sub category 2 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Then I should see "Test Grade Item 1"
And I follow "Edit Test Grade Item 1"
Expand Down Expand Up @@ -364,7 +364,7 @@ Feature: Set up contextual data for tests
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
Then I should see "Test Scale 1"
And I should see "Disappointing, Good, Very good, Excellent"
Expand All @@ -385,7 +385,7 @@ Feature: Set up contextual data for tests
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I follow "Outcomes"
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
Expand Down Expand Up @@ -413,7 +413,7 @@ Feature: Set up contextual data for tests
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Then I should see "Test Outcome Grade Item 1"
And I follow "Edit Test Outcome Grade Item 1"
Expand All @@ -430,5 +430,5 @@ Feature: Set up contextual data for tests
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| online_users | Course | C1 | course-view-* | site-pre |
When I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
Then I should see "Online users"
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/datetime_strings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Transform date time string arguments
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I should see "##yesterday##l, j F Y##"
And I log out
5 changes: 2 additions & 3 deletions admin/tool/behat/tests/behat/edit_permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Feature: Edit capabilities

Scenario: Course capabilities overrides
Given I log in as "teacher1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I override the system permissions of "Student" role with:
| mod/forum:deleteanypost | Prohibit |
Expand All @@ -45,8 +45,7 @@ Feature: Edit capabilities

Scenario: Module capabilities overrides
Given I log in as "teacher1"
And I am on course page "Course 1"
And I turn editing mode on
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 | I'm the name |
| Description | I'm the introduction |
Expand Down
13 changes: 6 additions & 7 deletions admin/tool/behat/tests/behat/get_and_set_fields.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Verify that all form fields values can be get and set
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
And I log in as "admin"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Reset" node in "Course administration"
# Select (multi-select) - Checking "the select box should contain".
And I expand all fieldsets
Expand All @@ -47,8 +47,7 @@ Feature: Verify that all form fields values can be get and set
And the "Unenrol users" select box should not contain "President"
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 page "Course 1"
And I turn editing mode on
And I am on "Course 1" course homepage with editing mode on
And I follow "Test this one"
And I press "Create page"
# Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values".
Expand Down Expand Up @@ -98,7 +97,7 @@ Feature: Verify that all form fields values can be get and set
| Default format | HTML |
| Force format | 1 |
And I press "Cancel"
And I am on course page "Course 1"
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 |
Expand All @@ -113,7 +112,7 @@ Feature: Verify that all form fields values can be get and set
And the field "one" matches value "1"
And the field "two" matches value ""
# Check if field xpath set/match works.
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Edit settings" node in "Course administration"
And I set the field with xpath "//input[@id='id_idnumber']" to "Course id number"
And the field with xpath "//input[@name='idnumber']" matches value "Course id number"
Expand All @@ -126,7 +125,7 @@ Feature: Verify that all form fields values can be get and set

@javascript
Scenario: with JS enabled all form fields getters and setters works as expected
Then I am on course page "Course 1"
Then I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
And I set the field "groups" to "Group 2"
Expand All @@ -138,7 +137,7 @@ Feature: Verify that all form fields values can be get and set
And the "members" select box should contain "Student 2"
And the "members" select box should not contain "Student 3"
# Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values".
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I add a "Lesson" to section "1"
And I set the following fields to these values:
| Name | Test lesson |
Expand Down
4 changes: 1 addition & 3 deletions admin/tool/behat/tests/behat/manipulate_forms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ Feature: Forms manipulation
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on site homepage
And I am on course page "Course 1"
And I turn editing mode on
And I am on "Course 1" course homepage with editing mode on
And I add a "Quiz" to section "1"
When I expand all fieldsets
Then I should see "Close the quiz"
Expand Down
4 changes: 1 addition & 3 deletions admin/tool/filetypes/tests/behat/add_filetypes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ Feature: Add customised file types
| Custom description | Froggy file |
And I press "Save changes"
# Create a resource activity and add it to a course
And I am on site homepage
And I am on course page "Course 1"
And I turn editing mode on
And I am on "Course 1" course homepage with editing mode on
When I add a "File" to section "1"
And I set the following fields to these values:
| Name | An example of customised file type |
Expand Down
13 changes: 6 additions & 7 deletions admin/tool/monitor/tests/behat/rule.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: tool_monitor_rule
And I navigate to "Event monitoring rules" node in "Site administration > Reports"
And I click on "Enable" "link"
And I am on site homepage
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
And I press "Add a new rule"
And I set the following fields to these values:
Expand All @@ -45,8 +45,7 @@ Feature: tool_monitor_rule

Scenario: Add a rule on course level
Given I log in as "teacher1"
And I am on site homepage
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
When I press "Add a new rule"
And I set the following fields to these values:
Expand All @@ -66,7 +65,7 @@ Feature: tool_monitor_rule

Scenario: Delete a rule on course level
Given I log in as "teacher1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
When I click on "Delete rule" "link"
Then I should see "Are you sure you want to delete the rule \"New rule course level\"?"
Expand All @@ -76,7 +75,7 @@ Feature: tool_monitor_rule

Scenario: Edit a rule on course level
Given I log in as "teacher1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
When I click on "Edit rule" "link"
And I set the following fields to these values:
Expand All @@ -95,7 +94,7 @@ Feature: tool_monitor_rule

Scenario: Duplicate a rule on course level
Given I log in as "teacher1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
When I click on "Duplicate rule" "link" in the "New rule course level" "table_row"
Then I should see "Rule successfully duplicated"
Expand Down Expand Up @@ -154,7 +153,7 @@ Feature: tool_monitor_rule

Scenario: Duplicate a rule on site level
Given I log in as "teacher1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
When I click on "Duplicate rule" "link" in the "New rule site level" "table_row"
Then I should see "Rule successfully duplicated"
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/monitor/tests/behat/subscription.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: tool_monitor_subscriptions
And I log in as "admin"
And I navigate to "Event monitoring rules" node in "Site administration > Reports"
And I click on "Enable" "link"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I navigate to "Event monitoring rules" node in "Course administration > Reports"
And I press "Add a new rule"
And I set the following fields to these values:
Expand Down Expand Up @@ -131,7 +131,7 @@ Feature: tool_monitor_subscriptions
And I follow "Subscribe to rule \"New rule course level\""
And I should see "Subscription successfully created"
And "#toolmonitorsubs_r0" "css_element" should exist
And I am on course page "Course 1"
And I am on "Course 1" course homepage
And I trigger cron
And I am on site homepage
When I click on ".popover-region-notifications" "css_element"
Expand Down
10 changes: 4 additions & 6 deletions admin/tool/recyclebin/tests/behat/backup_user_data.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ Feature: Backup user data
@javascript
Scenario: Delete and restore a quiz with user data
Given I log in as "teacher1"
And I am on course page "Course 1"
And I turn editing mode on
And I am on "Course 1" course homepage with editing mode on
And I add a "Quiz" to section "1" and I fill the form with:
| Name | Quiz 1 |
| Description | Test quiz description |
Expand All @@ -44,7 +43,7 @@ Feature: Backup user data
| 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 page "Course 1"
And I am on "Course 1" course homepage
And I follow "Quiz 1"
And I press "Attempt quiz now"
And I click on "True" "radio" in the "First question" "question"
Expand All @@ -55,16 +54,15 @@ Feature: Backup user data
And I should see "5.00 out of 10.00"
And I log out
And I log in as "teacher1"
And I am on course page "Course 1"
And I turn editing mode on
And I am on "Course 1" course homepage with editing mode on
And I delete "Quiz 1" activity
And I run all adhoc tasks
And I navigate to "Recycle bin" node in "Course administration"
And I should see "Quiz 1"
And I click on "Restore" "link" in the "region-main" "region"
And I log out
And I log in as "student1"
And I am on course page "Course 1"
And I am on "Course 1" course homepage
When I navigate to "User report" in the course gradebook
Then "Quiz 1" row "Grade" column of "user-grade" table should contain "5"
And "Quiz 1" row "Percentage" column of "user-grade" table should contain "50"
Loading

0 comments on commit fdeeaff

Please sign in to comment.