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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/features/app-comments.feature23
-rw-r--r--tests/acceptance/features/app-files-tags.feature11
-rw-r--r--tests/acceptance/features/app-files.feature56
-rw-r--r--tests/acceptance/features/bootstrap/CommentsAppContext.php28
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php61
-rw-r--r--tests/lib/UrlGeneratorTest.php64
6 files changed, 211 insertions, 32 deletions
diff --git a/tests/acceptance/features/app-comments.feature b/tests/acceptance/features/app-comments.feature
index a5bdb0aa745..1ee113d0aac 100644
--- a/tests/acceptance/features/app-comments.feature
+++ b/tests/acceptance/features/app-comments.feature
@@ -6,3 +6,26 @@ Feature: app-comments
And I open the "Comments" tab in the details view
When I create a new comment with "Hello world" as message
Then I see a comment with "Hello world" as message
+
+ Scenario: open the comments for a different file
+ Given I am logged in
+ And I create a new folder named "Folder"
+ And I open the details view for "welcome.txt"
+ And I open the "Comments" tab in the details view
+ And I create a new comment with "Hello world" as message
+ And I see a comment with "Hello world" as message
+ When I open the details view for "Folder"
+ # The "Comments" tab should already be opened
+ Then I see that there are no comments
+
+ Scenario: write a comment in a file right after writing a comment in another file
+ Given I am logged in
+ And I create a new folder named "Folder"
+ And I open the details view for "Folder"
+ And I open the "Comments" tab in the details view
+ And I create a new comment with "Comment in Folder" as message
+ And I open the details view for "welcome.txt"
+ # The "Comments" tab should already be opened
+ When I create a new comment with "Comment in welcome.txt" as message
+ Then I see a comment with "Comment in welcome.txt" as message
+ And I see that there is no comment with "Comment in Folder" as message
diff --git a/tests/acceptance/features/app-files-tags.feature b/tests/acceptance/features/app-files-tags.feature
index 3da24b7e1c2..d606c7a88a4 100644
--- a/tests/acceptance/features/app-files-tags.feature
+++ b/tests/acceptance/features/app-files-tags.feature
@@ -8,6 +8,17 @@ Feature: app-files-tags
When I open the input field for tags in the details view
Then I see that the input field for tags in the details view is shown
+ Scenario: show the input field for tags in the details view after closing and opening the details view again
+ Given I am logged in
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ And I see that the details view is closed
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ When I open the input field for tags in the details view
+ Then I see that the input field for tags in the details view is shown
+
Scenario: show the input field for tags in the details view after the sharing tab has loaded
Given I am logged in
And I open the details view for "welcome.txt"
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature
index 33bed4a3ef2..61b7678e843 100644
--- a/tests/acceptance/features/app-files.feature
+++ b/tests/acceptance/features/app-files.feature
@@ -1,5 +1,42 @@
Feature: app-files
+ Scenario: open and close the details view
+ Given I am logged in
+ When I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ Then I see that the details view is closed
+
+ Scenario: open and close the details view twice
+ Given I am logged in
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ And I see that the details view is closed
+ When I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ Then I see that the details view is closed
+
+ Scenario: open and close the details view again after coming back from a different section
+ Given I am logged in
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ And I see that the details view is closed
+ And I open the "Recent" section
+ And I see that the current section is "Recent"
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ And I see that the details view is closed
+ When I open the "All files" section
+ And I see that the current section is "All files"
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I close the details view
+ Then I see that the details view is closed
+
Scenario: viewing a favorite file in its folder shows the correct sidebar view
Given I am logged in
And I create a new folder named "other"
@@ -292,3 +329,22 @@ Feature: app-files
When I unmark "welcome.txt" as favorite
Then I see that "welcome.txt" is not marked as favorite
And I see that "A name alphabetically lower than welcome.txt" precedes "welcome.txt" in the file list
+
+ Scenario: mark a file as favorite in the details view
+ Given I am logged in
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ When I mark the file as favorite in the details view
+ Then I see that "welcome.txt" is marked as favorite
+ And I see that the file is marked as favorite in the details view
+
+ Scenario: unmark a file as favorite in the details view
+ Given I am logged in
+ And I open the details view for "welcome.txt"
+ And I see that the details view is open
+ And I mark the file as favorite in the details view
+ And I see that "welcome.txt" is marked as favorite
+ And I see that the file is marked as favorite in the details view
+ When I unmark the file as favorite in the details view
+ Then I see that "welcome.txt" is not marked as favorite
+ And I see that the file is not marked as favorite in the details view
diff --git a/tests/acceptance/features/bootstrap/CommentsAppContext.php b/tests/acceptance/features/bootstrap/CommentsAppContext.php
index 13d8af4e60e..5d19412c30e 100644
--- a/tests/acceptance/features/bootstrap/CommentsAppContext.php
+++ b/tests/acceptance/features/bootstrap/CommentsAppContext.php
@@ -63,6 +63,15 @@ class CommentsAppContext implements Context, ActorAwareInterface {
}
/**
+ * @return Locator
+ */
+ public static function emptyContent() {
+ return Locator::forThe()->css(".emptycontent")->
+ descendantOf(FilesAppContext::detailsView())->
+ describedAs("Empty content in details view in Files app");
+ }
+
+ /**
* @When /^I create a new comment with "([^"]*)" as message$/
*/
public function iCreateANewCommentWithAsMessage($commentText) {
@@ -71,10 +80,29 @@ class CommentsAppContext implements Context, ActorAwareInterface {
}
/**
+ * @Then /^I see that there are no comments$/
+ */
+ public function iSeeThatThereAreNoComments() {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::emptyContent(), 10)->isVisible());
+ }
+
+ /**
* @Then /^I see a comment with "([^"]*)" as message$/
*/
public function iSeeACommentWithAsMessage($commentText) {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::commentWithText($commentText), 10)->isVisible());
}
+
+ /**
+ * @Then /^I see that there is no comment with "([^"]*)" as message$/
+ */
+ public function iSeeThatThereIsNoCommentWithAsMessage($commentText) {
+ try {
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::commentWithText($commentText))->isVisible());
+ } catch (NoSuchElementException $exception) {
+ }
+ }
}
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index d9ac6431716..a5d2c636f3e 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -89,6 +89,33 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function favoriteActionInFileDetailsInDetailsView() {
+ return Locator::forThe()->css(".action-favorite")->
+ descendantOf(self::fileDetailsInDetailsView())->
+ describedAs("Favorite action in file details in details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function notFavoritedStateIconInFileDetailsInDetailsView() {
+ return Locator::forThe()->css(".icon-star")->
+ descendantOf(self::favoriteActionInFileDetailsInDetailsView())->
+ describedAs("Not favorited state icon in file details in details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function favoritedStateIconInFileDetailsInDetailsView() {
+ return Locator::forThe()->css(".icon-starred")->
+ descendantOf(self::favoriteActionInFileDetailsInDetailsView())->
+ describedAs("Favorited state icon in file details in details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
public static function fileDetailsInDetailsViewWithText($fileDetailsText) {
return Locator::forThe()->xpath("//span[normalize-space() = '$fileDetailsText']")->
descendantOf(self::fileDetailsInDetailsView())->
@@ -373,6 +400,24 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @When I mark the file as favorite in the details view
+ */
+ public function iMarkTheFileAsFavoriteInTheDetailsView() {
+ $this->iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView();
+
+ $this->actor->find(self::favoriteActionInFileDetailsInDetailsView(), 10)->click();
+ }
+
+ /**
+ * @When I unmark the file as favorite in the details view
+ */
+ public function iUnmarkTheFileAsFavoriteInTheDetailsView() {
+ $this->iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView();
+
+ $this->actor->find(self::favoriteActionInFileDetailsInDetailsView(), 10)->click();
+ }
+
+ /**
* @When I check the tag :tag in the dropdown for tags in the details view
*/
public function iCheckTheTagInTheDropdownForTagsInTheDetailsView($tag) {
@@ -501,6 +546,22 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that the file is marked as favorite in the details view
+ */
+ public function iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView() {
+ PHPUnit_Framework_Assert::assertNotNull(
+ $this->actor->find(self::favoritedStateIconInFileDetailsInDetailsView(), 10));
+ }
+
+ /**
+ * @Then I see that the file is not marked as favorite in the details view
+ */
+ public function iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView() {
+ PHPUnit_Framework_Assert::assertNotNull(
+ $this->actor->find(self::notFavoritedStateIconInFileDetailsInDetailsView(), 10));
+ }
+
+ /**
* @Then I see that the input field for tags in the details view is shown
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() {
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 0e50f4d92ec..9a8e588a229 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -14,8 +14,6 @@ use OCP\IURLGenerator;
/**
* Class UrlGeneratorTest
- *
- * @group DB
*/
class UrlGeneratorTest extends \Test\TestCase {
@@ -74,7 +72,7 @@ class UrlGeneratorTest extends \Test\TestCase {
* @dataProvider provideSubDirAppUrlParts
*/
public function testLinkToSubDir($app, $file, $args, $expectedResult) {
- \OC::$WEBROOT = '/owncloud';
+ \OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->linkTo($app, $file, $args);
$this->assertEquals($expectedResult, $result);
}
@@ -84,32 +82,32 @@ class UrlGeneratorTest extends \Test\TestCase {
*/
public function testLinkToRouteAbsolute($route, $expected) {
$this->mockBaseUrl();
- \OC::$WEBROOT = '/owncloud';
+ \OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->linkToRouteAbsolute($route);
$this->assertEquals($expected, $result);
}
public function provideRoutes() {
- return array(
- array('files_ajax_list', 'http://localhost/owncloud/index.php/apps/files/ajax/list.php'),
- array('core.Preview.getPreview', 'http://localhost/owncloud/index.php/core/preview.png'),
- );
+ return [
+ ['files_ajax_list', 'http://localhost/nextcloud/index.php/apps/files/ajax/list.php'],
+ ['core.Preview.getPreview', 'http://localhost/nextcloud/index.php/core/preview.png'],
+ ];
}
public function provideDocRootAppUrlParts() {
- return array(
- array('files', 'ajax/list.php', array(), '/index.php/apps/files/ajax/list.php'),
- array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), '/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'),
- array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), '/index.php?trut=trat&dut=dat'),
- );
+ return [
+ ['files', 'ajax/list.php', [], '/index.php/apps/files/ajax/list.php'],
+ ['files', 'ajax/list.php', ['trut' => 'trat', 'dut' => 'dat'], '/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'],
+ ['', 'index.php', ['trut' => 'trat', 'dut' => 'dat'], '/index.php?trut=trat&dut=dat'],
+ ];
}
public function provideSubDirAppUrlParts() {
- return array(
- array('files', 'ajax/list.php', array(), '/owncloud/index.php/apps/files/ajax/list.php'),
- array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), '/owncloud/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'),
- array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), '/owncloud/index.php?trut=trat&dut=dat'),
- );
+ return [
+ ['files', 'ajax/list.php', [], '/nextcloud/index.php/apps/files/ajax/list.php'],
+ ['files', 'ajax/list.php', ['trut' => 'trat', 'dut' => 'dat'], '/nextcloud/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'],
+ ['', 'index.php', ['trut' => 'trat', 'dut' => 'dat'], '/nextcloud/index.php?trut=trat&dut=dat'],
+ ];
}
/**
@@ -131,34 +129,36 @@ class UrlGeneratorTest extends \Test\TestCase {
*/
function testGetAbsoluteURLSubDir($url, $expectedResult) {
$this->mockBaseUrl();
- \OC::$WEBROOT = '/owncloud';
+ \OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->getAbsoluteURL($url);
$this->assertEquals($expectedResult, $result);
}
public function provideDocRootURLs() {
- return array(
- array("index.php", "http://localhost/index.php"),
- array("/index.php", "http://localhost/index.php"),
- array("/apps/index.php", "http://localhost/apps/index.php"),
- array("apps/index.php", "http://localhost/apps/index.php"),
- );
+ return [
+ ['index.php', 'http://localhost/index.php'],
+ ['/index.php', 'http://localhost/index.php'],
+ ['/apps/index.php', 'http://localhost/apps/index.php'],
+ ['apps/index.php', 'http://localhost/apps/index.php'],
+ ];
}
public function provideSubDirURLs() {
- return array(
- array("index.php", "http://localhost/owncloud/index.php"),
- array("/index.php", "http://localhost/owncloud/index.php"),
- array("/apps/index.php", "http://localhost/owncloud/apps/index.php"),
- array("apps/index.php", "http://localhost/owncloud/apps/index.php"),
- );
+ return [
+ ['', 'http://localhost/nextcloud/'],
+ ['/', 'http://localhost/nextcloud/'],
+ ['index.php', 'http://localhost/nextcloud/index.php'],
+ ['/index.php', 'http://localhost/nextcloud/index.php'],
+ ['/apps/index.php', 'http://localhost/nextcloud/apps/index.php'],
+ ['apps/index.php', 'http://localhost/nextcloud/apps/index.php'],
+ ];
}
public function testGetBaseUrl() {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
$actual = $this->urlGenerator->getBaseUrl();
- $expected = "http://localhost/nextcloud";
+ $expected = 'http://localhost/nextcloud';
$this->assertEquals($expected, $actual);
}