From 3796fdc96684b0048695c55875e30bcc97513c5b Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:42:44 +0100 Subject: [PATCH] Fix call timeline item snapshots. (#5923) * Fix call timeline item snapshots. * Fix a warning and hard code the call timer during tests. --- .../ActiveCallTimelineItemView.swift | 23 +++++++++++++------ ...tiveCallTimelineItemView.iPad-pseudo-0.png | 4 ++-- ...veCallTimelineItemView.iPhone-pseudo-0.png | 4 ++-- ...ificationRoomTimelineView.iPad-en-GB-0.png | 4 ++-- ...ficationRoomTimelineView.iPad-pseudo-0.png | 4 ++-- ...icationRoomTimelineView.iPhone-en-GB-0.png | 4 ++-- ...cationRoomTimelineView.iPhone-pseudo-0.png | 4 ++-- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ActiveCallTimelineItemView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ActiveCallTimelineItemView.swift index ec4ad39e3..f4e5eb5e5 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ActiveCallTimelineItemView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ActiveCallTimelineItemView.swift @@ -98,7 +98,7 @@ struct ActiveCallTimelineItemView: View { VStack(spacing: 4) { if !isJoined { - Button(action: { context?.send(viewAction: .joinActiveCall(isVoiceCall: isVoiceCall)) }) { + Button { context?.send(viewAction: .joinActiveCall(isVoiceCall: isVoiceCall)) } label: { Text(L10n.actionJoin) .font(.compound.bodyMDSemibold) .padding(.horizontal, 6) @@ -107,12 +107,10 @@ struct ActiveCallTimelineItemView: View { .buttonStyle(.compound(.primary, size: .small)) } - if let callStartTimestamp { - Text(callStartTimestamp, style: .timer) - .font(.compound.bodyXS) - .foregroundColor(.compound.textSecondary) - .monospacedDigit() - } + callTimer + .font(.compound.bodyXS) + .foregroundColor(.compound.textSecondary) + .monospacedDigit() } } .padding(12) @@ -120,6 +118,17 @@ struct ActiveCallTimelineItemView: View { .stroke(.compound.borderInteractivePrimary, lineWidth: 1)) .padding(16) } + + @ViewBuilder + private var callTimer: some View { + if let callStartTimestamp { + if ProcessInfo.isRunningTests { + Text("0:00") // A slow runner can take more than a second to record the snapshot 🤦‍♂️ + } else { + Text(callStartTimestamp, style: .timer) + } + } + } } // MARK: - Previews diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPad-pseudo-0.png index fa7c6048b..e6de17f46 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPad-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPad-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40d8037238e2d92a52ae9f6198bb625e9db2a725c6495da5174a0f3052801585 -size 164464 +oid sha256:3f63fc1b09ec77b4abd3d828fbaccf1653310724d9778c1d9d84469b4237893f +size 164948 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPhone-pseudo-0.png index 05701a4af..53555c118 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPhone-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/activeCallTimelineItemView.iPhone-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24a12ff5ba8829e72439b4e4605d6a5879ff2221c89eefbcc86513363e119bbc -size 132982 +oid sha256:7a672b63344f405ef6bada278f8fec875a47ffd844fdd8dd86e5855da83d09a4 +size 133102 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-en-GB-0.png index 840eed1c4..803f1bbdf 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:530f910db100c695e7e1ddb56ead0a1303c9ec732aac7f9aaec731bfade33ae6 -size 123981 +oid sha256:ea12680d6e660d45ba869dc8befdfbfae7dae8b4ea1d93a0bcd04260f4fe58ef +size 122557 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-pseudo-0.png index 7ff6e01bc..f70f04fa4 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPad-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4cb5fc7e3ef62505c3ad1f490d2f0be0c4119d128568f44cf9ce97ae55a323a1 -size 141458 +oid sha256:f3a2808f44ba49c947f8f7e992586cb9db28b85bf14f33b3cc53d1d78aea1b5a +size 142299 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-en-GB-0.png index 7b71576c5..7f452bb2a 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-en-GB-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-en-GB-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc60dcd6739ad9ad98d6d98d76c1ac9f097c9ded0b39c5016bc8175cdb6d2100 -size 77972 +oid sha256:0d3c33a7a13828c6e538f155f4152e82be68e3a1f7f82b660c7366f22cc64a84 +size 76322 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-pseudo-0.png index 511377d32..f269e76c1 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-pseudo-0.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/callNotificationRoomTimelineView.iPhone-pseudo-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24a80a6ca6a3e880c4bdf6cfe7937296feac87e4aeff6f0377c4813b89876650 -size 101480 +oid sha256:84c8d0ac8e6a34e642f0c7b53dd872a58df20201944726da7582fbabf346a79a +size 100642