From 4784b7ed3337962e7938d368d2748953d627d5bf Mon Sep 17 00:00:00 2001 From: Till <2353100+S7evinK@users.noreply.github.com> Date: Fri, 17 Jun 2022 10:21:07 +0200 Subject: [PATCH] Replace most non-synced actions (#1249) As explained in #1247, this PR changes most non-synced versions with the synced version. matrix_create_room_synced now also returns the room alias. --- tests/10apidoc/30room-create.pl | 10 ++-- tests/10apidoc/31room-state.pl | 2 +- tests/10apidoc/32room-alias.pl | 4 +- tests/10apidoc/33room-members.pl | 8 +-- tests/10apidoc/34room-messages.pl | 4 +- tests/30rooms/01state.pl | 2 +- tests/30rooms/02members-local.pl | 4 +- tests/30rooms/03members-remote.pl | 4 +- tests/30rooms/04messages.pl | 8 +-- tests/30rooms/05aliases.pl | 6 +- tests/30rooms/06invite.pl | 30 +++++----- tests/30rooms/08levels.pl | 2 +- tests/30rooms/09eventstream.pl | 4 +- tests/30rooms/10redactions.pl | 2 +- tests/30rooms/11leaving.pl | 8 +-- tests/30rooms/12thirdpartyinvite.pl | 22 +++---- tests/30rooms/13guestaccess.pl | 24 ++++---- tests/30rooms/21receipts.pl | 2 +- tests/30rooms/30history-visibility.pl | 34 +++++------ tests/30rooms/31forget.pl | 30 +++++----- tests/30rooms/32erasure.pl | 2 +- tests/30rooms/40joinedapis.pl | 18 +++--- tests/30rooms/50context.pl | 20 +++---- tests/30rooms/51event.pl | 10 ++-- tests/30rooms/52members.pl | 8 +-- tests/30rooms/60version_upgrade.pl | 8 +-- tests/30rooms/70publicroomslist.pl | 8 +-- tests/31sync/03joined.pl | 10 ++-- tests/31sync/04timeline.pl | 20 +++---- tests/31sync/05presence.pl | 4 +- tests/31sync/06state.pl | 58 +++++++++---------- tests/31sync/07invited.pl | 6 +- tests/31sync/09archived.pl | 22 +++---- tests/31sync/10archived-ban.pl | 12 ++-- tests/31sync/11typing.pl | 6 +- tests/31sync/12receipts.pl | 8 +-- tests/31sync/14read-markers.pl | 14 ++--- tests/31sync/15lazy-members.pl | 36 ++++++------ tests/32room-versions.pl | 8 +-- tests/41end-to-end-keys/06-device-lists.pl | 28 ++++----- tests/41end-to-end-keys/08-cross-signing.pl | 20 +++---- tests/42tags.pl | 12 ++-- tests/43search.pl | 14 ++--- tests/48admin.pl | 20 +++---- tests/49ignore.pl | 2 +- tests/50federation/00prepare.pl | 2 +- tests/50federation/30room-join.pl | 18 +++--- tests/50federation/31room-send.pl | 2 +- tests/50federation/32room-getevent.pl | 4 +- .../50federation/33room-get-missing-events.pl | 2 +- tests/50federation/34room-backfill.pl | 4 +- tests/50federation/35room-invite.pl | 8 +-- tests/50federation/36state.pl | 4 +- tests/50federation/38receipts.pl | 2 +- tests/50federation/39redactions.pl | 2 +- tests/50federation/40devicelists.pl | 45 +++----------- tests/50federation/40publicroomlist.pl | 2 +- tests/50federation/41power-levels.pl | 2 +- tests/50federation/44presence.pl | 6 +- tests/50federation/52soft-fail.pl | 4 +- tests/52user-directory/01public.pl | 34 +++++------ tests/52user-directory/02private.pl | 20 +++---- tests/60app-services/02ghost.pl | 4 +- tests/60app-services/03passive.pl | 2 +- tests/60app-services/06publicroomlist.pl | 4 +- tests/61push/01message-pushed.pl | 26 ++++----- tests/61push/03_unread_count.pl | 12 ++-- tests/61push/08_rejected_pushers.pl | 12 ++-- tests/61push/09_notifications_api.pl | 4 +- tests/90jira/SYN-343.pl | 2 +- tests/90jira/SYN-516.pl | 4 +- tests/90jira/SYN-606.pl | 4 +- 72 files changed, 397 insertions(+), 422 deletions(-) diff --git a/tests/10apidoc/30room-create.pl b/tests/10apidoc/30room-create.pl index 6a2b85f36..5abc49bd2 100644 --- a/tests/10apidoc/30room-create.pl +++ b/tests/10apidoc/30room-create.pl @@ -419,14 +419,16 @@ sub remote_room_alias_fixture =head2 matrix_create_room_synced matrix_create_room_synced( $creator, %params )->then( sub { - my ( $room_id ) = @_; + my ( $room_id, $room_alias ) = @_; }); Creates a new room, and waits for it to appear in the /sync response. The parameters are passed through to C. -The resultant future completes with the room_id. +The resultant future completes with the room_id and a room_alias. If +C is present in C<%params>, an alias will be built with the given +alias and user's server name. Otherwise, it will return C. =cut @@ -440,7 +442,7 @@ sub matrix_create_room_synced # The easiest way to do that is to send a sentinel message in the room and wait for # that to turn up. matrix_create_room( $user, %params )->then( sub { - my ( $room_id ) = @_; + my ( $room_id, $room_alias ) = @_; matrix_do_and_wait_for_sync( $user, do => sub { @@ -461,6 +463,6 @@ sub matrix_create_room_synced $_[0]->{event_id} eq $event_id }); }, - )->then_done( $room_id ); + )->then_done( $room_id, $room_alias ); }); } diff --git a/tests/10apidoc/31room-state.pl b/tests/10apidoc/31room-state.pl index 09c687684..da52eedfd 100644 --- a/tests/10apidoc/31room-state.pl +++ b/tests/10apidoc/31room-state.pl @@ -14,7 +14,7 @@ setup => sub { my ( $user, $room_alias_name ) = @_; - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, visibility => "public", ); diff --git a/tests/10apidoc/32room-alias.pl b/tests/10apidoc/32room-alias.pl index 6e51537e0..fa17af37e 100644 --- a/tests/10apidoc/32room-alias.pl +++ b/tests/10apidoc/32room-alias.pl @@ -6,7 +6,7 @@ setup => sub { my ( $user ) = @_; - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { my ( $room_id, undef ) = @_; Future->done( $room_id ); # Don't return the alias }); @@ -56,7 +56,7 @@ my ( $user, $room_alias ) = @_; my ( $room_id ); - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { ( $room_id ) = @_; # the list should be empty initially diff --git a/tests/10apidoc/33room-members.pl b/tests/10apidoc/33room-members.pl index a12020599..721d4eb76 100644 --- a/tests/10apidoc/33room-members.pl +++ b/tests/10apidoc/33room-members.pl @@ -11,7 +11,7 @@ setup => sub { my ( $user, $room_alias_name ) = @_; - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, ); }, @@ -242,7 +242,7 @@ sub matrix_join_room do => sub { my ( $joiner_to_leave, $room_id, undef ) = @_; - matrix_join_room( $joiner_to_leave, $room_id ) + matrix_join_room_synced( $joiner_to_leave, $room_id ) ->then( sub { do_request_json_for( $joiner_to_leave, method => "POST", @@ -401,7 +401,7 @@ sub _invite_users Future->needs_all( ( map { my $user = $_; - matrix_invite_user_to_room( $creator, $user, $room_id ); + matrix_invite_user_to_room_synced( $creator, $user, $room_id ); } @other_members) ); } @@ -465,7 +465,7 @@ sub matrix_create_and_join_room my $with_invite = delete $options{with_invite}; my $with_alias = delete $options{with_alias}; - matrix_create_room( $creator, + matrix_create_room_synced( $creator, %options, room_alias_name => $room_alias_name, )->then( sub { diff --git a/tests/10apidoc/34room-messages.pl b/tests/10apidoc/34room-messages.pl index 4a9554add..9bcf97164 100644 --- a/tests/10apidoc/34room-messages.pl +++ b/tests/10apidoc/34room-messages.pl @@ -137,7 +137,7 @@ sub matrix_send_room_text_message check => sub { my ( $user, $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Here is the message content", )->then( sub { matrix_sync( $user ) @@ -175,7 +175,7 @@ sub matrix_send_room_text_message check => sub { my ( $user, $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Here is the message content", )->then( sub { matrix_sync( $user ) diff --git a/tests/30rooms/01state.pl b/tests/30rooms/01state.pl index e6dc92d06..01bfc274a 100644 --- a/tests/30rooms/01state.pl +++ b/tests/30rooms/01state.pl @@ -10,7 +10,7 @@ setup => sub { my ( $user ) = @_; - matrix_create_room( $user, + matrix_create_room_synced( $user, visibility => "public", ); }, diff --git a/tests/30rooms/02members-local.pl b/tests/30rooms/02members-local.pl index 4096efd09..a604515a0 100644 --- a/tests/30rooms/02members-local.pl +++ b/tests/30rooms/02members-local.pl @@ -21,11 +21,11 @@ Future->needs_all( map { flush_events_for( $_ ) } $creator, $local_user )->then( sub { - matrix_create_room( $creator ) + matrix_create_room_synced( $creator ) })->then( sub { my ( $room_id ) = @_; - matrix_join_room( $local_user, $room_id ) + matrix_join_room_synced( $local_user, $room_id ) ->then_done( $room_id ); }); }, diff --git a/tests/30rooms/03members-remote.pl b/tests/30rooms/03members-remote.pl index 25fec6efb..05c672f30 100644 --- a/tests/30rooms/03members-remote.pl +++ b/tests/30rooms/03members-remote.pl @@ -20,7 +20,7 @@ setup => sub { my ( $user, $room_alias_name ) = @_; - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, ); }, @@ -255,7 +255,7 @@ check => sub { my ( $creator, $remote_user, $room_alias_name ) = @_; - matrix_create_room( $creator, + matrix_create_room_synced( $creator, room_alias_name => $room_alias_name, creation_content => { "m.federate" => JSON::false, diff --git a/tests/30rooms/04messages.pl b/tests/30rooms/04messages.pl index c8e101f7d..98026e984 100644 --- a/tests/30rooms/04messages.pl +++ b/tests/30rooms/04messages.pl @@ -211,7 +211,7 @@ my ( $user, $room_id ) = @_; ( repeat { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message number $_[0]" ) } foreach => [ 1 .. 20 ] )->then( sub { @@ -276,13 +276,13 @@ my ( $creator, $room_id, $room_alias, $remote_user ) = @_; ( repeat { - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "Message number $_[0]" ) } foreach => [ 1 .. 20 ] )->then( sub { matrix_sync( $remote_user ) })->then( sub { - matrix_join_room( $remote_user, $room_alias ); + matrix_join_room_synced( $remote_user, $room_alias ); })->then( sub { # We wait until we see our join to the room. await_sync_timeline_contains( $remote_user, $room_id, check => sub { @@ -338,7 +338,7 @@ assert_eq( $chunk->[4]{content}{body}, "Message number 11", 'chunk[4] content body' ); - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "Marker message" ) })->then( sub { diff --git a/tests/30rooms/05aliases.pl b/tests/30rooms/05aliases.pl index 371d15458..f4b6486ee 100644 --- a/tests/30rooms/05aliases.pl +++ b/tests/30rooms/05aliases.pl @@ -78,7 +78,7 @@ my ( $room_id, $room_alias ); - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, )->then( sub { ( $room_id, $room_alias ) = @_; @@ -122,7 +122,7 @@ my ( $room_id, $room_alias ); - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, )->then( sub { ( $room_id, $room_alias ) = @_; @@ -162,7 +162,7 @@ # Create a second room with an alias on it. my $other_alias_name = $room_alias_name . "2"; - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $other_alias_name, )->then( sub { my ( $other_room_id, $other_room_alias ) = @_; diff --git a/tests/30rooms/06invite.pl b/tests/30rooms/06invite.pl index 605352f4f..6052852c2 100644 --- a/tests/30rooms/06invite.pl +++ b/tests/30rooms/06invite.pl @@ -10,7 +10,7 @@ sub inviteonly_room_fixture setup => sub { my ( $creator ) = @_; - matrix_create_room( $creator, + matrix_create_room_synced( $creator, preset => "private_chat", )->then( sub { my ( $room_id ) = @_; @@ -46,7 +46,7 @@ sub inviteonly_room_fixture do => sub { my ( $creator, $invitee, $room_id ) = @_; - matrix_invite_user_to_room( $creator, $invitee, $room_id ) + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ) ->SyTest::pass_on_done( "Sent invite" ) ->then( sub { await_sync( $invitee, check => sub { @@ -57,7 +57,7 @@ sub inviteonly_room_fixture return 1; }) })->then( sub { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) ->SyTest::pass_on_done( "Joined room" ) })->then( sub { matrix_get_room_state( $invitee, $room_id, @@ -194,13 +194,13 @@ sub invited_user_can_reject_invite_for_empty_room { my ( $invitee, $creator, $room_id ) = @_; - matrix_invite_user_to_room( $creator, $invitee, $room_id ) + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ) ->then( sub { # wait for the leave to come down to make sure we're testing an empty room matrix_leave_room_synced( $creator, $room_id ) }) ->then( sub { - matrix_leave_room( $invitee, $room_id ) + matrix_leave_room_synced( $invitee, $room_id ) })->then( sub { matrix_sync( $invitee ) })->then( sub { @@ -227,12 +227,12 @@ sub invited_user_can_reject_invite_for_empty_room do => sub { my ( $invitee, $creator, $room_id ) = @_; - matrix_invite_user_to_room( $creator, $invitee, $room_id ) + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ) ->then( sub { # wait for the leave to come down to make sure we're testing an empty room matrix_leave_room_synced( $creator, $room_id ); })->then( sub { - matrix_leave_room( $invitee, $room_id ); + matrix_leave_room_synced( $invitee, $room_id ); })->then( sub { # there's nobody left who can look at the room state, but the # important thing is that a /sync for the invitee should not include @@ -270,7 +270,7 @@ sub invited_user_can_reject_invite_for_empty_room content => { url => "http://something" }, ), )->then( sub { - matrix_invite_user_to_room( $creator, $invitee, $room_id ); + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ); })->then( sub { await_sync( $invitee, check => sub { my ( $body ) = @_; @@ -406,7 +406,7 @@ sub invited_user_can_reject_invite_for_empty_room do => sub { my ( $creator, $room_id, $invitee ) = @_; - matrix_join_room( $invitee, $room_id )->then( sub { + matrix_join_room_synced( $invitee, $room_id )->then( sub { matrix_invite_user_to_room( $creator, $invitee, $room_id ) ->main::expect_http_403; }); @@ -421,7 +421,7 @@ sub invited_user_can_reject_invite_for_empty_room my $room_id; - matrix_create_room( $user_1 ) + matrix_create_room_synced( $user_1 ) ->SyTest::pass_on_done( "User A created a room" ) ->then( sub { ( $room_id ) = @_; @@ -432,7 +432,7 @@ sub invited_user_can_reject_invite_for_empty_room )->SyTest::pass_on_done( "User A set the join rules to 'invite'" ) })->then( sub { - matrix_invite_user_to_room( $user_1, $user_2, $room_id ) + matrix_invite_user_to_room_synced( $user_1, $user_2, $room_id ) ->SyTest::pass_on_done( "User A invited user B" ) })->then( sub { @@ -444,7 +444,7 @@ sub invited_user_can_reject_invite_for_empty_room })->SyTest::pass_on_done( "User B received the invite from A" ) })->then( sub { - matrix_join_room( $user_2, $room_id ) + matrix_join_room_synced( $user_2, $room_id ) ->SyTest::pass_on_done( "User B joined the room" ) })->then( sub { @@ -455,7 +455,7 @@ sub invited_user_can_reject_invite_for_empty_room })->SyTest::pass_on_done( "User A set user B's power level to 100" ) })->then( sub { - matrix_leave_room( $user_1, $room_id ) + matrix_leave_room_synced( $user_1, $room_id ) ->SyTest::pass_on_done( "User A left the room" ) })->then( sub { await_sync_timeline_contains( $user_2, $room_id, check => sub { @@ -465,7 +465,7 @@ sub invited_user_can_reject_invite_for_empty_room })->SyTest::pass_on_done( "User B received the leave event" ) })->then( sub { - matrix_invite_user_to_room( $user_2, $user_1, $room_id ) + matrix_invite_user_to_room_synced( $user_2, $user_1, $room_id ) ->SyTest::pass_on_done( "User B invited user A back to the room" ) })->then( sub { @@ -478,7 +478,7 @@ sub invited_user_can_reject_invite_for_empty_room })->then( sub { retry_until_success { - matrix_join_room( $user_1, $room_id ) + matrix_join_room_synced( $user_1, $room_id ) }->SyTest::pass_on_done( "User A joined the room" ) })->then_done(1); }; diff --git a/tests/30rooms/08levels.pl b/tests/30rooms/08levels.pl index f9875411a..7cb49a47a 100644 --- a/tests/30rooms/08levels.pl +++ b/tests/30rooms/08levels.pl @@ -91,7 +91,7 @@ sub test_powerlevel ## try => sub { ## my ( $test_user, $room_id ) = @_; ## -## matrix_invite_user_to_room( $test_user, '@random-invitee:$BIND_HOST:8001', $room_id ); +## matrix_invite_user_to_room_synced( $test_user, '@random-invitee:$BIND_HOST:8001', $room_id ); ## }; test_powerlevel "setting 'm.room.name' respects room powerlevel", diff --git a/tests/30rooms/09eventstream.pl b/tests/30rooms/09eventstream.pl index 74fbab5f1..bb3f2e091 100644 --- a/tests/30rooms/09eventstream.pl +++ b/tests/30rooms/09eventstream.pl @@ -13,7 +13,7 @@ my $room_id; # Have Alice create a new private room - matrix_create_room( $alice, + matrix_create_room_synced( $alice, visibility => "private", )->SyTest::pass_on_done( "Created a room" ) ->then( sub { @@ -52,7 +52,7 @@ my ( $user ) = @_; my ( $room_id, @expected_event_ids ); - matrix_create_room( $user, + matrix_create_room_synced( $user, visibility => "private", ) ->then( sub { diff --git a/tests/30rooms/10redactions.pl b/tests/30rooms/10redactions.pl index ef2758407..3b9338567 100644 --- a/tests/30rooms/10redactions.pl +++ b/tests/30rooms/10redactions.pl @@ -164,7 +164,7 @@ sub matrix_redact_event_synced do => sub { my ( $user1, $room1, $user2, $room2 ) = @_; - matrix_send_room_text_message( $user1, $room1, + matrix_send_room_text_message_synced( $user1, $room1, body => "test" )->then( sub { my ( $event_id ) = @_; diff --git a/tests/30rooms/11leaving.pl b/tests/30rooms/11leaving.pl index ae9d79a89..aae1ef4f6 100644 --- a/tests/30rooms/11leaving.pl +++ b/tests/30rooms/11leaving.pl @@ -34,17 +34,17 @@ content => { body => "S1. B's state before A left" }, ) })->then( sub { - matrix_send_room_text_message( $other_user, $room_id, + matrix_send_room_text_message_synced( $other_user, $room_id, body => "M1. B's message before A left", ) })->then( sub { - matrix_send_room_text_message( $other_user, $room_id, + matrix_send_room_text_message_synced( $other_user, $room_id, body => "M2. B's message before A left", ) })->then( sub { - matrix_leave_room( $leaving_user, $room_id ) + matrix_leave_room_synced( $leaving_user, $room_id ) })->then( sub { - matrix_send_room_text_message( $other_user, $room_id, + matrix_send_room_text_message_synced( $other_user, $room_id, body => "M3. B's message after A left", ) })->then( sub { diff --git a/tests/30rooms/12thirdpartyinvite.pl b/tests/30rooms/12thirdpartyinvite.pl index 61f041425..392276cfd 100644 --- a/tests/30rooms/12thirdpartyinvite.pl +++ b/tests/30rooms/12thirdpartyinvite.pl @@ -112,7 +112,7 @@ id_server => $id_server->name, id_access_token => $id_access_token, }; - matrix_create_room( $inviter, invite_3pid => [ $invite_info ] ); + matrix_create_room_synced( $inviter, invite_3pid => [ $invite_info ] ); })->then( sub { ( $room_id ) = @_; @@ -239,7 +239,7 @@ sub can_invite_unbound_3pid assert_eq( $body->{third_party_invite}{display_name}, 'Bob', 'invite display name' ); retry_until_success { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) } })->then( sub { retry_until_success { @@ -296,7 +296,7 @@ sub can_invite_unbound_3pid assert_eq( $body->{third_party_invite}{display_name}, 'Bob', 'invite display name' ); retry_until_success { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) } })->then( sub { await_event_for( $inviter, filter => sub { @@ -328,21 +328,21 @@ sub can_invite_unbound_3pid my $room_id; - matrix_create_room( $inviter, visibility => "private" ) + matrix_create_room_synced( $inviter, visibility => "private" ) ->then( sub { ( $room_id ) = @_; - matrix_invite_user_to_room( $inviter, $other_member, $room_id ); + matrix_invite_user_to_room_synced( $inviter, $other_member, $room_id ); })->then( sub { - matrix_join_room( $other_member, $room_id ); + matrix_join_room_synced( $other_member, $room_id ); })->then( sub { do_3pid_invite( $inviter, $room_id, $id_server, $invitee_email ) })->then( sub { - matrix_leave_room( $inviter, $room_id ); + matrix_leave_room_synced( $inviter, $room_id ); })->then( sub { $id_server->bind_identity( $hs_uribase, "email", $invitee_email, $invitee ); })->then( sub { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) })->then( sub { matrix_get_room_state( $other_member, $room_id, type => "m.room.member", @@ -361,7 +361,7 @@ sub can_invite_unbound_3pid my $room_id; - matrix_create_room( $inviter, visibility => "private" ) + matrix_create_room_synced( $inviter, visibility => "private" ) ->then( sub { ( $room_id ) = @_; @@ -384,7 +384,7 @@ sub can_invite_unbound_3pid $id_server->sign( \%req, ephemeral => 1 ); - matrix_join_room( $invitee, $room_id, + matrix_join_room_synced( $invitee, $room_id, third_party_signed => \%req ); })->then( sub { @@ -452,7 +452,7 @@ sub invite_should_fail { my $room_id; - matrix_create_room( $inviter, visibility => "private" ) + matrix_create_room_synced( $inviter, visibility => "private" ) ->then( sub { ( $room_id ) = @_; log_if_fail "Created room id $room_id"; diff --git a/tests/30rooms/13guestaccess.pl b/tests/30rooms/13guestaccess.pl index ec4e99659..cbaf9e3af 100644 --- a/tests/30rooms/13guestaccess.pl +++ b/tests/30rooms/13guestaccess.pl @@ -24,7 +24,7 @@ check => sub { my ( undef, $room_id, $guest_user ) = @_; - matrix_join_room( $guest_user, $room_id ); + matrix_join_room_synced( $guest_user, $room_id ); }; test "Guest users can send messages to guest_access rooms if joined", @@ -41,7 +41,7 @@ # (see https://github.com/matrix-org/sytest/issues/836) matrix_join_room_synced( $guest_user, $room_id ); })->then( sub { - matrix_send_room_text_message( $guest_user, $room_id, body => "sup" ); + matrix_send_room_text_message_synced( $guest_user, $room_id, body => "sup" ); })->then( sub { # We need to repeatedly call /messages as it may take some time before # the message propogates through the system. @@ -233,7 +233,7 @@ })->then( sub { matrix_set_room_guest_access( $local_user, $room_id, "can_join" ) })->then( sub { - matrix_join_room( $remote_user, $room_id ); + matrix_join_room_synced( $remote_user, $room_id ); })->then( sub { matrix_join_room_synced( $guest_user, $room_id ); })->then( sub { @@ -305,7 +305,7 @@ check => sub { my ( undef, $room_id, $guest_user ) = @_; - matrix_join_room( $guest_user, $room_id ); + matrix_join_room_synced( $guest_user, $room_id ); }; test "Guest user cannot upgrade other users", @@ -346,7 +346,7 @@ my $settings = $rooms{$_}; my $room_id; - my $f = matrix_create_room( $user, + my $f = matrix_create_room_synced( $user, visibility => "public", room_alias_name => $aliasname, )->on_done( sub { @@ -428,7 +428,7 @@ my ( $http, $user ) = @_; Future->needs_all( - matrix_create_room( $user, + matrix_create_room_synced( $user, visibility => "public", room_alias_name => "nonworldreadable", )->then( sub { @@ -443,7 +443,7 @@ ); }), - matrix_create_room( $user, + matrix_create_room_synced( $user, visibility => "public", room_alias_name => "worldreadable", )->then( sub { @@ -506,7 +506,7 @@ my ( $room_id ); - matrix_create_room( $remote_user )->then( sub { + matrix_create_room_synced( $remote_user )->then( sub { ( $room_id ) = @_; matrix_put_room_state( $remote_user, $room_id, @@ -519,9 +519,9 @@ })->then( sub { matrix_set_room_guest_access( $remote_user, $room_id, "can_join" ) })->then( sub { - matrix_invite_user_to_room( $remote_user, $local_guest, $room_id ) + matrix_invite_user_to_room_synced( $remote_user, $local_guest, $room_id ) })->then( sub { - matrix_join_room( $local_guest, $room_id ); + matrix_join_room_synced( $local_guest, $room_id ); })->then( sub { Future->done( 1 ); }); @@ -535,7 +535,7 @@ my ( $room_id ); - matrix_create_room( $remote_user )->then( sub { + matrix_create_room_synced( $remote_user )->then( sub { ( $room_id ) = @_; matrix_put_room_state( $remote_user, $room_id, @@ -548,7 +548,7 @@ })->then( sub { matrix_set_room_guest_access( $remote_user, $room_id, "forbidden" ) })->then( sub { - matrix_invite_user_to_room( $remote_user, $local_guest, $room_id ) + matrix_invite_user_to_room_synced( $remote_user, $local_guest, $room_id ) })->then( sub { matrix_join_room( $local_guest, $room_id ) ->main::expect_http_403 diff --git a/tests/30rooms/21receipts.pl b/tests/30rooms/21receipts.pl index a390a37fb..b86270f47 100644 --- a/tests/30rooms/21receipts.pl +++ b/tests/30rooms/21receipts.pl @@ -76,7 +76,7 @@ sub find_receipt pass "First m.read receipt is available"; # Now try advancing the receipt by posting a message - matrix_send_room_text_message( $user, $room_id, body => "a message" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "a message" ); })->then( sub { ( $message_event_id ) = @_; diff --git a/tests/30rooms/30history-visibility.pl b/tests/30rooms/30history-visibility.pl index 21d269809..b4f42bc4d 100644 --- a/tests/30rooms/30history-visibility.pl +++ b/tests/30rooms/30history-visibility.pl @@ -121,7 +121,7 @@ sub test_history_visibility matrix_set_room_history_visibility( $creator_user, $room_id, $visibility ) ->then( sub { - matrix_send_room_text_message( $creator_user, $room_id, body => "mice" ) + matrix_send_room_text_message_synced( $creator_user, $room_id, body => "mice" ) })->then( sub { matrix_get_events( $nonjoined_user, room_id => $room_id ); })->followed_by( \&expect_4xx_or_empty_chunk ); @@ -149,7 +149,7 @@ sub test_history_visibility matrix_initialsync_room( $nonjoined_user, $room_id ) })->then( sub { Future->needs_all( - matrix_send_room_text_message( $user, $room_id, body => "mice" ) + matrix_send_room_text_message_synced( $user, $room_id, body => "mice" ) ->on_done( sub { ( $sent_event_id ) = @_; }), @@ -300,7 +300,7 @@ sub test_history_visibility ->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $creating_user, $room_id, body => "private" ) + matrix_send_room_text_message_synced( $creating_user, $room_id, body => "private" ) })->then( sub { matrix_initialsync_room( $non_joined_user, $room_id ) ->main::expect_http_403; @@ -323,7 +323,7 @@ sub test_history_visibility ->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $creating_user, $room_id, body => "private" ) + matrix_send_room_text_message_synced( $creating_user, $room_id, body => "private" ) })->then( sub { matrix_set_room_history_visibility_synced( $creating_user, $room_id, "world_readable" ); })->then( sub { @@ -365,9 +365,9 @@ sub test_history_visibility matrix_set_room_history_visibility_synced( $user, $room_id, "world_readable" ), matrix_set_room_guest_access_synced( $user, $room_id, "can_join" ), )->then( sub { - matrix_join_room( $nonjoined_user, $room_id ); + matrix_join_room_synced( $nonjoined_user, $room_id ); })->then( sub { - matrix_leave_room( $nonjoined_user, $room_id ); + matrix_leave_room_synced( $nonjoined_user, $room_id ); })->then( sub { do_request_json_for( $nonjoined_user, method => "GET", @@ -402,13 +402,13 @@ sub test_history_visibility matrix_set_room_guest_access_synced( $user, $room_id, "can_join" ) ->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "shared" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "shared" ); })->then( sub { matrix_set_room_history_visibility( $user, $room_id, $visibility ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "pre_join" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "pre_join" ); })->then( sub { - matrix_join_room( $joining_user, $room_id ); + matrix_join_room_synced( $joining_user, $room_id ); })->then( sub { matrix_send_room_text_message_synced( $user, $room_id, body => "post_join" ); })->then( sub { @@ -464,15 +464,15 @@ sub test_history_visibility matrix_set_room_history_visibility_synced( $user, $room_id, "joined" ) ->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "1" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "1" ); })->then( sub { matrix_set_room_history_visibility_synced( $user, $room_id, "invited" ) })->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "2" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "2" ); })->then( sub { matrix_set_room_history_visibility_synced( $user, $room_id, "shared" ) })->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "3" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "3" ); })->then( sub { matrix_join_room_synced( $joining_user, $room_id ); })->then( sub { @@ -509,7 +509,7 @@ sub test_history_visibility my ( $room_alias_name, $user, $another_user, $remote_user ) = @_; my ( $room_id, $room_alias ); - matrix_create_room( + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, )->then( sub { @@ -520,16 +520,16 @@ sub test_history_visibility repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $user, $room_id, body => "Message $msgnum" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "Message $msgnum" ); }, foreach => [ 1 .. 10 ]); })->then( sub { # We now send a state event to ensure they're correctly handled in # backfill. This was a bug in synapse (c.f. #1943) - matrix_join_room( $another_user, $room_alias ); + matrix_join_room_synced( $another_user, $room_alias ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "2" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "2" ); })->then( sub { - matrix_join_room( $remote_user, $room_alias ); + matrix_join_room_synced( $remote_user, $room_alias ); })->then( sub { matrix_get_room_messages( $remote_user, $room_id, limit => 10 ) })->then( sub { diff --git a/tests/30rooms/31forget.pl b/tests/30rooms/31forget.pl index 843db7959..1c97c0c2f 100644 --- a/tests/30rooms/31forget.pl +++ b/tests/30rooms/31forget.pl @@ -21,7 +21,7 @@ sub matrix_forget_room do => sub { my ( $creator, $room_id, $user ) = @_; - matrix_join_room( $user, $room_id ) + matrix_join_room_synced( $user, $room_id ) ->then( sub { matrix_send_room_text_message_synced( $creator, $room_id, body => "sup" ) })->then( sub { @@ -33,7 +33,7 @@ sub matrix_forget_room log_if_fail "Chunk", $body->{chunk}; $body->{chunk}[0]{content}{body} eq "sup" or die "Wrong message"; - matrix_leave_room( $user, $room_id ) + matrix_leave_room_synced( $user, $room_id ) })->then( sub { matrix_get_room_state( $creator, $room_id, type => "m.room.member", @@ -78,11 +78,11 @@ sub matrix_forget_room do => sub { my ( $creator, $room_id, $user ) = @_; - matrix_join_room( $user, $room_id ) + matrix_join_room_synced( $user, $room_id ) ->then( sub { - matrix_send_room_text_message( $creator, $room_id, body => "sup" ) + matrix_send_room_text_message_synced( $creator, $room_id, body => "sup" ) })->then( sub { - matrix_leave_room( $user, $room_id ) + matrix_leave_room_synced( $user, $room_id ) })->then( sub { matrix_forget_room( $user, $room_id ) })->then( sub { @@ -106,9 +106,9 @@ sub matrix_forget_room do => sub { my ( $creator, $room_id, $user ) = @_; - matrix_join_room( $user, $room_id ) + matrix_join_room_synced( $user, $room_id ) ->then( sub { - matrix_send_room_text_message( $creator, $room_id, body => "sup" ); + matrix_send_room_text_message_synced( $creator, $room_id, body => "sup" ); })->then( sub { do_request_json_for( $creator, method => "POST", @@ -140,9 +140,9 @@ sub matrix_forget_room do => sub { my ( $creator, $room_id, $user ) = @_; - matrix_join_room( $user, $room_id ) + matrix_join_room_synced( $user, $room_id ) ->then( sub { - matrix_send_room_text_message( $creator, $room_id, body => "sup" ); + matrix_send_room_text_message_synced( $creator, $room_id, body => "sup" ); })->then( sub { matrix_forget_room( $user, $room_id ) })->main::expect_http_4xx; @@ -156,7 +156,7 @@ sub matrix_forget_room my ( $room_id ); - matrix_create_room( $creator, invite => [ $user->user_id ] )->then( sub { + matrix_create_room_synced( $creator, invite => [ $user->user_id ] )->then( sub { ( $room_id ) = @_; log_if_fail "room_id", $room_id; @@ -169,21 +169,21 @@ sub matrix_forget_room } ) })->then( sub { - matrix_join_room( $user, $room_id ); + matrix_join_room_synced( $user, $room_id ); })->then( sub { - matrix_send_room_text_message( $creator, $room_id, body => "before leave" ); + matrix_send_room_text_message_synced( $creator, $room_id, body => "before leave" ); })->then( sub { matrix_get_room_messages( $user, $room_id, limit => 100 ); })->then( sub { - matrix_leave_room( $user, $room_id ); + matrix_leave_room_synced( $user, $room_id ); })->then( sub { matrix_forget_room( $user, $room_id ); })->then( sub { matrix_join_room( $user, $room_id )->main::expect_http_403; })->then( sub { - matrix_invite_user_to_room( $creator, $user, $room_id ); + matrix_invite_user_to_room_synced( $creator, $user, $room_id ); })->then( sub { - matrix_join_room( $user, $room_id ); + matrix_join_room_synced( $user, $room_id ); })->then( sub { matrix_get_room_messages( $user, $room_id, limit => 100 ); })->then( sub { diff --git a/tests/30rooms/32erasure.pl b/tests/30rooms/32erasure.pl index 8d5e974f9..39df09016 100644 --- a/tests/30rooms/32erasure.pl +++ b/tests/30rooms/32erasure.pl @@ -23,7 +23,7 @@ my $message_id; matrix_join_room_synced( $member, $room_id ) ->then( sub { - matrix_send_room_text_message( $creator, $room_id, body => "body1" ); + matrix_send_room_text_message_synced( $creator, $room_id, body => "body1" ); })->then( sub { ( $message_id ) = @_; matrix_join_room_synced( $joiner, $room_id ); diff --git a/tests/30rooms/40joinedapis.pl b/tests/30rooms/40joinedapis.pl index 461a873d3..96ab1ca8e 100644 --- a/tests/30rooms/40joinedapis.pl +++ b/tests/30rooms/40joinedapis.pl @@ -9,23 +9,23 @@ my ( $room_joined, $room_left, $room_invited ); Future->needs_all( - matrix_create_room( $user )->on_done( sub { + matrix_create_room_synced( $user )->on_done( sub { ( $room_joined ) = @_; log_if_fail "room joined", $room_joined; }), - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { ( $room_left ) = @_; log_if_fail "room left", $room_left; - matrix_leave_room( $user, $room_left ); + matrix_leave_room_synced( $user, $room_left ); }), - matrix_create_room( $inviter )->then( sub { + matrix_create_room_synced( $inviter )->then( sub { ( $room_invited ) = @_; log_if_fail "room invited", $room_invited; - matrix_invite_user_to_room( $inviter, $user, $room_invited ); + matrix_invite_user_to_room_synced( $inviter, $user, $room_invited ); }), )->then( sub { do_request_json_for( $user, @@ -69,7 +69,7 @@ my $room_id; - matrix_create_room( $creator, + matrix_create_room_synced( $creator, invite => [ $user_joined->user_id, $user_left->user_id, $user_invited->user_id ], )->then( sub { ( $room_id ) = @_; @@ -77,10 +77,10 @@ log_if_fail "room", $room_id; Future->needs_all( - matrix_join_room( $user_joined, $room_id ), + matrix_join_room_synced( $user_joined, $room_id ), - matrix_join_room( $user_left, $room_id )->then( sub { - matrix_leave_room( $user_left, $room_id ); + matrix_join_room_synced( $user_left, $room_id )->then( sub { + matrix_leave_room_synced( $user_left, $room_id ); }), ); })->then( sub { diff --git a/tests/30rooms/50context.pl b/tests/30rooms/50context.pl index 24dc01ecb..c2dedfa10 100644 --- a/tests/30rooms/50context.pl +++ b/tests/30rooms/50context.pl @@ -6,7 +6,7 @@ check => sub { my ( $user, $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world", )->then( sub { my ( $event_id ) = @_; @@ -33,7 +33,7 @@ check => sub { my ( $user, $room_id, $other_user ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world", )->then( sub { my ( $event_id ) = @_; @@ -56,14 +56,14 @@ my ( $event_before_id, $event_middle_id, $event_after_id ); - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "event before", )->then( sub { ( $event_before_id ) = @_; log_if_fail "Before event", $event_before_id; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world", ) })->then( sub { @@ -71,7 +71,7 @@ log_if_fail "Middle event", $event_middle_id; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "event after", ) })->then( sub { @@ -112,18 +112,18 @@ check => sub { my ( $user, $room_id, $user2, $user3 ) = @_; - matrix_join_room( $user2, $room_id )->then( sub { - matrix_join_room( $user3, $room_id ); + matrix_join_room_synced( $user2, $room_id )->then( sub { + matrix_join_room_synced( $user3, $room_id ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world 1", ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world 2", ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world 3", ); })->then( sub { diff --git a/tests/30rooms/51event.pl b/tests/30rooms/51event.pl index 079887659..de4100ea4 100644 --- a/tests/30rooms/51event.pl +++ b/tests/30rooms/51event.pl @@ -27,7 +27,7 @@ sub matrix_get_event check => sub { my ( $user, $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world", )->then( sub { my ( $event_id ) = @_; @@ -54,7 +54,7 @@ sub matrix_get_event check => sub { my ( $user, $room_id, $other_user ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world", )->then( sub { my ( $event_id ) = @_; @@ -80,11 +80,11 @@ sub matrix_get_event matrix_set_room_history_visibility( $user, $room_id, "joined", )->then( sub { - matrix_invite_user_to_room( + matrix_invite_user_to_room_synced( $user, $other_user, $room_id, ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "before join", ); })->then( sub { @@ -92,7 +92,7 @@ sub matrix_get_event matrix_join_room_synced( $other_user, $room_id ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "after join", ); })->then( sub { diff --git a/tests/30rooms/52members.pl b/tests/30rooms/52members.pl index b6c99bbed..9da4daa06 100644 --- a/tests/30rooms/52members.pl +++ b/tests/30rooms/52members.pl @@ -40,7 +40,7 @@ matrix_create_and_join_room( [ $user1 ] )->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user1, $room_id, + matrix_send_room_text_message_synced( $user1, $room_id, body => "Hello world", ); })->then( sub { @@ -50,9 +50,9 @@ # find the token at this point so we can query it later $at_token = $body->{rooms}->{join}->{$room_id}->{timeline}->{prev_batch}; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { - matrix_send_room_text_message( $user1, $room_id, + matrix_send_room_text_message_synced( $user1, $room_id, body => "Hello back", ); })->then( sub { @@ -87,7 +87,7 @@ matrix_create_and_join_room( [ $user1, $user2 ] )->then( sub { ( $room_id ) = @_; - matrix_leave_room( $user2, $room_id ); + matrix_leave_room_synced( $user2, $room_id ); })->then( sub { do_request_json_for( $user1, method => "GET", diff --git a/tests/30rooms/60version_upgrade.pl b/tests/30rooms/60version_upgrade.pl index 5b854719e..74bbde890 100644 --- a/tests/30rooms/60version_upgrade.pl +++ b/tests/30rooms/60version_upgrade.pl @@ -752,7 +752,7 @@ sub upgrade_room_synced { log_if_fail $room_id; # Invite the remote user to our room - matrix_invite_user_to_room( + matrix_invite_user_to_room_synced( $creator, $remote_user, $room_id )->then( sub { # Have the remote user join the room @@ -775,7 +775,7 @@ sub upgrade_room_synced { ( $new_room_id ) = @_; # Invite the remote user to the new room - matrix_invite_user_to_room( + matrix_invite_user_to_room_synced( $creator, $remote_user, $new_room_id ); })->then( sub { @@ -973,7 +973,7 @@ sub upgrade_room_synced { do => sub { my ( $creator, $room_id, $joiner ) = @_; - matrix_join_room( $joiner, $room_id )->then( sub { + matrix_join_room_synced( $joiner, $room_id )->then( sub { upgrade_room( $joiner, $room_id, )->main::expect_matrix_error( 403, 'M_FORBIDDEN' ); @@ -1020,7 +1020,7 @@ sub upgrade_room_synced { my ( $creator, $remote_joiner ) = @_; my ( $room_id, $new_room_id, $pl_event_id ); - matrix_create_room( $creator, + matrix_create_room_synced( $creator, visibility => "public", )->then( sub { ( $room_id, ) = @_; diff --git a/tests/30rooms/70publicroomslist.pl b/tests/30rooms/70publicroomslist.pl index 2118cf7a3..1386a10c2 100644 --- a/tests/30rooms/70publicroomslist.pl +++ b/tests/30rooms/70publicroomslist.pl @@ -32,7 +32,7 @@ my $alias_local = $_; my $room = $rooms{$alias_local}; - matrix_create_room( $user, + matrix_create_room_synced( $user, visibility => "public", room_alias_name => $alias_local, %{$room}, @@ -119,7 +119,7 @@ my $room_id; - matrix_create_room( $local_user, + matrix_create_room_synced( $local_user, visibility => "public", name => "Test Name", topic => "Test Topic", @@ -263,7 +263,7 @@ my $room_id; - matrix_create_room( $local_user, + matrix_create_room_synced( $local_user, visibility => "public", name => "Test Name", topic => "Test Topic Wombles", @@ -309,7 +309,7 @@ my $room_id; - matrix_create_room( $local_user, + matrix_create_room_synced( $local_user, visibility => "public", name => "Test Name", topic => "Test Topic Wibbles", diff --git a/tests/31sync/03joined.pl b/tests/31sync/03joined.pl index b2c870946..7572dc214 100644 --- a/tests/31sync/03joined.pl +++ b/tests/31sync/03joined.pl @@ -142,16 +142,16 @@ matrix_create_filter( $user_b, $filter ) ->on_done( sub { ( $filter_id_b ) = @_ } ), )->then( sub { - matrix_create_room( $user_a )->on_done( sub { ( $room_id ) = @_ } ); + matrix_create_room_synced( $user_a )->on_done( sub { ( $room_id ) = @_ } ); })->then( sub { Future->needs_all( map { - matrix_send_room_text_message( $user_a, $room_id, body => "test1-$_" ); + matrix_send_room_text_message_synced( $user_a, $room_id, body => "test1-$_" ); } 0 .. 3 ); })->then( sub { matrix_sync( $user_b, filter => $filter_id_b ); })->then( sub { Future->needs_all( map { - matrix_send_room_text_message( $user_a, $room_id, body => "test2-$_" ); + matrix_send_room_text_message_synced( $user_a, $room_id, body => "test2-$_" ); } 0 .. 3 ); })->then( sub { matrix_join_room_synced( $user_b, $room_id ); @@ -195,7 +195,7 @@ my $room_id; - matrix_create_room( $user_a ) + matrix_create_room_synced( $user_a ) ->then( sub { ( $room_id ) = @_; @@ -248,7 +248,7 @@ my $room_id; - matrix_create_room( $user_a ) + matrix_create_room_synced( $user_a ) ->then( sub { ( $room_id ) = @_; diff --git a/tests/31sync/04timeline.pl b/tests/31sync/04timeline.pl index 1d47f42b8..7877114a4 100644 --- a/tests/31sync/04timeline.pl +++ b/tests/31sync/04timeline.pl @@ -12,11 +12,11 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Test message 1", ); })->then( sub { @@ -72,7 +72,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -189,11 +189,11 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "My message" ); })->then( sub { @@ -324,11 +324,11 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, body => "1" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "1" ); })->then( sub { ( $event_id_1 ) = @_; @@ -383,7 +383,7 @@ my ( $room_id, $event_id_1, $event_id_2 ); - matrix_create_room( $user ) + matrix_create_room_synced( $user ) ->then( sub { ( $room_id ) = @_; @@ -451,7 +451,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -471,7 +471,7 @@ $next_batch = $body->{next_batch}; - matrix_send_room_text_message( $user, $room_id, body => "2" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "2" ); })->then( sub { ( $event_id_2 ) = @_; diff --git a/tests/31sync/05presence.pl b/tests/31sync/05presence.pl index 094757c8a..2deec5142 100644 --- a/tests/31sync/05presence.pl +++ b/tests/31sync/05presence.pl @@ -104,10 +104,10 @@ # We can't use matrix_create_and_join since that polls the event # stream to check that the user has joined. - matrix_create_room( $user_a )->then( sub { + matrix_create_room_synced( $user_a )->then( sub { my ( $room_id ) = @_; - matrix_join_room( $user_b, $room_id ); + matrix_join_room_synced( $user_b, $room_id ); }); })->then( sub { matrix_sync( $user_a, filter => $filter_id_a ); diff --git a/tests/31sync/06state.pl b/tests/31sync/06state.pl index 821ffbfaa..b4431b48f 100644 --- a/tests/31sync/06state.pl +++ b/tests/31sync/06state.pl @@ -21,7 +21,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -76,7 +76,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $remote_user ); + matrix_create_room_synced( $remote_user ); })->then( sub { ( $room_id ) = @_; @@ -134,7 +134,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -201,7 +201,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ) + matrix_create_room_synced( $user ) })->then( sub { ( $room_id ) = @_; @@ -273,7 +273,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $remote_user ); + matrix_create_room_synced( $remote_user ); })->then( sub { ( $room_id ) = @_; matrix_invite_user_to_room_synced( @@ -338,7 +338,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -438,7 +438,7 @@ )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; @@ -496,7 +496,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -615,7 +615,7 @@ )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ) + matrix_create_room_synced( $user_a ) })->then( sub { ( $room_id ) = @_; matrix_put_room_state( $user_a, $room_id, @@ -630,7 +630,7 @@ })->then( sub { matrix_sync( $user_b, filter => $filter_id_b); })->then( sub { - matrix_join_room( $user_b, $room_id ); + matrix_join_room_synced( $user_b, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $user_a, $room_id, 20 ); })->then( sub { @@ -679,7 +679,7 @@ )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; @@ -697,7 +697,7 @@ })->then( sub { matrix_sync( $user_b, filter => $filter_id_b ); })->then( sub { - matrix_join_room( $user_b, $room_id ); + matrix_join_room_synced( $user_b, $room_id ); })->then( sub { matrix_leave_room_synced( $user_b, $room_id ); })->then( sub { @@ -733,21 +733,21 @@ my ( $room_id ); - matrix_create_room( $creator ) + matrix_create_room_synced( $creator ) ->then( sub { ( $room_id ) = @_; - matrix_join_room( $syncer, $room_id ) + matrix_join_room_synced( $syncer, $room_id ) })->then( sub { matrix_set_room_history_visibility( $creator, $room_id, "joined" ) })->then( sub { - matrix_invite_user_to_room( $creator, $invitee, $room_id ) + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ) })->then( sub { matrix_sync( $syncer ) })->then( sub { - matrix_leave_room( $syncer, $room_id ) + matrix_leave_room_synced( $syncer, $room_id ) })->then( sub { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) })->then( sub { matrix_join_room_synced( $syncer, $room_id ) })->then( sub { @@ -781,31 +781,31 @@ my ( $room_id ); - matrix_create_room( $creator ) + matrix_create_room_synced( $creator ) ->then( sub { ( $room_id ) = @_; - matrix_join_room( $syncer, $room_id ) + matrix_join_room_synced( $syncer, $room_id ) })->then( sub { matrix_set_room_history_visibility( $creator, $room_id, "joined" ) })->then( sub { - matrix_invite_user_to_room( $creator, $invitee, $room_id ) + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ) })->then( sub { matrix_sync( $syncer ) })->then( sub { repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "Message $msgnum", )->on_done( sub { log_if_fail "Sent msg $msgnum / 50"; }); }, foreach => [ 1 .. 50 ]) })->then( sub { - matrix_leave_room( $syncer, $room_id ) + matrix_leave_room_synced( $syncer, $room_id ) })->then( sub { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) })->then( sub { matrix_join_room_synced( $syncer, $room_id ) })->then( sub { @@ -841,26 +841,26 @@ my ( $room_id ); - matrix_create_room( $creator ) + matrix_create_room_synced( $creator ) ->then( sub { ( $room_id ) = @_; - matrix_join_room( $syncer, $room_id ) + matrix_join_room_synced( $syncer, $room_id ) })->then( sub { matrix_set_room_history_visibility( $creator, $room_id, "joined" ) })->then( sub { - matrix_invite_user_to_room( $creator, $invitee, $room_id ) + matrix_invite_user_to_room_synced( $creator, $invitee, $room_id ) })->then( sub { matrix_sync( $syncer ) })->then( sub { - matrix_leave_room( $syncer, $room_id ) + matrix_leave_room_synced( $syncer, $room_id ) })->then( sub { - matrix_join_room( $invitee, $room_id ) + matrix_join_room_synced( $invitee, $room_id ) })->then( sub { repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "Message $msgnum", )->on_done( sub { log_if_fail "Sent msg $msgnum / 50"; diff --git a/tests/31sync/07invited.pl b/tests/31sync/07invited.pl index 6fa40c0fc..d037b0049 100644 --- a/tests/31sync/07invited.pl +++ b/tests/31sync/07invited.pl @@ -15,7 +15,7 @@ )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; @@ -64,7 +64,7 @@ matrix_sync( $user_b, filter => $filter_id_b ); })->then( sub { - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; @@ -121,7 +121,7 @@ assert_json_keys( $room->{invite_state}, qw( events ) ); # accept the invite - matrix_join_room( $user, $room_id ); + matrix_join_room_synced( $user, $room_id ); })->then( sub { # wait for the sync to turn up await_sync( $user, diff --git a/tests/31sync/09archived.pl b/tests/31sync/09archived.pl index 5a060985b..dcd4056e6 100644 --- a/tests/31sync/09archived.pl +++ b/tests/31sync/09archived.pl @@ -12,7 +12,7 @@ )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -81,7 +81,7 @@ )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -133,7 +133,7 @@ )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $inviter ); + matrix_create_room_synced( $inviter ); })->then( sub { ( $room_id ) = @_; @@ -192,7 +192,7 @@ })->then( sub { matrix_sync( $user, filter => $filter_id ); })->then( sub { - matrix_leave_room( $user, $room_id_1 ); + matrix_leave_room_synced( $user, $room_id_1 ); })->then( sub { # Pad out the timeline with filler messages to create a "gap" between # this sync and the next. It's useful to test this since @@ -230,11 +230,11 @@ ( $filter_id ) = @_; Future->needs_all( - matrix_create_room( $user )->on_done( sub { ( $room_id_1 ) = @_; } ), - matrix_create_room( $user )->on_done( sub { ( $room_id_2 ) = @_; } ), + matrix_create_room_synced( $user )->on_done( sub { ( $room_id_1 ) = @_; } ), + matrix_create_room_synced( $user )->on_done( sub { ( $room_id_2 ) = @_; } ), ); })->then( sub { - matrix_join_room( $user2, $room_id_1 ); + matrix_join_room_synced( $user2, $room_id_1 ); })->then( sub { matrix_join_room_synced( $user2, $room_id_2 ); })->then( sub { @@ -328,7 +328,7 @@ )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; @@ -340,7 +340,7 @@ $next_b = $body->{next_batch}; - matrix_send_room_text_message( $user_a, $room_id, body => "before" ); + matrix_send_room_text_message_synced( $user_a, $room_id, body => "before" ); })->then( sub { matrix_put_room_state( $user_a, $room_id, type => "a.madeup.test.state", @@ -348,9 +348,9 @@ state_key => "", ); })->then( sub { - matrix_leave_room( $user_b, $room_id ); + matrix_leave_room_synced( $user_b, $room_id ); })->then( sub { - matrix_send_room_text_message( $user_a, $room_id, body => "after" ); + matrix_send_room_text_message_synced( $user_a, $room_id, body => "after" ); })->then( sub { matrix_put_room_state_synced( $user_a, $room_id, type => "a.madeup.test.state", diff --git a/tests/31sync/10archived-ban.pl b/tests/31sync/10archived-ban.pl index ad1ba1817..7f3dd20ea 100644 --- a/tests/31sync/10archived-ban.pl +++ b/tests/31sync/10archived-ban.pl @@ -37,11 +37,11 @@ sub ban_user_synced )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user_b, $room_id ); + matrix_join_room_synced( $user_b, $room_id ); })->then( sub { ban_user_synced( $user_a, $user_b, $room_id ); })->then( sub { @@ -74,11 +74,11 @@ sub ban_user_synced )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user_b, $room_id); + matrix_join_room_synced( $user_b, $room_id); })->then( sub { matrix_sync( $user_b, filter => $filter_id_b ); })->then( sub { @@ -113,11 +113,11 @@ sub ban_user_synced )->then( sub { ( $filter_id_a, $filter_id_b ) = @_; - matrix_create_room( $user_a ); + matrix_create_room_synced( $user_a ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user_b, $room_id); + matrix_join_room_synced( $user_b, $room_id); })->then( sub { matrix_sync( $user_b, filter => $filter_id_b ); })->then( sub { diff --git a/tests/31sync/11typing.pl b/tests/31sync/11typing.pl index f806bd9cc..11873be1b 100644 --- a/tests/31sync/11typing.pl +++ b/tests/31sync/11typing.pl @@ -19,7 +19,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -72,7 +72,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -126,7 +126,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; diff --git a/tests/31sync/12receipts.pl b/tests/31sync/12receipts.pl index 0846c28c8..911b5aa21 100644 --- a/tests/31sync/12receipts.pl +++ b/tests/31sync/12receipts.pl @@ -19,11 +19,11 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, body => "hello" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "hello" ); })->then( sub { ( $event_id ) = @_; @@ -73,11 +73,11 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, body => "hello" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "hello" ); })->then( sub { ( $event_id ) = @_; diff --git a/tests/31sync/14read-markers.pl b/tests/31sync/14read-markers.pl index 38384f3a8..6898e36ca 100644 --- a/tests/31sync/14read-markers.pl +++ b/tests/31sync/14read-markers.pl @@ -6,10 +6,10 @@ my ( $room_id, $event_id ); - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, body => "hello" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "hello" ); })->then( sub { ( $event_id ) = @_; @@ -26,10 +26,10 @@ my ( $room_id, $event_id ); - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, body => "hello" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "hello" ); })->then( sub { ( $event_id ) = @_; @@ -66,16 +66,16 @@ my ( $room_id, $event_id ); - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { ( $room_id ) = @_; - matrix_send_room_text_message( $user, $room_id, body => "hello" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "hello" ); })->then( sub { ( $event_id ) = @_; matrix_advance_room_read_marker_synced( $user, $room_id, $event_id ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, body => "hello2" ); + matrix_send_room_text_message_synced( $user, $room_id, body => "hello2" ); })->then( sub { ( $event_id ) = @_; diff --git a/tests/31sync/15lazy-members.pl b/tests/31sync/15lazy-members.pl index 3d384b211..2970abba8 100644 --- a/tests/31sync/15lazy-members.pl +++ b/tests/31sync/15lazy-members.pl @@ -93,9 +93,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -153,9 +153,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -242,9 +242,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -253,7 +253,7 @@ sub check_filler_event { my ( $body ) = @_; assert_room_members( $body, $room_id, [ $alice->user_id, $bob->user_id ]); - matrix_join_room( $dave, $room_id ); + matrix_join_room_synced( $dave, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $dave, $room_id, 10 ); })->then( sub { @@ -485,7 +485,7 @@ sub check_filler_event { })->then( sub { matrix_join_room_synced( $charlie, $room_id ); })->then( sub { - matrix_send_room_text_message( $charlie, $room_id, + matrix_send_room_text_message_synced( $charlie, $room_id, body => "Hello world", ) })->then( sub { @@ -557,9 +557,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -626,9 +626,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -640,7 +640,7 @@ sub check_filler_event { $bob->user_id, ]); - matrix_join_room( $dave, $room_id ); + matrix_join_room_synced( $dave, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $charlie, $room_id, 10 ); })->then( sub { @@ -696,9 +696,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -772,9 +772,9 @@ sub check_filler_event { content => { name => "A room name" }, ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_join_room( $charlie, $room_id ); + matrix_join_room_synced( $charlie, $room_id ); })->then( sub { matrix_send_filler_messages_synced( $bob, $room_id, 10 ); })->then( sub { @@ -789,7 +789,7 @@ sub check_filler_event { $charlie->user_id ]); - matrix_send_room_text_message( $bob, $room_id, + matrix_send_room_text_message_synced( $bob, $room_id, body => "New message from bob", ) })->then( sub { diff --git a/tests/32room-versions.pl b/tests/32room-versions.pl index 021bf1bfd..fb909d862 100644 --- a/tests/32room-versions.pl +++ b/tests/32room-versions.pl @@ -64,7 +64,7 @@ })->then( sub { matrix_sync( $joiner ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello", ); })->then( sub { @@ -113,7 +113,7 @@ })->then( sub { matrix_sync( $invitee ); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello", ); })->then( sub { @@ -155,7 +155,7 @@ ( $room_id ) = @_; ( repeat { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message number $_[0]" ) } foreach => [ 1 .. 20 ] ); @@ -218,7 +218,7 @@ matrix_join_room_synced( $remote, $room_id ); })->then( sub { - matrix_send_room_text_message( $remote, $room_id, + matrix_send_room_text_message_synced( $remote, $room_id, body => "Message" ); })->then( sub { diff --git a/tests/41end-to-end-keys/06-device-lists.pl b/tests/41end-to-end-keys/06-device-lists.pl index de6f7def0..50570dc24 100644 --- a/tests/41end-to-end-keys/06-device-lists.pl +++ b/tests/41end-to-end-keys/06-device-lists.pl @@ -61,10 +61,10 @@ sub sync_until_user_in_device_list_id my $room_id; - matrix_create_room( $user1 )->then( sub { + matrix_create_room_synced( $user1 )->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_sync( $user1 ); })->then( sub { @@ -96,10 +96,10 @@ sub sync_until_user_in_device_list_id my ( $room_id ); - matrix_create_room( $user1 )->then( sub { + matrix_create_room_synced( $user1 )->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_sync( $user1 ); })->then( sub { @@ -118,10 +118,10 @@ sub sync_until_user_in_device_list_id my $room_id; - matrix_create_room( $user1 )->then( sub { + matrix_create_room_synced( $user1 )->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_sync( $user1 ); })->then( sub { @@ -149,10 +149,10 @@ sub sync_until_user_in_device_list_id my ( $room_id ); - matrix_create_room( $user1 )->then( sub { + matrix_create_room_synced( $user1 )->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_sync( $user1 ); })->then( sub { @@ -310,10 +310,10 @@ sub sync_until_user_in_device_list_id # It takes a while for the leave to propagate so lets just hammer this # endpoint... try_repeat_until_success { - matrix_invite_user_to_room( $creator, $remote_leaver, $room_id ) + matrix_invite_user_to_room_synced( $creator, $remote_leaver, $room_id ) } })->then( sub { - matrix_join_room( $remote_leaver, $room_id ); + matrix_join_room_synced( $remote_leaver, $room_id ); })->then( sub { retry_until_success { matrix_sync_again( $creator, timeout => 1000 ) @@ -386,7 +386,7 @@ sub sync_until_user_in_device_list_id })->then( sub { # now one of the remote users leaves the room... - matrix_leave_room( $remote_leaver, $room_id ); + matrix_leave_room_synced( $remote_leaver, $room_id ); })->then( sub { log_if_fail "Remote_leaver " . $remote_leaver->user_id . " left room"; @@ -585,10 +585,10 @@ sub sync_until_user_in_device_list_id # It takes a while for the leave to propagate so lets just hammer this # endpoint... try_repeat_until_success { - matrix_invite_user_to_room( $creator, $remote_leaver, $room_id ) + matrix_invite_user_to_room_synced( $creator, $remote_leaver, $room_id ) } })->then( sub { - matrix_join_room( $remote_leaver, $room_id ); + matrix_join_room_synced( $remote_leaver, $room_id ); })->then( sub { sync_until_user_in_device_list( $creator, $remote_leaver ); })->then( sub { @@ -770,7 +770,7 @@ sub sync_until_user_in_device_list_id # It takes a while for the leave to propagate so lets just hammer this # endpoint... retry_until_success sub { - matrix_invite_user_to_room( $remote_user, $creator, $room_id + matrix_invite_user_to_room_synced( $remote_user, $creator, $room_id )->then( sub { Future->done(1); }) diff --git a/tests/41end-to-end-keys/08-cross-signing.pl b/tests/41end-to-end-keys/08-cross-signing.pl index b48747ed1..345e4f301 100644 --- a/tests/41end-to-end-keys/08-cross-signing.pl +++ b/tests/41end-to-end-keys/08-cross-signing.pl @@ -114,11 +114,11 @@ matrix_sync( $user1 )->then(sub { matrix_sync( $user2 ); })->then( sub { - matrix_create_room( $user1 ); + matrix_create_room_synced( $user1 ); })->then( sub { my ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { my $self_signing_key = { # private key: HvQBbU+hc2Zr+JP1sE0XwBe1pfZZEYtJNPJLZJtS+F8 @@ -265,11 +265,11 @@ matrix_sync( $user1 )->then(sub { matrix_sync( $user2 ); })->then( sub { - matrix_create_room( $user1 ); + matrix_create_room_synced( $user1 ); })->then( sub { my ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { my $self_signing_key = { # private key: HvQBbU+hc2Zr+JP1sE0XwBe1pfZZEYtJNPJLZJtS+F8 @@ -518,16 +518,16 @@ }, }, } )->then( sub { - matrix_create_room( $user1 ); + matrix_create_room_synced( $user1 ); })->then( sub { ( $room_id ) = @_; matrix_sync( $user1 ); })->then( sub { - matrix_invite_user_to_room( $user1, $user2, $room_id ) + matrix_invite_user_to_room_synced( $user1, $user2, $room_id ) })->then( sub { sync_until_user_in_device_list( $user1, $user2 ); })->then( sub { - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { sync_until_user_in_device_list( $user1, $user2 ); })->then( sub { @@ -638,16 +638,16 @@ "self_signing_key" => $self_signing_key, }); })->then( sub { - matrix_create_room( $user1 ); + matrix_create_room_synced( $user1 ); })->then( sub { ( $room_id ) = @_; matrix_sync( $user1 ); })->then( sub { - matrix_invite_user_to_room( $user1, $user2, $room_id ) + matrix_invite_user_to_room_synced( $user1, $user2, $room_id ) })->then( sub { sync_until_user_in_device_list( $user1, $user2 ); })->then( sub { - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { sync_until_user_in_device_list( $user1, $user2 ); })->then( sub { diff --git a/tests/42tags.pl b/tests/42tags.pl index b1b753b9f..f966535a4 100644 --- a/tests/42tags.pl +++ b/tests/42tags.pl @@ -73,7 +73,7 @@ sub matrix_list_tags do => sub { my ( $user ) = @_; - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { my ( $room_id ) = @_; matrix_add_tag( $user, $room_id, "test_tag", {} ); @@ -89,7 +89,7 @@ sub matrix_list_tags do => sub { my ( $user ) = @_; - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { my ( $room_id ) = @_; matrix_remove_tag( $user, $room_id, "test_tag" ); @@ -106,7 +106,7 @@ sub matrix_list_tags my $room_id; - matrix_create_room( $user )->then( sub { + matrix_create_room_synced( $user )->then( sub { ( $room_id ) = @_; matrix_add_tag( $user, $room_id, "test_tag", {} ); @@ -303,7 +303,7 @@ sub check_account_data { matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -340,7 +340,7 @@ sub check_account_data { matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; @@ -378,7 +378,7 @@ sub check_account_data { matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ); + matrix_create_room_synced( $user ); })->then( sub { ( $room_id ) = @_; diff --git a/tests/43search.pl b/tests/43search.pl index 643a979ba..5f6af18b4 100644 --- a/tests/43search.pl +++ b/tests/43search.pl @@ -10,7 +10,7 @@ my ( $event_id ); - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "hello, world", )->then( sub { ( $event_id ) = @_; @@ -81,7 +81,7 @@ repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message number $msgnum" )->on_done( sub { ( $event_ids[$msgnum] ) = @_ } ); }, foreach => [ 1 .. 7 ] )->then( sub { @@ -143,7 +143,7 @@ repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message number $msgnum" ) ->on_done( sub { ( $event_ids[$msgnum] ) = @_ } ) }, foreach => [ 0 .. 19 ] )->then( sub { @@ -240,7 +240,7 @@ my ( $event_id_one, $event_id_two ); - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "message 1", )->then( sub { ( $event_id_one ) = @_; @@ -252,7 +252,7 @@ })->then( sub { my ( $new_room_id ) = @_; - matrix_send_room_text_message( $user, $new_room_id, + matrix_send_room_text_message_synced( $user, $new_room_id, body => "message 2", ); })->then( sub { @@ -319,12 +319,12 @@ my ( $event_id_one, $event_id_two ); - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "message 1", )->then( sub { ( $event_id_one ) = @_; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "message 2", ); })->then( sub { diff --git a/tests/48admin.pl b/tests/48admin.pl index c08e7f7b6..3171340d2 100644 --- a/tests/48admin.pl +++ b/tests/48admin.pl @@ -106,7 +106,7 @@ sub await_purge_complete { repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message $msgnum", ) }, foreach => [ 1 .. 10 ]) @@ -189,7 +189,7 @@ sub await_purge_complete { repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message $msgnum", ) }, foreach => [ 1 .. 9 ]) @@ -197,7 +197,7 @@ sub await_purge_complete { $last_event_ts = time(); delay(0.01); })->then( sub { - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message 10", ); })->then( sub { @@ -270,9 +270,9 @@ sub await_purge_complete { my @event_ids; my $last_event_id; - matrix_invite_user_to_room( $user, $remote_user, $room_id ) + matrix_invite_user_to_room_synced( $user, $remote_user, $room_id ) ->then( sub { - matrix_join_room( $remote_user, $room_id ) + matrix_join_room_synced( $remote_user, $room_id ) })->then( sub { matrix_put_room_state( $user, $room_id, type => "m.room.name", @@ -288,7 +288,7 @@ sub await_purge_complete { repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $user, $room_id, + matrix_send_room_text_message_synced( $user, $room_id, body => "Message $msgnum", )->on_done( sub { push @event_ids, $_[0]; } ) }, foreach => [ 0 .. 4 ]) @@ -308,7 +308,7 @@ sub await_purge_complete { repeat( sub { my $msgnum = $_[0]; - matrix_send_room_text_message( $remote_user, $room_id, + matrix_send_room_text_message_synced( $remote_user, $room_id, body => "Message $msgnum", )->on_done( sub { push @event_ids, $_[0]; } ) }, foreach => [ 5 .. 9 ]) @@ -411,14 +411,14 @@ sub await_purge_complete { my ( $room_id, $new_room_id ); - matrix_create_room( $user, + matrix_create_room_synced( $user, room_alias_name => $room_alias_name, )->then( sub { ( $room_id ) = @_; - matrix_invite_user_to_room( $user, $remote_user, $room_id ); + matrix_invite_user_to_room_synced( $user, $remote_user, $room_id ); })->then( sub { - matrix_join_room( $remote_user, $room_id ); + matrix_join_room_synced( $remote_user, $room_id ); })->then( sub { do_request_json_for( $admin, method => "DELETE", diff --git a/tests/49ignore.pl b/tests/49ignore.pl index 49b67b926..df205c90f 100644 --- a/tests/49ignore.pl +++ b/tests/49ignore.pl @@ -203,7 +203,7 @@ assert_eq( scalar keys %$invite_rooms, 0, "Expected zero invites" ); - matrix_invite_user_to_room( $user2, $user1, $room_id ) + matrix_invite_user_to_room_synced( $user2, $user1, $room_id ) })->then( sub { matrix_add_account_data( $user1, "m.ignored_user_list", { "ignored_users" => { $user2->user_id => {} } } diff --git a/tests/50federation/00prepare.pl b/tests/50federation/00prepare.pl index 73120c230..a72567a06 100644 --- a/tests/50federation/00prepare.pl +++ b/tests/50federation/00prepare.pl @@ -444,7 +444,7 @@ sub federated_rooms_fixture { repeat( sub { my ( $idx ) = @_; - matrix_create_room( $synapse_user, %$room_opts )->then( sub { + matrix_create_room_synced( $synapse_user, %$room_opts )->then( sub { my ( $room_id ) = @_; $outbound_client->join_room( server_name => $synapse_server_name, diff --git a/tests/50federation/30room-join.pl b/tests/50federation/30room-join.pl index a3e64a270..2410c5cfa 100644 --- a/tests/50federation/30room-join.pl +++ b/tests/50federation/30room-join.pl @@ -355,7 +355,7 @@ sub assert_is_valid_pdu { my $user_id = $user->user_id; - matrix_create_room( + matrix_create_room_synced( $creator_user, room_version => "1", )->then( sub { @@ -427,7 +427,7 @@ sub assert_is_valid_pdu { my $join_event; my $room_version; - matrix_create_room( + matrix_create_room_synced( $creator_user, )->then( sub { ( $room_id ) = @_; @@ -560,7 +560,7 @@ sub assert_is_valid_pdu { log_if_fail "Found join event", $join_event; Future->needs_all( - matrix_leave_room( $joiner_user, $room_id ), + matrix_leave_room_synced( $joiner_user, $room_id ), # make sure that the leave propagates back to server-0 await_sync_timeline_contains( @@ -606,7 +606,7 @@ sub assert_is_valid_pdu { my $user_id = $creator_user->user_id; - matrix_create_room( + matrix_create_room_synced( $creator_user, )->then( sub { my ( $room_id ) = @_; @@ -637,7 +637,7 @@ sub assert_is_valid_pdu { my ( $outbound_client, $creator_user, $user_id ) = @_; my $first_home_server = $creator_user->server_name; - matrix_create_room( + matrix_create_room_synced( $creator_user, room_version => "1", )->then( sub { @@ -673,7 +673,7 @@ sub assert_is_valid_pdu { my ( $outbound_client, $creator_user, $user_id ) = @_; my $first_home_server = $creator_user->server_name; - matrix_create_room( + matrix_create_room_synced( $creator_user, room_version => '2', )->then( sub { @@ -706,7 +706,7 @@ sub assert_is_valid_pdu { my ( $outbound_client, $creator_user, $user_id ) = @_; my $first_home_server = $creator_user->server_name; - matrix_create_room( + matrix_create_room_synced( $creator_user, room_version => '2', )->then( sub { @@ -742,7 +742,7 @@ sub assert_is_valid_pdu { my ( $outbound_client, $creator_user, $user_id ) = @_; my $first_home_server = $creator_user->server_name; - matrix_create_room( + matrix_create_room_synced( $creator_user, room_version => '2', )->then( sub { @@ -1132,7 +1132,7 @@ sub assert_is_valid_pdu { # join the room and wait for it to turn up in /sync matrix_do_and_wait_for_sync( $user, do => sub { - matrix_join_room( $user, $room_alias )->on_done( sub { + matrix_join_room_synced( $user, $room_alias )->on_done( sub { my ( $res ) = @_; log_if_fail "Joined room", $res; }); diff --git a/tests/50federation/31room-send.pl b/tests/50federation/31room-send.pl index e5a41eb3c..4a9323670 100644 --- a/tests/50federation/31room-send.pl +++ b/tests/50federation/31room-send.pl @@ -42,7 +42,7 @@ Future->done(1); }), - matrix_send_room_text_message( $user, $room_id, body => "Hello" ), + matrix_send_room_text_message_synced( $user, $room_id, body => "Hello" ), ); }); }; diff --git a/tests/50federation/32room-getevent.pl b/tests/50federation/32room-getevent.pl index c22d24462..ec12fee0a 100644 --- a/tests/50federation/32room-getevent.pl +++ b/tests/50federation/32room-getevent.pl @@ -62,11 +62,11 @@ my $room_id = $room->room_id; my $message_id; - matrix_join_room( $remaining_user, $room_id ) + matrix_join_room_synced( $remaining_user, $room_id ) ->then( sub { # have the creator send a message into the room, which we will try to # fetch. - matrix_send_room_text_message( $creator, $room_id, body => "body1" ); + matrix_send_room_text_message_synced( $creator, $room_id, body => "body1" ); })->then( sub { ( $message_id ) = @_; diff --git a/tests/50federation/33room-get-missing-events.pl b/tests/50federation/33room-get-missing-events.pl index 0efebb621..d0b883c44 100644 --- a/tests/50federation/33room-get-missing-events.pl +++ b/tests/50federation/33room-get-missing-events.pl @@ -119,7 +119,7 @@ $creator, $room_id, $vis )->then( sub { # send a message - matrix_send_room_text_message( $creator, $room_id, body => "1" ) + matrix_send_room_text_message_synced( $creator, $room_id, body => "1" ) })->then( sub { $outbound_client->join_room( server_name => $first_home_server, diff --git a/tests/50federation/34room-backfill.pl b/tests/50federation/34room-backfill.pl index 01e7661e8..2572c45c5 100644 --- a/tests/50federation/34room-backfill.pl +++ b/tests/50federation/34room-backfill.pl @@ -150,7 +150,7 @@ # Create some past messages to backfill from ( repeat { - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "Message $_[0] here", ) } foreach => [ 1 .. 10 ] )->then( sub { @@ -219,7 +219,7 @@ user_id => $fed_user_id, )->then( sub { # Send an event into the private room - matrix_send_room_text_message( $priv_creator, $priv_room_id, + matrix_send_room_text_message_synced( $priv_creator, $priv_room_id, body => "Hello world", ) })->then( sub { diff --git a/tests/50federation/35room-invite.pl b/tests/50federation/35room-invite.pl index 84c85d509..e23d3f51a 100644 --- a/tests/50federation/35room-invite.pl +++ b/tests/50federation/35room-invite.pl @@ -374,7 +374,7 @@ sub do_v2_invite_request $child->close(); } - return matrix_leave_room( $user, $room_id ); + return matrix_leave_room_synced( $user, $room_id ); } else { Future->needs_all( @@ -387,7 +387,7 @@ sub do_v2_invite_request Future->done; }), - matrix_leave_room( $user, $room_id ) + matrix_leave_room_synced( $user, $room_id ) ); } })->then( sub { @@ -711,7 +711,7 @@ sub do_v2_invite_request ( $room ) = @_; log_if_fail "All users joined room; initiating leave"; Future->needs_all( - matrix_leave_room( $joiner_user, $room_id ), + matrix_leave_room_synced( $joiner_user, $room_id ), # make sure that the leave propagates back to the sytest server... $inbound_server->await_event( @@ -743,7 +743,7 @@ sub do_v2_invite_request # now that we've got the leave event, rejoin Future->needs_all( - matrix_join_room( $joiner_user, $room_id, server_name => $creator_user->server_name ), + matrix_join_room_synced( $joiner_user, $room_id, server_name => $creator_user->server_name ), $inbound_server->await_event( "m.room.member", $room_id, sub { my ( $ev ) = @_; diff --git a/tests/50federation/36state.pl b/tests/50federation/36state.pl index c666e269f..5f66ed695 100644 --- a/tests/50federation/36state.pl +++ b/tests/50federation/36state.pl @@ -883,7 +883,7 @@ sub get_state_ids_from_server { user_id => $fed_user_id, )->then( sub { # Send an event into the private room - matrix_send_room_text_message( $priv_creator, $priv_room_id, + matrix_send_room_text_message_synced( $priv_creator, $priv_room_id, body => "Hello world", ) })->then( sub { @@ -923,7 +923,7 @@ sub get_state_ids_from_server { user_id => $fed_user_id, )->then( sub { # Send an event into the private room - matrix_send_room_text_message( $priv_creator, $priv_room_id, + matrix_send_room_text_message_synced( $priv_creator, $priv_room_id, body => "Hello world", ) })->then( sub { diff --git a/tests/50federation/38receipts.pl b/tests/50federation/38receipts.pl index 72dcf0c15..00f42404b 100644 --- a/tests/50federation/38receipts.pl +++ b/tests/50federation/38receipts.pl @@ -93,7 +93,7 @@ room_id => $room_id, user_id => $user_id, )->then( sub { - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "Test message1" ) })->then( sub { diff --git a/tests/50federation/39redactions.pl b/tests/50federation/39redactions.pl index 756a242de..42ad6113b 100644 --- a/tests/50federation/39redactions.pl +++ b/tests/50federation/39redactions.pl @@ -31,7 +31,7 @@ my ( $msg_event_id, $redaction_event_id ); Future->needs_all( - matrix_send_room_text_message( $creator, $room_id, body => "Hello" ) + matrix_send_room_text_message_synced( $creator, $room_id, body => "Hello" ) -> on_done( sub { ( $msg_event_id ) = @_; log_if_fail "Sent message: $msg_event_id"; diff --git a/tests/50federation/40devicelists.pl b/tests/50federation/40devicelists.pl index fde1bc19d..8dde16e38 100644 --- a/tests/50federation/40devicelists.pl +++ b/tests/50federation/40devicelists.pl @@ -17,12 +17,8 @@ alias => $room_alias, ); - do_request_json_for( $user, - method => "POST", - uri => "/v3/join/$room_alias", - - content => {}, - )->then( sub { + matrix_join_room_synced( $user, $room_alias ) + ->then( sub { Future->needs_all( $inbound_server->await_edu( "m.device_list_update", sub {1} ) ->then( sub { @@ -321,7 +317,7 @@ assert_json_keys( $alice_keys, ( $device_id1 ) ); Future->needs_all( - matrix_leave_room( $user, $room->room_id )->on_done( sub { + matrix_leave_room_synced( $user, $room->room_id )->on_done( sub { log_if_fail "sent leave request"; }), @@ -338,17 +334,7 @@ ); })->then( sub { log_if_fail "left room; now rejoining"; - my $iter = 0; - retry_until_success { - $iter++; - matrix_join_room( $user, $room->room_id, - server_name => $inbound_server->server_name, - )->on_fail( sub { - my ( $exc ) = @_; - chomp $exc; - log_if_fail "Room join iteration $iter failed: $exc"; - }); - } + matrix_join_room_synced( $user, $room->room_id, server_name => $inbound_server->server_name) })->then( sub { log_if_fail "rejoined room"; Future->needs_all( @@ -420,18 +406,9 @@ alias => $room_alias, ); - do_request_json_for( $user1, - method => "POST", - uri => "/v3/join/$room_alias", - - content => {}, - )->then( sub { - do_request_json_for( $user2, - method => "POST", - uri => "/v3/join/$room_alias", - - content => {}, - ) + matrix_join_room_synced( $user1, $room_alias) + ->then( sub { + matrix_join_room_synced( $user2, $room_alias) })->then( sub { Future->needs_all( $inbound_server->await_edu( "m.device_list_update", sub {1} ) @@ -734,12 +711,8 @@ }, }; - do_request_json_for( $user, - method => "POST", - uri => "/v3/join/$room_alias", - - content => {}, - )->then( sub { + matrix_join_room_synced( $user, $room_alias ) + ->then( sub { Future->needs_all( $inbound_server->await_request_user_devices( $creator_id ) ->then( sub { diff --git a/tests/50federation/40publicroomlist.pl b/tests/50federation/40publicroomlist.pl index c4992b423..74c4f8793 100644 --- a/tests/50federation/40publicroomlist.pl +++ b/tests/50federation/40publicroomlist.pl @@ -25,7 +25,7 @@ my $alias_local = $_; my $room = $rooms{$alias_local}; - matrix_create_room( $user, + matrix_create_room_synced( $user, visibility => "public", room_alias_name => $alias_local, %$room, diff --git a/tests/50federation/41power-levels.pl b/tests/50federation/41power-levels.pl index caebfc47f..0205bba7d 100644 --- a/tests/50federation/41power-levels.pl +++ b/tests/50federation/41power-levels.pl @@ -35,7 +35,7 @@ my $room_id = $room->{room_id}; # now get synapse to join - return matrix_join_room( + return matrix_join_room_synced( $synapse_user, $room_alias )->then( sub { # now the synapse user ought not to be able to send a power_levels event diff --git a/tests/50federation/44presence.pl b/tests/50federation/44presence.pl index d99f66da4..ae5b98b5f 100644 --- a/tests/50federation/44presence.pl +++ b/tests/50federation/44presence.pl @@ -16,14 +16,14 @@ )->then( sub { # Have Alice create a new private room - matrix_create_room( $alice, + matrix_create_room_synced( $alice, visibility => "private", )->SyTest::pass_on_done( "Created a room" ) })->then( sub { ( $room_id ) = @_; # Alice invites Bob - matrix_invite_user_to_room( $alice, $bob, $room_id ) + matrix_invite_user_to_room_synced( $alice, $bob, $room_id ) ->SyTest::pass_on_done( "Sent invite" ) })->then( sub { @@ -37,7 +37,7 @@ })->then( sub { # Bob accepts the invite by joining the room - matrix_join_room( $bob, $room_id ) + matrix_join_room_synced( $bob, $room_id ) ->SyTest::pass_on_done( "Joined room" ) })->then( sub { diff --git a/tests/50federation/52soft-fail.pl b/tests/50federation/52soft-fail.pl index 97d1dfae3..c7bde157e 100644 --- a/tests/50federation/52soft-fail.pl +++ b/tests/50federation/52soft-fail.pl @@ -326,7 +326,7 @@ })->then( sub { # now tell synapse to send a regular message, and check it Future->needs_all( - matrix_send_room_text_message( $creator, $room_id, body => "m3" ), + matrix_send_room_text_message_synced( $creator, $room_id, body => "m3" ), $inbound_server->await_event( "m.room.message", $room_id, sub {1} ) ->then( sub { @@ -545,7 +545,7 @@ })->then( sub { # now tell synapse to send a regular message, and check it Future->needs_all( - matrix_send_room_text_message( $creator, $room_id, body => "m3" ), + matrix_send_room_text_message_synced( $creator, $room_id, body => "m3" ), $inbound_server->await_event( "m.room.message", $room_id, sub {1} ) ->then( sub { diff --git a/tests/52user-directory/01public.pl b/tests/52user-directory/01public.pl index 9ed7d0f46..567e9c3c9 100644 --- a/tests/52user-directory/01public.pl +++ b/tests/52user-directory/01public.pl @@ -17,12 +17,12 @@ })->then( sub { ( $searching_user ) = @_; - matrix_create_room( $user, + matrix_create_room_synced( $user, preset => "public_chat", ); })->then( sub { my ( $room_id ) = @_; - matrix_join_room( $searching_user, $room_id ); + matrix_join_room_synced( $searching_user, $room_id ); })->then( sub { repeat_until_true { do_request_json_for( $searching_user, @@ -63,7 +63,7 @@ })->then( sub { ( $searching_user ) = @_; - matrix_create_room( $user, + matrix_create_room_synced( $user, preset => "private_chat", ); })->then( sub { @@ -95,7 +95,7 @@ matrix_set_displayname( $user, $displayname ) ->then( sub { - matrix_create_room( $creator, + matrix_create_room_synced( $creator, preset => "public_chat", ); })->then( sub { @@ -115,7 +115,7 @@ pass "User initially not in directory"; - matrix_join_room( $user, $room_id ); + matrix_join_room_synced( $user, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user, $displayname ); })->then( sub { @@ -129,7 +129,7 @@ pass "User appears in directory after join"; - matrix_leave_room( $user, $room_id ); + matrix_leave_room_synced( $user, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user, $displayname ); })->then( sub { @@ -168,7 +168,7 @@ matrix_set_displayname( $user, $displayname ) ->then( sub { - matrix_create_room( $creator, + matrix_create_room_synced( $creator, preset => "private_chat", invite => [ $user->user_id ], ); })->then( sub { @@ -176,7 +176,7 @@ log_if_fail "Room", $room_id; - matrix_join_room( $user, $room_id ); + matrix_join_room_synced( $user, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user, $displayname ); })->then( sub { @@ -261,13 +261,13 @@ matrix_set_displayname( $user, $displayname ) ->then( sub { - matrix_create_room( $creator, + matrix_create_room_synced( $creator, preset => "private_chat", invite => [ $user->user_id ], ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user, $room_id ); + matrix_join_room_synced( $user, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user, $displayname ); })->then( sub { @@ -353,7 +353,7 @@ matrix_set_displayname( $creator, $displayname ) ->then( sub { - matrix_create_room( $creator, + matrix_create_room_synced( $creator, preset => "public_chat", invite => [ $remote->user_id ], ); })->then( sub { @@ -361,7 +361,7 @@ log_if_fail "room_id", $room_id; - matrix_join_room( $remote, $room_id ); + matrix_join_room_synced( $remote, $room_id ); })->then( sub { matrix_get_user_dir_synced( $remote, $displayname ); })->then( sub { @@ -373,7 +373,7 @@ any { $_->{user_id} eq $creator->user_id } @$results or die "user not in list"; - matrix_leave_room( $remote, $room_id ); + matrix_leave_room_synced( $remote, $room_id ); })->then( sub { matrix_get_user_dir_synced( $remote, $displayname ); })->then( sub { @@ -412,13 +412,13 @@ log_if_fail "First displayname", $displayname; - matrix_create_room( $user, + matrix_create_room_synced( $user, preset => "public_chat", ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $searching_user, $room_id ); + matrix_join_room_synced( $searching_user, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user, $displayname ); })->then( sub { @@ -485,7 +485,7 @@ sub matrix_get_user_dir_synced log_if_fail "Created test users for user directory search: " . $new_user->user_id . ", " . $searching_user->user_id; - matrix_create_room( $new_user, + matrix_create_room_synced( $new_user, preset => "public_chat", ); })->then( sub { @@ -493,7 +493,7 @@ sub matrix_get_user_dir_synced log_if_fail "Created test room for user directory search: " . $room_id; - matrix_join_room( $searching_user, $room_id ); + matrix_join_room_synced( $searching_user, $room_id ); })->then( sub { repeat_until_true { do_request_json_for( $searching_user, diff --git a/tests/52user-directory/02private.pl b/tests/52user-directory/02private.pl index f88407f29..9927c3424 100644 --- a/tests/52user-directory/02private.pl +++ b/tests/52user-directory/02private.pl @@ -10,13 +10,13 @@ matrix_set_displayname( $user1, $displayname ) ->then( sub { - matrix_create_room( $user1, + matrix_create_room_synced( $user1, preset => "private_chat", invite => [ $user2->user_id ], ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user2, $displayname ); })->then( sub { @@ -44,13 +44,13 @@ matrix_set_displayname( $user1, $displayname ) ->then( sub { - matrix_create_room( $user1, + matrix_create_room_synced( $user1, preset => "private_chat", invite => [ $user2->user_id ], ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user2, $displayname ); })->then( sub { @@ -61,7 +61,7 @@ any { $_->{user_id} eq $user1->user_id } @{ $body->{results} } or die "user not in list"; - matrix_leave_room( $user2, $room_id ); + matrix_leave_room_synced( $user2, $room_id ); })->then( sub { matrix_get_user_dir_synced( $user2, $displayname ); })->then( sub { @@ -88,21 +88,21 @@ matrix_set_displayname( $user1, $displayname ) ->then( sub { - matrix_create_room( $user1, + matrix_create_room_synced( $user1, preset => "private_chat", invite => [ $user2->user_id ], ); })->then( sub { ( $room_id1 ) = @_; - matrix_join_room( $user2, $room_id1 ); + matrix_join_room_synced( $user2, $room_id1 ); })->then( sub { - matrix_create_room( $user1, + matrix_create_room_synced( $user1, preset => "private_chat", invite => [ $user2->user_id ], ); })->then( sub { ( $room_id2 ) = @_; - matrix_join_room( $user2, $room_id2 ); + matrix_join_room_synced( $user2, $room_id2 ); })->then( sub { matrix_get_user_dir_synced( $user2, $displayname ); })->then( sub { @@ -113,7 +113,7 @@ any { $_->{user_id} eq $user1->user_id } @{ $body->{results} } or die "user not in list"; - matrix_leave_room( $user2, $room_id1 ); + matrix_leave_room_synced( $user2, $room_id1 ); })->then( sub { matrix_get_user_dir_synced( $user2, $displayname ); })->then( sub { diff --git a/tests/60app-services/02ghost.pl b/tests/60app-services/02ghost.pl index 7a6a4f6b7..fa39be7fe 100644 --- a/tests/60app-services/02ghost.pl +++ b/tests/60app-services/02ghost.pl @@ -113,7 +113,7 @@ Future->done; }), - matrix_join_room( $ghost, $room_id ) + matrix_join_room_synced( $ghost, $room_id ) )->SyTest::pass_on_done( "Ghost joined room themselves" ) ->then( sub { Future->needs_all( @@ -132,7 +132,7 @@ Future->done; }), - matrix_send_room_text_message( $ghost, $room_id, + matrix_send_room_text_message_synced( $ghost, $room_id, body => "Message from AS Ghost", ) ) diff --git a/tests/60app-services/03passive.pl b/tests/60app-services/03passive.pl index 100b6d61b..35436fedf 100644 --- a/tests/60app-services/03passive.pl +++ b/tests/60app-services/03passive.pl @@ -119,7 +119,7 @@ Future->done; }), - matrix_send_room_text_message( $creator, $room_id, + matrix_send_room_text_message_synced( $creator, $room_id, body => "A message for the AS", ), ); diff --git a/tests/60app-services/06publicroomlist.pl b/tests/60app-services/06publicroomlist.pl index 1faf3ac07..5aa3a397b 100644 --- a/tests/60app-services/06publicroomlist.pl +++ b/tests/60app-services/06publicroomlist.pl @@ -38,7 +38,7 @@ sub get_room_list_synced # as this relies on an internal synapse implementation detail. my $instance_id = "$appserv_id|$network_id"; - matrix_create_room( $local_user, + matrix_create_room_synced( $local_user, visibility => "private", preset => "public_chat", name => "Test Name", @@ -125,7 +125,7 @@ sub get_room_list_synced # as this relies on an internal synapse implementation detail. my $instance_id = "$appserv_id|$network_id"; - matrix_create_room( $local_user, + matrix_create_room_synced( $local_user, visibility => "private", preset => "public_chat", name => "Test Name", diff --git a/tests/61push/01message-pushed.pl b/tests/61push/01message-pushed.pl index 037d1b989..5151eec79 100644 --- a/tests/61push/01message-pushed.pl +++ b/tests/61push/01message-pushed.pl @@ -41,7 +41,7 @@ sub matrix_set_pusher { my $room_id; # Have Alice create a new private room - matrix_create_room( $alice, + matrix_create_room_synced( $alice, visibility => "private", )->then( sub { ( $room_id ) = @_; @@ -60,12 +60,12 @@ sub matrix_set_pusher { return $body->{rooms}{invite}{$room_id}; })->SyTest::pass_on_done( "Bob received invite" ), - matrix_invite_user_to_room( $alice, $bob, $room_id ), + matrix_invite_user_to_room_synced( $alice, $bob, $room_id ), flush_events_for( $alice ), ) })->then( sub { # Bob accepts the invite by joining the room - matrix_join_room( $bob, $room_id ) + matrix_join_room_synced( $bob, $room_id ) })->then( sub { my $join_event; await_sync_timeline_contains( $alice, $room_id, check => sub { @@ -106,7 +106,7 @@ sub matrix_set_pusher { return 1; }), - matrix_send_room_text_message( $bob, $room_id, + matrix_send_room_text_message_synced( $bob, $room_id, body => "Room message for 50push-01message-pushed", )->SyTest::pass_on_done( "Message sent" ), ) @@ -183,7 +183,7 @@ sub matrix_set_pusher { matrix_set_pusher( $alice, $test_server_info->client_location . $PUSH_LOCATION, )->then( sub { - matrix_create_room( $bob, visibility => "private" ); + matrix_create_room_synced( $bob, visibility => "private" ); })->then( sub { ( $room_id ) = @_; @@ -199,7 +199,7 @@ sub matrix_set_pusher { return unless $body->{notification}{type} eq "m.room.member"; return 1; }), - matrix_invite_user_to_room( $bob, $alice, $room_id ), + matrix_invite_user_to_room_synced( $bob, $alice, $room_id ), ); })->then( sub { my ( $request ) = @_; @@ -239,11 +239,11 @@ sub setup_push $alice, $target, )->then( sub { log_if_fail "Created pusher for ".$alice->user_id." -> ".$target; - matrix_create_room( $bob ); + matrix_create_room_synced( $bob ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $alice, $room_id ); + matrix_join_room_synced( $alice, $room_id ); })->then( sub { # we need to make sure the pusher is working. # @@ -293,7 +293,7 @@ sub wait_for_pusher_to_work # a future which will send messages until failure or cancelled my $send_future = repeat { - matrix_send_room_text_message( $sending_user, $room_id, body => "Message" ) -> + matrix_send_room_text_message_synced( $sending_user, $room_id, body => "Message" ) -> then( sub { return delay( 0.2 ); }); } while => sub { my ( $trial_f ) = @_; @@ -323,7 +323,7 @@ sub check_received_push_with_name return unless $body->{notification}{type} eq "m.room.message"; return 1; }), - matrix_send_room_text_message( $bob, $room_id, + matrix_send_room_text_message_synced( $bob, $room_id, body => "Message", ), )->then( sub { @@ -420,7 +420,7 @@ sub check_received_push_with_name content => { name => $name }, ); })->then( sub { - matrix_join_room( $charlie, $room_id) + matrix_join_room_synced( $charlie, $room_id) })->then( sub { do_request_json_for( $bob, method => "PUT", @@ -468,7 +468,7 @@ sub check_received_push_with_name return unless $body->{notification}{type} eq "m.room.message"; return 1; }), - matrix_send_room_text_message( $bob, $room_id, + matrix_send_room_text_message_synced( $bob, $room_id, body => "Initial Message", ), ) @@ -599,7 +599,7 @@ sub check_received_push_with_name )->then( sub { # we need a second local user in the room, so that we can test if # alice's pusher is active. - matrix_join_room( $bob, $room->room_id ); + matrix_join_room_synced( $bob, $room->room_id ); })->then( sub { wait_for_pusher_to_work( $bob, $room->room_id ); })->then( sub { diff --git a/tests/61push/03_unread_count.pl b/tests/61push/03_unread_count.pl index 6befc40a4..d33a70fe5 100644 --- a/tests/61push/03_unread_count.pl +++ b/tests/61push/03_unread_count.pl @@ -54,13 +54,13 @@ sub user_with_push_rule_fixture my $room_id; - matrix_create_room( $user1 ) + matrix_create_room_synced( $user1 ) ->then( sub { ($room_id) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { - matrix_send_room_text_message( $user2, $room_id, + matrix_send_room_text_message_synced( $user2, $room_id, body => "Test message 1", ); })->then( sub { @@ -118,13 +118,13 @@ sub user_with_push_rule_fixture pattern => "*", actions => [ "notify", { set_tweak => "highlight", value => JSON::true } ] })->then( sub { - matrix_create_room( $user1 ); + matrix_create_room_synced( $user1 ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { - matrix_send_room_text_message( $user2, $room_id, + matrix_send_room_text_message_synced( $user2, $room_id, body => "Test message 1", ); })->then( sub { diff --git a/tests/61push/08_rejected_pushers.pl b/tests/61push/08_rejected_pushers.pl index e25721ae7..d05da69f2 100644 --- a/tests/61push/08_rejected_pushers.pl +++ b/tests/61push/08_rejected_pushers.pl @@ -56,14 +56,14 @@ sub wait_for_push my $url = $test_server_info->client_location . $PUSH_LOCATION; - matrix_create_room( $alice, visibility => "private" )->then( sub { + matrix_create_room_synced( $alice, visibility => "private" )->then( sub { ( $room_id ) = @_; - matrix_invite_user_to_room( $alice, $bob, $room_id ); + matrix_invite_user_to_room_synced( $alice, $bob, $room_id ); })->then( sub { - matrix_join_room( $bob, $room_id ); + matrix_join_room_synced( $bob, $room_id ); })->then( sub { - matrix_send_room_text_message( + matrix_send_room_text_message_synced( $bob, $room_id, body => "message" ); })->then( sub { @@ -99,7 +99,7 @@ sub wait_for_push Future->needs_all( wait_for_push( "key_1" ), wait_for_push( "key_2" ), - matrix_send_room_text_message( $bob, $room_id, body => "message" ) + matrix_send_room_text_message_synced( $bob, $room_id, body => "message" ) ) }->SyTest::pass_on_done( "Message 1 Pushed" ); })->then( sub { @@ -107,7 +107,7 @@ sub wait_for_push Future->needs_all( wait_for_push( "key_1", { rejected => [ "key_1" ] } ), wait_for_push( "key_2" ), - matrix_send_room_text_message( $bob, $room_id, body => "message" ) + matrix_send_room_text_message_synced( $bob, $room_id, body => "message" ) )->SyTest::pass_on_done( "Message 2 Pushed" ); })->then( sub { retry_until_success { diff --git a/tests/61push/09_notifications_api.pl b/tests/61push/09_notifications_api.pl index d0c124eae..ef69c9625 100644 --- a/tests/61push/09_notifications_api.pl +++ b/tests/61push/09_notifications_api.pl @@ -12,11 +12,11 @@ pattern => "*", actions => [ "notify" ] })->then( sub { - matrix_create_room( $user1 ); + matrix_create_room_synced( $user1 ); })->then( sub { ( $room_id ) = @_; - matrix_join_room( $user2, $room_id ); + matrix_join_room_synced( $user2, $room_id ); })->then( sub { matrix_send_room_text_message_synced( $user2, $room_id, body => "Test message 1", diff --git a/tests/90jira/SYN-343.pl b/tests/90jira/SYN-343.pl index 61437cde5..f3c6e5cf7 100644 --- a/tests/90jira/SYN-343.pl +++ b/tests/90jira/SYN-343.pl @@ -7,7 +7,7 @@ my $room_id; - matrix_create_room( $creator ) + matrix_create_room_synced( $creator ) ->SyTest::pass_on_done( "Created room" ) ->then( sub { ( $room_id ) = @_; diff --git a/tests/90jira/SYN-516.pl b/tests/90jira/SYN-516.pl index 94760478e..2626fc866 100644 --- a/tests/90jira/SYN-516.pl +++ b/tests/90jira/SYN-516.pl @@ -18,7 +18,7 @@ matrix_create_filter( $user, $filter )->then( sub { ( $filter_id ) = @_; - matrix_create_room( $user ) + matrix_create_room_synced( $user ) ->SyTest::pass_on_done( "User A created a room" ); })->then( sub { ( $room_id ) = @_; @@ -26,7 +26,7 @@ matrix_typing( $user, $room_id, typing => JSON::true, timeout => 30000 ) ->SyTest::pass_on_done( "Sent typing notification" ); })->then( sub { - matrix_send_room_message( $user, $room_id, + matrix_send_room_message_synced( $user, $room_id, content => { msgtype => "m.message", body => "message" }) ->SyTest::pass_on_done( "Sent message" ); diff --git a/tests/90jira/SYN-606.pl b/tests/90jira/SYN-606.pl index fe266a37d..8f9b52f69 100644 --- a/tests/90jira/SYN-606.pl +++ b/tests/90jira/SYN-606.pl @@ -41,7 +41,7 @@ my $from_token = $body->{messages}{end}; Future->needs_all( - matrix_send_room_text_message( $user, $room_id1, body => "moose" ), + matrix_send_room_text_message_synced( $user, $room_id1, body => "moose" ), await_event_not_history_visibility_or_presence_for( $nonjoined_user, $room_id1, [], from => $from_token, ), @@ -54,7 +54,7 @@ my $from_token = $body->{messages}{end}; Future->needs_all( - matrix_send_room_text_message( $user, $room_id2, body => "mice" ), + matrix_send_room_text_message_synced( $user, $room_id2, body => "mice" ), await_event_not_history_visibility_or_presence_for( $nonjoined_user, $room_id2, [], from => $from_token, )->then( sub {