From 4901b803b5148a717c894ddfbe58229af2923be7 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Sat, 11 Apr 2020 01:18:25 +0800 Subject: [PATCH 1/2] Make message history pagination test less flaky --- tests/30rooms/04messages.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/30rooms/04messages.pl b/tests/30rooms/04messages.pl index 9a267a515..f6c532e5f 100644 --- a/tests/30rooms/04messages.pl +++ b/tests/30rooms/04messages.pl @@ -215,6 +215,15 @@ body => "Message number $_[0]" ) } foreach => [ 1 .. 20 ] )->then( sub { + await_sync( $user, check => sub { + sync_timeline_contains( $_[0], $room_id, sub { + any { + $_->{type} eq "m.room.message" + && $_->{content}{body} eq "Message number 20" + } @_; + }); + }); + })->then( sub { matrix_get_room_messages( $user, $room_id, limit => 5 ) })->then( sub { my ( $body ) = @_; From 44e3fc31565b5fa3e2ddc7033515719f2e7f1b6d Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Wed, 15 Apr 2020 02:24:57 +0800 Subject: [PATCH 2/2] Use await_sync_timeline_contains --- tests/30rooms/04messages.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/30rooms/04messages.pl b/tests/30rooms/04messages.pl index f6c532e5f..2eac89727 100644 --- a/tests/30rooms/04messages.pl +++ b/tests/30rooms/04messages.pl @@ -215,14 +215,14 @@ body => "Message number $_[0]" ) } foreach => [ 1 .. 20 ] )->then( sub { - await_sync( $user, check => sub { - sync_timeline_contains( $_[0], $room_id, sub { + await_sync_timeline_contains( + $user, $room_id, check => sub { any { $_->{type} eq "m.room.message" && $_->{content}{body} eq "Message number 20" } @_; - }); - }); + }, + ); })->then( sub { matrix_get_room_messages( $user, $room_id, limit => 5 ) })->then( sub {