MDL-72179 behat: Add page resolvers for activity roles/perms

This commit is contained in:
Andrew Nicols 2021-07-23 10:58:00 +08:00
parent 950c7adb1c
commit f14dbe0087
2 changed files with 18 additions and 1 deletions

View File

@ -22,6 +22,7 @@ Feature: Use core page resolvers for the I am on the page steps
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 |
@ -31,6 +32,8 @@ Feature: Use core page resolvers for the I am on the page steps
| 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:
@ -49,7 +52,7 @@ Feature: Use core page resolvers for the I am on the page steps
Then I should see "<shouldsee>"
Examples:
| description | identifier | type | shouldsee |
| 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 |
@ -59,6 +62,8 @@ Feature: Use core page resolvers for the I am on the page steps
| 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"

View File

@ -777,12 +777,24 @@ class behat_navigation extends behat_base {
$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]);
}
}
}