MDL-38687 behat: Add activity step modification

We are only supposed to look for
the activity name in @class=typename
This commit is contained in:
David Monllao
2013-04-02 14:13:57 +08:00
parent a5efbe6161
commit 44d5af386c
+6 -3
View File
@@ -61,7 +61,7 @@ class behat_course extends behat_base {
/**
* Adds the selected activity/resource filling the form data with the specified field/value pairs.
*
* @When /^I add a "(?P<activity_or_resource_string>(?:[^"]|\\")*)" to section "(?P<section_number>\d+)" and I fill the form with:$/
* @When /^I add a "(?P<activity_or_resource_name_string>(?:[^"]|\\")*)" to section "(?P<section_number>\d+)" and I fill the form with:$/
* @param string $activity The activity name
* @param string $section The section number
* @param TableNode $data The activity field/value data
@@ -78,7 +78,7 @@ class behat_course extends behat_base {
/**
* Opens the activity chooser and opens the activity/resource form page.
*
* @Given /^I add a "(?P<activity_or_resource_string>(?:[^"]|\\")*)" to section "(?P<section_number>\d+)"$/
* @Given /^I add a "(?P<activity_or_resource_name_string>(?:[^"]|\\")*)" to section "(?P<section_number>\d+)"$/
* @throws ElementNotFoundException Thrown by behat_base::find
* @param string $activity
* @param string $section
@@ -95,7 +95,10 @@ class behat_course extends behat_base {
$sectionnode->click();
// Clicks the selected activity if it exists.
$activityxpath = ".//label[contains(.,'" . $activity . "')]/input";
$activity = ucfirst($activity);
$activityxpath = "//div[@id='chooseform']/descendant::label
/descendant::span[contains(concat(' ', @class, ' '), ' typename ')][contains(.,'" . $activity . "')]
/parent::label/child::input";
$activitynode = $this->find('xpath', $activityxpath);
$activitynode->doubleClick();