Merge branch 'MDL-67668-39-2' of git://github.com/andrewnicols/moodle into MOODLE_39_STABLE
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
@tool_behat
|
||||
Feature: Verify that the inplace editable field works as expected
|
||||
In order to use behat step definitions
|
||||
As a test write
|
||||
I need to ensure that the inplace editable works in forms
|
||||
|
||||
Background:
|
||||
Given the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | idnumber |
|
||||
| forum | C1 | My first forum | forum1 |
|
||||
| assign | C1 | My first assignment | assign1 |
|
||||
| quiz | C1 | My first quiz | quiz1 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
@javascript
|
||||
Scenario: Using an inplace editable updates the name of an activity
|
||||
When I set the field "Edit title" in the "My first assignment" "activity" to "Coursework submission"
|
||||
Then I should see "Coursework submission"
|
||||
And I should not see "My first assignment"
|
||||
But I should see "My first forum"
|
||||
And I should see "My first quiz"
|
||||
And I set the field "Edit title" in the "Coursework submission" "activity" to "My first assignment"
|
||||
And I should not see "Coursework submission"
|
||||
But I should see "My first assignment"
|
||||
And I should see "My first forum"
|
||||
And I should see "My first quiz"
|
||||
@@ -150,4 +150,17 @@ class behat_block_site_main_menu extends behat_base {
|
||||
$xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_site_main_menu ')]//li[contains(., $activityname)]";
|
||||
$this->execute('behat_action_menu::i_open_the_action_menu_in', [$xpath, 'xpath_element']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of partial named selectors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_partial_named_selectors(): array {
|
||||
return [
|
||||
new behat_component_named_selector('Activity', [
|
||||
"//*[contains(concat(' ',normalize-space(@class),' '),' block_site_main_menu ')]//li[contains(., %locator%)]"
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,16 @@ Feature: Edit activities in main menu block
|
||||
|
||||
@javascript
|
||||
Scenario: Edit name of acitivity in-place in site main menu block
|
||||
Given I log in as "admin"
|
||||
Given the following "activity" exists:
|
||||
| activity | forum |
|
||||
| course | Acceptance test site |
|
||||
| name | My forum name |
|
||||
| idnumber | forum |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I navigate to "Turn editing on" in current page administration
|
||||
And I add the "Main menu" block
|
||||
When I add a "Forum" to section "0" and I fill the form with:
|
||||
| Forum name | My forum name |
|
||||
And I click on "Edit title" "link" in the "My forum name" activity in site main menu block
|
||||
And I set the field "New name for activity My forum name" to "New forum name"
|
||||
And I press the enter key
|
||||
When I set the field "Edit title" in the "My forum name" "block_site_main_menu > Activity" to "New forum name"
|
||||
Then I should not see "My forum name"
|
||||
And I should see "New forum name"
|
||||
And I follow "New forum name"
|
||||
|
||||
@@ -158,4 +158,17 @@ class behat_block_social_activities extends behat_base {
|
||||
$xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_social_activities ')]//li[contains(., $activityname)]";
|
||||
$this->execute('behat_action_menu::i_open_the_action_menu_in', [$xpath, 'xpath_element']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of partial named selectors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_partial_named_selectors(): array {
|
||||
return [
|
||||
new behat_component_named_selector('Activity', [
|
||||
"//*[contains(concat(' ',normalize-space(@class),' '),' block_social_activities ')]//li[contains(., %locator%)]",
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@ Feature: Edit activities in social activities block
|
||||
And I set the field "Add an activity to section 'section 0'" to "Forum"
|
||||
And I set the field "Forum name" to "My forum name"
|
||||
And I press "Save and return to course"
|
||||
And I click on "Edit title" "link" in the "My forum name" activity in social activities block
|
||||
And I set the field "New name for activity My forum name" to "New forum name"
|
||||
And I press the enter key
|
||||
When I set the field "Edit title" in the "My forum name" "block_social_activities > Activity" to "New forum name"
|
||||
Then I should not see "My forum name" in the "Social activities" "block"
|
||||
And I should see "New forum name"
|
||||
And I follow "New forum name"
|
||||
@@ -82,4 +80,3 @@ Feature: Edit activities in social activities block
|
||||
And I should not see "My forum name" in the "Social activities" "block"
|
||||
And I click on "My forum name" "link" in the "Recent activity" "block"
|
||||
And I should see "My forum name" in the ".breadcrumb" "css_element"
|
||||
And I log out
|
||||
|
||||
@@ -59,9 +59,7 @@ Feature: Add cohorts of users
|
||||
@javascript
|
||||
Scenario: Edit cohort name in-place
|
||||
When I follow "Cohorts"
|
||||
And I click on "Edit cohort name" "link" in the "Test cohort name" "table_row"
|
||||
And I set the field "New name for cohort Test cohort name" to "Students cohort"
|
||||
And I press the enter key
|
||||
And I set the field "Edit cohort name" to "Students cohort"
|
||||
Then I should not see "Test cohort name"
|
||||
And I should see "Students cohort"
|
||||
And I follow "Cohorts"
|
||||
|
||||
@@ -53,9 +53,7 @@ Feature: Sections can be edited and deleted in topics format
|
||||
|
||||
@javascript
|
||||
Scenario: Inline edit section name in topics format
|
||||
When I click on "Edit topic name" "link" in the "li#section-1" "css_element"
|
||||
And I set the field "New name for topic Topic 1" to "Midterm evaluation"
|
||||
And I press the enter key
|
||||
When I set the field "Edit topic name" in the "li#section-1" "css_element" to "Midterm evaluation"
|
||||
Then I should not see "Topic 1" in the "region-main" "region"
|
||||
And "New name for topic" "field" should not exist
|
||||
And I should see "Midterm evaluation" in the "li#section-1" "css_element"
|
||||
|
||||
@@ -54,9 +54,7 @@ Feature: Sections can be edited and deleted in weeks format
|
||||
|
||||
@javascript
|
||||
Scenario: Inline edit section name in weeks format
|
||||
When I click on "Edit week name" "link" in the "li#section-1" "css_element"
|
||||
And I set the field "New name for week 1 May - 7 May" to "Midterm evaluation"
|
||||
And I press the enter key
|
||||
When I set the field "Edit week name" in the "li#section-1" "css_element" to "Midterm evaluation"
|
||||
Then I should not see "1 May - 7 May" in the "region-main" "region"
|
||||
And "New name for week" "field" should not exist
|
||||
And I should see "Midterm evaluation" in the "li#section-1" "css_element"
|
||||
|
||||
@@ -15,15 +15,16 @@ Feature: Edit activity name in-place
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "activity" exists:
|
||||
| course | C1 |
|
||||
| activity | forum |
|
||||
| name | Test forum name |
|
||||
| description | Test forum description |
|
||||
| idnumber | forum1 |
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
# Rename activity
|
||||
And I click on "Edit title" "link" in the "//div[contains(@class,'activityinstance') and contains(.,'Test forum name')]" "xpath_element"
|
||||
And I set the field "New name for activity Test forum name" to "Good news"
|
||||
And I press the enter key
|
||||
And I set the field "Edit title" in the "Test forum name" "activity" to "Good news"
|
||||
Then I should not see "Test forum name" in the ".course-content" "css_element"
|
||||
And "New name for activity Test forum name" "field" should not exist
|
||||
And I should see "Good news"
|
||||
@@ -32,7 +33,7 @@ Feature: Edit activity name in-place
|
||||
And I should not see "Test forum name"
|
||||
# Cancel renaming
|
||||
And I click on "Edit title" "link" in the "//div[contains(@class,'activityinstance') and contains(.,'Good news')]" "xpath_element"
|
||||
And I set the field "New name for activity Good news" to "Terrible news"
|
||||
And I type "Terrible news"
|
||||
And I press the escape key
|
||||
And "New name for activity Good news" "field" should not exist
|
||||
And I should see "Good news"
|
||||
|
||||
@@ -852,22 +852,12 @@ class behat_course extends behat_base {
|
||||
* @param string $newactivityname
|
||||
*/
|
||||
public function i_change_activity_name_to($activityname, $newactivityname) {
|
||||
|
||||
if (!$this->running_javascript()) {
|
||||
throw new DriverException('Change activity name step is not available with Javascript disabled');
|
||||
}
|
||||
|
||||
$activity = $this->escape($activityname);
|
||||
|
||||
$this->execute('behat_course::i_click_on_in_the_activity',
|
||||
array(get_string('edittitle'), "link", $activity)
|
||||
);
|
||||
|
||||
// Adding chr(10) to save changes.
|
||||
$this->execute('behat_forms::i_set_the_field_to',
|
||||
array('title', $this->escape($newactivityname) . chr(10))
|
||||
);
|
||||
|
||||
$this->execute('behat_forms::i_set_the_field_in_container_to', [
|
||||
get_string('edittitle'),
|
||||
$activityname,
|
||||
'activity',
|
||||
$newactivityname
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,6 @@ Feature: Managers can manage categories for course custom fields
|
||||
Then I should see "Other fields" in the "#customfield_catlist" "css_element"
|
||||
And I navigate to "Reports > Logs" in site administration
|
||||
And I press "Get these logs"
|
||||
And I log out
|
||||
|
||||
Scenario: Edit a category name for custom course fields
|
||||
Given the following "custom field categories" exist:
|
||||
@@ -20,15 +19,12 @@ Feature: Managers can manage categories for course custom fields
|
||||
| Category for test | core_course | course | 0 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Courses > Course custom fields" in site administration
|
||||
And I click on "Edit category name" "link" in the "//div[contains(@class,'categoryinstance') and contains(.,'Category for test')]" "xpath_element"
|
||||
And I set the field "New value for Category for test" to "Good fields"
|
||||
And I press the enter key
|
||||
And I set the field "Edit category name" in the "//div[contains(@class,'categoryinstance') and contains(.,'Category for test')]" "xpath_element" to "Good fields"
|
||||
Then I should not see "Category for test" in the "#customfield_catlist" "css_element"
|
||||
And "New value for Category for test" "field" should not exist
|
||||
And I should see "Good fields" in the "#customfield_catlist" "css_element"
|
||||
And I navigate to "Reports > Logs" in site administration
|
||||
And I press "Get these logs"
|
||||
And I log out
|
||||
|
||||
Scenario: Delete a category for custom course fields
|
||||
Given the following "custom field categories" exist:
|
||||
@@ -46,7 +42,6 @@ Feature: Managers can manage categories for course custom fields
|
||||
Then I should not see "Test category" in the "#customfield_catlist" "css_element"
|
||||
And I navigate to "Reports > Logs" in site administration
|
||||
And I press "Get these logs"
|
||||
And I log out
|
||||
|
||||
Scenario: Move field in the course custom fields to another category
|
||||
Given the following "custom field categories" exist:
|
||||
@@ -78,7 +73,6 @@ Feature: Managers can manage categories for course custom fields
|
||||
And I press "Move \"Field1\""
|
||||
And I follow "After field Field2"
|
||||
And "Field1" "text" should appear after "Field2" "text"
|
||||
And I log out
|
||||
|
||||
Scenario: Reorder course custom field categories
|
||||
Given the following "custom field categories" exist:
|
||||
@@ -108,4 +102,3 @@ Feature: Managers can manage categories for course custom fields
|
||||
And "Field1" "text" should appear after "Category1" "text"
|
||||
And "Category2" "text" should appear after "Field1" "text"
|
||||
And "Category3" "text" should appear after "Category2" "text"
|
||||
And I log out
|
||||
|
||||
+5
-1303
File diff suppressed because it is too large
Load Diff
@@ -48,7 +48,6 @@ class behat_field_manager {
|
||||
* @return behat_form_field
|
||||
*/
|
||||
public static function get_form_field_from_label($label, RawMinkContext $context) {
|
||||
|
||||
// There are moodle form elements that are not directly related with
|
||||
// a basic HTML form field, we should also take care of them.
|
||||
// The DOM node.
|
||||
@@ -172,6 +171,10 @@ class behat_field_manager {
|
||||
} else if ($tagname == 'select') {
|
||||
// Select tag.
|
||||
return 'select';
|
||||
} else if ($tagname == 'span') {
|
||||
if ($fieldnode->hasAttribute('data-inplaceeditable') && $fieldnode->getAttribute('data-inplaceeditable')) {
|
||||
return 'inplaceeditable';
|
||||
}
|
||||
}
|
||||
|
||||
// We can not provide a closer field type.
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* The Interface for a behat root context.
|
||||
*
|
||||
* @package core
|
||||
* @category test
|
||||
* @copyright 2020 Andrew Nicols <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Interface for a behat root context.
|
||||
*
|
||||
* This interface should be implemented by the behat_base context, and behat form fields, and it should be paired with
|
||||
* the behat_session_trait.
|
||||
*
|
||||
* It should not be necessary to implement this interface, and the behat_session_trait trait in normal circumstances.
|
||||
*
|
||||
* @package core
|
||||
* @category test
|
||||
* @copyright 2020 Andrew Nicols <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
interface behat_session_interface {
|
||||
/**
|
||||
* Small timeout.
|
||||
*
|
||||
* A reduced timeout for cases where self::TIMEOUT is too much
|
||||
* and a simple $this->getSession()->getPage()->find() could not
|
||||
* be enough.
|
||||
*
|
||||
* @deprecated since Moodle 3.7 MDL-64979 - please use get_reduced_timeout() instead
|
||||
* @todo MDL-64982 This will be deleted in Moodle 3.11
|
||||
* @see behat_base::get_reduced_timeout()
|
||||
*/
|
||||
const REDUCED_TIMEOUT = 2;
|
||||
|
||||
/**
|
||||
* The timeout for each Behat step (load page, wait for an element to load...).
|
||||
*
|
||||
* @deprecated since Moodle 3.7 MDL-64979 - please use get_timeout() instead
|
||||
* @todo MDL-64982 This will be deleted in Moodle 3.11
|
||||
* @see behat_base::get_timeout()
|
||||
*/
|
||||
const TIMEOUT = 6;
|
||||
|
||||
/**
|
||||
* And extended timeout for specific cases.
|
||||
*
|
||||
* @deprecated since Moodle 3.7 MDL-64979 - please use get_extended_timeout() instead
|
||||
* @todo MDL-64982 This will be deleted in Moodle 3.11
|
||||
* @see behat_base::get_extended_timeout()
|
||||
*/
|
||||
const EXTENDED_TIMEOUT = 10;
|
||||
|
||||
/**
|
||||
* The JS code to check that the page is ready.
|
||||
*
|
||||
* The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.
|
||||
*/
|
||||
const PAGE_READY_JS = "document.readyState === 'complete' && " .
|
||||
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
|
||||
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)";
|
||||
|
||||
/**
|
||||
* Returns the Mink session.
|
||||
*
|
||||
* @param string|null $name name of the session OR active session will be used
|
||||
* @return \Behat\Mink\Session
|
||||
*/
|
||||
public function getSession($name = null);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -135,7 +135,7 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
|
||||
*/
|
||||
protected static $moodleselectors = array(
|
||||
'activity' => <<<XPATH
|
||||
.//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')][normalize-space(.) = %locator% ]
|
||||
.//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')][descendant::*[contains(normalize-space(.), %locator%)]]
|
||||
XPATH
|
||||
, 'block' => <<<XPATH
|
||||
.//*[@data-block][contains(concat(' ', normalize-space(@class), ' '), concat(' ', %locator%, ' ')) or
|
||||
@@ -262,6 +262,11 @@ XPATH
|
||||
.//*[@data-passwordunmask='wrapper']
|
||||
/descendant::input[@id = %locator% or @id = //label[contains(normalize-space(string(.)), %locator%)]/@for]
|
||||
XPATH
|
||||
,
|
||||
'inplaceeditable' => <<<XPATH
|
||||
.//descendant::span[@data-inplaceeditable][descendant::a[%titleMatch%]]
|
||||
XPATH
|
||||
,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
use Behat\Mink\Session as Session,
|
||||
Behat\Mink\Element\NodeElement as NodeElement;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use Behat\Mink\Session;
|
||||
|
||||
/**
|
||||
* Representation of a form field.
|
||||
@@ -38,7 +38,10 @@ use Behat\Mink\Session as Session,
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_form_field {
|
||||
class behat_form_field implements behat_session_interface {
|
||||
|
||||
// All of the functionality of behat_base is shared with form fields via the behat_session_trait trait.
|
||||
use behat_session_trait;
|
||||
|
||||
/**
|
||||
* @var Session Behat session.
|
||||
@@ -55,6 +58,16 @@ class behat_form_field {
|
||||
*/
|
||||
protected $fieldlocator = false;
|
||||
|
||||
/**
|
||||
* Returns the Mink session.
|
||||
*
|
||||
* @param string|null $name name of the session OR active session will be used
|
||||
* @return \Behat\Mink\Session
|
||||
*/
|
||||
public function getSession($name = null) {
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General constructor with the node and the session to interact with.
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Custom interaction with inplace editable elements.
|
||||
*
|
||||
* @package core_form
|
||||
* @category test
|
||||
* @copyright 2019 Andrew Nicols <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/behat_form_text.php');
|
||||
|
||||
/**
|
||||
* Custom interaction with inplace editable elements.
|
||||
*
|
||||
* @package core_form
|
||||
* @category test
|
||||
* @copyright 2019 Andrew Nicols <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_form_inplaceeditable extends behat_form_text {
|
||||
/**
|
||||
* Sets the value to a field.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function set_value($value) {
|
||||
// Require JS to run this step.
|
||||
self::require_javascript();
|
||||
|
||||
// Click to enable editing.
|
||||
self::execute(
|
||||
'behat_general::i_click_on_in_the',
|
||||
[
|
||||
'[data-inplaceeditablelink]',
|
||||
'css_element',
|
||||
$this->field,
|
||||
'NodeElement',
|
||||
]
|
||||
);
|
||||
|
||||
// Note: It is not possible to use the NodeElement->keyDown() and related functions because
|
||||
// this can trigger a focusOnElement call each time.
|
||||
// Instead use the behat_base::type_keys() function.
|
||||
|
||||
// The inplace editable selects all existing content on focus.
|
||||
// Clear the existing value.
|
||||
self::type_keys($this->session, [behat_keys::BACKSPACE]);
|
||||
|
||||
// Type in the new value, followed by ENTER to save the value.
|
||||
self::type_keys($this->session, array_merge(
|
||||
str_split($value),
|
||||
[behat_keys::ENTER]
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -12,16 +12,16 @@ Feature: Edited book chapters handle tags correctly
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following "activity" exists:
|
||||
| activity | book |
|
||||
| course | C1 |
|
||||
| idnumber | book1 |
|
||||
| name | Test book |
|
||||
| description | A book about dreams |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Book" to section "1" and I fill the form with:
|
||||
| Name | Test book |
|
||||
| Description | A book about dreams! |
|
||||
And I log out
|
||||
|
||||
Scenario: Book chapter edition of custom tags works as expected
|
||||
Given I log in as "teacher1"
|
||||
|
||||
@@ -130,8 +130,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
And I press "Search forums"
|
||||
And I should see "Advanced search"
|
||||
And I set the field "Is tagged with" to "SearchedTag"
|
||||
And I click on "[data-value='SearchedTag']" "css_element"
|
||||
And I press the escape key
|
||||
And I press the enter key
|
||||
When I press "Search forums"
|
||||
Then I should see "My subject"
|
||||
And I should not see "Your subjective"
|
||||
|
||||
@@ -21,9 +21,7 @@ Feature: Rename external tools via inline editing
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "External tool" to section "1" and I fill the form with:
|
||||
| Activity name | Test tool activity 1 |
|
||||
And I click on "Edit title" "link" in the "li#section-1" "css_element"
|
||||
And I set the field "New name for activity Test tool activity 1" to "Test tool activity renamed"
|
||||
And I press the enter key
|
||||
And I set the field "Edit title" in the "li#section-1" "css_element" to "Test tool activity renamed"
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
Then I should not see "Test tool activity 1"
|
||||
And I should see "Test tool activity renamed"
|
||||
|
||||
@@ -397,7 +397,8 @@ class behat_mod_quiz extends behat_question_base {
|
||||
|
||||
$this->execute('behat_general::assert_page_contains_text', $this->escape(get_string('edittitleinstructions')));
|
||||
|
||||
$this->execute('behat_forms::i_set_the_field_to', array('maxmark', $this->escape($newmark) . chr(10)));
|
||||
$this->execute('behat_general::i_type', [$newmark]);
|
||||
$this->execute('behat_general::i_press_named_key', ['', 'enter']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -653,7 +654,9 @@ class behat_mod_quiz extends behat_question_base {
|
||||
|
||||
$this->execute('behat_general::assert_page_contains_text', $this->escape(get_string('edittitleinstructions')));
|
||||
|
||||
$this->execute('behat_forms::i_set_the_field_to', array('section', $this->escape($sectionheading) . chr(10)));
|
||||
$this->execute('behat_general::i_press_named_key', ['', 'backspace']);
|
||||
$this->execute('behat_general::i_type', [$sectionheading]);
|
||||
$this->execute('behat_general::i_press_named_key', ['', 'enter']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,16 +17,19 @@ Feature: Edit quiz marks with no attempts
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | grade | decimalpoints | questiondecimalpoints |
|
||||
| quiz | Quiz 1 | C1 | quiz1 | 20 | 2 | -1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "True/False" question to the "Quiz 1" quiz with:
|
||||
| Question name | First question |
|
||||
| Question text | Answer me |
|
||||
| Default mark | 2.0 |
|
||||
And I add a "True/False" question to the "Quiz 1" quiz with:
|
||||
| Question name | Second question |
|
||||
| Question text | Answer again |
|
||||
| Default mark | 3.0 |
|
||||
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Course | C1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer me |
|
||||
| Test questions | truefalse | Second question | Answer again |
|
||||
And quiz "Quiz 1" contains the following questions:
|
||||
| question | page | maxmark |
|
||||
| First question | 1 | 2.0 |
|
||||
| Second question | 1 | 3.0 |
|
||||
And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
|
||||
@javascript
|
||||
Scenario: Set the max mark for a question.
|
||||
|
||||
@@ -28,15 +28,11 @@ Feature: Managers can create and manage tag collections
|
||||
Scenario: Adding tag collections
|
||||
When I follow "Hobbies"
|
||||
Then I should see "Nothing to display"
|
||||
And I log out
|
||||
|
||||
Scenario: Editing tag collections
|
||||
When I click on "Edit tag collection name" "link" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Hobbies')]" "xpath_element"
|
||||
And I set the field "New name for tag collection Hobbies" to "Newname"
|
||||
And I press the enter key
|
||||
When I set the field "Edit tag collection name" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Hobbies')]" "xpath_element" to "Newname"
|
||||
Then I should not see "Hobbies"
|
||||
And I should see "Newname"
|
||||
And I log out
|
||||
|
||||
Scenario: Resorting tag collections
|
||||
When I follow "Add tag collection"
|
||||
@@ -48,41 +44,34 @@ Feature: Managers can create and manage tag collections
|
||||
And "Blogging" "link" should appear before "Hobbies" "link"
|
||||
And I click on "Move down" "link" in the "Blogging" "table_row"
|
||||
And "Blogging" "link" should appear after "Hobbies" "link"
|
||||
And I log out
|
||||
|
||||
Scenario: Deleting tag collections
|
||||
When I click on "Delete" "link" in the "Hobbies" "table_row"
|
||||
Then I should see "Are you sure you want to delete tag collection \"Hobbies\"?"
|
||||
And I press "Yes"
|
||||
And I should not see "Hobbies"
|
||||
And I log out
|
||||
|
||||
Scenario: Assigning tag area to tag collection
|
||||
And I should see "User interests" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Default collection')]" "xpath_element"
|
||||
And I should not see "User interests" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Hobbies')]" "xpath_element"
|
||||
When I click on "Change tag collection" "link" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element"
|
||||
And I set the field "Change tag collection of area User interests" to "Hobbies"
|
||||
When I set the field "Change tag collection" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element" to "Hobbies"
|
||||
Then I should not see "User interests" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Default collection')]" "xpath_element"
|
||||
And I should see "User interests" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Hobbies')]" "xpath_element"
|
||||
And I should see "Hobbies" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element"
|
||||
And I log out
|
||||
|
||||
Scenario: Disabling tag areas
|
||||
When I click on "Disable" "link" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element"
|
||||
And I should not see "User interests" in the "table.tag-collections-table" "css_element"
|
||||
And I click on "Enable" "link" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element"
|
||||
And I should see "User interests" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Default collection')]" "xpath_element"
|
||||
And I log out
|
||||
|
||||
Scenario: Deleting non-empty tag collections
|
||||
When I click on "Change tag collection" "link" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element"
|
||||
And I set the field "Change tag collection of area User interests" to "Hobbies"
|
||||
When I set the field "Change tag collection" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element" to "Hobbies"
|
||||
And I click on "Delete" "link" in the "Hobbies" "table_row"
|
||||
Then I should see "Are you sure you want to delete tag collection \"Hobbies\"?"
|
||||
And I press "Yes"
|
||||
And I should not see "Hobbies"
|
||||
And I should see "User interests" in the "//table[contains(@class,'tag-collections-table')]//tr[contains(.,'Default collection')]" "xpath_element"
|
||||
And I log out
|
||||
|
||||
Scenario: Moving tags when changing tag collections
|
||||
And I open my profile in edit mode
|
||||
@@ -90,8 +79,7 @@ Feature: Managers can create and manage tag collections
|
||||
And I set the field "List of interests" to "Swimming, Tag0, Tag3"
|
||||
And I press "Update profile"
|
||||
And I navigate to "Appearance > Manage tags" in site administration
|
||||
When I click on "Change tag collection" "link" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element"
|
||||
And I set the field "Change tag collection of area User interests" to "Hobbies"
|
||||
When I set the field "Change tag collection" in the "//table[contains(@class,'tag-areas-table')]//tr[contains(.,'User interests')]" "xpath_element" to "Hobbies"
|
||||
And I follow "Hobbies"
|
||||
Then I should see "Swimming"
|
||||
And I should see "Tag0"
|
||||
@@ -107,7 +95,6 @@ Feature: Managers can create and manage tag collections
|
||||
And I should see "Tag3"
|
||||
And I should see "Tag1"
|
||||
And I should see "Tag2"
|
||||
And I log out
|
||||
|
||||
Scenario: Creating searchable and non-searchable tag collections
|
||||
And I follow "Add tag collection"
|
||||
@@ -129,4 +116,3 @@ Feature: Managers can create and manage tag collections
|
||||
And I click on "Site pages" "list_item" in the "Navigation" "block"
|
||||
And I click on "Tags" "link" in the "Navigation" "block"
|
||||
And "Select tag collection" "select" should not exist
|
||||
And I log out
|
||||
|
||||
@@ -158,19 +158,14 @@ Feature: Users can edit tags to add description or rename
|
||||
And I navigate to "Appearance > Manage tags" in site administration
|
||||
And I follow "Default collection"
|
||||
# Renaming tag to a valid name
|
||||
And I click on "Edit tag name" "link" in the "Cat" "table_row"
|
||||
And I set the field "New name for tag Cat" to "Kitten"
|
||||
And I press the enter key
|
||||
And I set the field "Edit tag name" in the "Cat" "table_row" to "Kitten"
|
||||
Then I should not see "Cat"
|
||||
And "New name for tag" "field" should not exist
|
||||
And I wait until "Kitten" "link" exists
|
||||
And I follow "Default collection"
|
||||
And I should see "Kitten"
|
||||
And I should not see "Cat"
|
||||
# Renaming tag to an invalid name
|
||||
And I click on "Edit tag name" "link" in the "Turtle" "table_row"
|
||||
And I set the field "New name for tag Turtle" to "DOG"
|
||||
And I press the enter key
|
||||
And I set the field "Edit tag name" in the "Turtle" "table_row" to "DOG"
|
||||
And I should see "The tag name is already in use. Do you want to combine these tags?"
|
||||
And I click on "Cancel" "button" in the "Confirm" "dialogue"
|
||||
And "New name for tag" "field" should not exist
|
||||
@@ -183,7 +178,7 @@ Feature: Users can edit tags to add description or rename
|
||||
And I should not see "DOG"
|
||||
# Cancel tag renaming
|
||||
And I click on "Edit tag name" "link" in the "Dog" "table_row"
|
||||
And I set the field "New name for tag Dog" to "Penguin"
|
||||
And I type "Penguin"
|
||||
And I press the escape key
|
||||
And "New name for tag" "field" should not exist
|
||||
And I should see "Turtle"
|
||||
@@ -197,9 +192,7 @@ Feature: Users can edit tags to add description or rename
|
||||
When I log in as "manager1"
|
||||
And I navigate to "Appearance > Manage tags" in site administration
|
||||
And I follow "Default collection"
|
||||
And I click on "Edit tag name" "link" in the "Turtle" "table_row"
|
||||
And I set the field "New name for tag Turtle" to "DOG"
|
||||
And I press the enter key
|
||||
And I set the field "Edit tag name" in the "Turtle" "table_row" to "DOG"
|
||||
And I should see "The tag name is already in use. Do you want to combine these tags?"
|
||||
And I press "Yes"
|
||||
Then I should not see "Turtle"
|
||||
|
||||
Reference in New Issue
Block a user