Skip to content

Commit

Permalink
fix: screenshot tests [WPB-983] (#3554)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Oct 25, 2024
1 parent 88ffcdd commit d70b073
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/generate-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
git lfs fetch --all
git lfs checkout
- name: Setup GitHub Actions Bot for Git
uses: fregante/setup-git-user@v2

- name: Merge Develop into screenshot-tests
run: |
git checkout screenshot-tests
Expand Down Expand Up @@ -73,9 +76,6 @@ jobs:
- name: Update Screenshot Reference Images
run: ./gradlew updateInternalDebugScreenshotTest

- name: Setup GitHub Actions Bot for Git
uses: fregante/setup-git-user@v2

- name: Create New Branch
id: create_branch
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ import com.wire.kalium.network.NetworkState
import com.wire.kalium.network.NetworkStateObserver
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import okio.Path.Companion.toPath

private const val MOCK_TIME_IN_SECONDS: Long = 1729837498
val mockFooter = MessageFooter("", mapOf("👍" to 1), setOf("👍"))
val mockEmptyFooter = MessageFooter("", emptyMap(), emptySet())
val mockMessageTime = MessageTime(Instant.fromEpochSeconds(MOCK_TIME_IN_SECONDS))

val mockHeader = MessageHeader(
username = UIText.DynamicString("John Doe"),
membership = Membership.Guest,
isLegalHold = true,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
expirationStatus = ExpirationStatus.NotExpirable
Expand Down Expand Up @@ -307,7 +308,7 @@ fun mockAssetMessage(assetId: String = "asset1", messageId: String = "msg1") = U
username = UIText.DynamicString("John Doe"),
membership = Membership.Guest,
isLegalHold = true,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
expirationStatus = ExpirationStatus.NotExpirable
Expand All @@ -326,6 +327,7 @@ fun mockAssetMessage(assetId: String = "asset1", messageId: String = "msg1") = U
messageFooter = mockEmptyFooter,
source = MessageSource.Self
)

fun mockAssetAudioMessage(assetId: String = "asset1", messageId: String = "msg1") = UIMessage.Regular(
conversationId = ConversationId("value", "domain"),
userAvatarData = UserAvatarData(
Expand All @@ -336,7 +338,7 @@ fun mockAssetAudioMessage(assetId: String = "asset1", messageId: String = "msg1"
username = UIText.DynamicString("John Doe"),
membership = Membership.Guest,
isLegalHold = true,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
expirationStatus = ExpirationStatus.NotExpirable
Expand Down Expand Up @@ -395,7 +397,7 @@ fun mockedImageUIMessage(
username = UIText.DynamicString("John Doe"),
membership = Membership.External,
isLegalHold = false,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = messageStatus,
messageId = messageId,
connectionState = ConnectionState.ACCEPTED,
Expand All @@ -416,7 +418,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.Guest,
isLegalHold = true,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
expirationStatus = ExpirationStatus.NotExpirable
Expand Down Expand Up @@ -446,7 +448,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.Guest,
isLegalHold = true,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Delivered, isDeleted = true,
expirationStatus = ExpirationStatus.NotExpirable
Expand All @@ -467,7 +469,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.External,
isLegalHold = false,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
editStatus = MessageEditStatus.Edited("May 31, 2022 12.24pm"),
Expand All @@ -489,7 +491,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.External,
isLegalHold = false,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
editStatus = MessageEditStatus.Edited("May 31, 2022 12.24pm"),
Expand All @@ -511,7 +513,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.External,
isLegalHold = false,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Delivered,
isDeleted = true,
Expand Down Expand Up @@ -542,7 +544,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.External,
isLegalHold = false,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
editStatus = MessageEditStatus.Edited("May 31, 2022 12.24pm"),
Expand All @@ -564,7 +566,7 @@ fun getMockedMessages(): List<UIMessage> = listOf(
username = UIText.DynamicString("John Doe"),
membership = Membership.External,
isLegalHold = false,
messageTime = MessageTime(Clock.System.now()),
messageTime = mockMessageTime,
messageStatus = MessageStatus(
flowStatus = MessageFlowStatus.Sent,
editStatus = MessageEditStatus.Edited("May 31, 2022 12.24pm"),
Expand Down

0 comments on commit d70b073

Please sign in to comment.