diff options
author | Joas Schilling <coding@schilljs.com> | 2021-03-26 16:22:10 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-03-26 16:27:10 +0300 |
commit | 5730ef0a7805e4bb08a76a03e76a574de666adb6 (patch) | |
tree | 9753a6c930507936e99efab91248740851fb42d8 /tests | |
parent | 0253a69f8762e6bfec2327375effa0da7312cae4 (diff) |
Add integration tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 15 | ||||
-rw-r--r-- | tests/integration/features/conversation/add-group.feature | 157 |
2 files changed, 172 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 6cb88c67d..5c797ac24 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -1825,6 +1825,21 @@ class FeatureContext implements Context, SnippetAcceptingContext { $this->setCurrentUser($currentUser); } + /** + * @When /^user "([^"]*)" is not member of group "([^"]*)"$/ + * @param string $user + * @param string $group + */ + public function removeUserFromGroup($user, $group) { + $currentUser = $this->currentUser; + $this->setCurrentUser('admin'); + $this->sendRequest('DELETE', "/cloud/users/$user/groups", [ + 'groupid' => $group, + ]); + $this->assertStatusCode($this->response, 200); + $this->setCurrentUser($currentUser); + } + /* * Requests */ diff --git a/tests/integration/features/conversation/add-group.feature b/tests/integration/features/conversation/add-group.feature new file mode 100644 index 000000000..a232cef94 --- /dev/null +++ b/tests/integration/features/conversation/add-group.feature @@ -0,0 +1,157 @@ +Feature: public + Background: + Given user "participant1" exists + Given user "participant2" exists + Given user "participant3" exists + And group "group1" exists + And user "participant2" is member of group "group1" + + Scenario: Owner invites a group + Given user "participant1" creates room "room" (v4) + | roomType | 3 | + | roomName | room | + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + And user "participant1" adds group "group1" to room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + + Scenario: Owner start a chat with a group + Given user "participant1" creates room "room" (v4) + | roomType | 2 | + | source | group | + | invite |group1 | + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + + Scenario: User is added to a group which is a member of a chat + Given user "participant1" creates room "room" (v4) + | roomType | 2 | + | source | group | + | invite |group1 | + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + And user "participant3" is member of group "group1" + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + | users | participant3 | 3 | + + Scenario: User is removed from a group which is a member of a chat + Given user "participant1" creates room "room" (v4) + | roomType | 2 | + | source | group | + | invite |group1 | + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + And user "participant2" is not member of group "group1" + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + + Scenario: User that was already a member has their group added to a chat + Given user "participant1" creates room "room" (v4) + | roomType | 3 | + | roomName | room | + And user "participant1" adds user "participant2" to room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | users | participant2 | 3 | + And user "participant1" adds group "group1" to room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | users | participant2 | 3 | + | groups | group1 | 3 | + + Scenario: User that was self-joined has their group added to a chat + Given user "participant1" creates room "room" (v4) + | roomType | 3 | + | roomName | room | + And user "participant2" joins room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | users | participant2 | 5 | + And user "participant1" adds group "group1" to room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | users | participant2 | 3 | + | groups | group1 | 3 | + + Scenario: User that was already a member is added to a group which is a member of a chat + Given user "participant1" creates room "room" (v4) + | roomType | 2 | + | source | group | + | invite |group1 | + And user "participant1" adds user "participant3" to room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + | users | participant3 | 3 | + And user "participant3" is member of group "group1" + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + | users | participant3 | 3 | + + Scenario: User that was self-joined is added to a group which is a member of a chat + Given user "participant1" creates room "room" (v4) + | roomType | 3 | + | roomName | room | + And user "participant1" adds group "group1" to room "room" with 200 (v4) + And user "participant3" joins room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + | users | participant3 | 5 | + And user "participant3" is member of group "group1" + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | + | users | participant2 | 3 | + | users | participant3 | 3 | + + Scenario: User that was already a member is removed from a group which is a member of a chat + # This might not be what most people desire but fixing this would mean we + # need to keep multiple records per user whether they were added manually before etc. + Given user "participant1" creates room "room" (v4) + | roomType | 3 | + | roomName | room | + And user "participant1" adds user "participant2" to room "room" with 200 (v4) + And user "participant1" adds group "group1" to room "room" with 200 (v4) + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | users | participant2 | 3 | + | groups | group1 | 3 | + And user "participant2" is not member of group "group1" + And user "participant1" sees the following attendees in room "room" with 200 (v4) + | actorType | actorId | participantType | + | users | participant1 | 1 | + | groups | group1 | 3 | |