Commit b4114079 authored by Rebecca Blundell's avatar Rebecca Blundell Committed by Robert Lyon
Browse files

Bug 1690709 - add step for finding a group page

edit to BehatGeneral.php to create a step to take you to a named group's
homepage.

Change-Id: Ib637c6438b3845712678782a3ada102f556d6cae
parent 44df12bb
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1087,6 +1087,29 @@ class BehatGeneral extends BehatBase {
        $this->visitPath("/view/view.php?id={$view->id}");
    }


    /**
     * Visit a Mahara group Page with the specified Group name
     *
     * @Given /^I go to group "([^"]*)"$/
     */
    public function i_go_to_group($name) {
        // Find the page's ID number
        //get_records_array takes: ($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='')
        $groups = get_records_array('group', 'name', $name, '', 'id');
        if (!$groups) {
            throw new Exception(sprintf('Invalid group name. No group found with name "%s".', $name));
        }
        if (count($groups) > 1) {
            throw new Exception(sprintf('Invalid group name. More than one group with name "%s".', $name));
        }

        $group = reset($groups);

        // success
        $this->visitPath("/group/view.php?id={$group->id}");
    }

    /**
     * Expand a collapsible section containing the specified text.
     *
+1 −2
Original line number Diff line number Diff line
@@ -21,8 +21,7 @@ Given the following "pages" exist:
Scenario: Copying a group page retains title (Bug 1519374)
 # Make the group page copyable
 Given I log in as "userA" with password "Kupuhipa1"
 When I choose "Groups" from main menu
 And I follow "testgroup"
 When I go to group "testgroup"
 And I follow "Share" in the "ul.nav-inpage" "css_element"
 And I click on "Edit access" in "Test Page" row
 And I follow "Advanced options"