diff --git a/tests/csapi/rooms_members_local_test.go b/tests/csapi/rooms_members_local_test.go index 79a62622..09ae5356 100644 --- a/tests/csapi/rooms_members_local_test.go +++ b/tests/csapi/rooms_members_local_test.go @@ -9,11 +9,13 @@ import ( ) func TestMembersLocal(t *testing.T) { - deployment := Deploy(t, b.BlueprintOneToOneRoom) + deployment := Deploy(t, b.BlueprintAlice) defer deployment.Destroy(t) alice := deployment.Client(t, "hs1", "@alice:hs1") - bob := deployment.Client(t, "hs1", "@bob:hs1") + // Here we don't use the BlueprintOneToOneRoom because else Bob would be able to see Alice's presence changes through + // that pre-existing one-on-one DM room. So we exclude that here. + bob := deployment.RegisterUser(t, "hs1", "bob", "bobspassword", false) roomID := alice.CreateRoom(t, map[string]interface{}{"preset": "public_chat"}) bob.MustDoFunc( @@ -23,7 +25,7 @@ func TestMembersLocal(t *testing.T) { }), ) - _, incrementalSyncToken := alice.MustSync(t, client.SyncReq{}) + _, incrementalSyncTokenBeforeBobJoinsRoom := alice.MustSync(t, client.SyncReq{TimeoutMillis: "0"}) bob.JoinRoom(t, roomID, []string{}) t.Run("Parallel", func(t *testing.T) { @@ -38,15 +40,17 @@ func TestMembersLocal(t *testing.T) { t.Run("Existing members see new members' join events", func(t *testing.T) { t.Parallel() // SyncJoinedTo already checks everything we need to know - alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID)) + alice.MustSyncUntil(t, client.SyncReq{Since: incrementalSyncTokenBeforeBobJoinsRoom}, client.SyncJoinedTo(bob.UserID, roomID)) }) // sytest: Existing members see new members' presence // Split into initial and incremental sync cases in Complement. - t.Run("Existing members see new members' presence in initial sync", func(t *testing.T) { - runtime.SkipIf(t, runtime.Dendrite) // FIXME: https://github.com/matrix-org/dendrite/issues/2803 + t.Run("Existing members see new members' presence (in initial sync)", func(t *testing.T) { + runtime.SkipIf(t, runtime.Dendrite) // FIXME: https://github.com/matrix-org/matrix-spec/issues/1374 t.Parallel() + // First we sync to make sure bob to have joined the room... alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID)) + // ...and then we do another initial sync - this time waiting for bob's presence - to confirm we can get that. alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID), client.SyncPresenceHas(bob.UserID, nil), @@ -55,10 +59,9 @@ func TestMembersLocal(t *testing.T) { // sytest: Existing members see new members' presence // Split into initial and incremental sync cases in Complement. - t.Run("Existing members see new members' presence in incremental sync", func(t *testing.T) { - runtime.SkipIf(t, runtime.Dendrite) // FIXME: https://github.com/matrix-org/dendrite/issues/2803 + t.Run("Existing members see new members' presence (in incremental sync)", func(t *testing.T) { t.Parallel() - alice.MustSyncUntil(t, client.SyncReq{Since: incrementalSyncToken}, + alice.MustSyncUntil(t, client.SyncReq{Since: incrementalSyncTokenBeforeBobJoinsRoom}, client.SyncJoinedTo(bob.UserID, roomID), client.SyncPresenceHas(bob.UserID, nil), )