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:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-08-16 15:58:23 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-09-26 11:54:27 +0300
commit255ac5dc86e9ae2b3b5ec3b610309aab27a40110 (patch)
tree882128bea6fc17f397a29a1f83bcfc1edd3b9ddc /tests
parent1ba0f4fd45f9240d77de77c6ec0deadf35ee31af (diff)
Add basic acceptance tests for the Talk sidebar in the public share page
The "I see that the current page is the shared link I wrote down" step is defined in the server but needs to be extended in Talk to also set (in the tests) the Talk sidebar as the ancestor of the chat view. In order to extend a step the whole Context that it belongs to must be extended. Note, however, that the step in the child Context should not include any "Given", "When" or "Then" annotation, as it would clash with the step defined in the parent Context (the "Override" annotation is simply informative, as it is ignored by Behat); as long as the method has the same signature the step from the child Context will be used instead if the step from the parent Context. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/config/behat.yml2
-rw-r--r--tests/acceptance/features/bootstrap/TalkPublicShareContext.php77
-rw-r--r--tests/acceptance/features/public-share.feature30
3 files changed, 108 insertions, 1 deletions
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
index 7f663333d..fa792b327 100644
--- a/tests/acceptance/config/behat.yml
+++ b/tests/acceptance/config/behat.yml
@@ -18,7 +18,6 @@ default:
- FilesAppSharingContext
- LoginPageContext
- NotificationContext
- - PublicShareContext
# Talk app contexts
- ChatContext
@@ -30,6 +29,7 @@ default:
- PublicConversationContext
- PublicSharePasswordRequestContext
- TalkAppContext
+ - TalkPublicShareContext
extensions:
Behat\MinkExtension:
diff --git a/tests/acceptance/features/bootstrap/TalkPublicShareContext.php b/tests/acceptance/features/bootstrap/TalkPublicShareContext.php
new file mode 100644
index 000000000..a25f33786
--- /dev/null
+++ b/tests/acceptance/features/bootstrap/TalkPublicShareContext.php
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ *
+ * @copyright Copyright (c) 2019, Daniel Calviño Sánchez (danxuliu@gmail.com)
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+class TalkPublicShareContext extends PublicShareContext {
+
+ use ChatAncestorSetter;
+
+ /**
+ * @return Locator
+ */
+ public static function talkSidebar() {
+ return Locator::forThe()->css("#talk-sidebar")->
+ describedAs("Talk sidebar in the public share page");
+ }
+
+ /**
+ * @override I see that the current page is the shared link I wrote down
+ */
+ public function iSeeThatTheCurrentPageIsTheSharedLinkIWroteDown() {
+ parent::iSeeThatTheCurrentPageIsTheSharedLinkIWroteDown();
+
+ $this->setChatAncestorForActor(self::talkSidebar(), $this->actor);
+ }
+
+ /**
+ * @Then I see that the Talk sidebar is shown in the public share page
+ */
+ public function iSeeThatTheTalkSidebarIsShownInThePublicSharePage() {
+ if (!WaitFor::elementToBeEventuallyShown(
+ $this->actor,
+ self::talkSidebar(),
+ $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
+ PHPUnit_Framework_Assert::fail("The Talk sidebar is not shown yet after $timeout seconds");
+ }
+ }
+
+ /**
+ * @Then I see that the Talk sidebar is not shown in the public share page
+ */
+ public function iSeeThatTheTalkSidebarIsNotShownInThePublicSharePage() {
+ try {
+ // Wait a little before deciding that the sidebar is not shown, as
+ // the sidebar would be loaded after the page has loaded.
+ $this->actor->find(self::talkSidebar(), 5);
+
+ // Once the sidebar has loaded it is not immediately shown; it will
+ // be shown once it has joined the room, so wait a little more to
+ // "ensure" that it is not shown.
+ sleep(2 * $this->actor->getFindTimeoutMultiplier());
+
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::talkSidebar())->isVisible());
+ } catch (NoSuchElementException $exception) {
+ }
+ }
+
+}
diff --git a/tests/acceptance/features/public-share.feature b/tests/acceptance/features/public-share.feature
new file mode 100644
index 000000000..616def1c9
--- /dev/null
+++ b/tests/acceptance/features/public-share.feature
@@ -0,0 +1,30 @@
+Feature: public share
+
+ Scenario: open the public shared link of a file
+ Given I act as John
+ And I am logged in
+ And I share the link for "welcome.txt"
+ And I write down the shared link
+ When I act as Jane
+ And I visit the shared link I wrote down
+ And I see that the current page is the shared link I wrote down
+ Then I see that the Talk sidebar is shown in the public share page
+
+ Scenario: open the public shared link of a folder
+ Given I act as John
+ And I am logged in
+ And I create a new folder named "Shared folder"
+ # To share the link the "Share" inline action has to be clicked but, as the
+ # details view is opened automatically when the folder is created, clicking
+ # on the inline action could fail if it is covered by the details view due
+ # to its opening animation. Instead of ensuring that the animations of the
+ # contents and the details view have both finished it is easier to close the
+ # details view and wait until it is closed before continuing.
+ And I close the details view
+ And I see that the details view is closed
+ And I share the link for "Shared folder"
+ And I write down the shared link
+ When I act as Jane
+ And I visit the shared link I wrote down
+ And I see that the current page is the shared link I wrote down
+ Then I see that the Talk sidebar is not shown in the public share page