Browse Source

Add integration test for the "get breakout rooms participants

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/8660/head
Joas Schilling 3 years ago
parent
commit
5af8539ced
No known key found for this signature in database GPG Key ID: C400AAF20C1BB6FC
  1. 33
      tests/integration/features/bootstrap/FeatureContext.php
  2. 12
      tests/integration/features/conversation/breakout-rooms.feature

33
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'];
}

12
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)

Loading…
Cancel
Save