From 31e31a6f007957e4769ad2eaa7c9e3ea03ee1503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 19 Nov 2018 17:08:00 +0100 Subject: [PATCH] Adjust acceptance tests to the virtual list for the message list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the virtual list removes its child elements that are no longer visible the index of the messages in the acceptance test is no longer an absolute index for the whole list, but an index only for the currently visible messages. However, as all the messages sent in each test fit in the available space no message is hidden and the previous indexes are still valid. The only change needed is in the locator for chat messages; as they are declared as direct children of their parent now they must be set as descendants of the wrapper instead of as descendants of the message list itself. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/features/bootstrap/ChatContext.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/bootstrap/ChatContext.php b/tests/acceptance/features/bootstrap/ChatContext.php index cd599c4f786..c269cba18d6 100644 --- a/tests/acceptance/features/bootstrap/ChatContext.php +++ b/tests/acceptance/features/bootstrap/ChatContext.php @@ -96,12 +96,21 @@ public static function chatMessagesList($chatAncestor) { describedAs("List of received chat messages"); } + /** + * @return Locator + */ + public static function chatMessagesWrapper($chatAncestor) { + return Locator::forThe()->css(".wrapper")-> + descendantOf(self::chatMessagesList($chatAncestor))-> + describedAs("Wrapper for visible messages in the list of received chat messages"); + } + /** * @return Locator */ public static function chatMessage($chatAncestor, $number) { return Locator::forThe()->xpath("li[not(contains(concat(' ', normalize-space(@class), ' '), ' systemMessage '))][$number]")-> - descendantOf(self::chatMessagesList($chatAncestor))-> + descendantOf(self::chatMessagesWrapper($chatAncestor))-> describedAs("Chat message $number in the list of received messages"); } @@ -110,7 +119,7 @@ public static function chatMessage($chatAncestor, $number) { */ public static function groupedChatMessage($chatAncestor, $number) { return Locator::forThe()->xpath("li[not(contains(concat(' ', normalize-space(@class), ' '), ' systemMessage '))][position() = $number and contains(concat(' ', normalize-space(@class), ' '), ' grouped ')]")-> - descendantOf(self::chatMessagesList($chatAncestor))-> + descendantOf(self::chatMessagesWrapper($chatAncestor))-> describedAs("Grouped chat message $number in the list of received messages"); }