Browse Source

Add integration tests for read-only conversations

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/1640/head
Joas Schilling 7 years ago
parent
commit
9a8746d8e1
No known key found for this signature in database GPG Key ID: 7076EA9751AACDDA
  1. 17
      tests/integration/features/bootstrap/FeatureContext.php
  2. 28
      tests/integration/features/callapi/group-read-only.feature
  3. 69
      tests/integration/features/callapi/public-read-only.feature
  4. 47
      tests/integration/features/chat/group-read-only.feature
  5. 69
      tests/integration/features/chat/public-read-only.feature

17
tests/integration/features/bootstrap/FeatureContext.php

@ -359,6 +359,23 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$this->assertStatusCode($this->response, $statusCode);
}
/**
* @Then /^user "([^"]*)" (locks|unlocks) room "([^"]*)" with (\d+)$/
*
* @param string $user
* @param string $newState
* @param string $identifier
* @param string $statusCode
*/
public function userChangesReadOnlyStateOfTheRoom($user, $newState, $identifier, $statusCode) {
$this->setCurrentUser($user);
$this->sendRequest(
'PUT', '/apps/spreed/api/v1/room/' . self::$identifierToToken[$identifier] . '/read-only',
new TableNode([['state', $newState === 'unlocks' ? 0 : 1]])
);
$this->assertStatusCode($this->response, $statusCode);
}
/**
* @Then /^user "([^"]*)" adds "([^"]*)" to room "([^"]*)" with (\d+)$/
*

28
tests/integration/features/callapi/group-read-only.feature

@ -0,0 +1,28 @@
Feature: callapi/group-read-only
Background:
Given user "participant1" exists
And user "participant2" exists
And user "participant3" exists
And group "attendees1" exists
And user "participant2" is member of group "attendees1"
Scenario: User1 invites group attendees1 to a group room and they cant join the call in a locked conversation
When user "participant1" creates room "room"
| roomType | 2 |
| invite | attendees1 |
Then user "participant1" is participant of room "room"
And user "participant2" is participant of room "room"
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant2" sees 0 peers in call "room" with 200
When user "participant1" locks room "room" with 200
And user "participant1" joins room "room" with 200
And user "participant1" joins call "room" with 403
And user "participant2" joins room "room" with 200
And user "participant2" joins call "room" with 403
Then user "participant1" sees 0 peers in call "room" with 403
And user "participant2" sees 0 peers in call "room" with 403
When user "participant1" unlocks room "room" with 200
And user "participant1" joins call "room" with 200
And user "participant2" joins call "room" with 200
Then user "participant1" sees 2 peers in call "room" with 200
And user "participant2" sees 2 peers in call "room" with 200

69
tests/integration/features/callapi/public-read-only.feature

@ -0,0 +1,69 @@
Feature: callapi/public-read-only
Background:
Given user "participant1" exists
And user "participant2" exists
And user "participant3" exists
Scenario: User1 invites user2 to a public room and they cant join the call in a locked conversation
When user "participant1" creates room "room"
| roomType | 3 |
| roomName | room |
And user "participant1" adds "participant2" to room "room" with 200
Then user "participant1" is participant of room "room"
And user "participant2" is participant of room "room"
Then user "participant1" sees 0 peers in call "room" with 200
And user "participant2" sees 0 peers in call "room" with 200
When user "participant1" locks room "room" with 200
And user "participant1" joins room "room" with 200
And user "participant1" joins call "room" with 403
And user "participant2" joins room "room" with 200
And user "participant2" joins call "room" with 403
Then user "participant1" sees 0 peers in call "room" with 403
And user "participant2" sees 0 peers in call "room" with 403
When user "participant1" unlocks room "room" with 200
And user "participant1" joins call "room" with 200
And user "participant2" joins call "room" with 200
Then user "participant1" sees 2 peers in call "room" with 200
And user "participant2" sees 2 peers in call "room" with 200
Scenario: User1 invites user2 to a public room and user3 cant join the call in a locked conversation
When user "participant1" creates room "room"
| roomType | 3 |
| roomName | room |
And user "participant1" adds "participant2" to room "room" with 200
Then user "participant1" is participant of room "room"
Then user "participant3" is not participant of room "room"
When user "participant1" locks room "room" with 200
And user "participant1" joins room "room" with 200
And user "participant1" joins call "room" with 403
And user "participant3" joins room "room" with 200
And user "participant3" joins call "room" with 403
Then user "participant1" sees 0 peers in call "room" with 403
And user "participant3" sees 0 peers in call "room" with 403
When user "participant1" unlocks room "room" with 200
And user "participant1" joins call "room" with 200
And user "participant3" joins call "room" with 200
Then user "participant1" sees 2 peers in call "room" with 200
And user "participant3" sees 2 peers in call "room" with 200
Scenario: User1 invites user2 to a public room and guest cant join the call in a locked conversation
When user "participant1" creates room "room"
| roomType | 3 |
| roomName | room |
And user "participant1" adds "participant2" to room "room" with 200
Then user "participant1" is participant of room "room"
When user "participant1" locks room "room" with 200
And user "guest" sees 0 peers in call "room" with 404
Then user "participant1" joins room "room" with 200
Then user "participant1" joins call "room" with 403
Then user "guest" joins room "room" with 200
And user "guest" joins call "room" with 403
Then user "participant1" sees 0 peers in call "room" with 403
And user "guest" sees 0 peers in call "room" with 403
When user "participant1" unlocks room "room" with 200
And user "participant1" sees 0 peers in call "room" with 200
And user "guest" sees 0 peers in call "room" with 200
Then user "participant1" joins call "room" with 200
And user "guest" joins call "room" with 200
Then user "participant1" sees 2 peers in call "room" with 200
And user "guest" sees 2 peers in call "room" with 200

47
tests/integration/features/chat/group-read-only.feature

@ -0,0 +1,47 @@
Feature: chat/group-read-only
Background:
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists
And group "attendees1" exists
And user "participant2" is member of group "attendees1"
Scenario: owner can send and receive chat messages to and from group room
Given user "participant1" creates room "group room"
| roomType | 2 |
| invite | attendees1 |
When user "participant1" sends message "Message 1" to room "group room" with 201
Then user "participant1" sees the following messages in room "group room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| group room | users | participant1 | participant1-displayname | Message 1 | [] |
When user "participant1" locks room "group room" with 200
When user "participant1" sends message "Message 2" to room "group room" with 403
Then user "participant1" sees the following messages in room "group room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| group room | users | participant1 | participant1-displayname | Message 1 | [] |
When user "participant1" unlocks room "group room" with 200
When user "participant1" sends message "Message 3" to room "group room" with 201
Then user "participant1" sees the following messages in room "group room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| group room | users | participant1 | participant1-displayname | Message 3 | [] |
| group room | users | participant1 | participant1-displayname | Message 1 | [] |
Scenario: invited user can send and receive chat messages to and from group room
Given user "participant1" creates room "group room"
| roomType | 2 |
| invite | attendees1 |
When user "participant2" sends message "Message 1" to room "group room" with 201
Then user "participant2" sees the following messages in room "group room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| group room | users | participant2 | participant2-displayname | Message 1 | [] |
When user "participant1" locks room "group room" with 200
When user "participant2" sends message "Message 2" to room "group room" with 403
Then user "participant2" sees the following messages in room "group room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| group room | users | participant2 | participant2-displayname | Message 1 | [] |
When user "participant1" unlocks room "group room" with 200
When user "participant2" sends message "Message 3" to room "group room" with 201
Then user "participant2" sees the following messages in room "group room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| group room | users | participant2 | participant2-displayname | Message 3 | [] |
| group room | users | participant2 | participant2-displayname | Message 1 | [] |

69
tests/integration/features/chat/public-read-only.feature

@ -0,0 +1,69 @@
Feature: chat/public-read-only
Background:
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists
And group "attendees1" exists
And user "participant2" is member of group "attendees1"
Scenario: owner can send and receive chat messages to and from group room
Given user "participant1" creates room "public room"
| roomType | 3 |
| roomName | room |
When user "participant1" sends message "Message 1" to room "public room" with 201
Then user "participant1" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant1 | participant1-displayname | Message 1 | [] |
When user "participant1" locks room "public room" with 200
When user "participant1" sends message "Message 2" to room "public room" with 403
Then user "participant1" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant1 | participant1-displayname | Message 1 | [] |
When user "participant1" unlocks room "public room" with 200
When user "participant1" sends message "Message 3" to room "public room" with 201
Then user "participant1" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant1 | participant1-displayname | Message 3 | [] |
| public room | users | participant1 | participant1-displayname | Message 1 | [] |
Scenario: invited user can send and receive chat messages to and from group room
Given user "participant1" creates room "public room"
| roomType | 3 |
| roomName | room |
And user "participant1" adds "participant2" to room "public room" with 200
When user "participant2" sends message "Message 1" to room "public room" with 201
Then user "participant2" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant2 | participant2-displayname | Message 1 | [] |
When user "participant1" locks room "public room" with 200
When user "participant2" sends message "Message 2" to room "public room" with 403
Then user "participant2" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant2 | participant2-displayname | Message 1 | [] |
When user "participant1" unlocks room "public room" with 200
When user "participant2" sends message "Message 3" to room "public room" with 201
Then user "participant2" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant2 | participant2-displayname | Message 3 | [] |
| public room | users | participant2 | participant2-displayname | Message 1 | [] |
Scenario: not invited but joined user can send and receive chat messages to and from public room
Given user "participant1" creates room "public room"
| roomType | 3 |
| roomName | room |
And user "participant3" joins room "public room" with 200
When user "participant3" sends message "Message 1" to room "public room" with 201
Then user "participant3" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant3 | participant3-displayname | Message 1 | [] |
When user "participant1" locks room "public room" with 200
When user "participant3" sends message "Message 2" to room "public room" with 403
Then user "participant3" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant3 | participant3-displayname | Message 1 | [] |
When user "participant1" unlocks room "public room" with 200
When user "participant3" sends message "Message 3" to room "public room" with 201
Then user "participant3" sees the following messages in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant3 | participant3-displayname | Message 3 | [] |
| public room | users | participant3 | participant3-displayname | Message 1 | [] |
Loading…
Cancel
Save