Skip to content

Commit

Permalink
(ui-tests) fix broken ui-tests (#4935)
Browse files Browse the repository at this point in the history
* (ui-tests) fix broken ui-tests

* (ui-tests) fix random failures of ChannelKtTest

* (ui-tests) fix detekt

---------

Co-authored-by: kanat <>
  • Loading branch information
kanat authored Aug 29, 2023
1 parent 401e7ad commit 25a604c
Show file tree
Hide file tree
Showing 14 changed files with 362 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ class ChannelItemTest : ComposeScreenshotTest() {
fun channelItemWithUnreadCount() = runScreenshotTest {
ChannelItem(
channelItem = ChannelItemState(
channel = TestData.channel1().apply {
channel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
)
),
messages = listOf(
TestData.message1(),
TestData.message2(),
)
unreadCount = 2
lastMessageAt = TestData.date2()
},
),
unreadCount = 2,
lastMessageAt = TestData.date2(),
),
),
currentUser = TestData.user1(),
onChannelClick = {},
Expand All @@ -51,17 +51,17 @@ class ChannelItemTest : ComposeScreenshotTest() {
fun channelItemWithoutCurrentUser() = runScreenshotTest {
ChannelItem(
channelItem = ChannelItemState(
channel = TestData.channel1().apply {
channel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
)
),
messages = listOf(
TestData.message1(),
TestData.message2(),
)
lastMessageAt = TestData.date2()
},
),
lastMessageAt = TestData.date2(),
),
),
currentUser = null,
onChannelClick = {},
Expand All @@ -73,17 +73,17 @@ class ChannelItemTest : ComposeScreenshotTest() {
fun channelItemForMutedChannel() = runScreenshotTest {
ChannelItem(
channelItem = ChannelItemState(
channel = TestData.channel1().apply {
channel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
)
),
messages = listOf(
TestData.message1(),
TestData.message2(),
)
lastMessageAt = TestData.date2()
},
),
lastMessageAt = TestData.date2(),
),
isMuted = true,
),
currentUser = TestData.user1(),
Expand All @@ -96,12 +96,12 @@ class ChannelItemTest : ComposeScreenshotTest() {
fun channelItemForChannelWithoutMessages() = runScreenshotTest {
ChannelItem(
channelItem = ChannelItemState(
channel = TestData.channel1().apply {
channel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
)
},
),
),
),
currentUser = TestData.user1(),
onChannelClick = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ChannelListHeaderTest : ComposeScreenshotTest() {
ChannelListHeader(
title = "Stream Chat",
currentUser = TestData.user1(),
connectionState = ConnectionState.CONNECTED,
connectionState = ConnectionState.Connected,
)
}

Expand All @@ -38,7 +38,7 @@ class ChannelListHeaderTest : ComposeScreenshotTest() {
ChannelListHeader(
title = "Stream Chat",
currentUser = TestData.user1(),
connectionState = ConnectionState.CONNECTING,
connectionState = ConnectionState.Connecting,
)
}

Expand All @@ -47,7 +47,7 @@ class ChannelListHeaderTest : ComposeScreenshotTest() {
ChannelListHeader(
title = "Stream Chat",
currentUser = TestData.user1(),
connectionState = ConnectionState.OFFLINE,
connectionState = ConnectionState.Offline,
)
}

Expand All @@ -56,7 +56,7 @@ class ChannelListHeaderTest : ComposeScreenshotTest() {
ChannelListHeader(
title = "Stream Chat",
currentUser = null,
connectionState = ConnectionState.CONNECTED,
connectionState = ConnectionState.Connected,
)
}

Expand All @@ -65,7 +65,7 @@ class ChannelListHeaderTest : ComposeScreenshotTest() {
ChannelListHeader(
title = "",
currentUser = TestData.user1(),
connectionState = ConnectionState.CONNECTED,
connectionState = ConnectionState.Connected,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,52 +36,52 @@ class ChannelListTest : ComposeScreenshotTest() {
isLoadingMore = false,
channelItems = listOf(
ChannelItemState(
channel = TestData.channel1().apply {
channel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
)
),
messages = listOf(
TestData.message1(),
)
lastMessageAt = TestData.date1()
},
),
lastMessageAt = TestData.date1(),
),
),
ChannelItemState(
channel = TestData.channel2().apply {
channel = TestData.channel2().copy(
members = listOf(
TestData.member1(),
TestData.member3(),
)
),
messages = listOf(
TestData.message2(),
)
lastMessageAt = TestData.date2()
},
),
lastMessageAt = TestData.date2(),
),
),
ChannelItemState(
channel = TestData.channel3().apply {
channel = TestData.channel3().copy(
members = listOf(
TestData.member1(),
TestData.member4(),
)
),
messages = listOf(
TestData.message3(),
)
lastMessageAt = TestData.date3()
},
),
lastMessageAt = TestData.date3(),
),
),
ChannelItemState(
channel = TestData.channel4().apply {
channel = TestData.channel4().copy(
members = listOf(
TestData.member1(),
TestData.member5(),
)
),
messages = listOf(
TestData.message4(),
)
lastMessageAt = TestData.date4()
},
),
lastMessageAt = TestData.date4(),
),
),
),
),
Expand Down Expand Up @@ -111,52 +111,52 @@ class ChannelListTest : ComposeScreenshotTest() {
isLoadingMore = true,
channelItems = listOf(
ChannelItemState(
channel = TestData.channel1().apply {
channel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
)
),
messages = listOf(
TestData.message1(),
)
lastMessageAt = TestData.date1()
},
),
lastMessageAt = TestData.date1(),
),
),
ChannelItemState(
channel = TestData.channel2().apply {
channel = TestData.channel2().copy(
members = listOf(
TestData.member1(),
TestData.member3(),
)
),
messages = listOf(
TestData.message2(),
)
lastMessageAt = TestData.date2()
},
),
lastMessageAt = TestData.date2(),
),
),
ChannelItemState(
channel = TestData.channel3().apply {
channel = TestData.channel3().copy(
members = listOf(
TestData.member1(),
TestData.member4(),
)
),
messages = listOf(
TestData.message3(),
)
lastMessageAt = TestData.date3()
},
),
lastMessageAt = TestData.date3(),
),
),
ChannelItemState(
channel = TestData.channel4().apply {
channel = TestData.channel4().copy(
members = listOf(
TestData.member1(),
TestData.member5(),
)
),
messages = listOf(
TestData.message4(),
)
lastMessageAt = TestData.date4()
},
),
lastMessageAt = TestData.date4(),
),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ class SelectedChannelMenuTest : ComposeScreenshotTest() {
Box(modifier = Modifier.fillMaxSize()) {
SelectedChannelMenu(
modifier = Modifier.align(Alignment.BottomCenter),
selectedChannel = TestData.channel1().apply {
selectedChannel = TestData.channel1().copy(
members = listOf(
TestData.member1(),
TestData.member2(),
TestData.member3(),
TestData.member4(),
TestData.member5(),
)
messages = listOf(TestData.message1())
},
),
messages = listOf(TestData.message1()),
),
isMuted = false,
currentUser = TestData.user1(),
onChannelOptionClick = {},
Expand Down
Loading

0 comments on commit 25a604c

Please sign in to comment.