diff --git a/appdatabase/migrations/sql/1628512914_profile_pictures_show_to.up.sql b/appdatabase/migrations/sql/1632262444_profile_pictures_show_to.up.sql similarity index 100% rename from appdatabase/migrations/sql/1628512914_profile_pictures_show_to.up.sql rename to appdatabase/migrations/sql/1632262444_profile_pictures_show_to.up.sql diff --git a/protocol/messenger_identity_image_test.go b/protocol/messenger_identity_image_test.go index f53615a8dd3..923480e7fd5 100644 --- a/protocol/messenger_identity_image_test.go +++ b/protocol/messenger_identity_image_test.go @@ -241,12 +241,7 @@ func (s *MessengerProfilePictureHandlerSuite) TestE2eSendingReceivingProfilePict privateChat, } - // TODO Set option for testing between private and public chat types - // private types need to send and received Contact Code message with attached chat identity - // private types send large and thumbnail image payloads - // TODO see if possible to push each test scenario into a go routine - for _, cc := range chatContexts { for sn, ss := range profilePicShowSettings { for vn, vs := range profilePicViewSettings { @@ -440,19 +435,41 @@ func (s *MessengerProfilePictureHandlerSuite) TestE2eSendingReceivingProfilePict s.logger.Debug("checked alice's contact info all good") - // Check Alice's profile picture(s) + // Check that Bob now has Alice's profile picture(s) switch cc { case publicChat: - s.Require().Len(contact.Images, 1) + // In public chat context we only need the images.SmallDimName, but also may have the large + s.Require().GreaterOrEqual(len(contact.Images), 1) // Check if the result matches expectation + smImg, ok := contact.Images[images.SmallDimName] + s.Require().True(ok, "contact images must contain the images.SmallDimName") + for _, ii := range iis { if ii.Name == images.SmallDimName { - s.Require().Equal(ii.Payload, contact.Images[images.SmallDimName].Payload) + s.Require().Equal(ii.Payload, smImg.Payload) } } case privateChat: + s.Require().Equal(len(contact.Images), 2) s.logger.Info("private chat chat images", zap.Any("iis", iis)) + + // Check if the result matches expectation + smImg, ok := contact.Images[images.SmallDimName] + s.Require().True(ok, "contact images must contain the images.SmallDimName") + + lgImg, ok := contact.Images[images.LargeDimName] + s.Require().True(ok, "contact images must contain the images.LargeDimName") + + for _, ii := range iis { + switch ii.Name{ + case images.SmallDimName: + s.Require().Equal(ii.Payload, smImg.Payload) + case images.LargeDimName: + s.Require().Equal(ii.Payload, lgImg.Payload) + } + } + } s.logger.Info("Completed testing with criteria:",