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:
tests:
name: Tests
runs-on: perf-only
runs-on: macos-14
concurrency:
# 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([])
recentConversationCounterpartsReturnValue = []
getElementWellKnownReturnValue = .success(nil)
loadMediaContentForSourceThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaThumbnailForSourceWidthHeightThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaFileForSourceBodyThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ class Signposter {
private let logger = Logger(subsystem: subsystem, category: category)
/// Signpost name constants.
private enum Name {
enum Name {
static let login: StaticString = "Login"
static let firstSync: StaticString = "FirstSync"
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)))))
ServiceLocator.shared.settings.migratedAccounts[clientProxy.userID] = true
let appMediator = AppMediatorMock.default
appMediator.underlyingWindowManager = windowManager
let flowCoordinator = UserSessionFlowCoordinator(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
navigationRootCoordinator: navigationRootCoordinator,
appLockService: AppLockService(keychainController: KeychainControllerMock(),
@ -527,7 +530,7 @@ class MockScreen: Identifiable {
bugReportService: BugReportServiceMock(),
elementCallService: ElementCallServiceMock(.init()),
roomTimelineControllerFactory: RoomTimelineControllerFactoryMock(configuration: .init()),
appMediator: AppMediatorMock.default,
appMediator: appMediator,
appSettings: appSettings,
analytics: ServiceLocator.shared.analytics,
notificationManager: NotificationManagerMock(),

View File

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

View File

@ -77,8 +77,8 @@ class PreviewTests: XCTestCase {
fatalError("Unknown device name: \(deviceName)")
}
// Ignore specific device safe area
device.safeArea = .zero
// Ignore specific device safe area (using the workaround value to fix rendering issues).
device.safeArea = .one
// Ignore specific device display scale
let traits = UITraitCollection(displayScale: 2.0)
@ -159,7 +159,7 @@ class PreviewTests: XCTestCase {
if let simulatorDevice {
let deviceModel = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]
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
#endif
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):
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))
@ -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
// swiftformat:enable all

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