Various test fixes (#873)

* Switch back to macos-12 and see if the tests work

* Fix unit tests, add default invited, joined and active member counts to the mock room proxy

* Try running UI tests on 14.3 but on an existing iPad simulator

* Revert "Try running UI tests on 14.3 but on an existing iPad simulator"

This reverts commit b075e7fa384330a9070dc35ed4dded57e0af26e1.
This commit is contained in:
Stefan Ceriu
2023-05-11 16:28:35 +03:00
committed by GitHub
parent 16eb3311f0
commit 3468ed2a02
8 changed files with 28 additions and 21 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ on:
jobs: jobs:
integration_tests: integration_tests:
name: Integration Tests name: Integration Tests
runs-on: macos-13 runs-on: macos-12
concurrency: concurrency:
# Only allow a single run of this workflow on each branch, automatically cancelling older runs. # Only allow a single run of this workflow on each branch, automatically cancelling older runs.
+1 -1
View File
@@ -9,7 +9,7 @@ on:
jobs: jobs:
tests: tests:
name: Tests name: Tests
runs-on: macos-13 runs-on: macos-12
concurrency: concurrency:
# When running on develop, use the sha to allow all runs of this workflow to run concurrently. # When running on develop, use the sha to allow all runs of this workflow to run concurrently.
@@ -160,7 +160,7 @@ class AppCoordinator: AppCoordinatorProtocol {
case (.signingOut, .completedSigningOut(let isSoft), .signedOut): case (.signingOut, .completedSigningOut(let isSoft), .signedOut):
self.presentSplashScreen(isSoftLogout: isSoft) self.presentSplashScreen(isSoftLogout: isSoft)
case (.signedIn, .clearCache, .initial): case (.signedIn, .clearCache, .initial):
clearCache() self.clearCache()
default: default:
fatalError("Unknown transition: \(context)") fatalError("Unknown transition: \(context)")
} }
@@ -414,21 +414,21 @@ class RoomProxyMock: RoomProxyProtocol {
set(value) { underlyingMembersPublisher = value } set(value) { underlyingMembersPublisher = value }
} }
var underlyingMembersPublisher: AnyPublisher<[RoomMemberProxyProtocol], Never>! var underlyingMembersPublisher: AnyPublisher<[RoomMemberProxyProtocol], Never>!
var invitedMembersCount: UInt64 { var invitedMembersCount: UInt {
get { return underlyingInvitedMembersCount } get { return underlyingInvitedMembersCount }
set(value) { underlyingInvitedMembersCount = value } set(value) { underlyingInvitedMembersCount = value }
} }
var underlyingInvitedMembersCount: UInt64! var underlyingInvitedMembersCount: UInt!
var joinedMembersCount: UInt64 { var joinedMembersCount: UInt {
get { return underlyingJoinedMembersCount } get { return underlyingJoinedMembersCount }
set(value) { underlyingJoinedMembersCount = value } set(value) { underlyingJoinedMembersCount = value }
} }
var underlyingJoinedMembersCount: UInt64! var underlyingJoinedMembersCount: UInt!
var activeMembersCount: UInt64 { var activeMembersCount: UInt {
get { return underlyingActiveMembersCount } get { return underlyingActiveMembersCount }
set(value) { underlyingActiveMembersCount = value } set(value) { underlyingActiveMembersCount = value }
} }
var underlyingActiveMembersCount: UInt64! var underlyingActiveMembersCount: UInt!
//MARK: - loadAvatarURLForUserId //MARK: - loadAvatarURLForUserId
@@ -33,6 +33,10 @@ struct RoomProxyMockConfiguration {
var hasUnreadNotifications = Bool.random() var hasUnreadNotifications = Bool.random()
var members: [RoomMemberProxyProtocol]? var members: [RoomMemberProxyProtocol]?
var inviter: RoomMemberProxyMock? var inviter: RoomMemberProxyMock?
var invitedMembersCount: UInt = 100
var joinedMembersCount: UInt = 50
var activeMembersCount: UInt = 25
} }
extension RoomProxyMock { extension RoomProxyMock {
@@ -52,6 +56,10 @@ extension RoomProxyMock {
canonicalAlias = configuration.canonicalAlias canonicalAlias = configuration.canonicalAlias
alternativeAliases = configuration.alternativeAliases alternativeAliases = configuration.alternativeAliases
hasUnreadNotifications = configuration.hasUnreadNotifications hasUnreadNotifications = configuration.hasUnreadNotifications
invitedMembersCount = configuration.invitedMembersCount
joinedMembersCount = configuration.joinedMembersCount
activeMembersCount = configuration.activeMembersCount
if let members = configuration.members { if let members = configuration.members {
membersPublisher = Just(members).eraseToAnyPublisher() membersPublisher = Just(members).eraseToAnyPublisher()
@@ -44,9 +44,6 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
case .send: case .send:
Task { Task {
startLoading() startLoading()
defer {
stopLoading()
}
switch await mediaUploadingPreprocessor.processMedia(at: url) { switch await mediaUploadingPreprocessor.processMedia(at: url) {
case .success(let mediaInfo): case .success(let mediaInfo):
@@ -58,9 +55,11 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
showError(label: L10n.screenMediaUploadPreviewErrorFailedSending) showError(label: L10n.screenMediaUploadPreviewErrorFailedSending)
} }
stopLoading()
case .failure(let error): case .failure(let error):
MXLog.error("Failed processing media to upload with error: \(error)") MXLog.error("Failed processing media to upload with error: \(error)")
showError(label: L10n.screenMediaUploadPreviewErrorFailedProcessing) showError(label: L10n.screenMediaUploadPreviewErrorFailedProcessing)
stopLoading()
} }
} }
@@ -441,16 +441,16 @@ class RoomProxy: RoomProxyProtocol {
} }
} }
var invitedMembersCount: UInt64 { var invitedMembersCount: UInt {
room.invitedMembersCount() UInt(room.invitedMembersCount())
} }
var joinedMembersCount: UInt64 { var joinedMembersCount: UInt {
room.joinedMembersCount() UInt(room.joinedMembersCount())
} }
var activeMembersCount: UInt64 { var activeMembersCount: UInt {
room.activeMembersCount() UInt(room.activeMembersCount())
} }
// MARK: - Private // MARK: - Private
@@ -105,11 +105,11 @@ protocol RoomProxyProtocol {
func fetchDetails(for eventID: String) func fetchDetails(for eventID: String)
var invitedMembersCount: UInt64 { get } var invitedMembersCount: UInt { get }
var joinedMembersCount: UInt64 { get } var joinedMembersCount: UInt { get }
var activeMembersCount: UInt64 { get } var activeMembersCount: UInt { get }
} }
extension RoomProxyProtocol { extension RoomProxyProtocol {