-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/shields_not_shown_in_group_participan…
…ts_list-cherry-pick-cherry-pick
- Loading branch information
Showing
15 changed files
with
346 additions
and
25 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
...src/androidTest/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroupTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2024 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.android.ui.userprofile.other | ||
|
||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithContentDescription | ||
import com.wire.android.ui.WireTestTheme | ||
import com.wire.android.ui.home.conversationslist.model.Membership | ||
import com.wire.android.ui.userprofile.other.OtherUserStubs.provideState | ||
import kotlinx.coroutines.test.runTest | ||
import kotlinx.datetime.Instant | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class OtherUserProfileGroupTest { | ||
@get:Rule | ||
val composeTestRule by lazy { createComposeRule() } | ||
|
||
@Test | ||
fun givenARoleSelectionComponentIsShow_ShouldNotAllowModificationForTempUsers() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
OtherUserProfileGroup( | ||
provideState(withExpireAt = Instant.DISTANT_FUTURE.toEpochMilliseconds()), | ||
onRemoveFromConversation = {}, | ||
openChangeRoleBottomSheet = {}, | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithContentDescription("Edit").assertDoesNotExist() | ||
} | ||
|
||
@Test | ||
fun givenARoleSelectionComponentIsShow_ShouldNotAllowModificationForUsersWithoutMetadata() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
OtherUserProfileGroup( | ||
provideState(withUserName = "", withFullName = ""), | ||
onRemoveFromConversation = {}, | ||
openChangeRoleBottomSheet = {}, | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithContentDescription("Edit").assertDoesNotExist() | ||
} | ||
|
||
@Test | ||
fun givenARoleSelectionComponentIsShow_ShouldNotAllowModificationForFederatedUsers() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
OtherUserProfileGroup( | ||
provideState(withMembership = Membership.Federated), | ||
onRemoveFromConversation = {}, | ||
openChangeRoleBottomSheet = {}, | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithContentDescription("Edit").assertDoesNotExist() | ||
} | ||
|
||
@Test | ||
fun givenARoleSelectionComponentIsShow_ShouldNotAllowModificationForServices() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
OtherUserProfileGroup( | ||
provideState(withMembership = Membership.Service), | ||
onRemoveFromConversation = {}, | ||
openChangeRoleBottomSheet = {}, | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithContentDescription("Edit").assertDoesNotExist() | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...rc/androidTest/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2024 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.android.ui.userprofile.other | ||
|
||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import com.wire.android.ui.WireTestTheme | ||
import com.wire.android.ui.connection.CONNECTION_ACTION_BUTTONS_TEST_TAG | ||
import com.wire.android.ui.home.conversationslist.model.Membership | ||
import com.wire.android.ui.theme.wireDimensions | ||
import com.wire.android.ui.userprofile.other.OtherUserStubs.provideState | ||
import kotlinx.coroutines.test.runTest | ||
import kotlinx.datetime.Instant | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class OtherUserProfileScreenTest { | ||
@get:Rule | ||
val composeTestRule by lazy { createComposeRule() } | ||
|
||
@Test | ||
fun givenOtherUserProfileFooter_ShouldNotShowConnectButtonForTempUsers() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
ContentFooter( | ||
state = provideState(withExpireAt = Instant.DISTANT_FUTURE.toEpochMilliseconds()), | ||
maxBarElevation = MaterialTheme.wireDimensions.topBarShadowElevation | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithTag(CONNECTION_ACTION_BUTTONS_TEST_TAG).assertDoesNotExist() | ||
} | ||
|
||
@Test | ||
fun givenOtherUserProfileFooter_ShouldNotShowConnectButtonForUsersWithoutMetadata() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
ContentFooter( | ||
state = provideState(withUserName = "", withFullName = ""), | ||
maxBarElevation = MaterialTheme.wireDimensions.topBarShadowElevation | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithTag(CONNECTION_ACTION_BUTTONS_TEST_TAG).assertDoesNotExist() | ||
} | ||
|
||
@Test | ||
fun givenOtherUserProfileFooter_ShouldNotShowConnectButtonForServices() = runTest { | ||
composeTestRule.setContent { | ||
WireTestTheme { | ||
ContentFooter( | ||
state = provideState(withMembership = Membership.Service), | ||
maxBarElevation = MaterialTheme.wireDimensions.topBarShadowElevation | ||
) | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithTag(CONNECTION_ACTION_BUTTONS_TEST_TAG).assertDoesNotExist() | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/androidTest/kotlin/com/wire/android/ui/userprofile/other/OtherUserStubs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2024 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.android.ui.userprofile.other | ||
|
||
import com.wire.android.ui.home.conversationslist.model.Membership | ||
import com.wire.kalium.logic.data.conversation.Conversation.Member | ||
import com.wire.kalium.logic.data.id.ConversationId | ||
import com.wire.kalium.logic.data.user.UserId | ||
import kotlinx.datetime.Instant | ||
|
||
object OtherUserStubs { | ||
private val baseState = OtherUserProfileState( | ||
userId = UserId("some_user", "domain.com"), | ||
fullName = "name", | ||
userName = "username", | ||
teamName = "team", | ||
email = "email", | ||
groupState = OtherUserProfileGroupState( | ||
groupName = "group name", | ||
role = Member.Role.Member, | ||
isSelfAdmin = true, | ||
conversationId = ConversationId("some_user", "domain.com") | ||
) | ||
) | ||
|
||
fun provideState( | ||
withFullName: String = "name", | ||
withUserName: String = "username", | ||
withExpireAt: Long? = null, | ||
withMembership: Membership = Membership.Standard | ||
): OtherUserProfileState { | ||
return baseState.copy( | ||
fullName = withFullName, | ||
userName = withUserName, | ||
expiresAt = withExpireAt?.let { Instant.fromEpochMilliseconds(it) }, | ||
membership = withMembership | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- | ||
~ Wire | ||
~ Copyright (C) 2024 Wire Swiss GmbH | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ This program is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU General Public License | ||
~ along with this program. If not, see http://www.gnu.org/licenses/. | ||
--> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="108dp" | ||
android:height="108dp" | ||
android:viewportWidth="512" | ||
android:viewportHeight="512"> | ||
<group android:scaleX="0.3" | ||
android:scaleY="0.3" | ||
android:translateX="190" | ||
android:translateY="120.39214"> | ||
<group android:translateY="139.21875"> | ||
<path android:pathData="M12.9375,0L47.742188,0Q62.859375,0,73.546875,-6.0117188Q84.234375,-12.0234375,89.92969,-23.378906Q95.625,-34.734375,95.625,-50.695312L95.625,-50.835938Q95.625,-66.796875,89.92969,-78.11719Q84.234375,-89.4375,73.51172,-95.44922Q62.789062,-101.46094,47.742188,-101.46094L12.9375,-101.46094ZM25.59375,-11.390625L25.59375,-90.07031L46.898438,-90.07031Q58.148438,-90.07031,66.16406,-85.39453Q74.17969,-80.71875,78.43359,-71.89453Q82.6875,-63.070312,82.6875,-50.695312L82.6875,-50.554688Q82.6875,-38.25,78.46875,-29.460938Q74.25,-20.671875,66.234375,-16.03125Q58.21875,-11.390625,46.898438,-11.390625Z" | ||
android:fillColor="#000000"/> | ||
<path android:pathData="M140.32812,1.3359375Q147.00781,1.3359375,152.38672,-0.38671875Q157.76562,-2.109375,161.70312,-5.0273438Q165.64062,-7.9453125,168.13672,-11.566406Q170.63281,-15.1875,171.61719,-19.054688L171.75781,-19.617188L159.52344,-19.617188L159.24219,-18.984375Q158.25781,-16.734375,155.79688,-14.5546875Q153.33594,-12.375,149.53906,-10.96875Q145.74219,-9.5625,140.60938,-9.5625Q133.71875,-9.5625,128.65625,-12.621094Q123.59375,-15.6796875,120.85156,-21.410156Q118.109375,-27.140625,118.109375,-35.226562L118.109375,-40.078125Q118.109375,-48.585938,120.921875,-54.421875Q123.734375,-60.257812,128.55078,-63.246094Q133.36719,-66.234375,139.48438,-66.234375Q145.60156,-66.234375,150.3125,-63.38672Q155.02344,-60.539062,157.69531,-54.773438Q160.36719,-49.007812,160.36719,-40.078125L160.36719,-35.226562L166.41406,-44.15625L111.921875,-44.15625L111.921875,-34.382812L172.67188,-34.382812L172.67188,-39.164062Q172.67188,-50.484375,168.69922,-59.027344Q164.72656,-67.57031,157.3086,-72.35156Q149.89062,-77.13281,139.55469,-77.13281Q129.28906,-77.13281,121.625,-72.140625Q113.96094,-67.14844,109.77734,-58.289062Q105.59375,-49.429688,105.59375,-37.6875L105.59375,-37.617188Q105.59375,-25.734375,109.77734,-16.980469Q113.96094,-8.2265625,121.73047,-3.4453125Q129.5,1.3359375,140.32812,1.3359375Z" | ||
android:fillColor="#000000"/> | ||
<path android:pathData="M221.07812,1.3359375Q230.71094,1.3359375,237.84766,-3.515625Q244.98438,-8.3671875,248.92188,-17.191406Q252.85938,-26.015625,252.85938,-37.828125L252.85938,-37.96875Q252.85938,-49.851562,248.92188,-58.640625Q244.98438,-67.42969,237.84766,-72.28125Q230.71094,-77.13281,221.07812,-77.13281Q215.875,-77.13281,211.26953,-75.48047Q206.66406,-73.828125,203.11328,-70.875Q199.5625,-67.921875,197.45312,-63.84375L196.32812,-63.84375L196.32812,-105.890625L184.09375,-105.890625L184.09375,0L196.32812,0L196.32812,-12.09375L197.45312,-12.09375Q199.77344,-7.875,203.28906,-4.8867188Q206.80469,-1.8984375,211.30469,-0.28125Q215.80469,1.3359375,221.07812,1.3359375ZM218.26562,-9.4921875Q211.375,-9.4921875,206.38281,-12.9375Q201.39062,-16.382812,198.71875,-22.746094Q196.04688,-29.109375,196.04688,-37.828125L196.04688,-37.96875Q196.04688,-46.757812,198.71875,-53.085938Q201.39062,-59.414062,206.38281,-62.859375Q211.375,-66.30469,218.26562,-66.30469Q225.22656,-66.30469,230.14844,-62.89453Q235.07031,-59.484375,237.70703,-53.15625Q240.34375,-46.828125,240.34375,-37.96875L240.34375,-37.828125Q240.34375,-29.039062,237.70703,-22.675781Q235.07031,-16.3125,230.14844,-12.902344Q225.22656,-9.4921875,218.26562,-9.4921875Z" | ||
android:fillColor="#000000"/> | ||
<path android:pathData="M288.77344,1.3359375Q294.32812,1.3359375,298.72266,-0.140625Q303.1172,-1.6171875,306.28125,-4.4648438Q309.4453,-7.3125,311.27344,-11.3203125L312.39844,-11.3203125L312.39844,0L324.6328,0L324.6328,-75.796875L312.39844,-75.796875L312.39844,-30.9375Q312.39844,-25.945312,311.09766,-21.972656Q309.79688,-18,307.1953,-15.222656Q304.59375,-12.4453125,300.76172,-10.96875Q296.9297,-9.4921875,291.9375,-9.4921875Q282.8672,-9.4921875,278.89453,-14.484375Q274.92188,-19.476562,274.92188,-29.671875L274.92188,-75.796875L262.6875,-75.796875L262.6875,-26.71875Q262.6875,-17.789062,265.60547,-11.496094Q268.52344,-5.203125,274.35938,-1.9335938Q280.1953,1.3359375,288.77344,1.3359375Z" | ||
android:fillColor="#000000"/> | ||
<path android:pathData="M370.60938,26.71875Q380.9453,26.71875,388.53906,23.308594Q396.1328,19.898438,400.2461,13.640625Q404.35938,7.3828125,404.35938,-1.0546875L404.35938,-75.796875L392.125,-75.796875L392.125,-63.28125L391.28125,-63.28125Q388.96094,-67.57031,385.48047,-70.66406Q382,-73.75781,377.5,-75.44531Q373,-77.13281,367.65625,-77.13281Q357.7422,-77.13281,350.5703,-72.38672Q343.39844,-67.640625,339.4961,-59.378906Q335.59375,-51.117188,335.59375,-40.5L335.59375,-40.359375Q335.59375,-29.742188,339.46094,-21.515625Q343.32812,-13.2890625,350.46484,-8.613281Q357.60156,-3.9375,367.375,-3.9375Q372.57812,-3.9375,377.07812,-5.4492188Q381.57812,-6.9609375,385.16406,-9.9140625Q388.75,-12.8671875,391.14062,-17.015625L392.26562,-17.015625L392.26562,-1.6875Q392.26562,6.6796875,386.53516,11.285156Q380.8047,15.890625,370.60938,15.890625Q362.45312,15.890625,357.53125,13.113281Q352.60938,10.3359375,351.625,6.046875L351.5547,5.9765625L338.89844,5.9765625L338.7578,6.046875Q339.7422,12.234375,343.78516,16.910156Q347.82812,21.585938,354.64844,24.152344Q361.46875,26.71875,370.60938,26.71875ZM370.04688,-14.765625Q363.01562,-14.765625,358.1289,-18.035156Q353.2422,-21.304688,350.67578,-27.070312Q348.10938,-32.835938,348.10938,-40.359375L348.10938,-40.5Q348.10938,-48.023438,350.67578,-53.859375Q353.2422,-59.695312,358.1289,-63Q363.01562,-66.30469,370.04688,-66.30469Q377.07812,-66.30469,382.10547,-63Q387.1328,-59.695312,389.83984,-53.859375Q392.54688,-48.023438,392.54688,-40.5L392.54688,-40.359375Q392.54688,-32.835938,389.83984,-27.070312Q387.1328,-21.304688,382.10547,-18.035156Q377.07812,-14.765625,370.04688,-14.765625Z" | ||
android:fillColor="#000000"/> | ||
</group> | ||
</group> | ||
<group | ||
android:scaleX="0.65" | ||
android:scaleY="0.65" | ||
android:translateX="89.6" | ||
android:translateY="89.6"> | ||
<path | ||
android:fillColor="#000000" | ||
android:fillType="evenOdd" | ||
android:pathData="M256.84,348.61C271.08,359.55 288.54,365.42 306.45,365.42C351.4,365.42 388.74,327.69 388.74,282.85V154.11H369.4V282.76L369.4,282.77V282.77C369.49,296.45 365.09,309.68 357.01,320.62C336.7,347.98 298.42,354.09 270.64,334.81C282.57,320.11 289.14,301.75 289.05,282.75L289.05,179.13C288.74,161.79 274.34,147.3 256.97,147.01C239.15,146.71 223.99,161.29 223.7,179.13L223.7,282.76L223.7,282.76C223.8,301.65 230.49,320.25 242.55,334.81C232.06,342.02 219.62,345.97 206.85,345.97C172.32,345.97 143.43,317.35 143.34,282.75V154.11H124V282.95C124,328.52 161.36,365.52 206.85,365.52C224.96,365.52 242.51,359.56 256.84,348.61ZM256.37,165.79C263.78,165.79 269.71,171.81 269.71,179.15V282.76C269.71,296.83 265.03,310.49 256.38,321.57C247.79,310.49 243.03,296.82 243.03,282.76V179.15C243.03,171.73 249.04,165.79 256.37,165.79Z" /> | ||
</group> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.