From ea48d5ade2c53638a9290a251e8c40e2be552b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 26 Aug 2019 19:25:44 +0200 Subject: [PATCH] Add integration tests for preventing access to some APIs in the lobby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- .../features/conversation/lobby.feature | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/tests/integration/features/conversation/lobby.feature b/tests/integration/features/conversation/lobby.feature index 728199227..62b0464c8 100644 --- a/tests/integration/features/conversation/lobby.feature +++ b/tests/integration/features/conversation/lobby.feature @@ -68,3 +68,142 @@ Feature: conversation/lobby | roomName | room | When user "participant2" sets lobby state for room "room" to "moderators only" with 404 And user "participant2" sets lobby state for room "room" to "all participants" with 404 + + + + Scenario: participants can join the room when the lobby is active + Given user "participant1" creates room "room" + | roomType | 3 | + | roomName | room | + And user "participant1" adds "participant2" to room "room" with 200 + And user "participant1" promotes "participant2" in room "room" with 200 + And user "participant1" adds "participant3" to room "room" with 200 + When user "participant1" sets lobby state for room "room" to "moderators only" with 200 + Then user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + And user "guest" joins room "room" with 200 + And user "participant1" promotes "guest" in room "room" with 200 + And user "guest2" joins room "room" with 200 + + Scenario: participants can join a password protected room when the lobby is active + Given user "participant1" creates room "room" + | roomType | 3 | + | roomName | room | + And user "participant1" sets password "foobar" for room "room" with 200 + And user "participant1" adds "participant2" to room "room" with 200 + And user "participant1" promotes "participant2" in room "room" with 200 + And user "participant1" adds "participant3" to room "room" with 200 + When user "participant1" sets lobby state for room "room" to "moderators only" with 200 + Then user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + | password | foobar | + And user "guest" joins room "room" with 200 + | password | foobar | + And user "participant1" promotes "guest" in room "room" with 200 + And user "guest2" joins room "room" with 200 + | password | foobar | + + Scenario: lobby prevents chats for non moderators + Given user "participant1" creates room "room" + | roomType | 3 | + | roomName | room | + And user "participant1" adds "participant2" to room "room" with 200 + And user "participant1" promotes "participant2" in room "room" with 200 + And user "participant1" adds "participant3" to room "room" with 200 + And user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + And user "guest" joins room "room" with 200 + And user "participant1" promotes "guest" in room "room" with 200 + And user "guest2" joins room "room" with 200 + When user "participant1" sets lobby state for room "room" to "moderators only" with 200 + Then user "participant1" sends message "Message 1" to room "room" with 201 + And user "participant2" sends message "Message 2" to room "room" with 201 + And user "participant3" sends message "Message 3" to room "room" with 403 + And user "participant4" sends message "Message 4" to room "room" with 403 + And user "guest" sends message "Message 5" to room "room" with 201 + And user "guest2" sends message "Message 6" to room "room" with 403 + And user "participant1" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | + | room | guests | guest | | Message 5 | [] | + | room | users | participant2 | participant2-displayname | Message 2 | [] | + | room | users | participant1 | participant1-displayname | Message 1 | [] | + And user "participant2" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | + | room | guests | guest | | Message 5 | [] | + | room | users | participant2 | participant2-displayname | Message 2 | [] | + | room | users | participant1 | participant1-displayname | Message 1 | [] | + And user "participant3" sees the following messages in room "room" with 403 + And user "participant4" sees the following messages in room "room" with 403 + And user "guest" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | + | room | guests | guest | | Message 5 | [] | + | room | users | participant2 | participant2-displayname | Message 2 | [] | + | room | users | participant1 | participant1-displayname | Message 1 | [] | + And user "guest2" sees the following messages in room "room" with 403 + + Scenario: lobby prevents calls for non moderators + Given user "participant1" creates room "room" + | roomType | 3 | + | roomName | room | + And user "participant1" adds "participant2" to room "room" with 200 + And user "participant1" promotes "participant2" in room "room" with 200 + And user "participant1" adds "participant3" to room "room" with 200 + And user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + And user "guest" joins room "room" with 200 + And user "participant1" promotes "guest" in room "room" with 200 + And user "guest2" joins room "room" with 200 + When user "participant1" sets lobby state for room "room" to "moderators only" with 200 + Then user "participant1" joins call "room" with 200 + And user "participant2" joins call "room" with 200 + And user "participant3" joins call "room" with 403 + And user "participant4" joins call "room" with 403 + And user "guest" joins call "room" with 200 + And user "guest2" joins call "room" with 403 + And user "participant1" sees 3 peers in call "room" with 200 + And user "participant2" sees 3 peers in call "room" with 200 + And user "participant3" sees 0 peers in call "room" with 403 + And user "participant4" sees 0 peers in call "room" with 403 + And user "guest" sees 3 peers in call "room" with 200 + And user "guest2" sees 0 peers in call "room" with 403 + And user "participant1" leaves call "room" with 200 + And user "participant2" leaves call "room" with 200 + And user "guest" leaves call "room" with 200 + + Scenario: lobby prevents some room actions for non moderators + Given user "participant1" creates room "room" + | roomType | 3 | + | roomName | room | + And user "participant1" adds "participant2" to room "room" with 200 + And user "participant1" promotes "participant2" in room "room" with 200 + And user "participant1" adds "participant3" to room "room" with 200 + And user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + And user "guest" joins room "room" with 200 + And user "participant1" promotes "guest" in room "room" with 200 + And user "guest2" joins room "room" with 200 + When user "participant1" sets lobby state for room "room" to "moderators only" with 200 + Then user "participant1" leaves room "room" with 200 + And user "participant2" leaves room "room" with 200 + And user "participant3" leaves room "room" with 200 + And user "participant4" leaves room "room" with 200 + And user "guest" leaves room "room" with 200 + And user "guest2" leaves room "room" with 200 + And user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + And user "guest" joins room "room" with 200 + And user "guest2" joins room "room" with 200 + And user "participant2" removes themselves from room "room" with 200 + And user "participant3" removes themselves from room "room" with 200