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'.
This commit is contained in:
Andrew Nicols 2021-07-20 12:49:45 +08:00
parent c204fe3eeb
commit ba8e0a4871
2 changed files with 6 additions and 7 deletions

View File

@ -51,7 +51,6 @@ Feature: Use core page resolvers for the I am on the page steps
Examples:
| description | identifier | shouldsee |
| Admin page | Admin | Check for available updates |
| Home page | Homepage | Recently accessed courses |
@javascript

View File

@ -697,10 +697,10 @@ 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 |
*
* @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'.
@ -711,12 +711,12 @@ class behat_navigation extends behat_base {
global $DB;
switch (strtolower($type)) {
case 'category page':
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 = $this->get_course_id($identifier);