Skip to content

Commit

Permalink
Finalised e2e test for send/receive ii
Browse files Browse the repository at this point in the history
  • Loading branch information
Samyoul committed Sep 21, 2021
1 parent 0b6a7a4 commit 44658d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions protocol/messenger_identity_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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:",
Expand Down

0 comments on commit 44658d4

Please sign in to comment.