Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 0 additions & 9 deletions tests/acceptance/features/app-comments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Feature: app-comments
And I create a new comment with "Hello world" as message
And I see a comment with "Hello world" as message
When I act as Jane
And I accept the share for "shared.txt" in the notifications
# The Files app is open again to reload the file list and the comments
And I open the Files app
And I open the details view for "shared.txt"
Expand All @@ -64,7 +63,6 @@ Feature: app-comments
And I share "shared.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "shared.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I open the details view for "shared.txt"
Expand Down Expand Up @@ -94,7 +92,6 @@ Feature: app-comments
And I create a new comment with "Hello world" as message
And I see a comment with "Hello world" as message
When I act as Jane
And I accept the share for "shared.txt" in the notifications
# The Files app is open again to reload the file list and the comments
And I open the Files app
Then I see that "shared.txt" has unread comments
Expand All @@ -112,7 +109,6 @@ Feature: app-comments
And I share "shared.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "shared.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I open the details view for "shared.txt"
Expand Down Expand Up @@ -141,7 +137,6 @@ Feature: app-comments
And I create a new comment with "Hello world" as message
And I see a comment with "Hello world" as message
When I act as Jane
And I accept the share for "Folder" in the notifications
# The Files app is open again to reload the file list and the comments
And I open the Files app
Then I see that "Folder" has unread comments
Expand All @@ -159,7 +154,6 @@ Feature: app-comments
And I share "Folder" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "Folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I open the details view for "Folder"
Expand Down Expand Up @@ -190,7 +184,6 @@ Feature: app-comments
And I create a new comment with "Hello world" as message
And I see a comment with "Hello world" as message
When I act as Jane
And I accept the share for "Folder" in the notifications
# The Files app is open again to reload the file list and the comments
And I open the Files app
And I enter in the folder named "Folder"
Expand All @@ -209,7 +202,6 @@ Feature: app-comments
And I share "Folder" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "Folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I enter in the folder named "Folder"
Expand Down Expand Up @@ -264,7 +256,6 @@ Feature: app-comments
And I share "shared.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "shared.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I open the details view for "shared.txt"
Expand Down
59 changes: 45 additions & 14 deletions tests/acceptance/features/app-files-sharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,33 @@ Feature: app-files-sharing
When I share "farewell.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "farewell.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "farewell.txt"
And I open the details view for "farewell.txt"
And I see that the details view is open
And I open the "Sharing" tab in the details view
And I see that the "Sharing" tab in the details view is eventually loaded
And I see that the file is shared with me by "admin"

Scenario: share a file with another user that needs to accept shares
Given I act as John
And I am logged in as the admin
And I act as Jane
And I am logged in
And I visit the settings page
And I open the "Sharing" section
And I disable accepting the shares by default
And I see that shares are not accepted by default
And I act as John
And I rename "welcome.txt" to "farewell.txt"
And I see that the file list contains a file named "farewell.txt"
When I share "farewell.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I open the Files app
And I see that the file list does not contain a file named "farewell.txt"
And I accept the share for "/farewell.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "farewell.txt"
Expand All @@ -30,7 +56,6 @@ Feature: app-files-sharing
When I share "welcome.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "welcome.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "welcome (2).txt"
Expand All @@ -40,6 +65,24 @@ Feature: app-files-sharing
And I see that the "Sharing" tab in the details view is eventually loaded
And I see that the file is shared with me by "admin"

Scenario: share a skeleton file with another user before first login
# If a file is shared with a user before her first login the skeleton would
# not have been created, so if the shared file has the same name as one from
# the skeleton the shared file will take its place and the skeleton file
# will not be added.
Given I act as John
And I am logged in as the admin
When I share "welcome.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I am logged in
Then I see that the file list contains a file named "welcome.txt"
And I open the details view for "welcome.txt"
And I see that the details view is open
And I open the "Sharing" tab in the details view
And I see that the "Sharing" tab in the details view is eventually loaded
And I see that the file is shared with me by "admin"

Scenario: reshare a file with another user
Given I act as John
And I am logged in as the admin
Expand All @@ -53,13 +96,11 @@ Feature: app-files-sharing
And I share "farewell.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "farewell.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
When I share "farewell.txt" with "user1"
And I see that the file is shared with "user1"
And I act as Jim
And I accept the share for "farewell.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "farewell.txt"
Expand All @@ -80,7 +121,6 @@ Feature: app-files-sharing
And I share "farewell.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "farewell.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I share "farewell.txt" with "user1"
Expand All @@ -106,7 +146,6 @@ Feature: app-files-sharing
When I share "Shared folder" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "Shared folder"
Expand All @@ -130,7 +169,6 @@ Feature: app-files-sharing
And I create a new folder named "Subfolder"
And I see that the file list contains a file named "Subfolder"
When I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I enter in the folder named "Shared folder"
Expand All @@ -147,7 +185,6 @@ Feature: app-files-sharing
And I share "Shared folder" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I enter in the folder named "Shared folder"
Expand All @@ -170,7 +207,6 @@ Feature: app-files-sharing
And I share "Shared folder" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I share "Shared folder" with "user1"
Expand All @@ -179,7 +215,6 @@ Feature: app-files-sharing
And I create a new folder named "Subfolder"
And I see that the file list contains a file named "Subfolder"
When I act as Jim
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I enter in the folder named "Shared folder"
Expand All @@ -198,12 +233,10 @@ Feature: app-files-sharing
And I share "Shared folder" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I share "Shared folder" with "user1"
And I act as Jim
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I enter in the folder named "Shared folder"
Expand All @@ -226,7 +259,6 @@ Feature: app-files-sharing
And I set the share with "user0" as not reshareable
And I see that "user0" can not reshare the share
When I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "Shared folder"
Expand All @@ -253,7 +285,6 @@ Feature: app-files-sharing
And I create a new folder named "Subfolder"
And I see that the file list contains a file named "Subfolder"
When I act as Jane
And I accept the share for "Shared folder" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
And I enter in the folder named "Shared folder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function iAcceptTheShareForInTheNotifications($fileName) {
// As the waiting is long enough already the find timeout multiplier is
// capped at 2 when finding notifications.
$findTimeoutMultiplier = $this->actor->getFindTimeoutMultiplier();
$this->actor->setFindTimeoutMultiplier(max(2, $findTimeoutMultiplier));
$this->actor->setFindTimeoutMultiplier(min(2, $findTimeoutMultiplier));
$this->actor->find(self::acceptButtonInIncomingShareNotificationForFile($fileName), 35)->click();
$this->actor->setFindTimeoutMultiplier($findTimeoutMultiplier);

Expand Down
44 changes: 44 additions & 0 deletions tests/acceptance/features/bootstrap/SettingsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ class SettingsContext implements Context, ActorAwareInterface {

use ActorAware;

/**
* @return Locator
*/
public static function acceptSharesByDefaultCheckbox() {
// forThe()->checkbox("Accept user...") can not be used here; that would
// return the checkbox itself, but the element that the user interacts
// with is the label.
return Locator::forThe()->xpath("//label[normalize-space() = 'Accept user and group shares by default']")->
describedAs("Accept shares by default checkbox in Sharing section in Personal Sharing Settings");
}

/**
* @return Locator
*/
public static function acceptSharesByDefaultCheckboxInput() {
return Locator::forThe()->checkbox("Accept user and group shares by default")->
describedAs("Accept shares by default checkbox input in Sharing section in Personal Sharing Settings");
}

/**
* @return Locator
*/
Expand Down Expand Up @@ -84,6 +103,15 @@ public static function systemTagsResetButton() {
describedAs("Reset button in system tags section in Administration Settings");
}

/**
* @When I disable accepting the shares by default
*/
public function iDisableAcceptingTheSharesByDefault() {
$this->iSeeThatSharesAreAcceptedByDefault();

$this->actor->find(self::acceptSharesByDefaultCheckbox(), 2)->click();
}

/**
* @When I create the tag :tag in the settings
*/
Expand All @@ -93,6 +121,22 @@ public function iCreateTheTagInTheSettings($tag) {
$this->actor->find(self::systemTagsCreateOrUpdateButton())->click();
}

/**
* @Then I see that shares are accepted by default
*/
public function iSeeThatSharesAreAcceptedByDefault() {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked());
}

/**
* @Then I see that shares are not accepted by default
*/
public function iSeeThatSharesAreNotAcceptedByDefault() {
PHPUnit_Framework_Assert::assertFalse(
$this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked());
}

/**
* @Then I see that the button to select tags is shown
*/
Expand Down