public IEnumerator LandingPageUITests_ProjectList_Collaborators() { yield return(GivenUserIsLoggedInAndLandingScreenIsOpen()); var landingPageDialog = Resources.FindObjectsOfTypeAll <LandingScreenUIController>().First(); //When the project receives the list yield return(AddProjects(new[] { "A", "B", "C", "D", "E", "F", "G", "H" })); using (var roomSelector = UISelectorFactory.createSelector <IProjectRoom[]>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .rooms))) { //When User connects to Room A List <IProjectRoom> data = roomSelector.GetValue().ToList(); ((ProjectRoom)data[0]).users.Add(new UserIdentity("1", 1, "User Alpha", DateTime.UtcNow, null)); ((ProjectRoom)data[0]).users.Add(new UserIdentity("2", 2, "User Beta", DateTime.UtcNow.AddSeconds(5), null)); yield return(WaitAFrame()); //TODO switch to forceUpdate on Value change Dispatcher.Dispatch(SetProjectRoomAction.From(data.Cast <IProjectRoom>().ToArray())); } yield return(WaitAFrame()); //Then UI should display all projects with the searched string in the name var notFoundDisplayObj = GivenChildNamed(landingPageDialog.gameObject, "No Project Panel"); var projectListContainer = GivenGameObjectNamed("Project List Container"); var items = projectListContainer.GetComponentsInChildren <ProjectListItem>(); Assert.IsFalse(notFoundDisplayObj.activeInHierarchy); var avatars = items[0].gameObject.GetComponentsInChildren <UserDetailsUIController>(); Assert.AreEqual(2, avatars.Length); yield return(WaitAFrame()); }
IEnumerator ConnectAllUsers(string projectId, IEnumerable <UserIdentity> testUsers) { using (var RoomSelector = UISelectorFactory.createSelector <IProjectRoom[]>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .rooms))) { Assert.AreEqual(1, RoomSelector.GetValue().Length); var roomIndex = Array.FindIndex(RoomSelector.GetValue(), (r) => ((ProjectRoom)r).project.serverProjectId == projectId); foreach (var user in testUsers) { ((ProjectRoom)RoomSelector.GetValue()[roomIndex]).users.Add(user); Dispatcher.Dispatch(SetProjectRoomAction.From(RoomSelector.GetValue())); UIStateManager.current.ForceSendSessionStateChangedEvent(); } } foreach (var user in testUsers) { AddUserToRoom(new NetworkUserData() { matchmakerId = user.matchmakerId, lastUpdateTimeStamp = DateTime.Now, }); yield return(WaitAFrame()); } yield return(WaitAFrame()); }