summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-12-12 13:05:01 +0100
committerJoas Schilling <coding@schilljs.com>2023-01-04 17:35:21 +0100
commitc87813021c95b24bbc4503ecb5a2d00bf7ed8c87 (patch)
tree68ba969266c813de97f7d90add83714a4acc2ab7 /tests
parent616a0cb202cffbea53da7b5a8f1bfed97ef70af7 (diff)
Allow creating individual breakout rooms via the normal API
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php22
-rw-r--r--tests/integration/features/conversation/breakout-rooms.feature64
2 files changed, 81 insertions, 5 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 59a5c654f..5b46d8403 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -789,8 +789,20 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @param TableNode|null $formData
*/
public function userCreatesRoomWith(string $user, string $identifier, int $statusCode, string $apiVersion = 'v1', TableNode $formData = null): void {
+ $body = $formData->getRowsHash();
+
+ if (isset($body['objectType'], $body['objectId']) && $body['objectType'] === 'room') {
+ $result = preg_match('/ROOM\(([^)]+)\)/', $body['objectId'], $matches);
+ if ($result && isset(self::$identifierToToken[$matches[1]])) {
+ $body['objectId'] = self::$identifierToToken[$matches[1]];
+ } elseif ($result) {
+ throw new \InvalidArgumentException('Could not find parent room');
+ }
+ }
+
+
$this->setCurrentUser($user);
- $this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/room', $formData);
+ $this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/room', $body);
$this->assertStatusCode($this->response, $statusCode);
$response = $this->getDataFromResponse($this->response);
@@ -2367,12 +2379,12 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @param string $user
* @param int $amount
* @param string $modeString
- * @param string $roomName
+ * @param string $identifier
* @param int $status
* @param string $apiVersion
* @param TableNode|null $formData
*/
- public function userCreatesBreakoutRooms(string $user, int $amount, string $modeString, string $roomName, int $status, string $apiVersion, TableNode $formData = null): void {
+ public function userCreatesBreakoutRooms(string $user, int $amount, string $modeString, string $identifier, int $status, string $apiVersion, TableNode $formData = null): void {
switch ($modeString) {
case 'automatic':
$mode = 1;
@@ -2396,14 +2408,14 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$mapArray = [];
foreach ($formData->getRowsHash() as $attendee => $roomNumber) {
[$type, $id] = explode('::', $attendee);
- $attendeeId = $this->getAttendeeId($type, $id, $roomName);
+ $attendeeId = $this->getAttendeeId($type, $id, $identifier);
$mapArray[$attendeeId] = (int) $roomNumber;
}
$data['attendeeMap'] = json_encode($mapArray, JSON_THROW_ON_ERROR);
}
$this->setCurrentUser($user);
- $this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/breakout-rooms/' . self::$identifierToToken[$roomName], $data);
+ $this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/breakout-rooms/' . self::$identifierToToken[$identifier], $data);
$this->assertStatusCode($this->response, $status);
}
diff --git a/tests/integration/features/conversation/breakout-rooms.feature b/tests/integration/features/conversation/breakout-rooms.feature
index c05185f7c..93eaaf02f 100644
--- a/tests/integration/features/conversation/breakout-rooms.feature
+++ b/tests/integration/features/conversation/breakout-rooms.feature
@@ -516,3 +516,67 @@ Feature: conversation/breakout-rooms
When user "participant1" deletes room "class room" with 200 (v4)
And user "participant1" is participant of the following rooms (v4)
And user "participant2" is participant of the following rooms (v4)
+
+ Scenario: Create an additional breakout room on the fly
+ Given user "participant1" creates room "class room" (v4)
+ | roomType | 2 |
+ | roomName | class room |
+ And user "participant1" adds user "participant2" to room "class room" with 200 (v4)
+ And user "participant1" promotes "participant2" in room "class room" with 200 (v4)
+ And user "participant1" sees the following attendees in room "class room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | users | participant2 | 2 |
+ And user "participant1" creates 2 automatic breakout rooms for "class room" with 200 (v1)
+ And user "participant1" is participant of the following rooms (v4)
+ | type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
+ | 2 | class room | 0 | 1 | 0 |
+ | 2 | Room 1 | 1 | 0 | 0 |
+ | 2 | Room 2 | 1 | 0 | 0 |
+ And user "participant2" is participant of the following rooms (v4)
+ | type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
+ | 2 | class room | 0 | 1 | 0 |
+ | 2 | Room 1 | 1 | 0 | 0 |
+ | 2 | Room 2 | 1 | 0 | 0 |
+ # Can not nest
+ Given user "participant1" creates room "Room 3" with 400 (v4)
+ | roomType | 2 |
+ | roomName | Room 3 |
+ | objectType | room |
+ | objectId | ROOM(Room 2) |
+ Given user "participant1" creates room "Room 3" with 201 (v4)
+ | roomType | 2 |
+ | roomName | Room 3 |
+ | objectType | room |
+ | objectId | ROOM(class room) |
+ And user "participant1" is participant of the following rooms (v4)
+ | type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
+ | 2 | class room | 0 | 1 | 0 |
+ | 2 | Room 1 | 1 | 0 | 0 |
+ | 2 | Room 2 | 1 | 0 | 0 |
+ | 2 | Room 3 | 1 | 0 | 0 |
+ And user "participant2" is participant of the following rooms (v4)
+ | type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
+ | 2 | class room | 0 | 1 | 0 |
+ | 2 | Room 1 | 1 | 0 | 0 |
+ | 2 | Room 2 | 1 | 0 | 0 |
+ | 2 | Room 3 | 1 | 0 | 0 |
+ And user "participant1" starts breakout rooms in room "class room" with 200 (v1)
+ And user "participant1" is participant of the following rooms (v4)
+ | type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
+ | 2 | class room | 0 | 1 | 1 |
+ | 2 | Room 1 | 0 | 0 | 0 |
+ | 2 | Room 2 | 0 | 0 | 0 |
+ | 2 | Room 3 | 0 | 0 | 0 |
+ Given user "participant1" creates room "Room 3" with 201 (v4)
+ | roomType | 2 |
+ | roomName | Room 4 |
+ | objectType | room |
+ | objectId | ROOM(class room) |
+ And user "participant1" is participant of the following rooms (v4)
+ | type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
+ | 2 | class room | 0 | 1 | 1 |
+ | 2 | Room 1 | 0 | 0 | 0 |
+ | 2 | Room 2 | 0 | 0 | 0 |
+ | 2 | Room 3 | 0 | 0 | 0 |
+ | 2 | Room 4 | 0 | 0 | 0 |