Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-07-12 11:16:02 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-08-28 01:49:54 +0300
commitb2b506aa82966de6f5d10de78e8aa801535a6d3a (patch)
tree8f5adeb52c453f272f25e4fe22c34b43113e6e31 /tests
parent09371860722555f00bb75be65b0ed499b37b2b79 (diff)
Add integration tests for guest mentions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php32
-rw-r--r--tests/integration/features/chat/mentions.feature66
2 files changed, 91 insertions, 7 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 62e17349a..c9128a494 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -681,13 +681,31 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
PHPUnit_Framework_Assert::assertCount(count($formData->getHash()), $mentions, 'Mentions count does not match');
- PHPUnit_Framework_Assert::assertEquals($formData->getHash(), array_map(function($mention) {
- return [
- 'id' => (string) $mention['id'],
- 'label' => (string) $mention['label'],
- 'source' => (string) $mention['source'],
- ];
- }, $mentions));
+
+ foreach ($formData->getHash() as $key => $row) {
+ if ($row['id'] === 'GUEST_ID') {
+ PHPUnit_Framework_Assert::assertRegExp('/^guest\/[0-9a-f]{40}$/', $mentions[$key]['id']);
+ $mentions[$key]['id'] = 'GUEST_ID';
+ }
+ PHPUnit_Framework_Assert::assertEquals($row, $mentions[$key]);
+ }
+ }
+
+ /**
+ * @Then /^guest "([^"]*)" sets name to "([^"]*)" in room "([^"]*)" with (\d+)$/
+ *
+ * @param string $user
+ * @param string $name
+ * @param string $identifier
+ * @param string $statusCode
+ */
+ public function guestSetsName($user, $name, $identifier, $statusCode) {
+ $this->setCurrentUser($user);
+ $this->sendRequest(
+ 'POST', '/apps/spreed/api/v1/guest/' . self::$identifierToToken[$identifier] . '/name',
+ new TableNode([['displayName', $name]])
+ );
+ $this->assertStatusCode($this->response, $statusCode);
}
/**
diff --git a/tests/integration/features/chat/mentions.feature b/tests/integration/features/chat/mentions.feature
index 3520ead84..f76a324ac 100644
--- a/tests/integration/features/chat/mentions.feature
+++ b/tests/integration/features/chat/mentions.feature
@@ -132,16 +132,25 @@ Feature: chat/mentions
| all | room | calls |
| participant2 | participant2-displayname | users |
| participant3 | participant3-displayname | users |
+ | GUEST_ID | Guest | guests |
And user "participant2" gets the following candidate mentions in room "public room" for "" with 200
| id | label | source |
| all | room | calls |
| participant1 | participant1-displayname | users |
| participant3 | participant3-displayname | users |
+ | GUEST_ID | Guest | guests |
And user "participant3" gets the following candidate mentions in room "public room" for "" with 200
| id | label | source |
| all | room | calls |
| participant1 | participant1-displayname | users |
| participant2 | participant2-displayname | users |
+ | GUEST_ID | Guest | guests |
+ And user "guest" gets the following candidate mentions in room "public room" for "" with 200
+ | id | label | source |
+ | all | room | calls |
+ | participant1 | participant1-displayname | users |
+ | participant2 | participant2-displayname | users |
+ | participant3 | participant3-displayname | users |
Scenario: get matched mentions in a public room
When user "participant1" creates room "public room"
@@ -162,6 +171,62 @@ Feature: chat/mentions
| id | label | source |
| participant1 | participant1-displayname | users |
| participant2 | participant2-displayname | users |
+ And user "guest" gets the following candidate mentions in room "public room" for "part" with 200
+ | id | label | source |
+ | participant1 | participant1-displayname | users |
+ | participant2 | participant2-displayname | users |
+ | participant3 | participant3-displayname | users |
+
+ Scenario: get matched guest mentions in a public room
+ When user "participant1" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "participant1" adds "participant2" to room "public room" with 200
+ And user "participant3" joins room "public room" with 200
+ And user "guest1" joins room "public room" with 200
+ And user "guest2" joins room "public room" with 200
+ Then user "participant1" gets the following candidate mentions in room "public room" for "uest" with 200
+ | id | label | source |
+ | GUEST_ID | Guest | guests |
+ | GUEST_ID | Guest | guests |
+ And user "participant2" gets the following candidate mentions in room "public room" for "uest" with 200
+ | id | label | source |
+ | GUEST_ID | Guest | guests |
+ | GUEST_ID | Guest | guests |
+ And user "participant3" gets the following candidate mentions in room "public room" for "uest" with 200
+ | id | label | source |
+ | GUEST_ID | Guest | guests |
+ | GUEST_ID | Guest | guests |
+ And user "guest1" gets the following candidate mentions in room "public room" for "uest" with 200
+ | id | label | source |
+ | GUEST_ID | Guest | guests |
+ And user "guest2" gets the following candidate mentions in room "public room" for "uest" with 200
+ | id | label | source |
+ | GUEST_ID | Guest | guests |
+
+ Scenario: get matched named guest mentions in a public room
+ When user "participant1" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "participant1" adds "participant2" to room "public room" with 200
+ And user "participant3" joins room "public room" with 200
+ And user "guest1" joins room "public room" with 200
+ And guest "guest1" sets name to "FooBar" in room "public room" with 200
+ And user "guest2" joins room "public room" with 200
+ Then user "participant1" gets the following candidate mentions in room "public room" for "oob" with 200
+ | id | label | source |
+ | GUEST_ID | FooBar | guests |
+ And user "participant2" gets the following candidate mentions in room "public room" for "oob" with 200
+ | id | label | source |
+ | GUEST_ID | FooBar | guests |
+ And user "participant3" gets the following candidate mentions in room "public room" for "oob" with 200
+ | id | label | source |
+ | GUEST_ID | FooBar | guests |
+ And user "guest1" gets the following candidate mentions in room "public room" for "oob" with 200
+ | id | label | source |
+ And user "guest2" gets the following candidate mentions in room "public room" for "oob" with 200
+ | id | label | source |
+ | GUEST_ID | FooBar | guests |
Scenario: get unmatched mentions in a public room
When user "participant1" creates room "public room"
@@ -173,6 +238,7 @@ Feature: chat/mentions
Then user "participant1" gets the following candidate mentions in room "public room" for "unknown" with 200
And user "participant2" gets the following candidate mentions in room "public room" for "unknown" with 200
And user "participant3" gets the following candidate mentions in room "public room" for "unknown" with 200
+ And user "guest" gets the following candidate mentions in room "public room" for "unknown" with 200
Scenario: get mentions in a public room with a participant not in the room
When user "participant1" creates room "public room"