summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-02-01 09:16:41 +0100
committerJoas Schilling <coding@schilljs.com>2023-02-01 09:17:04 +0100
commit5af8539ced8dba4466239e09bd946b256ebd30ce (patch)
treed6e27f9bb40e3e2f7a30c96adb7dac5f8ec13514 /tests
parent6150cb402e90ae7fc2cf6f30e964b464c3068e8f (diff)
Add integration test for the "get breakout rooms participants
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php33
-rw-r--r--tests/integration/features/conversation/breakout-rooms.feature12
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 7e91444b4..43d3f5bd6 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -580,11 +580,44 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if ($formData instanceof TableNode) {
$attendees = $this->getDataFromResponse($this->response);
+ } else {
+ $attendees = [];
+ }
+ $this->assertAttendeeList($identifier, $formData, $attendees);
+ }
+
+ /**
+ * @Then /^user "([^"]*)" sees the following attendees in breakout rooms for room "([^"]*)" with (\d+) \((v4)\)$/
+ *
+ * @param string $user
+ * @param string $identifier
+ * @param int $statusCode
+ * @param string $apiVersion
+ * @param TableNode $formData
+ */
+ public function userSeesAttendeesInBreakoutRoomsForRoom(string $user, string $identifier, int $statusCode, string $apiVersion, TableNode $formData = null): void {
+ $this->setCurrentUser($user);
+ $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/breakout-rooms/participants');
+ $this->assertStatusCode($this->response, $statusCode);
+
+ if ($formData instanceof TableNode) {
+ $attendees = $this->getDataFromResponse($this->response);
+ } else {
+ $attendees = [];
+ }
+ $this->assertAttendeeList($identifier, $formData, $attendees);
+ }
+
+ protected function assertAttendeeList(string $identifier, ?TableNode $formData, array $attendees): void {
+ if ($formData instanceof TableNode) {
$expectedKeys = array_flip($formData->getRows()[0]);
$result = [];
foreach ($attendees as $attendee) {
$data = [];
+ if (isset($expectedKeys['roomToken'])) {
+ $data['roomToken'] = self::$tokenToIdentifier[$attendee['roomToken']];
+ }
if (isset($expectedKeys['actorType'])) {
$data['actorType'] = $attendee['actorType'];
}
diff --git a/tests/integration/features/conversation/breakout-rooms.feature b/tests/integration/features/conversation/breakout-rooms.feature
index 279fe5e09..aedc91e6f 100644
--- a/tests/integration/features/conversation/breakout-rooms.feature
+++ b/tests/integration/features/conversation/breakout-rooms.feature
@@ -41,6 +41,18 @@ Feature: conversation/breakout-rooms
| type | name |
| 2 | class room |
| 2 | Room 3 |
+ And user "participant1" sees the following attendees in breakout rooms for room "class room" with 200 (v4)
+ | roomToken | actorType | actorId | participantType |
+ | class room | users | participant1 | 1 |
+ | class room | users | participant2 | 3 |
+ | class room | users | participant3 | 3 |
+ | class room | users | participant4 | 3 |
+ | Room 1 | users | participant1 | 1 |
+ | Room 1 | users | participant2 | 3 |
+ | Room 2 | users | participant1 | 1 |
+ | Room 2 | users | participant3 | 3 |
+ | Room 3 | users | participant1 | 1 |
+ | Room 3 | users | participant4 | 3 |
Scenario: Teacher creates automatic breakout rooms
Given user "participant1" creates room "class room" (v4)