first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,98 @@
<?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/>.
/**
* User tour related steps definitions.
*
* @package tool_usertours
* @category test
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
use Behat\Gherkin\Node\TableNode;
/**
* User tour related steps definitions.
*
* @package tool_usertours
* @category test
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_tool_usertours extends behat_base {
/**
* Add a new user tour.
*
* @Given /^I add a new user tour with:$/
* @param TableNode $table
*/
public function i_add_a_new_user_tour_with(TableNode $table) {
$this->execute('behat_tool_usertours::i_open_the_user_tour_settings_page');
$this->execute('behat_general::click_link', get_string('newtour', 'tool_usertours'));
// Fill form and post.
$this->execute('behat_forms::i_set_the_following_fields_to_these_values', $table);
$this->execute('behat_forms::press_button', get_string('savechanges', 'moodle'));
$this->execute('behat_general::i_wait_to_be_redirected');
}
/**
* Add new steps to a user tour.
*
* @Given /^I add steps to the "(?P<tour_name_string>(?:[^"]|\\")*)" tour:$/
* @param string $tourname The name of the tour to add steps to.
* @param TableNode $table
*/
public function i_add_steps_to_the_named_tour($tourname, TableNode $table) {
$this->execute('behat_tool_usertours::i_open_the_user_tour_settings_page');
$this->execute('behat_general::click_link', $this->escape($tourname));
$this->execute('behat_tool_usertours::i_add_steps_to_the_tour', $table);
}
/**
* Add new steps to the current user tour.
*
* @Given /^I add steps to the tour:$/
* @param TableNode $table
*/
public function i_add_steps_to_the_tour(TableNode $table) {
foreach ($table->getHash() as $step) {
$this->execute('behat_general::click_link', get_string('newstep', 'tool_usertours'));
foreach ($step as $locator => $value) {
$this->execute('behat_forms::i_set_the_field_to', [$this->escape($locator), $this->escape($value)]);
}
$this->execute('behat_forms::press_button', get_string('savechanges', 'moodle'));
$this->execute('behat_general::i_wait_to_be_redirected');
}
}
/**
* Navigate to the user tour settings page.
*
* @Given /^I open the User tour settings page$/
*/
public function i_open_the_user_tour_settings_page() {
$this->execute(
'behat_navigation::i_navigate_to_in_site_administration',
get_string('appearance', 'admin') . ' > ' .
get_string('usertours', 'tool_usertours')
);
}
}
@@ -0,0 +1,160 @@
@tool @tool_usertours
Feature: Add a new user tour
In order to help users learn of new features
As an administrator
I need to create a user tour
@javascript
Scenario: Add a new tour
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And 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 |
And I add steps to the "First tour" tour:
| 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 | Manual |
And I add steps to the "First tour" tour:
| targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here | Manual |
| Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here | Manual |
And I add steps to the "First tour" tour:
| 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. | Manual |
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"
And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "This is the Timeline. All of your upcoming activities can be found here"
And I should not see "This is the Calendar. All of your assignments and due dates can be found here"
And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "This is the Calendar. All of your assignments and due dates can be found here"
And I should not see "This area shows you what's happening in some of your courses"
And I click on "Skip tour" "button" in the "[data-role='flexitour-step']" "css_element"
And I should not see "This area shows you what's happening in some of your courses"
And I am on homepage
And 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"
And I should not see "This area shows you what's happening in some of your courses"
And I follow "Reset user tour on this page"
And 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"
@javascript
Scenario: A hidden tour should not be visible
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And 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 | 0 |
And I add steps to the "First tour" tour:
| 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 | Manual |
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"
@javascript
Scenario: Tour visibility can be toggled
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And 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 | 0 |
And I add steps to the "First tour" tour:
| 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 | Manual |
And I open the User tour settings page
When I click on "Enable" "link" in the "My first tour" "table_row"
And 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"
@javascript
Scenario: Display step numbers was enabled
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And I log in as "admin"
And I add a new user tour with:
| Name | Steps tour |
| Description | My steps tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| Display step numbers | 1 |
| End tour button's label | Sample end label |
And I add steps to the "Steps tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | First step of the Tour | Manual |
And I add steps to the "Steps tour" tour:
| targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | Second step of the Tour | Manual |
| Block | Calendar | Calendar | Third step of the Tour | Manual |
When I am on homepage
Then I should see "First step of the Tour"
And I should see "Next (1/3)"
And I should not see "End tour"
And I should not see "Sample end label"
And "Skip tour" "button" should exist in the "[data-role='flexitour-step']" "css_element"
And I click on "Next (1/3)" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "Second step of the Tour"
And I should see "Next (2/3)"
And I click on "Next (2/3)" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "Third step of the Tour"
And I should not see "Next (3/3)"
And I should not see "Skip tour"
And "Sample end label" "button" should exist in the "[data-role='flexitour-step']" "css_element"
@javascript
Scenario: Display step numbers was disabled
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And I log in as "admin"
And I add a new user tour with:
| Name | Steps tour |
| Description | My steps tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| Display step numbers | 0 |
And I add steps to the "Steps tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | First step of the Tour | Manual |
And I add steps to the "Steps tour" tour:
| targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | Second step of the Tour | Manual |
| Block | Calendar | Calendar | Third step of the Tour | Manual |
When I am on homepage
Then I should see "First step of the Tour"
And I should see "Next"
And I should not see "Next (1/3)"
And I click on "Next" "button" in the "[data-role='flexitour-step']" "css_element"
And I should see "Second step of the Tour"
And I should see "Next"
And I should not see "Next (2/3)"
@javascript
Scenario: Single step tour with display step numbers was enable
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And I log in as "admin"
And I add a new user tour with:
| Name | Steps tour |
| Description | My steps tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| Display step numbers | 1 |
And I add steps to the "Steps tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | This is a single step tour | Manual |
When I am on homepage
Then I should see "This is a single step tour"
And I should not see "Next (1/1)"
@@ -0,0 +1,24 @@
@tool @tool_usertours
Feature: Duplicate a user tour
As an administrator
I want to duplicate a user tour
@javascript
Scenario: Tour can be duplicated
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And 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 | 0 |
And I add steps to the "First tour" tour:
| 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 | Manual |
And I open the User tour settings page
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 open the User tour settings page
Then I should see "1" occurrences of "First tour (copy)" in the "admintable" "table"
@@ -0,0 +1,28 @@
@tool @tool_usertours
Feature: Reset a tour
In order to test a tour
As an administrator
I can reset the tour to force it to display again
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 | FRONTPAGE |
| Tour is enabled | 1 |
| Show with backdrop | 1 |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome tour. | Manual |
@javascript
Scenario: Reset the tour with mobile view
# Changing the window viewport to mobile so we will have the footer section.
Given I change viewport size to "480x800"
And I am on site homepage
And I should see "Welcome"
And I press "Got it"
And I should not see "Welcome"
When I click on "Reset user tour on this page" "link" in the "#page-footer" "css_element"
Then I should see "Welcome"
@@ -0,0 +1,32 @@
@tool @tool_usertours @javascript
Feature: Verify the breadcrumbs in user tours site administration pages
Whenever I navigate to user tours page in site administration
As an admin
The breadcrumbs should be visible
Background:
Given I log in as "admin"
Scenario: Verify the breadcrumbs in user tours, expand to explore, next step, create and import pages as admin
Given I navigate to "Appearance > User tours" in site administration
And I click on "Block drawer" "link"
And "Block drawer" "text" should exist in the ".breadcrumb" "css_element"
And "User tours" "link" should exist in the ".breadcrumb" "css_element"
When I click on "Expand to explore" "link"
Then "Expand to explore" "text" should exist in the ".breadcrumb" "css_element"
And "Block drawer" "link" should exist in the ".breadcrumb" "css_element"
And "User tours" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I click on "New step" "link"
And "New step" "text" should exist in the ".breadcrumb" "css_element"
And "Block drawer" "link" should exist in the ".breadcrumb" "css_element"
And "User tours" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I navigate to "Appearance > User tours" in site administration
And I click on "Create a new tour" "link"
And "Create a new tour" "text" should exist in the ".breadcrumb" "css_element"
And "User tours" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I click on "Import tour" "link"
And "Import tour" "text" should exist in the ".breadcrumb" "css_element"
And "User tours" "link" should exist in the ".breadcrumb" "css_element"
@@ -0,0 +1,76 @@
@tool @tool_usertours
Feature: Apply accessibility to a 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 | FRONTPAGE |
| Tour is enabled | 1 |
| Show with backdrop | 1 |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome tour. | Manual |
And I add steps to the tour:
| targettype | targetvalue_selector | Title | id_content | Content type |
| Selector | .usermenu | User menu | Next page | Manual |
| Selector | .navbar-brand | Page 2 | Next page | Manual |
And I add steps to the tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Page 3 | Final page. | Manual |
@javascript
Scenario: Check tabbing working correctly.
Given I am on site homepage
And I wait "1" seconds
And I should see "Welcome"
# First dialogue of the tour, "Welcome". It has Next and End buttons.
# Nothing highlighted on the page. Initially whole dialogue focused.
When I press tab
Then the focused element is "Next" "button" in the "Welcome" "dialogue"
When I press tab
Then the focused element is "Skip tour" "button" in the "Welcome" "dialogue"
When I press tab
# Here the focus loops round to the whole dialogue again.
And I press tab
Then the focused element is "Next" "button" in the "Welcome" "dialogue"
# Check looping works properly going backwards too.
When I press shift tab
And I press shift tab
Then the focused element is "Skip tour" "button" in the "Welcome" "dialogue"
When I press "Next"
# Now we are on the "User menu" step, so Previous is also enabled.
# Also, the user menu section in the page is highlighted, and this
# section contain a hyperlink so the focus have to go though and back to the dialogue.
And I wait "1" seconds
And I press tab
Then the focused element is "Next" "button" in the "User menu" "dialogue"
When I press tab
Then the focused element is "Skip tour" "button" in the "User menu" "dialogue"
# We tab 3 times from "Skip Tour" button to header container, drop down then go to "Dashboard" link.
When I press tab
Then the focused element is ".usermenu" "css_element"
When I press tab
Then the focused element is "User menu" "button" in the ".usermenu" "css_element"
When I press tab
And I press tab
Then the focused element is "Next" "button" in the "User menu" "dialogue"
# Press shift-tab twice should lead us back to the user menu button.
When I press shift tab
And I press shift tab
Then the focused element is "User menu" "button" in the ".usermenu" "css_element"
@javascript
Scenario: Aria tags should not exist
And I am on site homepage
When I click on "Next" "button"
And I click on "Next" "button"
Then ".navbar-brand[aria-describedby^='tour-step-tool_usertours']" "css_element" should exist
And ".navbar-brand[tabindex]" "css_element" should exist
When I click on "Next" "button"
Then ".navbar-brand[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And ".navbar-brand[tabindex]:not([tabindex='-1'])" "css_element" should not exist
When I click on "End tour" "button"
Then ".navbar-brand[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And ".navbar-brand[tabindex]:not([tabindex='0'])" "css_element" should not exist
@@ -0,0 +1,82 @@
@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 |
And I add a new user tour with:
| Name | tour_activityinfo_activity_student_title,tool_usertours |
| Description | tour_activityinfo_activity_student_content,tool_usertours |
| Apply to URL match | /my/% |
| Tour is enabled | 0 |
@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 "Language string ID"
And the "Content type" select box should contain "Manual"
And I select "Language string ID" from the "Content type" singleselect
And I should see " Language string ID"
And I should not see "Content" in the "#fitem_id_content" "css_element"
And I select "Manual" from the "Content type" singleselect
And I should see "Content" in the "#fitem_id_content" "css_element"
And I should not see "Language string ID" in the "#fitem_id_contentlangstring" "css_element"
@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 "Language string ID" from the "Content type" singleselect
And I set the field "Language string ID" to "tour_activityinfo_course_teacher_content_abc,tool_usertours"
When I press "Save changes"
Then I should see "Invalid language string ID"
And I set the field "Language string ID" 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 I should see "Editing \"New: Activity information\""
And the field "Title" matches value "tour_activityinfo_course_teacher_title,tool_usertours"
And the field "Language string ID" 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 "Manual" from the "Content type" singleselect
And I set the field "id_content" to "<p><strong>Test content</strong></p>"
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 see "Editing \"New: Activity information\""
And I should not see "Language string ID" in the "#fitem_id_contentlangstring" "css_element"
And the field "Title" matches value "tour_activityinfo_course_teacher_title,tool_usertours"
And the field "id_content" matches value "<p><strong>Test content</strong></p>"
@javascript
Scenario: Tour name and description can be translatable
Given I open the User tour settings page
And I should see "New: Activity information"
And I should see "Activity dates plus what to do to complete the activity are shown on the activity page."
When I click on "View" "link" in the "New: Activity information" "table_row"
Then I should see "New: Activity information"
And I should see "This is the 'New: Activity information' tour. It applies to the path '/my/%'."
And I click on "edit the tour defaults" "link"
And I should see "New: Activity information"
And the field "Name" matches value "tour_activityinfo_activity_student_title,tool_usertours"
And the field "Description" matches value "tour_activityinfo_activity_student_content,tool_usertours"
@@ -0,0 +1,40 @@
@tool @tool_usertours
Feature: Apply Moodle filter to a tour
In order to give more content to a tour
As an administrator
I need to create a user tour with Moodle filters applied
Background:
Given I log in as "admin"
And the following "courses" exist:
| shortname | fullname |
| C1 | Course 1 |
And the following "activities" exist:
| activity | name | content | course |
| page | Page for Usertour | Content of page for Usertour | C1 |
And I add a new user tour with:
| Name | Activity names auto-linking tour |
| Description | Tour with activity names auto-linking filter |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
And I add steps to the "Activity names auto-linking tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Activity names auto-linking | Test Activity names auto-linking Filter Page for Usertour | Manual |
@javascript
Scenario: Add a new tour with Activity names auto-linking filter off
Given the "activitynames" filter is "off"
When I am on "Course 1" course homepage
Then I should see "Test Activity names auto-linking Filter" in the "Activity names auto-linking" "dialogue"
And I should see "Page for Usertour" in the "Activity names auto-linking" "dialogue"
And "Page for Usertour" "link" should not exist in the "Activity names auto-linking" "dialogue"
@javascript
Scenario: Add a new tour with Activity names auto-linking filter on
Given the "activitynames" filter is "on"
When I am on "Course 1" course homepage
Then I should see "Test Activity names auto-linking Filter" in the "Activity names auto-linking" "dialogue"
And I should see "Page for Usertour" in the "Activity names auto-linking" "dialogue"
And "Page for Usertour" "link" should exist in the "Activity names auto-linking" "dialogue"
And I click on "Page for Usertour" "link" in the "Activity names auto-linking" "dialogue"
And I should see "Content of page for Usertour"
@@ -0,0 +1,222 @@
@tool @tool_usertours
Feature: Apply tour filters to a tour
In order to give more directed tours
As an administrator
I need to create a user tour with filters applied
@javascript
Scenario: Add a tour for a specific role
Given the following "courses" exist:
| fullname | shortname | format | enablecompletion |
| Course 1 | C1 | topics | 1 |
And the following "users" exist:
| username |
| editor1 |
| teacher1 |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| editor1 | C1 | editingteacher |
| teacher1 | C1 | teacher |
| student1 | C1 | student |
And I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | My first tour |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
| Role | Student,Non-editing teacher |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour. | Manual |
And I log out
And I log in as "editor1"
When I am on "Course 1" course homepage
Then I should not see "Welcome to your course tour."
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I should see "Welcome to your course tour."
And I click on "Got it" "button"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I should see "Welcome to your course tour."
@javascript
Scenario: Add tour for a specific category and its subcategory
Given the following "categories" exist:
| name | category | idnumber |
| MainCat | 0 | CAT1 |
| SubCat | CAT1 | CAT2 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | CAT1 |
| Course 2 | C2 | CAT2 |
And the following "users" exist:
| username |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student1 | C2 | student |
And I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | My first tour |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
| Category | MainCat |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour. | Manual |
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
And I wait until the page is ready
Then I should see "Welcome to your course tour."
When I am on "Course 2" course homepage
And I wait until the page is ready
Then I should see "Welcome to your course tour."
@javascript
Scenario: Add tour for a specific courseformat
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| Course 2 | C2 | weeks |
And the following "users" exist:
| username |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student1 | C2 | student |
And I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | My first tour |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
| Course format | Weekly sections |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour. | Manual |
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
And I wait until the page is ready
Then I should not see "Welcome to your course tour."
When I am on "Course 2" course homepage
And I wait until the page is ready
Then I should see "Welcome to your course tour."
@javascript
Scenario: Add tour for a specific course
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| Course 2 | C2 | weeks |
And the following "users" exist:
| username |
| student1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student1 | C2 | student |
And I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | My first tour |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
| Courses | C1 |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to your course tour. | Manual |
And I log out
And I log in as "student1"
When I am on "Course 1" course homepage
And I wait until the page is ready
Then I should see "Welcome to your course tour."
When I am on "Course 2" course homepage
And I wait until the page is ready
Then I should not see "Welcome to your course tour."
@javascript
Scenario: Add tours with CSS selectors
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
Given the following "courses" exist:
| fullname | shortname | format | enablecompletion |
| Course 1 | C1 | topics | 1 |
| Course 2 | C2 | topics | 1 |
And the following "activities" exist:
| activity | course | name | firstpagetitle | wikimode | idnumber | intro | type |
| wiki | C1 | Test wiki name | First page | collaborative | | | |
| forum | C2 | Test forum name | | | 001 | Test forum description | general |
And I log in as "admin"
And I add a new user tour with:
| Name | Wiki tour |
| Description | A tour with both matches |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
| CSS selector | .modtype_wiki |
And I add steps to the "Wiki tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Wiki tour | Manual |
And I add a new user tour with:
| Name | Forum tour |
| Description | A tour with both matches |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
| CSS selector | .modtype_forum |
And I add steps to the "Forum tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Forum tour | Manual |
And I am on "Course 1" course homepage
Then I should see "Welcome to the Wiki tour"
And I am on "Course 2" course homepage
Then I should see "Welcome to the Forum tour"
@javascript
Scenario: Check filtering respects the sort order
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | The first tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| CSS selector | #page-my-index |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the First tour | Manual |
And I add a new user tour with:
| Name | Second tour |
| Description | The second tour |
| Apply to URL match | /my/% |
| Tour is enabled | 0 |
| CSS selector | #page-my-index |
And I add steps to the "Second tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Second tour | Manual |
And I add a new user tour with:
| Name | Third tour |
| Description | The third tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| CSS selector | #page-my-index |
And I add steps to the "Third tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome to the Third tour | Manual |
And I am on homepage
Then I should see "Welcome to the First tour"
And I open the User tour settings page
And I click on "Move tour down" "link" in the "The first tour" "table_row"
And I click on "Move tour down" "link" in the "The first tour" "table_row"
And I am on homepage
Then I should see "Welcome to the Third tour"
@@ -0,0 +1,100 @@
@tool @tool_usertours
Feature: Steps can be navigated within a tour
In order to use a tour effectively
As a user
I can navigate its steps
@javascript
Scenario: Clicking on items in the page should not end the tour
Given I log in as "admin"
And I add a new user tour with:
| Name | Calendar tour |
| Description | Calendar tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | Manual |
And I change window size to "large"
And I follow "Dashboard"
And I wait until the page is ready
And I should see "This is the calendar block"
When I click on ".block_calendar_month .calendar-controls .next" "css_element"
And I wait until the page is ready
Then I should see "Calendar events"
@javascript
Scenario: End tour button text for one step tours
Given I log in as "admin"
And I add a new user tour with:
| Name | Calendar tour |
| Description | Calendar tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | Manual |
And I change window size to "large"
And I follow "Dashboard"
And I wait until the page is ready
And I should see "This is the calendar block"
Then I should see "Got it"
@javascript
Scenario: End tour button text for multiple step tours
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 |
And I add steps to the "First tour" tour:
| 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 | Manual |
And I add steps to the "First tour" tour:
| targettype | targetvalue_block | Title | id_content | Content type |
| Block | Timeline | Timeline | This is the Timeline. All of your upcoming activities can be found here | Manual |
| Block | Calendar | Calendar | This is the Calendar. All of your assignments and due dates can be found here | Manual |
When I am on homepage
Then I should see "Skip tour"
And I should see "Next (1/3)"
And I click on "Next (1/3)" "button" in the "Welcome" "dialogue"
And I should see "Skip tour"
And I click on "Next (2/3)" "button" in the "Timeline" "dialogue"
And I should see "End tour"
@javascript
Scenario: Customised 'end tour' button text for one step tours
Given I log in as "admin"
And I add a new user tour with:
| Name | Calendar tour |
| Description | Calendar tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| End tour button's label | CustomText |
And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | Manual |
And I change window size to "large"
And I follow "Dashboard"
And I wait until the page is ready
And I should see "This is the calendar block"
Then I should see "CustomText"
@javascript
Scenario: Customised 'end tour' button text for one step tours can be translatable
Given I log in as "admin"
And I add a new user tour with:
| Name | Calendar tour |
| Description | Calendar tour |
| Apply to URL match | /my/% |
| Tour is enabled | 1 |
| End tour button's label | exporttour,tool_usertours |
And I add steps to the "Calendar tour" tour:
| targettype | Block | Title | id_content | Content type |
| Block | Calendar | Calendar events | This is the calendar block | Manual |
And I change window size to "large"
And I follow "Dashboard"
And I wait until the page is ready
And I should see "This is the calendar block"
Then I should see "Export tour"
@@ -0,0 +1,29 @@
@tool @tool_usertours
Feature: Prevent yours from being marked as complete
In order to impart key information
As an administrator
I can prevent a user tour from being marked as complete
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 | FRONTPAGE |
| Tour is enabled | 1 |
| Show with backdrop | 1 |
# 2 = tour::SHOW_TOUR_ON_EACH_PAGE_VISIT
| Show tour | 2 |
And I add steps to the "First tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Welcome | Welcome tour. | Manual |
@javascript
Scenario: Ending the tour should not mark it as complete
# Changing the window viewport to mobile so we will have the footer section.
Given I am on site homepage
And I should see "Welcome"
And I press "Got it"
And I should not see "Welcome"
When I am on site homepage
Then I should see "Welcome"