Merge branch 'MDL-79460-master' of https://github.com/HuongNV13/moodle

This commit is contained in:
Huong Nguyen 2023-10-31 09:35:01 +07:00 committed by Jun Pataleta
commit 6d7c78b7f1
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 37 additions and 37 deletions

View File

@ -28,22 +28,21 @@ Feature: Communication matrix form field
And I navigate to "Communication" in current page administration
Then the field "id_communicationroomname" matches value "Sampleroomname"
# Skipping while we update the Mock Server with the new route.
# Scenario: I can add room topic for matrix room
# Given a Matrix mock server is configured
# And I log in as "teacher1"
# And I am on "Test course" course homepage
# When I navigate to "Communication" in current page administration
# And I set the field "id_selectedcommunication" to "Matrix"
# And I wait to be redirected
# And I should see "Room name"
# And I should see "Room topic"
# And I set the field "id_communicationroomname" to "Sampleroomname"
# And I set the field "id_matrixroomtopic" to "Sampleroomtopic"
# And I press "Save changes"
# And I navigate to "Communication" in current page administration
# Then the field "id_communicationroomname" matches value "Sampleroomname"
# And I press "Cancel"
# And I run all adhoc tasks
# And I navigate to "Communication" in current page administration
# And the field "id_matrixroomtopic" matches value "Sampleroomtopic"
Scenario: I can add room topic for matrix room
Given a Matrix mock server is configured
And I log in as "teacher1"
And I am on "Test course" course homepage
When I navigate to "Communication" in current page administration
And I set the field "id_selectedcommunication" to "Matrix"
And I wait to be redirected
And I should see "Room name"
And I should see "Room topic"
And I set the field "id_communicationroomname" to "Sampleroomname"
And I set the field "id_matrixroomtopic" to "Sampleroomtopic"
And I press "Save changes"
And I navigate to "Communication" in current page administration
Then the field "id_communicationroomname" matches value "Sampleroomname"
And I press "Cancel"
And I run all adhoc tasks
And I navigate to "Communication" in current page administration
And the field "id_matrixroomtopic" matches value "Sampleroomtopic"

View File

@ -24,17 +24,16 @@ Feature: Display communication room status banner
# Not for students to see.
Then I should not see "Your Matrix room will be ready soon." in the "page-content" "region"
# Skipping while we update the Mock Server with the new route.
# Scenario: I can see the room has been created and ready to access
# When I run all adhoc tasks
# And I am on the "Test course" "Course" page logged in as "teacher1"
# Then I should see "Your Matrix room is ready!" in the "page-content" "region"
# # This is a one time message per user.
# When I reload the page
# Then I should not see "Your Matrix room is ready." in the "page-content" "region"
# # Not for students to see.
# When I am on the "Test course" "Course" page logged in as "student1"
# Then I should not see "Your Matrix room is ready." in the "page-content" "region"
Scenario: I can see the room has been created and ready to access
When I run all adhoc tasks
And I am on the "Test course" "Course" page logged in as "teacher1"
Then I should see "Your Matrix room is ready." in the "page-content" "region"
# This is a one time message per user.
When I reload the page
Then I should not see "Your Matrix room is ready." in the "page-content" "region"
# Not for students to see.
When I am on the "Test course" "Course" page logged in as "student1"
Then I should not see "Your Matrix room is ready." in the "page-content" "region"
Scenario: Enabling or disabling the matrix plugin hides the banner accordingly
Given I am on the "Test course" "Course" page logged in as "teacher1"

View File

@ -368,8 +368,6 @@ class communication_feature_test extends \advanced_testcase {
* @covers ::set_matrix_power_levels
*/
public function test_add_and_remove_members_from_room(): void {
$this->markTestSkipped('Skipping while we update the Mock Server with the new route');
$user = $this->getDataGenerator()->create_user();
$user2 = $this->getDataGenerator()->create_user();
@ -413,28 +411,32 @@ class communication_feature_test extends \advanced_testcase {
* @covers ::get_user_allowed_power_level
*/
public function test_update_room_membership(): void {
$this->markTestSkipped('Skipping while we update the Mock Server with the new route');
$this->resetAfterTest();
global $DB;
// Create a new room.
$course = $this->get_course('Sampleroom', 'none');
$coursecontext = \context_course::instance($course->id);
$user = $this->get_user();
$communication = $this->create_room(
component: 'core_course',
itemtype: 'coursecommunication',
itemid: $course->id
itemid: $course->id,
roomname: 'sampleroom',
roomtopic: 'sampltopic',
roomavatar: null,
members: [$user->id],
context: $coursecontext,
);
$provider = $communication->get_room_user_provider();
// Add the members to the room.
$provider->add_members_to_room([$user->id]);
// Assign teacher role to the user.
$coursecontext = \context_course::instance($course->id);
$teacherrole = $DB->get_record('role', ['shortname' => 'teacher']);
$this->getDataGenerator()->enrol_user($user->id, $course->id);
role_assign($teacherrole->id, $user->id, $coursecontext->id);
@ -443,7 +445,7 @@ class communication_feature_test extends \advanced_testcase {
$provider->update_room_membership([$user->id]);
$processor = \core_communication\processor::load_by_instance(
context: \core\context\course::instance($course->id),
context: $coursecontext,
component: 'core_course',
instancetype: 'coursecommunication',
instanceid: $course->id,