summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2023-05-03 09:06:11 -0300
committerVitor Mattos <vitor@php.rio>2023-05-03 09:06:11 -0300
commitc92f66c01d7a1d522e3f4a6ff69ec9955fee7322 (patch)
tree0e7e801a88e715ff160ce76552acd51f640a7ef5 /tests
parentee52c47523ade345991e71b730f437cc3ba5abad (diff)
Cover with integration tests the room avatar with emoji
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php40
-rw-r--r--tests/integration/features/conversation/avatar.feature25
2 files changed, 51 insertions, 14 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 541e940d6..71084f8fb 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -3232,6 +3232,46 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @When /^the room "([^"]*)" has an svg as avatar with (\d+)(?: \((v1)\))?$/
+ */
+ public function theRoomNeedToHaveAnAsvAvatarWithStatusCode(string $identifier, int $statusCode, string $apiVersion = 'v1'): void {
+ $this->theRoomNeedToHavetAnAsvAvatarWithStatusCode($identifier, $statusCode, $apiVersion, true);
+ }
+
+ /**
+ * @When /^the room "([^"]*)" has not an svg as avatar with (\d+)(?: \((v1)\))?$/
+ */
+ public function theRoomNeedToHavetAnAsvAvatarWithStatusCode(string $identifier, int $statusCode, string $apiVersion = 'v1', bool $expectedToBeSvg = false): void {
+ $this->theRoomNeedToHaveAnAvatarWithStatusCode($identifier, $statusCode, $apiVersion);
+ $content = $this->response->getBody()->getContents();
+ try {
+ simplexml_load_string($content);
+ $actualIsSvg = true;
+ } catch (\Throwable $th) {
+ $actualIsSvg = false;
+ }
+ if ($expectedToBeSvg) {
+ Assert::assertEquals($expectedToBeSvg, $actualIsSvg, 'The room avatar need to be a XML file');
+ } else {
+ Assert::assertEquals($expectedToBeSvg, $actualIsSvg, 'The room avatar can not be a XML file');
+ }
+ }
+
+ /**
+ * @When /^the avatar svg of room "([^"]*)" contais the string "([^"]*)"(?: \((v1)\))?$/
+ */
+ public function theAvatarSvgOfRoomContainsTheString(string $identifier, string $string, string $apiVersion = 'v1'): void {
+ $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/avatar');
+ $content = $this->response->getBody()->getContents();
+ try {
+ simplexml_load_string($content);
+ } catch (\Throwable $th) {
+ throw new Exception('The avatar need to be a XML');
+ }
+ Assert::stringContains($content, $string);
+ }
+
+ /**
* @When /^user "([^"]*)" delete the avatar of room "([^"]*)" with (\d+)(?: \((v1)\))?$/
*/
public function userDeleteTheAvatarOfRoom(string $user, string $identifier, int $statusCode, string $apiVersion = 'v1'): void {
diff --git a/tests/integration/features/conversation/avatar.feature b/tests/integration/features/conversation/avatar.feature
index 861f75795..b327af66c 100644
--- a/tests/integration/features/conversation/avatar.feature
+++ b/tests/integration/features/conversation/avatar.feature
@@ -16,16 +16,16 @@ Feature: conversation/avatar
| roomType | 3 |
| roomName | room2 |
When user "participant1" uploads file "/img/favicon.png" as avatar of room "room2" with 200
- And user "participant1" gets room "room2" with 200 (v4)
+ Then user "participant1" gets room "room2" with 200 (v4)
| avatarVersion | NOT_EMPTY |
| isCustomAvatar | 1 |
- Then the room "room2" has an avatar with 200
+ And the room "room2" has not an svg as avatar with 200
And user "participant1" sees the following system messages in room "room2" with 200
| room | actorType | actorId | systemMessage | message |
| room2 | users | participant1 | avatar_set | You set the conversation picture |
| room2 | users | participant1 | conversation_created | You created the conversation |
- And user "participant1" delete the avatar of room "room2" with 200
- And user "participant1" sees the following system messages in room "room2" with 200
+ When user "participant1" delete the avatar of room "room2" with 200
+ Then user "participant1" sees the following system messages in room "room2" with 200
| room | actorType | actorId | systemMessage | message |
| room2 | users | participant1 | avatar_removed | You removed the conversation picture |
| room2 | users | participant1 | avatar_set | You set the conversation picture |
@@ -66,27 +66,24 @@ Feature: conversation/avatar
Given user "participant1" creates room "room1" (v4)
| roomType | 3 |
| roomName | room1 |
+ And the room "room1" has an svg as avatar with 200
And user "participant1" gets room "room1" with 200 (v4)
| avatarVersion | NOT_EMPTY |
| isCustomAvatar | 0 |
| displayName | room1 |
- And user "participant1" renames room "room1" to "room2" with 200 (v4)
- And user "participant1" gets room "room1" with 200 (v4)
- | avatarVersion | NOT_EMPTY |
- | isCustomAvatar | 0 |
- | displayName | room2 |
- Then the room "room1" has an avatar with 200
And user "participant1" renames room "room1" to "💙room2" with 200 (v4)
- And user "participant1" gets room "room1" with 200 (v4)
+ Then user "participant1" gets room "room1" with 200 (v4)
| avatarVersion | NOT_EMPTY |
| isCustomAvatar | 0 |
| displayName | 💙room2 |
- Then the room "room1" has an avatar with 200
- And user "participant1" renames room "room1" to "room1" with 200 (v4)
- And user "participant1" gets room "room1" with 200 (v4)
+ And the room "room1" has an svg as avatar with 200
+ And the avatar svg of room "room1" contais the string "💙"
+ When user "participant1" renames room "room1" to "room1" with 200 (v4)
+ Then user "participant1" gets room "room1" with 200 (v4)
| avatarVersion | NOT_EMPTY |
| isCustomAvatar | 0 |
| displayName | room1 |
+ And the room "room1" has an svg as avatar with 200
Scenario: User should receive the room avatar when see a rich object at media tab
Given user "participant1" creates room "public room" (v4)