Merge branch 'MDL-39348_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2013-05-06 01:49:51 +02:00
29 changed files with 151 additions and 91 deletions
+4 -4
View File
@@ -72,11 +72,11 @@ class behat_admin extends behat_base {
// Admin settings does not use the same DOM structure than other moodle forms
// but we also need to use lib/behat/form_field/* to deal with the different moodle form elements.
$exception = new ElementNotFoundException($this->getSession(), '"' . $label . '" administration setting ');
$fieldxpath = "//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]
[@id=//label[contains(normalize-space(string(.)), '" . $label . "')]/@for]";
$fieldxpath = "//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" .
"[@id=//label[contains(normalize-space(string(.)), '" . $label . "')]/@for]";
$fieldnode = $this->find('xpath', $fieldxpath, $exception);
$formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']
/child::div[contains(concat(' ', @class, ' '), ' form-')]/child::*/parent::div");
$formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']" .
"/child::div[contains(concat(' ', @class, ' '), ' form-')]/child::*/parent::div");
// Getting the class which contains the field type.
$classes = explode(' ', $formfieldtypenode->getAttribute('class'));
+2 -2
View File
@@ -52,8 +52,8 @@ class behat_auth extends behat_base {
new Given('I follow "Login"'),
new Given('I fill in "Username" with "'.$username.'"'),
new Given('I fill in "Password" with "'.$username.'"'),
new When('I press "Login"'),
new Given('I should see "You are logged in as"'));
new Given('I press "Login"')
);
}
/**
+18 -16
View File
@@ -112,9 +112,9 @@ class behat_backup extends behat_base {
$exception = new ExpectationException('"' . $fromcourse . '" course not found in the list of courses to import from', $this->getSession());
$fromcourse = str_replace("'", "\'", $fromcourse);
$xpath = "//div[contains(concat(' ', @class, ' '), ' ics-results ')]
/descendant::tr[contains(., '" . $fromcourse . "')]
/descendant::input[@type='radio']";
$xpath = "//div[contains(concat(' ', @class, ' '), ' ics-results ')]" .
"/descendant::tr[contains(., '" . $fromcourse . "')]" .
"/descendant::input[@type='radio']";
$radionode = $this->find('xpath', $xpath, $exception);
$radionode->check();
$radionode->click();
@@ -152,10 +152,10 @@ class behat_backup extends behat_base {
// Selecting the specified course (we can not call behat_forms::select_radio here as is in another behat subcontext).
$existingcourse = str_replace("'", "\'", $existingcourse);
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-existing-course')]
/descendant::div[@class='restore-course-search']
/descendant::tr[contains(., '" . $existingcourse . "')]
/descendant::input[@type='radio']");
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-existing-course')]" .
"/descendant::div[@class='restore-course-search']" .
"/descendant::tr[contains(., '" . $existingcourse . "')]" .
"/descendant::input[@type='radio']");
$radionode->check();
$radionode->click();
@@ -181,9 +181,9 @@ class behat_backup extends behat_base {
$this->select_backup($backupfilename);
// The first category in the list.
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-new-course')]
/descendant::div[@class='restore-course-search']
/descendant::input[@type='radio']");
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-new-course')]" .
"/descendant::div[@class='restore-course-search']" .
"/descendant::input[@type='radio']");
$radionode->check();
$radionode->click();
@@ -209,13 +209,14 @@ class behat_backup extends behat_base {
$this->select_backup($backupfilename);
// Merge without deleting radio option.
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]
/descendant::input[@type='radio'][@name='target'][@value='1']");
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]" .
"/descendant::input[@type='radio'][@name='target'][@value='1']");
$radionode->check();
$radionode->click();
// Pressing the continue button of the restore merging section.
$continuenode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]/descendant::input[@type='submit'][@value='Continue']");
$continuenode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]" .
"/descendant::input[@type='submit'][@value='Continue']");
$continuenode->click();
$this->wait();
@@ -236,13 +237,14 @@ class behat_backup extends behat_base {
$this->select_backup($backupfilename);
// Delete contents radio option.
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]
/descendant::input[@type='radio'][@name='target'][@value='0']");
$radionode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]" .
"/descendant::input[@type='radio'][@name='target'][@value='0']");
$radionode->check();
$radionode->click();
// Pressing the continue button of the restore merging section.
$continuenode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]/descendant::input[@type='submit'][@value='Continue']");
$continuenode = $this->find('xpath', "//div[contains(@class, 'bcs-current-course')]" .
"/descendant::input[@type='submit'][@value='Continue']");
$continuenode->click();
$this->wait();
@@ -12,7 +12,7 @@ Feature: Restore Moodle 2 course backups
And I log in as "admin"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I add the "Community finder" block
@@ -91,8 +91,8 @@ class behat_block_comments extends behat_base {
$exception = new ElementNotFoundException($this->getSession(), '"' . $comment . '" comment ');
$commentxpath = "//div[contains(concat(' ', @class, ' '), ' block_comments ')]
/descendant::div[@class='comment-message'][contains(., '" . $comment . "')]";
$commentxpath = "//div[contains(concat(' ', @class, ' '), ' block_comments ')]" .
"/descendant::div[@class='comment-message'][contains(., '" . $comment . "')]";
$commentnode = $this->find('xpath', $commentxpath, $exception);
// Click on delete icon.
+8 -3
View File
@@ -50,7 +50,8 @@ class behat_completion extends behat_base {
public function user_has_completed_activity($userfullname, $activityname) {
// Will throw an exception if the element can not be hovered.
$xpath = "//table[@id='completion-progress']/descendant::img[contains(@title, '" . $userfullname . ", " . $activityname . ": Completed')]";
$xpath = "//table[@id='completion-progress']" .
"/descendant::img[contains(@title, '" . $userfullname . ", " . $activityname . ": Completed')]";
return array(
new Given('I go to the current course activity completion report'),
@@ -67,7 +68,8 @@ class behat_completion extends behat_base {
*/
public function user_has_not_completed_activity($userfullname, $activityname) {
$xpath = "//table[@id='completion-progress']/descendant::img[contains(@title, '" . $userfullname . ", " . $activityname . ": Not completed')]";
$xpath = "//table[@id='completion-progress']" .
"/descendant::img[contains(@title, '" . $userfullname . ", " . $activityname . ": Not completed')]";
return array(
new Given('I go to the current course activity completion report'),
new Given('I hover "' . $xpath . '" "xpath_element"')
@@ -87,7 +89,10 @@ class behat_completion extends behat_base {
// Expand reports node if we can't see the link.
try {
$this->find('xpath', "//*[@id='settingsnav']/descendant::li/descendant::li[not(contains(@class,'collapsed'))]/descendant::p[contains(., 'Activity completion')]");
$this->find('xpath', "//*[@id='settingsnav']" .
"/descendant::li" .
"/descendant::li[not(contains(@class,'collapsed'))]" .
"/descendant::p[contains(., 'Activity completion')]");
} catch (ElementNotFoundException $e) {
$steps[] = new Given('I expand "Reports" node');
}
@@ -18,7 +18,7 @@ Feature: Toggle activities groups mode from the course page
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I follow "Edit settings"
@@ -20,7 +20,7 @@ Feature: Toggle activities visibility from the course page
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Visible | Show |
+7 -7
View File
@@ -126,9 +126,9 @@ class behat_course extends behat_base {
// Clicks the selected activity if it exists.
$activity = ucfirst($activity);
$activityxpath = "//div[@id='chooseform']/descendant::label
/descendant::span[contains(concat(' ', @class, ' '), ' typename ')][contains(.,'" . $activity . "')]
/parent::label/child::input";
$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();
@@ -136,8 +136,8 @@ class behat_course extends behat_base {
// Without Javascript.
// Selecting the option from the select box which contains the option.
$selectxpath = $sectionxpath . "/descendant::div[contains(concat(' ', @class, ' '), ' section_add_menus ')]
/descendant::select[contains(., '" . $activity . "')]";
$selectxpath = $sectionxpath . "/descendant::div[contains(concat(' ', @class, ' '), ' section_add_menus ')]" .
"/descendant::select[contains(., '" . $activity . "')]";
$selectnode = $this->find('xpath', $selectxpath);
$selectnode->selectOption($activity);
@@ -279,8 +279,8 @@ class behat_course extends behat_base {
foreach ($activities as $activity) {
// Dimmed.
$this->find('xpath', "//div[contains(concat(' ', @class, ' '), ' activityinstance ')]
/a[contains(concat(' ', @class, ' '), ' dimmed ')]", $dimmedexception, $activity);
$this->find('xpath', "//div[contains(concat(' ', @class, ' '), ' activityinstance ')]" .
"/a[contains(concat(' ', @class, ' '), ' dimmed ')]", $dimmedexception, $activity);
// To check that the visibility is not clickable we check the funcionality rather than the applied style.
$visibilityiconnode = $this->find('css', 'a.editing_show img', false, $activity);
+1 -1
View File
@@ -17,7 +17,7 @@ Feature: Force group mode in a course
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "chat" to section "1" and I fill the form with:
And I add a "Chat" to section "1" and I fill the form with:
| Name of this chat room | Chat room |
| Description | Chat description |
And I follow "Edit settings"
@@ -20,10 +20,10 @@ Feature: Restrict activities availability
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add a "glossary" to section "1" and I fill the form with:
When I add a "Glossary" to section "1" and I fill the form with:
| Name | Test glossary name |
| Description | Test glossary description |
And I add a "chat" to section "1" and I fill the form with:
And I add a "Chat" to section "1" and I fill the form with:
| Name of this chat room | Test chat name |
| Description | Test chat description |
Then I should see "Test glossary name"
@@ -20,27 +20,27 @@ Feature: Show/hide course sections
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test hidden forum 11 name |
| Description | Test hidden forum 11 description |
| Visible | Hide |
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test hidden forum 12 name |
| Description | Test hidden forum 12 description |
| Visible | Show |
And I add a "forum" to section "2" and I fill the form with:
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test hidden forum 21 name |
| Description | Test hidden forum 21 description |
| Visible | Hide |
And I add a "forum" to section "2" and I fill the form with:
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test hidden forum 22 name |
| Description | Test hidden forum 22 description |
| Visible | Show |
And I add a "forum" to section "3" and I fill the form with:
And I add a "Forum" to section "3" and I fill the form with:
| Forum name | Test hidden forum 31 name |
| Description | Test hidden forum 31 description |
| Visible | Hide |
And I add a "forum" to section "3" and I fill the form with:
And I add a "Forum" to section "3" and I fill the form with:
| Forum name | Test hidden forum 32 name |
| Description | Test hidden forum 32 description |
| Visible | Show |
+1 -1
View File
@@ -411,7 +411,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
* @return boolean
*/
protected function running_javascript() {
return get_class($this->getSession()->getDriver()) === 'Moodle\BehatExtension\Driver\MoodleSelenium2Driver';
return get_class($this->getSession()->getDriver()) !== 'Behat\Mink\Driver\GoutteDriver';
}
}
+15 -4
View File
@@ -112,7 +112,7 @@ class behat_form_field {
global $CFG;
// Textareas are considered text based elements.
$tagname = $this->field->getTagName();
$tagname = strtolower($this->field->getTagName());
if ($tagname == 'textarea') {
return false;
}
@@ -131,11 +131,13 @@ class behat_form_field {
default:
return false;
}
}
// Select tag.
if ($tagname == 'select') {
} else if ($tagname == 'select') {
// Select tag.
$classname = 'behat_form_select';
} else {
return false;
}
$classpath = $CFG->dirroot . '/lib/behat/form_field/' . $classname . '.php';
@@ -143,4 +145,13 @@ class behat_form_field {
return new $classname($this->session, $this->field);
}
/**
* Returns whether the scenario is running in a browser that can run Javascript or not.
*
* @return bool
*/
protected function running_javascript() {
return get_class($this->session->getDriver()) !== 'Behat\Mink\Driver\GoutteDriver';
}
}
@@ -45,6 +45,26 @@ class behat_form_select extends behat_form_field {
*/
public function set_value($value) {
$this->field->selectOption($value);
// Adding a click as Selenium requires it to fire some JS events.
if ($this->running_javascript()) {
// Single select needs an extra click in the option.
if (!$this->field->hasAttribute('multiple')) {
// Using the driver direcly because Element methods are messy when dealing
// with elements inside containers.
$optionxpath = $this->field->getXpath() .
"/descendant::option[(./@value = '" . $value . "' or contains(normalize-space(string(.)), '" . $value . "'))]";
$optionnodes = $this->session->getDriver()->find($optionxpath);
if ($optionnodes) {
current($optionnodes)->click();
}
} else {
// Multiple ones needs the click in the select.
$this->field->click();
}
}
}
/**
+12 -2
View File
@@ -132,7 +132,8 @@ class behat_forms extends behat_base {
// Show all fields.
$showmorestr = get_string('showmore', 'form');
$showmores = $this->find_all('xpath', "//a[contains(concat(' ', normalize-space(.), ' '), '" . $showmorestr . "')][contains(concat(' ', normalize-space(@class), ' '), ' moreless-toggler')]");
$showmores = $this->find_all('xpath', "//a[contains(concat(' ', normalize-space(.), ' '), '" . $showmorestr . "')]" .
"[contains(concat(' ', normalize-space(@class), ' '), ' moreless-toggler')]");
// We are supposed to have 'show more's here, otherwise exception.
@@ -177,7 +178,16 @@ class behat_forms extends behat_base {
// Adding a click as Selenium requires it to fire some JS events.
if ($this->running_javascript()) {
$selectnode->click();
if (!$selectnode->hasAttribute('multiple')) {
// Single select needs an extra click in the option.
$xpath = ".//option[(./@value = '" . $option . "' or contains(normalize-space(string(.)), '" . $option . "'))]";
$optionnode = $this->find('xpath', $xpath, false, $selectnode);
$optionnode->click();
} else {
// Multiple ones needs the click in the select.
$selectnode->click();
}
}
}
+17 -4
View File
@@ -150,7 +150,7 @@ class behat_hooks extends behat_base {
// Just trying if server responds.
try {
$this->getSession()->executeScript('// empty comment');
$this->getSession()->wait(0, false);
} catch (Exception $e) {
$moreinfo = 'More info in ' . behat_command::DOCS_URL . '#Running_tests';
$msg = 'Selenium server is not running, you need to start it to run tests that involves Javascript. ' . $moreinfo;
@@ -173,9 +173,22 @@ class behat_hooks extends behat_base {
return;
}
// Wait until the page is ready.
try {
$this->getSession()->wait(self::TIMEOUT, '(document.readyState === "complete")');
// Wait until the page is ready.
// We are already checking that we use a JS browser, this could
// change in case we use another JS driver.
try {
// Safari and Internet Explorer requires time between steps,
// otherwise Selenium tries to click in the previous page's DOM.
if ($this->getSession()->getDriver()->getBrowserName() == 'safari' ||
$this->getSession()->getDriver()->getBrowserName() == 'internet explorer') {
$this->getSession()->wait(self::TIMEOUT * 1000, false);
} else {
// With other browsers we just wait for the DOM ready.
$this->getSession()->wait(self::TIMEOUT * 1000, '(document.readyState === "complete")');
}
} catch (NoSuchWindow $e) {
// If we were interacting with a popup window it will not exists after closing it.
}
+10 -11
View File
@@ -53,17 +53,16 @@ class behat_navigation extends behat_base {
return false;
}
$xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]
/child::li
/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]
/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]
|
//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]
/descendant::li[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed'))]
/descendant::li
/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]
/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]
";
$xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .
"/child::li" .
"/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]" .
"/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]" .
"|" .
"//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .
"/descendant::li[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed'))]" .
"/descendant::li" .
"/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]" .
"/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]";
$node = $this->find('xpath', $xpath);
$node->click();
+1 -1
View File
@@ -20,7 +20,7 @@ Feature: Add choice activity
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "choice" to section "1" and I fill the form with:
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
@@ -22,7 +22,7 @@ Feature: A teacher can choose one of 4 options for publishing choice results
@javascript
Scenario: Do not publish results to students
Given I add a "choice" to section "1" and I fill the form with:
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| Description | Choice Description |
| Publish results | Do not publish results to students |
@@ -38,7 +38,7 @@ Feature: A teacher can choose one of 4 options for publishing choice results
@javascript
Scenario: Show results to students after they answer
Given I add a "choice" to section "1" and I fill the form with:
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| Description | Choice Description |
| option[0] | Option 1 |
@@ -58,7 +58,7 @@ Feature: A teacher can choose one of 4 options for publishing choice results
@javascript
Scenario: Show results to students only after the choice is closed
Given I add a "choice" to section "1" and I fill the form with:
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| Description | Choice Description |
| Publish results | Show results to students only after the choice is closed |
@@ -90,7 +90,7 @@ Feature: A teacher can choose one of 4 options for publishing choice results
@javascript
Scenario: Always show results to students
Given I add a "choice" to section "1" and I fill the form with:
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| Description | Choice Description |
| option[0] | Option 1 |
@@ -24,7 +24,7 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
@javascript
Scenario: Publish anonymous results
Given I add a "choice" to section "1" and I fill the form with:
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| Description | Choice Description |
| option[0] | Option 1 |
@@ -45,7 +45,7 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
@javascript
Scenario: Publish full results
Given I add a "choice" to section "1" and I fill the form with:
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| Description | Choice Description |
| option[0] | Option 1 |
+1 -1
View File
@@ -18,7 +18,7 @@ Feature: Add forum activities and discussions
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
@@ -17,7 +17,7 @@ Feature: Students can choose from 4 discussion display options and their choice
And I log in as "admin"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I add a new discussion to "Test forum name" forum with:
@@ -23,7 +23,7 @@ Feature: Students can edit or delete their forum posts within a set time limit
And I am on homepage
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
@@ -19,7 +19,7 @@ Feature: Teachers can edit or delete any forum post
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I add a new discussion to "Test forum name" forum with:
@@ -19,7 +19,7 @@ Feature: Single simple forum discussion type
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Single discussion forum name |
| Forum type | A single simple discussion |
| Description | Single discussion forum description |
@@ -20,7 +20,7 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos
@javascript
Scenario: Tracking forum posts on
Given I add a "forum" to section "1" and I fill the form with:
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
@@ -41,7 +41,7 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos
@javascript
Scenario: Tracking forum posts off
Given I add a "forum" to section "1" and I fill the form with:
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
@@ -59,7 +59,7 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos
@javascript
Scenario: Tracking forum posts optional
Given I add a "forum" to section "1" and I fill the form with:
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
+4 -4
View File
@@ -51,8 +51,8 @@ class behat_question extends behat_base {
*/
public function i_add_a_question_filling_the_form_with($questiontypename, TableNode $questiondata) {
$questiontypexpath = "//span[@class='qtypename'][.='" . $questiontypename . "']
/ancestor::div[@class='qtypeoption']/descendant::input";
$questiontypexpath = "//span[@class='qtypename'][.='" . $questiontypename . "']" .
"/ancestor::div[@class='qtypeoption']/descendant::input";
return array(
new Given('I follow "' . get_string('questionbank', 'question') . '"'),
@@ -81,8 +81,8 @@ class behat_question extends behat_base {
$this->find('xpath', $questionxpath, $exception);
$exception = new ExpectationException('Question "' . $questiondescription . '" state is not "' . $state . '"', $this->getSession());
$xpath = $questionxpath . "/ancestor::div[contains(concat(' ', @class, ' '), ' que ')]
/descendant::div[@class='state'][contains(., '" . $state . "')]";
$xpath = $questionxpath . "/ancestor::div[contains(concat(' ', @class, ' '), ' que ')]" .
"/descendant::div[@class='state'][contains(., '" . $state . "')]";
$this->find('xpath', $xpath, $exception);
}
+4 -4
View File
@@ -92,8 +92,8 @@ class behat_filepicker extends behat_files {
// In the current folder workspace.
$folder = $this->find(
'xpath',
"//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-folder ')]
//descendant::div[contains(concat(' ', normalize-space(.), ' '), '" . $foldername . "')]",
"//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-folder ')]" .
"//descendant::div[contains(concat(' ', normalize-space(.), ' '), '" . $foldername . "')]",
$exception,
$fieldnode
);
@@ -102,8 +102,8 @@ class behat_filepicker extends behat_files {
// And in the pathbar.
$folder = $this->find(
'xpath',
"//a[contains(concat(' ', normalize-space(@class), ' '), ' fp-path-folder-name ')]
[contains(concat(' ', normalize-space(.), ' '), '" . $foldername . "')]",
"//a[contains(concat(' ', normalize-space(@class), ' '), ' fp-path-folder-name ')]" .
"[contains(concat(' ', normalize-space(.), ' '), '" . $foldername . "')]",
$exception,
$fieldnode
);