Skip to content

Commit

Permalink
MDL-79460 communication_matrix: Re-enabled tests that use new sync route
Browse files Browse the repository at this point in the history
  • Loading branch information
davewoloszyn authored and HuongNV13 committed Oct 31, 2023
1 parent 859df15 commit 4ecea7c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ public function test_create_members(): void {
* @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();

Expand Down Expand Up @@ -413,28 +411,32 @@ public function test_add_and_remove_members_from_room(): void {
* @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);
Expand All @@ -443,7 +445,7 @@ public function test_update_room_membership(): void {
$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,
Expand Down

0 comments on commit 4ecea7c

Please sign in to comment.