diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-08-16 21:04:17 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-09-26 11:54:28 +0300 |
commit | aaa8b84c318843eb0263e96d4dba5fa8af9df045 (patch) | |
tree | a11f814b150a1df4ad63427a27a7f1218927dc64 /tests | |
parent | 83b5469f55b9d804c1f7c9734ffea2033e91a361 (diff) |
Add acceptance tests for registered users in the public share page
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/features/bootstrap/ChatContext.php | 29 | ||||
-rw-r--r-- | tests/acceptance/features/public-share.feature | 58 |
2 files changed, 85 insertions, 2 deletions
diff --git a/tests/acceptance/features/bootstrap/ChatContext.php b/tests/acceptance/features/bootstrap/ChatContext.php index 19f0cbf22..0f377c95b 100644 --- a/tests/acceptance/features/bootstrap/ChatContext.php +++ b/tests/acceptance/features/bootstrap/ChatContext.php @@ -204,9 +204,27 @@ class ChatContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function newChatMessageRow($chatAncestor) { + return Locator::forThe()->css(".newCommentRow")-> + descendantOf(self::chatView($chatAncestor))-> + describedAs("New chat message row"); + } + + /** + * @return Locator + */ + public static function userNameLabel($chatAncestor) { + return Locator::forThe()->css(".author")-> + descendantOf(self::newChatMessageRow($chatAncestor))-> + describedAs("User name label"); + } + + /** + * @return Locator + */ public static function guestNameEditableTextLabel($chatAncestor) { return Locator::forThe()->css(".guest-name.editable-text-label")-> - descendantOf(self::chatView($chatAncestor))-> + descendantOf(self::newChatMessageRow($chatAncestor))-> describedAs("Guest name editable text label"); } @@ -233,7 +251,7 @@ class ChatContext implements Context, ActorAwareInterface { */ public static function newChatMessageForm($chatAncestor) { return Locator::forThe()->css(".newCommentForm")-> - descendantOf(self::chatView($chatAncestor))-> + descendantOf(self::newChatMessageRow($chatAncestor))-> describedAs("New chat message form"); } @@ -365,6 +383,13 @@ class ChatContext implements Context, ActorAwareInterface { } /** + * @Then I see that the current participant is the user :user + */ + public function iSeeThatTheCurrentParticipantIsTheUser($user) { + PHPUnit_Framework_Assert::assertEquals($user, $this->actor->find(self::userNameLabel($this->chatAncestor), 10)->getText()); + } + + /** * @Then I see that the message :number was sent by :author with the text :message */ public function iSeeThatTheMessageWasSentByWithTheText($number, $author, $message) { diff --git a/tests/acceptance/features/public-share.feature b/tests/acceptance/features/public-share.feature index 616def1c9..735c40935 100644 --- a/tests/acceptance/features/public-share.feature +++ b/tests/acceptance/features/public-share.feature @@ -28,3 +28,61 @@ Feature: public share 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 + + + + Scenario: open Talk after opening the public shared link of a file as a user with direct access to the file + Given I act as John + And I am logged in as the admin + And I share "welcome.txt" with "user0" + And I see that the file is shared with "user0" + And I share the link for "welcome.txt" + And I write down the shared link + And I act as Jane + And I am logged in + And I have opened the Talk app + # Wait until the "Talk updates" conversation is shown to ensure that the + # list is loaded before checking that there is no "welcome.txt" conversation + And I see that the "Talk updates ✅" conversation is shown in the list + And I see that the "welcome.txt" conversation is not shown in the list + And I visit the shared link I wrote down + And I see that the current page is the shared link I wrote down + And I see that the Talk sidebar is shown in the public share page + And I see that the current participant is the user "user0" + # Visit the Home page so the header shows again the list of apps + When I visit the Home page + And I have opened the Talk app + Then I see that the "welcome.txt" conversation is shown in the list + + Scenario: open Talk after opening the public shared link of a file as a user without direct access to the 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 + And I act as Jane + And I am logged in as the admin + And I have opened the Talk app + # Wait until the "Talk updates" conversation is shown to ensure that the + # list is loaded before checking that there is no "welcome.txt" conversation + And I see that the "Talk updates ✅" conversation is shown in the list + And I see that the "welcome.txt" conversation is not shown in the list + And I visit the shared link I wrote down + And I see that the current page is the shared link I wrote down + And I see that the Talk sidebar is shown in the public share page + And I see that the current participant is the user "admin" + # Log in with the same user from a different window to check Talk while the + # original window is in the public share page + And I act as Jim + And I am logged in as the admin + And I have opened the Talk app + And I see that the "welcome.txt" conversation is shown in the list + # Leave the public share page from the original window by going to Talk and + # checking that the conversation is no longer shown + When I act as Jane + # Visit the Home page so the header shows again the list of apps + And I visit the Home page + And I have opened the Talk app + # Wait until the "Talk updates" conversation is shown to ensure that the + # list is loaded before checking that there is no "welcome.txt" conversation + And I see that the "Talk updates ✅" conversation is shown in the list + Then I see that the "welcome.txt" conversation is not shown in the list |