1
+ # This file is part of Moodle - http://moodle.org/
2
+ #
3
+ # Moodle is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # Moodle is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Moodle. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+ # Tests for showing the correct name when config values are set
17
+ #
18
+ # @package mod_hsuforum
19
+ # @author Juan Ibarra <juan.ibarra@openlms.net>
20
+ # @copyright Copyright (c) 2020 Open LMS (https://www.openlms.net)
21
+ # @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
+
23
+ @mod @mod_hsuforum
24
+ Feature : Recent forum posts summary
25
+ As a student or teacher
26
+ I see my name shown in the respect viewfullname capability
27
+
28
+ Background :
29
+ Given the following config values are set as admin:
30
+ | fullnamedisplay | firstname lastname |
31
+ | alternativefullnameformat | lastname firstname |
32
+ Given the following "users" exist:
33
+ | username | firstname | lastname | email |
34
+ | teacher1 | Teacher | 1 | teacher1 @example .com |
35
+ | student1 | Student | 1 | student1 @example .com |
36
+ And the following "courses" exist:
37
+ | fullname | shortname | category |
38
+ | Course 1 | C1 | 0 |
39
+ And the following "course enrolments" exist:
40
+ | user | course | role |
41
+ | teacher1 | C1 | editingteacher |
42
+ | student1 | C1 | student |
43
+ And the following "activities" exist:
44
+ | activity | name | intro | course | idnumber | groupmode |
45
+ | hsuforum | Test forum name | Test forum | C1 | hsuforum | 0 |
46
+ And I log in as "student1"
47
+ And I am on "Course 1" course homepage
48
+ And I wait until the page is ready
49
+ And I follow "Test forum name"
50
+ And I add a new discussion to "Test forum name" Open Forum with:
51
+ | Subject | Forum discussion 1 |
52
+ | Message | How awesome is this forum discussion ? |
53
+ And I log out
54
+
55
+ @javascript
56
+ Scenario : Check that the links for Open forums options exists and can be activated
57
+ And I log in as "teacher1"
58
+ And I am on "Course 1" course homepage
59
+ Then "//div[contains(@class, 'hsuforum-recent')]//h5[contains(text(), '1 Student')]" "xpath_element" should exist
60
+ And I click on "//div[contains(@class, 'hsuforum-recent')]//a" "xpath_element"
61
+ Then "//div[contains(@class, 'hsuforum-thread-author')]//a[contains(text(), '1 Student')]" "xpath_element" should exist
62
+ And I log out
63
+ And I log in as "student1"
64
+ And I am on "Course 1" course homepage
65
+ Then "//div[contains(@class, 'activityinstance')]//h5[contains(text(), 'Student 1')]" "xpath_element" should exist
66
+ And I click on "//div[contains(@class, 'hsuforum-recent')]//a" "xpath_element"
67
+ Then "//div[contains(@class, 'hsuforum-thread-author')]//a[contains(text(), 'Student 1')]" "xpath_element" should exist
0 commit comments