Commit fba3c512 authored by Aaron Wells's avatar Aaron Wells

New Behat Step for visiting a specific Portfolio page "bug 1484361"

Change-Id: I676a4c4c5bac56673e02bf6e0c95283edab54feb
behatnotneeded: Tested in subsequent patches
parent 495c7749
......@@ -859,4 +859,26 @@ class BehatGeneral extends BehatBase {
$this->getSession()->executeScript("document.body.innerHTML = '<p>".$text."</p>'");
$this->getSession()->switchToIFrame();
}
/**
* Visit a Mahara portfolio Page with the specified title
*
* @Given /^I go to portfolio page "([^"]*)"$/
* @Given /^I go to view "([^"]*)"$/
*/
public function i_go_to_view($title) {
// Find the page's ID number
$views = get_records_array('view', 'title', $title, '', 'id');
if (!$views) {
throw new Exception(sprintf('Invalid page title. No view found with title "%s".', $title));
}
if (count($views) > 1) {
throw new Exception(sprintf('Invalid page title. More than one view with title "%s".', $title));
}
$view = reset($views);
// success
return new Given("I go to \"/view/view.php?id={$view->id}\"");
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment