From d5725cb3d99072a628eb4a8011d344ccf14db16b Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Sat, 24 Nov 2018 18:06:20 +0100 Subject: Wait for the empty content element to be shown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the "Comments" tab is open the empty content element is always in the DOM, although it is only shown once the message collection was fetched and there were no messages. Due to this it is necessary to explicitly wait for it to be shown instead of relying on the implicit wait made to find the element; otherwise it would be found immediately and if the collection was not fetched yet it would not be visible, causing the test to fail. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/features/bootstrap/CommentsAppContext.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/acceptance') diff --git a/tests/acceptance/features/bootstrap/CommentsAppContext.php b/tests/acceptance/features/bootstrap/CommentsAppContext.php index 5d19412c30e..57e60afa60e 100644 --- a/tests/acceptance/features/bootstrap/CommentsAppContext.php +++ b/tests/acceptance/features/bootstrap/CommentsAppContext.php @@ -83,8 +83,12 @@ 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()); + if (!WaitFor::elementToBeEventuallyShown( + $this->actor, + self::emptyContent(), + $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { + PHPUnit_Framework_Assert::fail("The no comments message is not visible yet after $timeout seconds"); + } } /** -- cgit v1.2.3 From 65263817d0208bdf5f7d9a2c1ef43512ccfbdd4b Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Sat, 24 Nov 2018 18:16:09 +0100 Subject: Wait for the comment to be added before changing to another file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the server is too slow, changing to a different file immediately after sending a new comment but without waiting for the comment to be shown for the original file could cause the new comment to be shown for the current file instead. This is, indeed, a bug in the comments. However, it is not possible to test it reliably in the acceptance tests, as it depends on how fast the server adds the message and how fast the client changes to a different file; sometimes the test would fail and sometimes it would not. Therefore, now it is waited for the comment to be added before changing to another file, as in this case it can be reliably tested that changing to a different file does not cause the comments from the previous file to be shown in the current file (this was a different bug already fixed and due to which this test was added in the first place). Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/features/app-comments.feature | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/acceptance') diff --git a/tests/acceptance/features/app-comments.feature b/tests/acceptance/features/app-comments.feature index 1ee113d0aac..42893e5ea35 100644 --- a/tests/acceptance/features/app-comments.feature +++ b/tests/acceptance/features/app-comments.feature @@ -24,6 +24,7 @@ Feature: app-comments 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 see a 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 -- cgit v1.2.3