Skip to content

Commit

Permalink
Adjust acceptance tests to the virtual list for the message list
Browse files Browse the repository at this point in the history
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 <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Nov 20, 2018
1 parent 9fc7e91 commit 31e31a6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/acceptance/features/bootstrap/ChatContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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");
}

Expand Down

0 comments on commit 31e31a6

Please sign in to comment.