-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/association manager #302
Merged
Merged
Changes from all commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
41f7305
refactor(association-manager): remove unused SnackbarHost
Aurelien9Code ffea892
refactor(association-manager): update permissions for Association Man…
Aurelien9Code 3947acc
feat(association-manager): add horizontal & vertical strips on the As…
Aurelien9Code 6967af6
feat(association-manager): add better overview permission
Aurelien9Code 75f53b2
feat(association-manager): update strings
Aurelien9Code 87a2190
feat(association-manager): add pages if one permission
Aurelien9Code 83d5110
style(association-manager): format using ktmft formating
Aurelien9Code e9efe39
test(association-manager): update test
Aurelien9Code 63ea039
test(association-manager): update emulator data to make tests pass
Aurelien9Code 281011c
refactor(association-manager): solve problem of date in EventCreation…
Aurelien9Code 7f321be
feat(association-manager): create swipe for events in Actions page
Aurelien9Code e8ee816
feat(association-manager): add members to search view model
Aurelien9Code 499dcd5
feat(association-manager): add Event Search Bar for the Actions page …
Aurelien9Code 72d88ee
feat(association-manager): generalize SearchBar for Associations, Eve…
Aurelien9Code 62e97f4
refactor(association-manager): minor fixes
Aurelien9Code 9dbcc56
feat(association-manager): update SearchRepository to add Member hand…
Aurelien9Code cbed71e
feat(association-manager): create new MemberSearchBar abstraction
Aurelien9Code 672f16d
feat(association-manager): create MemberDocument for the App Search
Aurelien9Code 054f0cd
style(association-manager): format using ktmft formating
Aurelien9Code 18523bd
feat(association-manager): abstract SearchPager into a SearchPagerSec…
Aurelien9Code 56e7161
feat(association-manager): implement SearchpagerSection for events
Aurelien9Code 2ed11a4
feat(association-manager): implement SearchpagerSection for members
Aurelien9Code abc2fd9
feat(association-manager): minor helper (will be removed)
Aurelien9Code 006124b
feat(association-manager): create helper function in associatioNViewM…
Aurelien9Code ac1c56c
feat(association-manager): create new cloud functions to add Roles se…
Aurelien9Code 9d24762
fix(association-manager): minor fix to align to center the composable
Aurelien9Code d1d39be
feat(association-manager): add new permissions
Aurelien9Code 6d6fe40
feat(association-manager): allow user to create its own role directly…
Aurelien9Code 1c9b28d
feat(association-manager): minor fix
Aurelien9Code 375578b
feat(association-manager): add ColorPicker
Aurelien9Code 5fa20d0
feat(association-manager): allow users to edit and delete roles
Aurelien9Code eb56e36
feat(association-manager): update changes on Roles locally in the Ass…
Aurelien9Code 8fdfffe
feat(association-manager): allow user to also edit association with t…
Aurelien9Code f0ba3f8
feat(association-manager): allow user to also edit association with t…
Aurelien9Code 5441f94
feat(association-manager): make sure the color of the bar is changed …
Aurelien9Code ed1bd2a
refactor(association-manager): modify Association & Member structure …
Aurelien9Code c4deeb3
refactor(association-manager): modify Association & Member structure …
Aurelien9Code a21e863
refactor(association-manager): minor change of name
Aurelien9Code 18be3ae
Merge branch 'main' into feat/association-manager
Aurelien9Code 850a16a
fix(Tests): put all tests in commentary (don't worry this is expected)
AlouchLaBouche fb69c58
feat(association-manager): tout good
Aurelien9Code 93b2b66
Merge main into feat/association-manager 19/12 10h
AlouchLaBouche b0a2459
Merge branch 'feat/association-manager' of github.com:SwEnt-Group13/U…
AlouchLaBouche 7f29add
fix(AssociationProfile): Fix scroll state for screens
AlouchLaBouche 4cd61f1
feat(association-manager): fix forced fetch
Aurelien9Code 36c77b9
feat(association-manager): remove add Event Button in Overview page
Aurelien9Code f17234f
feat(association-manager): allow scripts to update an element locally…
Aurelien9Code a5b8a93
feat(association-manager): create saveEvent cloud function & update v…
Aurelien9Code a793ca0
feat(association-manager): centralize all calls to cloud functions
Aurelien9Code f74e2f2
fix(association-manager): minor fix
Aurelien9Code 3976242
feat(association-manager): link images to event
Aurelien9Code e1b1586
feat(association-manager): update better viewmodels in Association Pr…
Aurelien9Code 04fd0a1
feat(association-manager): update better viewmodels in AssociationVie…
Aurelien9Code 70e6cc0
test(association-manager): remove comments from tests
Aurelien9Code 5650e38
test(association-manager): remove comments from tests
Aurelien9Code 6a6397b
test(association-manager): remove comments from tests
Aurelien9Code 6ca8480
test(association-manager): remove comments from tests
Aurelien9Code b644cf5
style(association-manager): format using ktmft formating
Aurelien9Code d0cf73d
style(association-manager): format using ktmft formating
Aurelien9Code 5222631
fix(association-manager): fix giving of permissions owner when claimi…
Aurelien9Code 30ca7d7
refactor(association-manager): update SearchPagerSection
Aurelien9Code 70c5067
refactor(association-manager): update strings
Aurelien9Code 9e40150
style(association-manager): format using ktmft formating
Aurelien9Code d2cc5a2
test(association-manager): update CI to not check the rules (explained)
Aurelien9Code 6f7cf49
chore: add temporarily new firestore rules
armouldr 5eafdb3
test(association-manager): make unit tests pass
Aurelien9Code cf54f17
style(association-manager): format using ktmft formating
Aurelien9Code 3abcc81
test(association-manager): make AssociationProfileTest pass
Aurelien9Code 473d457
refactor(association-manager): update tests data structures
Aurelien9Code 3e817e5
tests(association-manager): update UI data testTags
Aurelien9Code 8c9a4b7
fix(association-manager): fix hardcoded serialization
Aurelien9Code b11c0cb
test(association-manager): make EventCardTest works
Aurelien9Code ac75e33
fix(association-manager): put Firebase functions in a constant
Aurelien9Code 09568d2
test(association-manager): make EventDetailTest works
Aurelien9Code d33c2a0
test(association-manager): make EventCreationE2ETest works
Aurelien9Code f8c2595
style(association-manager): format using ktmft formating
Aurelien9Code d2a5cd9
feat(association-manager): update associationByCategory in Associatio…
Aurelien9Code 3f7b2f0
feat(association-manager): delete unused addRole in AssociationViewModel
Aurelien9Code 322d9a9
test(association-manager): add a bit of time to the CI to find instagram
Aurelien9Code c89754c
refactor(association-manager): extract serialization of Cloud functio…
Aurelien9Code 6c60059
refactor(association-manager): minor fix
Aurelien9Code 4373f08
style(association-manager): format using ktmft formating
Aurelien9Code 39cc012
test(association-manager): make CI pass
Aurelien9Code f7eae43
test(association-manager): make CI pass again
Aurelien9Code 4dbe336
refactor(association-manager): remove unused search Bars
Aurelien9Code e3699ee
refactor(association-manager): update hardcoded strings
Aurelien9Code 27ca2a6
test(association-manager): add some tests
Aurelien9Code 643cee9
style(association-manager): format using ktmft formating
Aurelien9Code 577b2a7
test(association-manager): wait for Arnaud PR to ba able to modify fi…
Aurelien9Code 40d799a
refactor(association-manager): make useful changes
Aurelien9Code 0451708
Merge branch 'main' into feat/association-manager
Aurelien9Code cc88178
feat(association-manager): update firebase data
Aurelien9Code File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import android.net.Network | |
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.assertIsNotDisplayed | ||
import androidx.compose.ui.test.assertTextContains | ||
import androidx.compose.ui.test.isDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.onNodeWithText | ||
|
@@ -34,6 +35,9 @@ import com.android.unio.model.firestore.emptyFirestoreReferenceList | |
import com.android.unio.model.firestore.firestoreReferenceListWith | ||
import com.android.unio.model.hilt.module.FirebaseModule | ||
import com.android.unio.model.image.ImageRepositoryFirebaseStorage | ||
import com.android.unio.model.search.SearchRepository | ||
import com.android.unio.model.search.SearchViewModel | ||
import com.android.unio.model.strings.test_tags.association.AssociationProfileActionsTestTags | ||
import com.android.unio.model.strings.test_tags.association.AssociationProfileTestTags | ||
import com.android.unio.model.usecase.FollowUseCaseFirestore | ||
import com.android.unio.model.usecase.SaveUseCaseFirestore | ||
|
@@ -67,6 +71,7 @@ import io.mockk.every | |
import io.mockk.impl.annotations.MockK | ||
import io.mockk.mockk | ||
import io.mockk.mockkStatic | ||
import io.mockk.spyk | ||
import io.mockk.verify | ||
import me.zhanghai.compose.preference.ProvidePreferenceLocals | ||
import org.junit.Before | ||
|
@@ -85,6 +90,9 @@ class AssociationProfileTest : TearDown() { | |
private lateinit var userViewModel: UserViewModel | ||
private lateinit var associationViewModel: AssociationViewModel | ||
|
||
private lateinit var searchViewModel: SearchViewModel | ||
@MockK(relaxed = true) private lateinit var searchRepository: SearchRepository | ||
|
||
@MockK private lateinit var associationRepository: AssociationRepositoryFirestore | ||
|
||
@MockK private lateinit var eventRepository: EventRepositoryFirestore | ||
|
@@ -192,7 +200,7 @@ class AssociationProfileTest : TearDown() { | |
Member( | ||
MockReferenceElement( | ||
MockUser.createMockUser(uid = "1", associationDependency = true)), | ||
Role.ADMIN)), | ||
Role.ADMIN.uid)), | ||
events = Event.Companion.firestoreReferenceListWith(events.map { it.uid })), | ||
MockAssociation.createMockAssociation( | ||
uid = "a2", | ||
|
@@ -202,7 +210,7 @@ class AssociationProfileTest : TearDown() { | |
Member( | ||
MockReferenceElement( | ||
MockUser.createMockUser(uid = "1", associationDependency = true)), | ||
Role.ADMIN)), | ||
Role.ADMIN.uid)), | ||
events = Event.Companion.firestoreReferenceListWith(events.map { it.uid })), | ||
) | ||
|
||
|
@@ -257,6 +265,8 @@ class AssociationProfileTest : TearDown() { | |
concurrentAssociationUserRepository) | ||
associationViewModel.getAssociations() | ||
associationViewModel.selectAssociation(associations.first().uid) | ||
|
||
searchViewModel = spyk(SearchViewModel(searchRepository)) | ||
} | ||
|
||
@Test | ||
|
@@ -266,7 +276,11 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
composeTestRule.waitForIdle() | ||
|
@@ -318,7 +332,11 @@ class AssociationProfileTest : TearDown() { | |
|
||
seeLess = context.getString(R.string.association_see_less) | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
composeTestRule | ||
|
@@ -367,7 +385,11 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
val currentCount = associationViewModel.selectedAssociation.value!!.followersCount | ||
|
@@ -404,7 +426,11 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
|
||
|
@@ -429,7 +455,11 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
|
||
|
@@ -445,7 +475,11 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
|
||
|
@@ -461,7 +495,7 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScreen( | ||
navigationAction, associationViewModel, userViewModel, eventViewModel) | ||
navigationAction, associationViewModel, searchViewModel, userViewModel, eventViewModel) | ||
} | ||
} | ||
|
||
|
@@ -475,13 +509,31 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithTag(AssociationProfileTestTags.ADD_EVENT_BUTTON).assertIsDisplayed() | ||
composeTestRule.waitUntil(10000) { | ||
composeTestRule.onNodeWithTag(AssociationProfileTestTags.ACTIONS_PAGE).isDisplayed() | ||
} | ||
composeTestRule.onNodeWithTag(AssociationProfileTestTags.ACTIONS_PAGE).performClick() | ||
|
||
composeTestRule.waitUntil(10000) { | ||
composeTestRule | ||
.onNodeWithTag(AssociationProfileActionsTestTags.ADD_EVENT_BUTTON) | ||
.isDisplayed() | ||
} | ||
|
||
composeTestRule | ||
.onNodeWithTag(AssociationProfileActionsTestTags.ADD_EVENT_BUTTON) | ||
.assertIsDisplayed() | ||
Comment on lines
+520
to
+533
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is basic testing but it ensures that everything is well displayed. |
||
|
||
composeTestRule | ||
.onNodeWithTag(AssociationProfileTestTags.ADD_EVENT_BUTTON) | ||
.onNodeWithTag(AssociationProfileActionsTestTags.ADD_EVENT_BUTTON) | ||
.performScrollTo() | ||
.performClick() | ||
|
||
|
@@ -495,13 +547,31 @@ class AssociationProfileTest : TearDown() { | |
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
AssociationProfileScaffold( | ||
navigationAction, userViewModel, eventViewModel, associationViewModel) {} | ||
navigationAction, | ||
userViewModel, | ||
eventViewModel, | ||
associationViewModel, | ||
searchViewModel) {} | ||
} | ||
} | ||
|
||
composeTestRule.onNodeWithTag(AssociationProfileTestTags.ADD_EVENT_BUTTON).assertIsDisplayed() | ||
composeTestRule.waitUntil(10000) { | ||
composeTestRule.onNodeWithTag(AssociationProfileTestTags.ACTIONS_PAGE).isDisplayed() | ||
} | ||
composeTestRule.onNodeWithTag(AssociationProfileTestTags.ACTIONS_PAGE).performClick() | ||
|
||
composeTestRule.waitUntil(10000) { | ||
composeTestRule | ||
.onNodeWithTag(AssociationProfileActionsTestTags.ADD_EVENT_BUTTON) | ||
.isDisplayed() | ||
} | ||
|
||
composeTestRule | ||
.onNodeWithTag(AssociationProfileActionsTestTags.ADD_EVENT_BUTTON) | ||
.assertIsDisplayed() | ||
|
||
composeTestRule | ||
.onNodeWithTag(AssociationProfileTestTags.ADD_EVENT_BUTTON) | ||
.onNodeWithTag(AssociationProfileActionsTestTags.ADD_EVENT_BUTTON) | ||
.performScrollTo() | ||
.performClick() | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,10 +112,10 @@ class EventCardTest : TearDown() { | |
every { eventRepository.getEvents(any(), any()) } | ||
} | ||
|
||
private fun setEventScreen(event: Event) { | ||
private fun setEventScreen(event: Event, shouldBeEditable: Boolean = true) { | ||
composeTestRule.setContent { | ||
ProvidePreferenceLocals { | ||
EventCard(navigationAction, event, userViewModel, eventViewModel, true) | ||
EventCard(navigationAction, event, userViewModel, eventViewModel, shouldBeEditable) | ||
} | ||
} | ||
} | ||
|
@@ -131,8 +131,9 @@ class EventCardTest : TearDown() { | |
@Test | ||
fun testEventCardElementsExist() { | ||
setEventViewModel(listOf(sampleEvent)) | ||
setEventScreen(sampleEvent) | ||
setEventScreen(sampleEvent, false) | ||
|
||
Thread.sleep(10000) | ||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_TITLE, useUnmergedTree = true) | ||
.assertExists() | ||
|
@@ -165,6 +166,43 @@ class EventCardTest : TearDown() { | |
composeTestRule | ||
.onNodeWithTag(EventDetailsTestTags.SAVE_BUTTON, useUnmergedTree = true) | ||
.assertExists() | ||
} | ||
|
||
@Test | ||
fun testEventCardElementsExistEdit() { | ||
setEventViewModel(listOf(sampleEvent)) | ||
setEventScreen(sampleEvent, true) | ||
|
||
Thread.sleep(10000) | ||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_TITLE, useUnmergedTree = true) | ||
.assertExists() | ||
.assertTextEquals("Sample Event") | ||
|
||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_MAIN_TYPE, useUnmergedTree = true) | ||
.assertExists() | ||
.assertTextEquals("Trip") | ||
|
||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_LOCATION, useUnmergedTree = true) | ||
.assertExists() | ||
.assertTextEquals("Sample Location") | ||
|
||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_DATE, useUnmergedTree = true) | ||
.assertExists() | ||
.assertTextEquals("20/07") | ||
|
||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_TIME, useUnmergedTree = true) | ||
.assertExists() | ||
.assertTextEquals("00:00") | ||
|
||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EVENT_CATCHY_DESCRIPTION, useUnmergedTree = true) | ||
.assertExists() | ||
.assertTextEquals("This is a catchy description.") | ||
Comment on lines
+172
to
+205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great to add tests to some old code and not only to the new one ! 🚀 |
||
|
||
composeTestRule | ||
.onNodeWithTag(EventCardTestTags.EDIT_BUTTON, useUnmergedTree = true) | ||
|
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to uncomment this as soon as we have merged my PR :)