MDL-73188 usertours: Make language string ID work again

- New dropdown was created, user can choose to enter the content manually
  or using Moodle Language string
- New text field was created to allow user to input the Lang string format
- New validation was created to validate the language identifier
- New Behat tests were created to validate the new feature
This commit is contained in:
Huong Nguyen 2022-01-21 08:56:00 +07:00
parent a01f1fa71c
commit 2137ce6539
12 changed files with 263 additions and 76 deletions

View file

@ -24,6 +24,9 @@
namespace tool_usertours\local\forms; namespace tool_usertours\local\forms;
use stdClass;
use tool_usertours\step;
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
require_once($CFG->libdir . '/formslib.php'); require_once($CFG->libdir . '/formslib.php');
@ -40,6 +43,16 @@ class editstep extends \moodleform {
*/ */
protected $step; protected $step;
/**
* @var int Display the step's content by using Moodle language string.
*/
private const CONTENTTYPE_LANGSTRING = 0;
/**
* @var int Display the step's content by entering it manually.
*/
private const CONTENTTYPE_MANUAL = 1;
/** /**
* Create the edit step form. * Create the edit step form.
* *
@ -81,6 +94,20 @@ class editstep extends \moodleform {
$mform->setType('title', PARAM_TEXT); $mform->setType('title', PARAM_TEXT);
$mform->addHelpButton('title', 'title', 'tool_usertours'); $mform->addHelpButton('title', 'title', 'tool_usertours');
// Content type.
$typeoptions = [
static::CONTENTTYPE_LANGSTRING => get_string('content_type_langstring', 'tool_usertours'),
static::CONTENTTYPE_MANUAL => get_string('content_type_manual', 'tool_usertours')
];
$mform->addElement('select', 'contenttype', get_string('content_type', 'tool_usertours'), $typeoptions);
$mform->addHelpButton('contenttype', 'content_type', 'tool_usertours');
$mform->setDefault('contenttype', static::CONTENTTYPE_MANUAL);
// Language identifier.
$mform->addElement('textarea', 'contentlangstring', get_string('moodle_language_identifider', 'tool_usertours'));
$mform->setType('contentlangstring', PARAM_TEXT);
$mform->hideIf('contentlangstring', 'contenttype', 'eq', static::CONTENTTYPE_MANUAL);
$editoroptions = [ $editoroptions = [
'subdirs' => 1, 'subdirs' => 1,
'maxbytes' => $CFG->maxbytes, 'maxbytes' => $CFG->maxbytes,
@ -88,10 +115,11 @@ class editstep extends \moodleform {
'changeformat' => 1, 'changeformat' => 1,
'trusttext' => true 'trusttext' => true
]; ];
$mform->addElement('editor', 'content', get_string('content', 'tool_usertours'), null, $editoroptions); $objs = $mform->createElement('editor', 'content', get_string('content', 'tool_usertours'), null, $editoroptions);
$mform->addRule('content', get_string('required'), 'required', null, 'client'); // TODO: MDL-68540 We need to add the editor to a group element because editor element will not work with hideIf.
$mform->setType('content', PARAM_RAW); // No XSS prevention here, users must be trusted. $mform->addElement('group', 'contenthtmlgrp', get_string('content', 'tool_usertours'), [$objs], ' ', false);
$mform->addHelpButton('content', 'content', 'tool_usertours'); $mform->addHelpButton('contenthtmlgrp', 'content', 'tool_usertours');
$mform->hideIf('contenthtmlgrp', 'contenttype', 'eq', static::CONTENTTYPE_LANGSTRING);
// Add the step configuration. // Add the step configuration.
$mform->addElement('header', 'heading_options', get_string('options_heading', 'tool_usertours')); $mform->addElement('header', 'heading_options', get_string('options_heading', 'tool_usertours'));
@ -106,4 +134,79 @@ class editstep extends \moodleform {
$this->add_action_buttons(); $this->add_action_buttons();
} }
/**
* Validate the database on the submitted content type.
*
* @param array $data array of ("fieldname"=>value) of submitted data
* @param array $files array of uploaded files "element_name"=>tmp_file_path
* @return array of "element_name"=>"error_description" if there are errors,
* or an empty array if everything is OK (true allowed for backwards compatibility too).
*/
public function validation($data, $files): array {
$errors = parent::validation($data, $files);
if ($data['contenttype'] == static::CONTENTTYPE_LANGSTRING) {
if (!isset($data['contentlangstring']) || trim($data['contentlangstring']) == '') {
$errors['contentlangstring'] = get_string('required');
} else {
$splitted = explode(',', trim($data['contentlangstring']), 2);
$langid = $splitted[0];
$langcomponent = $splitted[1];
if (!get_string_manager()->string_exists($langid, $langcomponent)) {
$errors['contentlangstring'] = get_string('invalid_lang_id', 'tool_usertours');
}
}
}
if ($data['contenttype'] == static::CONTENTTYPE_MANUAL) {
if (strip_tags($data['content']['text']) == '') {
$errors['content'] = get_string('required');
}
}
return $errors;
}
/**
* Load in existing data as form defaults. Usually new entry defaults are stored directly in
* form definition (new entry form); this function is used to load in data where values
* already exist and data is being edited (edit entry form).
*
* @param stdClass|array $data object or array of default values
*/
public function set_data($data): void {
$data = (object) $data;
if (!isset($data->contenttype)) {
if (!empty($data->content['text']) && step::is_language_string_from_input($data->content['text'])) {
$data->contenttype = static::CONTENTTYPE_LANGSTRING;
$data->contentlangstring = $data->content['text'];
// Empty the editor content.
$data->content = ['text' => ''];
} else {
$data->contenttype = static::CONTENTTYPE_MANUAL;
}
}
parent::set_data($data);
}
/**
* Return submitted data if properly submitted or returns NULL if validation fails or
* if there is no submitted data.
*
* @return object|null submitted data; NULL if not valid or not submitted or cancelled
*/
public function get_data(): ?object {
$data = parent::get_data();
if ($data) {
if ($data->contenttype == static::CONTENTTYPE_LANGSTRING) {
$data->content = [
'text' => $data->contentlangstring,
'format' => 1,
];
}
}
return $data;
}
} }

View file

@ -89,6 +89,11 @@ class step {
*/ */
protected $dirty = false; protected $dirty = false;
/**
* @var string Regex to check any matching lang string.
*/
protected const LANG_STRING_REGEX = '|^([a-zA-Z][a-zA-Z0-9\.:/_-]*),([a-zA-Z][a-zA-Z0-9\.:/_-]*)$|';
/** /**
* Fetch the step instance. * Fetch the step instance.
* *
@ -712,7 +717,7 @@ class step {
public static function get_string_from_input($string) { public static function get_string_from_input($string) {
$string = trim($string); $string = trim($string);
if (preg_match('|^([a-zA-Z][a-zA-Z0-9\.:/_-]*),([a-zA-Z][a-zA-Z0-9\.:/_-]*)$|', $string, $matches)) { if (preg_match(static::LANG_STRING_REGEX, $string, $matches)) {
if ($matches[2] === 'moodle') { if ($matches[2] === 'moodle') {
$matches[2] = 'core'; $matches[2] = 'core';
} }
@ -724,4 +729,14 @@ class step {
return $string; return $string;
} }
/**
* Check if the given string contains any matching langstring.
*
* @param string $string Tour step content
* @return bool
*/
public static function is_language_string_from_input(string $string): bool {
return preg_match(static::LANG_STRING_REGEX, $string) == true;
}
} }

View file

@ -39,9 +39,14 @@ $string['confirmtourremovalquestion'] = 'Are you sure that you wish to remove th
$string['confirmtourremovaltitle'] = 'Confirm tour removal'; $string['confirmtourremovaltitle'] = 'Confirm tour removal';
$string['content'] = 'Content'; $string['content'] = 'Content';
$string['content_heading'] = 'Content'; $string['content_heading'] = 'Content';
$string['content_help'] = 'Content describing the step may be added as plain text, enclosed in multilang tags (for use with the multi-language content filter) if required. $string['content_help'] = 'Content describing the step may be added as plain text, enclosed in multilang tags (for use with the multi-language content filter) if required.';
$string['content_type'] = 'Content type';
$string['content_type_help'] = 'Content types are:
Alternatively, a language string ID may be entered in the format identifier,component (with no brackets or space after the comma).'; * Read from language pack - Language string ID may be entered in the format identifier,component (with no brackets or space after the comma).
* Enter manually - Using an editor to input the content';
$string['content_type_langstring'] = 'Read from language pack';
$string['content_type_manual'] = 'Enter manually';
$string['cssselector'] = 'CSS selector'; $string['cssselector'] = 'CSS selector';
$string['defaultvalue'] = 'Default ({$a})'; $string['defaultvalue'] = 'Default ({$a})';
$string['delay'] = 'Delay before showing the step'; $string['delay'] = 'Delay before showing the step';
@ -79,8 +84,10 @@ $string['filter_theme_help'] = 'Show the tour when the user is using one of the
$string['filter_role'] = 'Role'; $string['filter_role'] = 'Role';
$string['filter_role_help'] = 'A tour may be restricted to users with selected roles in the context where the tour is shown. For example, restricting a Dashboard tour to users with the role of student won\'t work if users have the role of student in a course (as is generally the case). A Dashboard tour can only be restricted to users with a system role.'; $string['filter_role_help'] = 'A tour may be restricted to users with selected roles in the context where the tour is shown. For example, restricting a Dashboard tour to users with the role of student won\'t work if users have the role of student in a course (as is generally the case). A Dashboard tour can only be restricted to users with a system role.';
$string['importtour'] = 'Import tour'; $string['importtour'] = 'Import tour';
$string['invalid_lang_id'] = 'Invalid language identifier';
$string['left'] = 'Left'; $string['left'] = 'Left';
$string['modifyshippedtourwarning'] = 'This is a user tour that has shipped with Moodle. Any modifications you make may be overridden during your next site upgrade.'; $string['modifyshippedtourwarning'] = 'This is a user tour that has shipped with Moodle. Any modifications you make may be overridden during your next site upgrade.';
$string['moodle_language_identifider'] = 'Moodle language identifier';
$string['movestepdown'] = 'Move step down'; $string['movestepdown'] = 'Move step down';
$string['movestepup'] = 'Move step up'; $string['movestepup'] = 'Move step up';
$string['movetourdown'] = 'Move tour down'; $string['movetourdown'] = 'Move tour down';

View file

@ -16,15 +16,15 @@ Feature: Add a new user tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 1 | | Tour is enabled | 1 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | targetvalue_block | Title | Content | | targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here | | Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here | Enter manually |
| Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here | | Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here | Enter manually |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | targetvalue_selector | Title | Content | | targettype | targetvalue_selector | Title | id_content | Content type |
| Selector | .usermenu | User menu | This is your personal user menu. You'll find your personal preferences and your user profile here. | | Selector | .usermenu | User menu | This is your personal user menu. You'll find your personal preferences and your user profile here. | Enter manually |
When I am on homepage When I am on homepage
Then I should see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful" Then I should see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful"
And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element" And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element"
@ -53,8 +53,8 @@ Feature: Add a new user tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 0 | | Tour is enabled | 0 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
When I am on homepage When I am on homepage
Then I should not see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful" Then I should not see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful"
@ -70,8 +70,8 @@ Feature: Add a new user tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 0 | | Tour is enabled | 0 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
And I open the User tour settings page And I open the User tour settings page
When I click on "Enable" "link" in the "My first tour" "table_row" When I click on "Enable" "link" in the "My first tour" "table_row"
And I am on homepage And I am on homepage
@ -91,12 +91,12 @@ Feature: Add a new user tour
| Display step numbers | 1 | | Display step numbers | 1 |
| End tour button's label | Sample end label | | End tour button's label | Sample end label |
And I add steps to the "Steps tour" tour: And I add steps to the "Steps tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | First step of the Tour | | Display in middle of page | Welcome | First step of the Tour | Enter manually |
And I add steps to the "Steps tour" tour: And I add steps to the "Steps tour" tour:
| targettype | targetvalue_block | Title | Content | | targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | Second step of the Tour | | Block | Timeline | Timeline | Second step of the Tour | Enter manually |
| Block | Calendar | Calendar | Third step of the Tour | | Block | Calendar | Calendar | Third step of the Tour | Enter manually |
When I am on homepage When I am on homepage
Then I should see "First step of the Tour" Then I should see "First step of the Tour"
And I should see "Next (1/3)" And I should see "Next (1/3)"
@ -125,12 +125,12 @@ Feature: Add a new user tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Display step numbers | 0 | | Display step numbers | 0 |
And I add steps to the "Steps tour" tour: And I add steps to the "Steps tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | First step of the Tour | | Display in middle of page | Welcome | First step of the Tour | Enter manually |
And I add steps to the "Steps tour" tour: And I add steps to the "Steps tour" tour:
| targettype | targetvalue_block | Title | Content | | targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | Second step of the Tour | | Block | Timeline | Timeline | Second step of the Tour | Enter manually |
| Block | Calendar | Calendar | Third step of the Tour | | Block | Calendar | Calendar | Third step of the Tour | Enter manually |
When I am on homepage When I am on homepage
Then I should see "First step of the Tour" Then I should see "First step of the Tour"
And I should see "Next" And I should see "Next"
@ -153,8 +153,8 @@ Feature: Add a new user tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Display step numbers | 1 | | Display step numbers | 1 |
And I add steps to the "Steps tour" tour: And I add steps to the "Steps tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | This is a single step tour | | Display in middle of page | Welcome | This is a single step tour | Enter manually |
When I am on homepage When I am on homepage
Then I should see "This is a single step tour" Then I should see "This is a single step tour"
And I should not see "Next (1/1)" And I should not see "Next (1/1)"

View file

@ -15,8 +15,8 @@ Feature: Duplicate a user tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 0 | | Tour is enabled | 0 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
And I open the User tour settings page And I open the User tour settings page
And I should see "1" occurrences of "First tour" in the "admintable" "table" And I should see "1" occurrences of "First tour" in the "admintable" "table"
And I click on "Duplicate" "link" in the "My first tour" "table_row" And I click on "Duplicate" "link" in the "My first tour" "table_row"

View file

@ -13,8 +13,8 @@ Feature: Reset a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Show with backdrop | 1 | | Show with backdrop | 1 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome tour. | | Display in middle of page | Welcome | Welcome tour. | Enter manually |
@javascript @javascript
Scenario: Reset the tour with mobile view Scenario: Reset the tour with mobile view

View file

@ -9,15 +9,15 @@ Feature: Apply accessibility to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Show with backdrop | 1 | | Show with backdrop | 1 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome tour. | | Display in middle of page | Welcome | Welcome tour. | Enter manually |
And I add steps to the tour: And I add steps to the tour:
| targettype | targetvalue_selector | Title | Content | | targettype | targetvalue_selector | Title | id_content | Content type |
| Selector | .usermenu | User menu | Next page | | Selector | .usermenu | User menu | Next page | Enter manually |
| Selector | .navbar-brand | Page 2 | Next page | | Selector | .navbar-brand | Page 2 | Next page | Enter manually |
And I add steps to the tour: And I add steps to the tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Page 3 | Final page. | | Display in middle of page | Page 3 | Final page. | Enter manually |
@javascript @javascript
Scenario: Check tabbing working correctly. Scenario: Check tabbing working correctly.

View file

@ -0,0 +1,62 @@
@tool @tool_usertours
Feature: Apply content type to a tour
In order to give more content to a tour
As an administrator
I need to change the content type of the user tour
Background:
Given I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | My first tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
@javascript
Scenario: User can choose the the content type of the tour step
Given I open the User tour settings page
And I click on "View" "link" in the "My first tour" "table_row"
When I click on "New step" "link"
Then "Content type" "select" should exist
And the "Content type" select box should contain "Read from language pack"
And the "Content type" select box should contain "Enter manually"
And I select "Read from language pack" from the "Content type" singleselect
And I should see " Moodle language identifier"
And "#fgroup_id_contenthtmlgrp" "css_element" should not be visible
And I select "Enter manually" from the "Content type" singleselect
And "#fgroup_id_contenthtmlgrp" "css_element" should be visible
And I should not see "Moodle language identifier"
@javascript
Scenario: Create a new step with Moodle Language content type
Given I open the User tour settings page
And I click on "View" "link" in the "My first tour" "table_row"
And I click on "New step" "link"
And I set the field "Title" to "tour_activityinfo_course_teacher_title,tool_usertours"
And I select "Read from language pack" from the "Content type" singleselect
And I set the field "Moodle language identifier" to "tour_activityinfo_course_teacher_content_abc,tool_usertours"
When I press "Save changes"
Then I should see "Invalid language identifier"
And I set the field "Moodle language identifier" to "tour_activityinfo_course_teacher_content,tool_usertours"
And I press "Save changes"
And I should see "New: Activity information"
And I should see "New course settings 'Show completion conditions' and 'Show activity dates' enable you to choose whether activity completion conditions (if set) and/or dates are displayed for students on the course page."
And I click on "Edit" "link" in the "New: Activity information" "table_row"
And the field "Title" matches value "tour_activityinfo_course_teacher_title,tool_usertours"
And the field "Moodle language identifier" matches value "tour_activityinfo_course_teacher_content,tool_usertours"
@javascript
Scenario: Create a new step with manual content type
Given I open the User tour settings page
And I click on "View" "link" in the "My first tour" "table_row"
And I click on "New step" "link"
And I set the field "Title" to "tour_activityinfo_course_teacher_title,tool_usertours"
And I select "Enter manually" from the "Content type" singleselect
And I set the field "id_content" to "<b>Test content</b>"
And I press "Save changes"
And I should see "New: Activity information"
And I should see "Test content"
And I click on "Edit" "link" in the "New: Activity information" "table_row"
And I should not see "Moodle language identifier"
And the field "Title" matches value "tour_activityinfo_course_teacher_title,tool_usertours"
And the field "id_content" matches value "<b>Test content</b>"

View file

@ -27,8 +27,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Role | Student,Non-editing teacher | | Role | Student,Non-editing teacher |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour.| | Display in middle of page | Welcome | Welcome to your course tour. | Enter manually |
And I log out And I log out
And I log in as "editor1" And I log in as "editor1"
When I am on "Course 1" course homepage When I am on "Course 1" course homepage
@ -68,8 +68,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Category | MainCat | | Category | MainCat |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour.| | Display in middle of page | Welcome | Welcome to your course tour. | Enter manually |
And I log out And I log out
And I log in as "student1" And I log in as "student1"
When I am on "Course 1" course homepage When I am on "Course 1" course homepage
@ -100,8 +100,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Course format | Weekly format | | Course format | Weekly format |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour.| | Display in middle of page | Welcome | Welcome to your course tour. | Enter manually |
And I log out And I log out
And I log in as "student1" And I log in as "student1"
When I am on "Course 1" course homepage When I am on "Course 1" course homepage
@ -132,8 +132,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Courses | C1 | | Courses | C1 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour.| | Display in middle of page | Welcome | Welcome to your course tour. | Enter manually |
And I log out And I log out
And I log in as "student1" And I log in as "student1"
When I am on "Course 1" course homepage When I am on "Course 1" course homepage
@ -171,8 +171,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| CSS selector | .modtype_wiki | | CSS selector | .modtype_wiki |
And I add steps to the "Wiki tour" tour: And I add steps to the "Wiki tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Wiki tour | | Display in middle of page | Welcome | Welcome to the Wiki tour | Enter manually |
And I add a new user tour with: And I add a new user tour with:
| Name | Forum tour | | Name | Forum tour |
| Description | A tour with both matches | | Description | A tour with both matches |
@ -180,8 +180,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| CSS selector | .modtype_forum | | CSS selector | .modtype_forum |
And I add steps to the "Forum tour" tour: And I add steps to the "Forum tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Forum tour | | Display in middle of page | Welcome | Welcome to the Forum tour | Enter manually |
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
Then I should see "Welcome to the Wiki tour" Then I should see "Welcome to the Wiki tour"
And I am on "Course 2" course homepage And I am on "Course 2" course homepage
@ -200,8 +200,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| CSS selector | #page-my-index | | CSS selector | #page-my-index |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the First tour | | Display in middle of page | Welcome | Welcome to the First tour | Enter manually |
And I add a new user tour with: And I add a new user tour with:
| Name | Second tour | | Name | Second tour |
| Description | The second tour | | Description | The second tour |
@ -209,8 +209,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 0 | | Tour is enabled | 0 |
| CSS selector | #page-my-index | | CSS selector | #page-my-index |
And I add steps to the "Second tour" tour: And I add steps to the "Second tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Second tour | | Display in middle of page | Welcome | Welcome to the Second tour | Enter manually |
And I add a new user tour with: And I add a new user tour with:
| Name | Third tour | | Name | Third tour |
| Description | The third tour | | Description | The third tour |
@ -218,8 +218,8 @@ Feature: Apply tour filters to a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| CSS selector | #page-my-index | | CSS selector | #page-my-index |
And I add steps to the "Third tour" tour: And I add steps to the "Third tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Third tour | | Display in middle of page | Welcome | Welcome to the Third tour | Enter manually |
And I am on homepage And I am on homepage
Then I should see "Welcome to the First tour" Then I should see "Welcome to the First tour"
And I open the User tour settings page And I open the User tour settings page

View file

@ -13,8 +13,8 @@ Feature: Steps can be navigated within a tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 1 | | Tour is enabled | 1 |
And I add steps to the "Calendar tour" tour: And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | Content | | targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | | Block | Calendar | Calendar events | This is the calendar block | Enter manually |
And I change window size to "large" And I change window size to "large"
And I follow "Dashboard" And I follow "Dashboard"
And I wait until the page is ready And I wait until the page is ready
@ -32,8 +32,8 @@ Feature: Steps can be navigated within a tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 1 | | Tour is enabled | 1 |
And I add steps to the "Calendar tour" tour: And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | Content | | targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | | Block | Calendar | Calendar events | This is the calendar block | Enter manually |
And I change window size to "large" And I change window size to "large"
And I follow "Dashboard" And I follow "Dashboard"
And I wait until the page is ready And I wait until the page is ready
@ -49,12 +49,12 @@ Feature: Steps can be navigated within a tour
| Apply to URL match | /my/% | | Apply to URL match | /my/% |
| Tour is enabled | 1 | | Tour is enabled | 1 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | targetvalue_block | Title | Content | | targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here | | Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here | Enter manually |
| Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here | | Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here | Enter manually |
When I am on homepage When I am on homepage
Then I should see "Skip tour" Then I should see "Skip tour"
And I should see "Next (1/3)" And I should see "Next (1/3)"
@ -73,8 +73,8 @@ Feature: Steps can be navigated within a tour
| Tour is enabled | 1 | | Tour is enabled | 1 |
| End tour button's label | CustomText | | End tour button's label | CustomText |
And I add steps to the "Calendar tour" tour: And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | Content | | targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | | Block | Calendar | Calendar events | This is the calendar block | Enter manually |
And I change window size to "large" And I change window size to "large"
And I follow "Dashboard" And I follow "Dashboard"
And I wait until the page is ready And I wait until the page is ready

View file

@ -13,8 +13,8 @@ Feature: Reset a tour for Boost
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Show with backdrop | 1 | | Show with backdrop | 1 |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome tour. | | Display in middle of page | Welcome | Welcome tour. | Enter manually |
@javascript @javascript
Scenario: Reset the tour with desktop view Scenario: Reset the tour with desktop view

View file

@ -14,8 +14,8 @@ Feature: Apply tour filters to a tour for Classic
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Theme | Classic | | Theme | Classic |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
When I am on homepage When I am on homepage
Then I should not see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful" Then I should not see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful"
@ -29,7 +29,7 @@ Feature: Apply tour filters to a tour for Classic
| Tour is enabled | 1 | | Tour is enabled | 1 |
| Theme | Boost | | Theme | Boost |
And I add steps to the "First tour" tour: And I add steps to the "First tour" tour:
| targettype | Title | Content | | targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | | Display in middle of page | Welcome | Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful | Enter manually |
When I am on homepage When I am on homepage
Then I should see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful" Then I should see "Welcome to your personal learning space. We'd like to give you a quick tour to show you some of the areas you may find helpful"