Upgrade the project to use Xcode 15.4 (#3027)

* Update snapshots for Xcode 15.4

* Update CI.

* Fix crashing UI test.

* Fix compile error in Integration Tests.

* Try putting UI tests on GH runners again.
This commit is contained in:
Doug 2024-07-11 17:38:32 +01:00 committed by GitHub
parent c164e47ea4
commit c92c6a28ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1133 changed files with 2265 additions and 2266 deletions

View File

@ -13,7 +13,7 @@ on:
jobs: jobs:
tests: tests:
name: Tests name: Tests
runs-on: perf-only runs-on: macos-14
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.

View File

@ -76,6 +76,8 @@ extension ClientProxyMock {
recentlyVisitedRoomsReturnValue = .success([]) recentlyVisitedRoomsReturnValue = .success([])
recentConversationCounterpartsReturnValue = [] recentConversationCounterpartsReturnValue = []
getElementWellKnownReturnValue = .success(nil)
loadMediaContentForSourceThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic) loadMediaContentForSourceThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaThumbnailForSourceWidthHeightThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic) loadMediaThumbnailForSourceWidthHeightThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaFileForSourceBodyThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic) loadMediaFileForSourceBodyThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)

View File

@ -31,6 +31,7 @@ struct FormActionButtonStyle: ButtonStyle {
Text(title) Text(title)
.foregroundColor(.compound.textPrimary) .foregroundColor(.compound.textPrimary)
.font(.compound.bodyLG) .font(.compound.bodyLG)
.textCase(.none)
} }
.padding(.horizontal, 4) .padding(.horizontal, 4)
.padding(.vertical, 8) .padding(.vertical, 8)

View File

@ -197,11 +197,11 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview {
}() }()
static var previews: some View { static var previews: some View {
NavigationView { NavigationStack {
CreateRoomScreen(context: viewModel.context) CreateRoomScreen(context: viewModel.context)
} }
.previewDisplayName("Create Room") .previewDisplayName("Create Room")
NavigationView { NavigationStack {
CreateRoomScreen(context: emtpyViewModel.context) CreateRoomScreen(context: emtpyViewModel.context)
} }
.previewDisplayName("Create Room without users") .previewDisplayName("Create Room without users")

View File

@ -95,7 +95,14 @@ struct EmojiPickerScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View { static var previews: some View {
EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"]) EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"])
.previewDisplayName("Screen") .previewDisplayName("Screen")
.snapshot(delay: 0.5)
}
}
struct EmojiPickerScreenSheet_Previews: PreviewProvider {
static let viewModel = EmojiPickerScreenViewModel(emojiProvider: EmojiProvider())
static var previews: some View {
Text("Timeline view") Text("Timeline view")
.sheet(isPresented: .constant(true)) { .sheet(isPresented: .constant(true)) {
EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"]) EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"])

View File

@ -68,6 +68,7 @@ struct RoomListFiltersEmptyStateView_Previews: PreviewProvider, TestablePreview
} }
RoomListFiltersEmptyStateView(state: .init(activeFilters: [.people, .favourites])) RoomListFiltersEmptyStateView(state: .init(activeFilters: [.people, .favourites]))
} }
.padding(.bottom)
.previewLayout(.sizeThatFits) .previewLayout(.sizeThatFits)
} }
} }

View File

@ -169,7 +169,7 @@ struct InviteUsersScreen_Previews: PreviewProvider, TestablePreview {
}() }()
static var previews: some View { static var previews: some View {
NavigationView { NavigationStack {
InviteUsersScreen(context: viewModel.context) InviteUsersScreen(context: viewModel.context)
} }
} }

View File

@ -140,7 +140,7 @@ struct StartChatScreen_Previews: PreviewProvider, TestablePreview {
}() }()
static var previews: some View { static var previews: some View {
NavigationView { NavigationStack {
StartChatScreen(context: viewModel.context) StartChatScreen(context: viewModel.context)
} }
} }

View File

@ -25,7 +25,7 @@ class Signposter {
private let logger = Logger(subsystem: subsystem, category: category) private let logger = Logger(subsystem: subsystem, category: category)
/// Signpost name constants. /// Signpost name constants.
private enum Name { enum Name {
static let login: StaticString = "Login" static let login: StaticString = "Login"
static let firstSync: StaticString = "FirstSync" static let firstSync: StaticString = "FirstSync"
static let firstRooms: StaticString = "FirstRooms" static let firstRooms: StaticString = "FirstRooms"

View File

@ -520,6 +520,9 @@ class MockScreen: Identifiable {
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms))))) let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
ServiceLocator.shared.settings.migratedAccounts[clientProxy.userID] = true ServiceLocator.shared.settings.migratedAccounts[clientProxy.userID] = true
let appMediator = AppMediatorMock.default
appMediator.underlyingWindowManager = windowManager
let flowCoordinator = UserSessionFlowCoordinator(userSession: UserSessionMock(.init(clientProxy: clientProxy)), let flowCoordinator = UserSessionFlowCoordinator(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
navigationRootCoordinator: navigationRootCoordinator, navigationRootCoordinator: navigationRootCoordinator,
appLockService: AppLockService(keychainController: KeychainControllerMock(), appLockService: AppLockService(keychainController: KeychainControllerMock(),
@ -527,7 +530,7 @@ class MockScreen: Identifiable {
bugReportService: BugReportServiceMock(), bugReportService: BugReportServiceMock(),
elementCallService: ElementCallServiceMock(.init()), elementCallService: ElementCallServiceMock(.init()),
roomTimelineControllerFactory: RoomTimelineControllerFactoryMock(configuration: .init()), roomTimelineControllerFactory: RoomTimelineControllerFactoryMock(configuration: .init()),
appMediator: AppMediatorMock.default, appMediator: appMediator,
appSettings: appSettings, appSettings: appSettings,
analytics: ServiceLocator.shared.analytics, analytics: ServiceLocator.shared.analytics,
notificationManager: NotificationManagerMock(), notificationManager: NotificationManagerMock(),

View File

@ -1,6 +1,6 @@
test_configuration: test_configuration:
- template_file_path: PreviewTests.stencil - template_file_path: PreviewTests.stencil
- simulator_device: "iPhone15" - simulator_device: "iPhone14,6" # iPhone SE 3rd Generation
- required_os: 17 - required_os: 17
- snapshot_devices: - snapshot_devices:
- iPhone 15 - iPhone 15

View File

@ -77,8 +77,8 @@ class PreviewTests: XCTestCase {
fatalError("Unknown device name: \(deviceName)") fatalError("Unknown device name: \(deviceName)")
} }
// Ignore specific device safe area // Ignore specific device safe area (using the workaround value to fix rendering issues).
device.safeArea = .zero device.safeArea = .one
// Ignore specific device display scale // Ignore specific device display scale
let traits = UITraitCollection(displayScale: 2.0) let traits = UITraitCollection(displayScale: 2.0)
@ -159,7 +159,7 @@ class PreviewTests: XCTestCase {
if let simulatorDevice { if let simulatorDevice {
let deviceModel = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] let deviceModel = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]
guard deviceModel?.contains(simulatorDevice) ?? false else { guard deviceModel?.contains(simulatorDevice) ?? false else {
fatalError("Switch to using \(simulatorDevice) for these tests.") fatalError("\(deviceModel ?? "Unknown") is the wrong one. Switch to using \(simulatorDevice) for these tests.")
} }
} }
@ -215,10 +215,12 @@ private extension Snapshotting where Value: SwiftUI.View, Format == UIImage {
config = deviceConfig config = deviceConfig
#endif #endif
case .sizeThatFits: case .sizeThatFits:
config = .init(safeArea: .zero, size: nil, traits: traits) // Make sure to use the workaround safe area insets.
config = .init(safeArea: .one, size: nil, traits: traits)
case let .fixed(width: width, height: height): case let .fixed(width: width, height: height):
let size = CGSize(width: width, height: height) let size = CGSize(width: width, height: height)
config = .init(safeArea: .zero, size: size, traits: traits) // Make sure to use the workaround safe area insets.
config = .init(safeArea: .one, size: size, traits: traits)
} }
return SimplySnapshotting<UIImage>(pathExtension: "png", diffing: .prefireImage(precision: precision, perceptualPrecision: perceptualPrecision, scale: traits.displayScale)) return SimplySnapshotting<UIImage>(pathExtension: "png", diffing: .prefireImage(precision: precision, perceptualPrecision: perceptualPrecision, scale: traits.displayScale))
@ -272,5 +274,11 @@ private extension Diffing where Value == UIImage {
} }
} }
private extension UIEdgeInsets {
/// A custom inset that prevents the snapshotting library from rendering the
/// origin at (10000, 10000) which breaks some of our views such as MessageText.
static var one: UIEdgeInsets { UIEdgeInsets(top: 1, left: 1, bottom: 1, right: 1) }
}
// swiftlint:enable all // swiftlint:enable all
// swiftformat:enable all // swiftformat:enable all

Some files were not shown because too many files have changed in this diff Show More