Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1e37164
Add support for public shares to file rooms
danxuliu Jul 18, 2018
37f2f71
Add integration tests for files shared by link
danxuliu Aug 14, 2019
d1a3e69
Add integration tests for self-joined users in files shared by link
danxuliu Aug 14, 2019
f2e7806
Add self-joined users and guests to the candidate mentions in file rooms
danxuliu Aug 14, 2019
fc6d2a4
Add integration tests for mentions in a file shared by link
danxuliu Aug 14, 2019
6b04fb7
Fix avatar container height during calls
danxuliu Sep 16, 2019
094b9b3
Add support for Talk sidebar in public share pages
danxuliu Aug 15, 2019
18a1037
Add basic acceptance tests for the Talk sidebar in the public share page
danxuliu Aug 16, 2019
465059d
Add acceptance tests for Talk sidebar in public share page to Drone
danxuliu Aug 16, 2019
1521c5f
Add acceptance tests for registered users in the public share page
danxuliu Aug 16, 2019
f6ac589
Add acceptance tests for mentioning users in the Files app
danxuliu Aug 16, 2019
b8be6a7
Add acceptance tests for mentions in the public share page
danxuliu Aug 16, 2019
3361774
Add acceptance tests for chats in a file shared by link
danxuliu Aug 16, 2019
bab3557
Add acceptance tests for chats in a file shared by link with a password
danxuliu Aug 16, 2019
744de08
Correctly check if the share has a password and if it was entered cor…
nickvergessen Aug 16, 2019
2f58186
Add integration tests for getting the room for link share with password
danxuliu Aug 17, 2019
6b0a0dc
Do not add system message for self joined users to file rooms
danxuliu Aug 19, 2019
ad37a86
Add integration tests for the "user_added" system message
danxuliu Aug 19, 2019
2f12dc9
Add wrapper around "OC.getCurrentUser()" to be able to override the user
danxuliu Sep 25, 2019
4b9a47a
Override the current user when getting the room for a public share page
danxuliu Sep 25, 2019
68797f3
Fix guest avatars in public share page
danxuliu Sep 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add integration tests for files shared by link
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Sep 27, 2019
commit 37f2f71062a9161977dd610cac0ecc704182601c
37 changes: 37 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
Expand Down Expand Up @@ -65,6 +66,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
/** @var array */
protected $createdGroups = [];

/** @var SharingContext */
private $sharingContext;

public static function getTokenForIdentifier(string $identifier) {
return self::$identifierToToken[$identifier];
}
Expand All @@ -91,6 +95,15 @@ public function setUp() {
$this->createdGroups = [];
}

/**
* @BeforeScenario
*/
public function getOtherRequiredSiblingContexts(BeforeScenarioScope $scope) {
$environment = $scope->getEnvironment();

$this->sharingContext = $environment->getContext("SharingContext");
}

/**
* @AfterScenario
*/
Expand Down Expand Up @@ -362,6 +375,30 @@ private function sendingToDav(string $verb, string $url, array $headers = null,
}
}

/**
* @Then /^user "([^"]*)" gets the room for last share with (\d+)$/
*
* @param string $user
* @param int $statusCode
*/
public function userGetsTheRoomForLastShare($user, $statusCode) {
$shareToken = $this->sharingContext->getLastShareToken();

$this->setCurrentUser($user);
$this->sendRequest('GET', '/apps/spreed/api/v1/publicshare/' . $shareToken);
$this->assertStatusCode($this->response, $statusCode);

if ($statusCode !== '200') {
return;
}

$response = $this->getDataFromResponse($this->response);

$identifier = 'file last share room';
self::$identifierToToken[$identifier] = $response['token'];
self::$tokenToIdentifier[$response['token']] = $identifier;
}

/**
* @Then /^user "([^"]*)" joins room "([^"]*)" with (\d+)$/
*
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/features/bootstrap/SharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,13 @@ private function loggingInUsingWebAs(string $user) {
return [$requestToken, $cookieJar];
}

/**
* @return string
*/
public function getLastShareToken(): string {
return (string)$this->lastCreatedShareData->data[0]->token;
}

/**
* @return string
*/
Expand Down
167 changes: 167 additions & 0 deletions tests/integration/features/conversation/files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,60 @@ Feature: conversation/files



Scenario: get room for link share
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
When user "participant1" gets the room for last share with 200
And user "participant2" gets the room for last share with 200
And user "participant3" gets the room for last share with 200
And user "guest" gets the room for last share with 200
Then user "participant1" is not participant of room "file last share room"
And user "participant2" is not participant of room "file last share room"
And user "participant3" is not participant of room "file last share room"
And user "guest" is not participant of room "file last share room"

Scenario: get room for link share of a folder
Given user "participant1" creates folder "/test"
And user "participant1" shares "test" by link with OCS 100
When user "participant1" gets the room for last share with 404
And user "participant2" gets the room for last share with 404
And user "guest" gets the room for last share with 404

Scenario: get room for link no longer shared
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant1" deletes last share
When user "participant1" gets the room for last share with 404
And user "participant2" gets the room for last share with 404
And user "participant3" gets the room for last share with 404
And user "guest" gets the room for last share with 404

Scenario: get room for file shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
When user "participant1" gets the room for path "welcome.txt" with 200
Then user "participant1" is not participant of room "file welcome.txt room"

Scenario: get room for folder shared by link
Given user "participant1" creates folder "/test"
And user "participant1" shares "test" by link with OCS 100
When user "participant1" gets the room for path "test" with 404

Scenario: get room for file in folder shared by link
Given user "participant1" creates folder "/test"
And user "participant1" moves file "/welcome.txt" to "/test/renamed.txt" with 201
And user "participant1" shares "test" by link with OCS 100
When user "participant1" gets the room for path "test/renamed.txt" with 404

Scenario: get room for file in folder shared by link and reshared with user
Given user "participant1" creates folder "/test"
And user "participant1" moves file "/welcome.txt" to "/test/renamed.txt" with 201
And user "participant1" shares "test" by link with OCS 100
And user "participant1" shares "test" with user "participant2" with OCS 100
When user "participant1" gets the room for path "test/renamed.txt" with 200
And user "participant2" gets the room for path "test/renamed.txt" with 200
Then user "participant1" is not participant of room "file test/renamed.txt room"
And user "participant2" is not participant of room "file test/renamed.txt room"

Scenario: get room for file shared with user and by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
Expand All @@ -88,6 +137,14 @@ Feature: conversation/files
Then user "participant1" is not participant of room "file welcome (2).txt room"
And user "participant2" is not participant of room "file welcome (2).txt room"

Scenario: get room for last link share also shared with user
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
When user "participant1" gets the room for last share with 200
And user "participant2" gets the room for last share with 200
Then user "participant1" is not participant of room "file welcome (2).txt room"
And user "participant2" is not participant of room "file welcome (2).txt room"



Scenario: owner of a shared file can join its room
Expand Down Expand Up @@ -179,6 +236,27 @@ Feature: conversation/files



Scenario: owner of a file shared by link can join its room
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant1" gets the room for last share with 200
When user "participant1" joins room "file last share room" with 200
Then user "participant1" is participant of room "file last share room"

Scenario: user with access to a file shared by link can join its room
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant2" gets the room for last share with 200
When user "participant2" joins room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

Scenario: guest can join the room of a file shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "guest" gets the room for last share with 200
When user "guest" joins room "file last share room" with 200
And user "guest" is participant of room "file last share room"



Scenario: owner of a shared file is not removed from its room after leaving it
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
# Note that the room token is got by a different user than the one that
Expand All @@ -201,6 +279,33 @@ Feature: conversation/files



Scenario: owner of a file shared by link is not removed from its room after leaving it
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant1" gets the room for last share with 200
And user "participant1" joins room "file last share room" with 200
And user "participant1" is participant of room "file last share room"
When user "participant1" leaves room "file last share room" with 200
Then user "participant1" is participant of room "file last share room"

Scenario: user with access to a file shared by link is not removed from its room after leaving it
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant2" gets the room for last share with 200
And user "participant2" joins room "file last share room" with 200
And user "participant2" is participant of room "file last share room"
When user "participant2" leaves room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

Scenario: guest is removed from the room of a file shared by link after leaving it
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "guest" gets the room for last share with 200
And user "guest" joins room "file last share room" with 200
And user "guest" is participant of room "file last share room"
When user "guest" leaves room "file last share room" with 200
And user "guest" is not participant of room "file last share room"



Scenario: owner of a shared file can join its room again after removing self from it
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
# Note that the room token is got by a different user than the one that
Expand All @@ -227,6 +332,31 @@ Feature: conversation/files



Scenario: owner of a file shared by link can join its room again after removing self from it
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant1" gets the room for last share with 200
And user "participant1" joins room "file last share room" with 200
And user "participant1" is participant of room "file last share room"
When user "participant1" removes themselves from room "file last share room" with 200
And user "participant1" is not participant of room "file last share room"
And user "participant1" joins room "file last share room" with 200
Then user "participant1" is participant of room "file last share room"

Scenario: user with access to a file shared by link can join its room again after removing self from it
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant2" gets the room for last share with 200
And user "participant2" joins room "file last share room" with 200
And user "participant2" is participant of room "file last share room"
When user "participant2" removes themselves from room "file last share room" with 200
And user "participant2" is not participant of room "file last share room"
And user "participant2" joins room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

# Guests can not remove themselves from a room.



# Participants are removed from the room for a no longer shared file once they
# try to join the room again, but not when the file is unshared.

Expand All @@ -251,3 +381,40 @@ Feature: conversation/files
Then user "participant2" is participant of room "file welcome (2).txt room"
And user "participant2" joins room "file welcome (2).txt room" with 404
And user "participant2" is not participant of room "file welcome (2).txt room"



Scenario: owner is not participant of room for file no longer shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant1" gets the room for last share with 200
And user "participant1" joins room "file last share room" with 200
And user "participant1" leaves room "file last share room" with 200
And user "participant1" is participant of room "file last share room"
When user "participant1" deletes last share
Then user "participant1" is participant of room "file last share room"
And user "participant1" joins room "file last share room" with 404
And user "participant1" is not participant of room "file last share room"

Scenario: user is participant of room for file no longer shared by link but with access to it
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" shares "welcome.txt" by link with OCS 100
And user "participant2" gets the room for last share with 200
And user "participant2" joins room "file last share room" with 200
And user "participant2" leaves room "file last share room" with 200
And user "participant2" is participant of room "file last share room"
When user "participant1" deletes last share
Then user "participant2" is participant of room "file last share room"
# Although the room was created for the shared link it will still be
# available to other types of shares after the shared link is deleted.
And user "participant2" joins room "file last share room" with 200
And user "participant2" is participant of room "file last share room"

Scenario: guest is not participant of room for file no longer shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "guest" gets the room for last share with 200
And user "guest" joins room "file last share room" with 200
And user "guest" leaves room "file last share room" with 200
When user "participant1" deletes last share
Then user "guest" is not participant of room "file last share room"
And user "guest" joins room "file last share room" with 404
And user "guest" is not participant of room "file last share room"