diff --git a/.swiftformat b/.swiftformat index 09b4ef180..d07296f9a 100644 --- a/.swiftformat +++ b/.swiftformat @@ -35,7 +35,7 @@ --rules redundantRawValues --rules redundantVoidReturnType --rules semicolons ---rules sortedImports +--rules sortImports --rules spaceAroundBraces --rules spaceAroundBrackets --rules spaceAroundComments @@ -81,4 +81,4 @@ --wrapcollections before-first # Exclude paths ---exclude Sources/StreamChatSwiftUI/Generated,Sources/StreamChatSwiftUI/StreamSwiftyGif,Sources/StreamChatSwiftUI/StreamNuke +--exclude Sources/StreamChatSwiftUI/Generated,Sources/StreamChatSwiftUI/StreamSwiftyGif,Sources/StreamChatSwiftUI/StreamNuke,vendor/bundle,Pods,spm_cache,derived_data,.build diff --git a/.swiftlint.yml b/.swiftlint.yml index 6a5da8f1b..4020346bd 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -5,6 +5,7 @@ excluded: - Sources/StreamChatSwiftUI/Generated - Sources/StreamChatSwiftUI/StreamSwiftyGif - Sources/StreamChatSwiftUI/StreamNuke + - vendor/bundle only_rules: - attribute_name_spacing @@ -43,7 +44,6 @@ only_rules: - trailing_comma - trailing_newline - trailing_semicolon - - trailing_whitespace - unneeded_break_in_switch - unneeded_override - unused_closure_parameter @@ -55,8 +55,5 @@ only_rules: multiline_arguments: only_enforce_after_first_closure_on_first_line: true -trailing_whitespace: - ignores_empty_lines: true - file_name_no_space: severity: error diff --git a/Scripts/GenerateSPMFileLists.swift b/Scripts/GenerateSPMFileLists.swift index e49785bc1..2debc37b2 100755 --- a/Scripts/GenerateSPMFileLists.swift +++ b/Scripts/GenerateSPMFileLists.swift @@ -34,7 +34,7 @@ func sourceFileList(at url: URL) -> [String] { let basePathRange = path.range(of: url.path + "/")! return String(path[basePathRange.upperBound...]) } - .filter { $0.hasSuffix("_Tests.swift") || $0.hasSuffix("_Mock.swift") || $0.contains("__Snapshots__")} + .filter { $0.hasSuffix("_Tests.swift") || $0.hasSuffix("_Mock.swift") || $0.contains("__Snapshots__") } return sourceFiles } @@ -59,8 +59,6 @@ newGeneratedContent += "] }\n" newGeneratedContent += "\n" - - // StreamChatUI excluded source files let streamChatUIExcludedFiles = sourceFileList(at: URL(string: "Sources/StreamChatUI")!) newGeneratedContent += "var streamChatUIFilesExcluded: [String] { [\n" diff --git a/StreamChatSwiftUITestsApp/AppDelegate.swift b/StreamChatSwiftUITestsApp/AppDelegate.swift index d3d6a5606..7a9bfa7c4 100644 --- a/StreamChatSwiftUITestsApp/AppDelegate.swift +++ b/StreamChatSwiftUITestsApp/AppDelegate.swift @@ -5,18 +5,21 @@ import SwiftUI class AppDelegate: NSObject, UIApplicationDelegate { - - func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { disableAnimations() registerForPushNotifications() UNUserNotificationCenter.current().delegate = NotificationsHandler.shared return true } - func application(_ application: UIApplication, - configurationForConnecting connectingSceneSession: UISceneSession, - options: UIScene.ConnectionOptions) -> UISceneConfiguration { + func application( + _ application: UIApplication, + configurationForConnecting connectingSceneSession: UISceneSession, + options: UIScene.ConnectionOptions + ) -> UISceneConfiguration { let sceneConfig = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) sceneConfig.delegateClass = SceneDelegate.self return sceneConfig @@ -44,13 +47,14 @@ class AppDelegate: NSObject, UIApplicationDelegate { } func application( - _ application: UIApplication, - didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data + _ application: UIApplication, + didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data ) { let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) } let token = tokenParts.joined() print("Device Token: \(token)") } + func application( _ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error diff --git a/StreamChatSwiftUITestsApp/CustomChannelHeader.swift b/StreamChatSwiftUITestsApp/CustomChannelHeader.swift index a3d98f602..c3269c9da 100644 --- a/StreamChatSwiftUITestsApp/CustomChannelHeader.swift +++ b/StreamChatSwiftUITestsApp/CustomChannelHeader.swift @@ -7,7 +7,6 @@ import StreamChatSwiftUI import SwiftUI public struct CustomChannelHeader: ToolbarContent { - @Injected(\.fonts) var fonts @Injected(\.images) var images @Injected(\.colors) var colors @@ -36,7 +35,6 @@ public struct CustomChannelHeader: ToolbarContent { } struct CustomChannelModifier: ChannelListHeaderViewModifier { - @Injected(\.chatClient) var chatClient var title: String diff --git a/StreamChatSwiftUITestsApp/InternetConnectionMonitor_Mock.swift b/StreamChatSwiftUITestsApp/InternetConnectionMonitor_Mock.swift index ec1e8026e..cb5a87b6d 100644 --- a/StreamChatSwiftUITestsApp/InternetConnectionMonitor_Mock.swift +++ b/StreamChatSwiftUITestsApp/InternetConnectionMonitor_Mock.swift @@ -4,7 +4,7 @@ import Foundation -//#if TESTS +// #if TESTS @testable import StreamChat final class InternetConnectionMonitor_Mock: InternetConnectionMonitor { @@ -19,6 +19,6 @@ final class InternetConnectionMonitor_Mock: InternetConnectionMonitor { self.status = status delegate?.internetConnectionStatusDidChange(status: status) } - } -//#endif + +// #endif diff --git a/StreamChatSwiftUITestsApp/StartPage.swift b/StreamChatSwiftUITestsApp/StartPage.swift index 280b967c3..69e61f7d7 100644 --- a/StreamChatSwiftUITestsApp/StartPage.swift +++ b/StreamChatSwiftUITestsApp/StartPage.swift @@ -2,12 +2,11 @@ // Copyright © 2025 Stream.io Inc. All rights reserved. // -import SwiftUI import StreamChat import StreamChatSwiftUI +import SwiftUI struct StartPage: View { - @State var streamChat: StreamChat? @State var chatShown = false @ObservedObject var appState = AppState.shared @@ -67,8 +66,8 @@ struct StartPage: View { streamChat = StreamChat(chatClient: chatClient) chatClient.connectUser( - userInfo: .init(id: credentials.id, name: credentials.name, imageURL: credentials.avatarURL), - token: token + userInfo: .init(id: credentials.id, name: credentials.name, imageURL: credentials.avatarURL), + token: token ) { error in if let error = error { log.error("connecting the user failed \(error)") @@ -79,7 +78,6 @@ struct StartPage: View { } class DemoAppFactory: ViewFactory { - @Injected(\.chatClient) public var chatClient private init() {} diff --git a/StreamChatSwiftUITestsApp/StreamChatSwiftUITestsAppApp.swift b/StreamChatSwiftUITestsApp/StreamChatSwiftUITestsAppApp.swift index 0b6fc9e6d..0fccfefff 100644 --- a/StreamChatSwiftUITestsApp/StreamChatSwiftUITestsAppApp.swift +++ b/StreamChatSwiftUITestsApp/StreamChatSwiftUITestsAppApp.swift @@ -7,7 +7,6 @@ import SwiftUI @main struct StreamChatSwiftUITestsAppApp: App { - @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { @@ -18,7 +17,6 @@ struct StreamChatSwiftUITestsAppApp: App { } class AppState: ObservableObject, Equatable { - static func == (lhs: AppState, rhs: AppState) -> Bool { lhs.userState == rhs.userState } diff --git a/StreamChatSwiftUITestsApp/StreamChatWrapper.swift b/StreamChatSwiftUITestsApp/StreamChatWrapper.swift index a18853d6b..78c4e217c 100644 --- a/StreamChatSwiftUITestsApp/StreamChatWrapper.swift +++ b/StreamChatSwiftUITestsApp/StreamChatWrapper.swift @@ -4,8 +4,8 @@ import Foundation #if TESTS -@testable import StreamChat import OHHTTPStubs +@testable import StreamChat #else import StreamChat #endif @@ -13,7 +13,6 @@ import StreamChatSwiftUI import UIKit final class StreamChatWrapper { - @Injected(\.chatClient) var client static let shared = StreamChatWrapper() @@ -26,9 +25,11 @@ final class StreamChatWrapper { let baseURL = self.client.config.baseURL.restAPIBaseURL.absoluteString return request.url?.absoluteString.contains(baseURL) ?? false }, withStubResponse: { _ -> HTTPStubsResponse in - let error = NSError(domain: "NSURLErrorDomain", - code: -1009, - userInfo: nil) + let error = NSError( + domain: "NSURLErrorDomain", + code: -1009, + userInfo: nil + ) return HTTPStubsResponse(error: error) }) @@ -51,5 +52,4 @@ final class StreamChatWrapper { } #endif } - } diff --git a/StreamChatSwiftUITestsApp/UserCredentials.swift b/StreamChatSwiftUITestsApp/UserCredentials.swift index df293db54..64c216211 100644 --- a/StreamChatSwiftUITestsApp/UserCredentials.swift +++ b/StreamChatSwiftUITestsApp/UserCredentials.swift @@ -18,15 +18,15 @@ public struct UserCredentials { } extension UserCredentials { - static func builtInUsersByID(id: String) -> UserCredentials? { mock } - static let mock: UserCredentials = UserCredentials(id: "luke_skywalker", - name: "Luke Skywalker", - avatarURL: URL(string: "https://vignette.wikia.nocookie.net/starwars/images/2/20/LukeTLJ.jpg")!, - token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibHVrZV9za3l3YWxrZXIifQ.b6EiC8dq2AHk0JPfI-6PN-AM9TVzt8JV-qB1N9kchlI", - birthLand: "Tatooine") - + static let mock: UserCredentials = UserCredentials( + id: "luke_skywalker", + name: "Luke Skywalker", + avatarURL: URL(string: "https://vignette.wikia.nocookie.net/starwars/images/2/20/LukeTLJ.jpg")!, + token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibHVrZV9za3l3YWxrZXIifQ.b6EiC8dq2AHk0JPfI-6PN-AM9TVzt8JV-qB1N9kchlI", + birthLand: "Tatooine" + ) } diff --git a/StreamChatSwiftUITestsAppTests/Pages/ChannelListPage.swift b/StreamChatSwiftUITestsAppTests/Pages/ChannelListPage.swift index f926db289..4cf37f9b8 100644 --- a/StreamChatSwiftUITestsAppTests/Pages/ChannelListPage.swift +++ b/StreamChatSwiftUITestsAppTests/Pages/ChannelListPage.swift @@ -3,11 +3,10 @@ // import Foundation -import XCTest import StreamChat +import XCTest enum ChannelListPage { - static var userAvatar: XCUIElement { return app.buttons["LogoutButton"] } @@ -55,5 +54,4 @@ enum ChannelListPage { return cell.images["readIndicatorCheckmark"] } } - } diff --git a/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift b/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift index 314d04d46..1eac12e41 100644 --- a/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift +++ b/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift @@ -3,14 +3,13 @@ // import Foundation -import XCTest import StreamChat @testable import StreamChatSwiftUI +import XCTest // swiftlint:disable convenience_type class MessageListPage { - static var cells: XCUIElementQuery { app.otherElements.matching(identifier: "MessageContainerView") } @@ -44,7 +43,6 @@ class MessageListPage { } enum NavigationBar { - static var chatAvatar: XCUIElement { app.images["ChannelAvatarView"] } @@ -57,13 +55,13 @@ class MessageListPage { app.staticTexts.matching(identifier: "ChannelTitleView").lastMatch! } - // FIXME + // FIXME: static var debugMenu: XCUIElement { app.buttons[""].firstMatch } } - // FIXME + // FIXME: enum Alert { enum Debug { // Add member @@ -168,7 +166,7 @@ class MessageListPage { messageCell.staticTexts["readIndicatorCount"] } - // FIXME + // FIXME: static func statusCheckmark(for status: MessageDeliveryStatus? = nil, in messageCell: XCUIElement) -> XCUIElement { messageCell.images["readIndicatorCheckmark"] } @@ -314,7 +312,7 @@ class MessageListPage { } } - struct Element { + enum Element { static var actionsView: XCUIElement { app.otherElements["MessageActionsView"] } static var reply: XCUIElement { app.otherElements["messageAction-reply_message_action"].images.firstMatch } static var threadReply: XCUIElement { app.otherElements["messageAction-thread_message_action"].images.firstMatch } @@ -324,7 +322,7 @@ class MessageListPage { static var unmute: XCUIElement { app.otherElements["messageAction-unmute_message_action"].images.firstMatch } static var edit: XCUIElement { app.otherElements["messageAction-edit_message_action"].images.firstMatch } static var delete: XCUIElement { app.otherElements["messageAction-delete_message_action"].images.firstMatch } - static var hardDelete: XCUIElement { app.otherElements["messageAction-delete_message_action"].images.firstMatch } // FIXME + static var hardDelete: XCUIElement { app.otherElements["messageAction-delete_message_action"].images.firstMatch } // FIXME: static var resend: XCUIElement { app.otherElements["messageAction-resend_message_action"].images.firstMatch } static var pin: XCUIElement { app.otherElements["messageAction-pin_message_action"].images.firstMatch } static var unpin: XCUIElement { app.otherElements["messageAction-unpin_message_action"].images.firstMatch } @@ -348,6 +346,7 @@ class MessageListPage { static var cancelButton: XCUIElement { app.scrollViews.buttons.matching(NSPredicate(format: "label LIKE 'Cancel'")).firstMatch } + static var images: XCUIElementQuery { app.scrollViews["AttachmentTypeContainer"].images } } @@ -374,5 +373,4 @@ class MessageListPage { app.scrollViews["CommandsContainerView"].otherElements.matching(NSPredicate(format: "identifier LIKE 'MessageAvatarView'")) } } - } diff --git a/StreamChatSwiftUITestsAppTests/Pages/SpringBoard.swift b/StreamChatSwiftUITestsAppTests/Pages/SpringBoard.swift index ea7568949..e94aecf42 100644 --- a/StreamChatSwiftUITestsAppTests/Pages/SpringBoard.swift +++ b/StreamChatSwiftUITestsAppTests/Pages/SpringBoard.swift @@ -14,9 +14,9 @@ enum SpringBoard { static var notificationBanner: XCUIElement { app.otherElements["Notification"] - .descendants(matching: .any) - .matching(NSPredicate(format: "label CONTAINS[c] ', now,'")) - .firstMatch + .descendants(matching: .any) + .matching(NSPredicate(format: "label CONTAINS[c] ', now,'")) + .firstMatch } static var testAppIcon: XCUIElement { diff --git a/StreamChatSwiftUITestsAppTests/Pages/ThreadPage.swift b/StreamChatSwiftUITestsAppTests/Pages/ThreadPage.swift index 9a6daecb1..eca7e35b9 100644 --- a/StreamChatSwiftUITestsAppTests/Pages/ThreadPage.swift +++ b/StreamChatSwiftUITestsAppTests/Pages/ThreadPage.swift @@ -6,7 +6,5 @@ import Foundation import XCTest class ThreadPage: MessageListPage { - static var alsoSendInChannelCheckbox: XCUIElement { app.buttons["SendInChannelView"] } - } diff --git a/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift b/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift index 637cdb19a..3ab1f0b8b 100644 --- a/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift +++ b/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift @@ -3,9 +3,9 @@ // import Foundation -import XCTest import StreamChat @testable import StreamChatSwiftUI +import XCTest let channelAttributes = ChannelListPage.Attributes.self let channelCells = ChannelListPage.cells @@ -13,26 +13,28 @@ let attributes = MessageListPage.Attributes.self let cells = MessageListPage.cells // MARK: Channel List -extension UserRobot { +extension UserRobot { @discardableResult - func channelCell(withIndex index: Int? = nil, - file: StaticString = #filePath, - line: UInt = #line) -> XCUIElement { - guard let index = index else { - return channelCells.firstMatch - } + func channelCell( + withIndex index: Int? = nil, + file: StaticString = #filePath, + line: UInt = #line + ) -> XCUIElement { + guard let index = index else { + return channelCells.firstMatch + } - let minExpectedCount = index + 1 - let cells = cells.waitCount(index) - XCTAssertGreaterThanOrEqual( - cells.count, - minExpectedCount, - "Message cell is not found at index #\(index)", - file: file, - line: line - ) - return channelCells.element(boundBy: index) + let minExpectedCount = index + 1 + let cells = cells.waitCount(index) + XCTAssertGreaterThanOrEqual( + cells.count, + minExpectedCount, + "Message cell is not found at index #\(index)", + file: file, + line: line + ) + return channelCells.element(boundBy: index) } @discardableResult @@ -45,10 +47,12 @@ extension UserRobot { let cell = channelCell(withIndex: cellIndex, file: file, line: line) let message = channelAttributes.lastMessage(in: cell) let actualText = message.waitForText(text, mustBeEqual: false).text - XCTAssertTrue(actualText.contains(text), - "'\(actualText)' does not contain '\(text)'", - file: file, - line: line) + XCTAssertTrue( + actualText.contains(text), + "'\(actualText)' does not contain '\(text)'", + file: file, + line: line + ) return self } @@ -116,10 +120,12 @@ extension UserRobot { let expectedChannel = ChannelListPage.channel(withName: "\(expectedCount)") var expectedChannelExist = expectedChannel.exists - XCTAssertFalse(expectedChannelExist, - "Expected channel should not be visible", - file: file, - line: line) + XCTAssertFalse( + expectedChannelExist, + "Expected channel should not be visible", + file: file, + line: line + ) let endTime = Date().timeIntervalSince1970 * 1000 + XCUIElement.waitTimeout * 1000 while !expectedChannelExist && endTime > Date().timeIntervalSince1970 * 1000 { @@ -127,10 +133,12 @@ extension UserRobot { expectedChannelExist = expectedChannel.exists } - XCTAssertTrue(expectedChannelExist, - "Expected channel should be visible", - file: file, - line: line) + XCTAssertTrue( + expectedChannelExist, + "Expected channel should be visible", + file: file, + line: line + ) return self } @@ -147,12 +155,14 @@ extension UserRobot { } // MARK: Message List -extension UserRobot { +extension UserRobot { @discardableResult - func messageCell(withIndex index: Int? = nil, - file: StaticString = #filePath, - line: UInt = #line) -> XCUIElement { + func messageCell( + withIndex index: Int? = nil, + file: StaticString = #filePath, + line: UInt = #line + ) -> XCUIElement { let messageCell: XCUIElement if let index = index { let minExpectedCount = index + 1 @@ -193,29 +203,37 @@ extension UserRobot { line: UInt = #line ) -> Self { let pushNotification = SpringBoard.notificationBanner.wait() - XCTAssertTrue(pushNotification.exists, - "Push notification should appear", - file: file, - line: line) + XCTAssertTrue( + pushNotification.exists, + "Push notification should appear", + file: file, + line: line + ) let pushNotificationContent = pushNotification.text - XCTAssertTrue(pushNotificationContent.contains(text), - "\(pushNotificationContent) does not contain \(text)", - file: file, - line: line) - XCTAssertTrue(pushNotificationContent.contains(sender), - "\(pushNotificationContent) does not contain \(sender)", - file: file, - line: line) + XCTAssertTrue( + pushNotificationContent.contains(text), + "\(pushNotificationContent) does not contain \(text)", + file: file, + line: line + ) + XCTAssertTrue( + pushNotificationContent.contains(sender), + "\(pushNotificationContent) does not contain \(sender)", + file: file, + line: line + ) return self } @discardableResult func assertPushNotificationDoesNotAppear(file: StaticString = #filePath, line: UInt = #line) -> Self { - XCTAssertFalse(SpringBoard.notificationBanner.exists, - "Push notification should not appear", - file: file, - line: line) + XCTAssertFalse( + SpringBoard.notificationBanner.exists, + "Push notification should not appear", + file: file, + line: line + ) return self } @@ -227,11 +245,13 @@ extension UserRobot { ) -> Self { SpringBoard.notificationBanner.wait() let appIconValue = SpringBoard.testAppIcon.value as? String - XCTAssertEqual(appIconValue?.contains("1"), - shouldBeVisible, - "Badge should be visible: \(shouldBeVisible)", - file: file, - line: line) + XCTAssertEqual( + appIconValue?.contains("1"), + shouldBeVisible, + "Badge should be visible: \(shouldBeVisible)", + file: file, + line: line + ) return self } @@ -334,6 +354,7 @@ extension UserRobot { file: StaticString = #filePath, line: UInt = #line ) -> Self { + // swiftformat:disable:next isEmpty if MessageListPage.cells.count > 0 { let messageCell = messageCell(withIndex: messageCellIndex, file: file, line: line) let actualText = attributes.text(in: messageCell).waitForTextDisappearance(deletedText).text @@ -356,7 +377,7 @@ extension UserRobot { XCTAssertEqual(author, actualAuthor, file: file, line: line) return self } - + @discardableResult func assertScrollToBottomButton( isVisible: Bool, @@ -365,14 +386,16 @@ extension UserRobot { ) -> Self { var btn = MessageListPage.scrollToBottomButton btn = isVisible ? btn.wait() : btn.waitForDisappearance() - XCTAssertEqual(isVisible, - btn.exists, - "Scroll to bottom button should be \(isVisible ? "visible" : "hidden")", - file: file, - line: line) + XCTAssertEqual( + isVisible, + btn.exists, + "Scroll to bottom button should be \(isVisible ? "visible" : "hidden")", + file: file, + line: line + ) return self } - + @discardableResult func assertScrollToBottomButtonUnreadCount( _ expectedCount: Int, @@ -399,14 +422,18 @@ extension UserRobot { line: UInt = #line ) -> Self { let typingIndicatorView = MessageListPage.typingIndicator.wait(timeout: waitTimeout) - XCTAssertTrue(typingIndicatorView.exists, - "Element hidden", - file: file, - line: line) - XCTAssertTrue(typingIndicatorView.text.contains(typingUserName), - "User name is wrong", - file: file, - line: line) + XCTAssertTrue( + typingIndicatorView.exists, + "Element hidden", + file: file, + line: line + ) + XCTAssertTrue( + typingIndicatorView.text.contains(typingUserName), + "User name is wrong", + file: file, + line: line + ) return self } @@ -422,10 +449,12 @@ extension UserRobot { } @discardableResult - func assertContextMenuOptionNotAvailable(option: MessageListPage.ContextMenu, - forMessageAtIndex index: Int = 0, - file: StaticString = #filePath, - line: UInt = #line) -> Self { + func assertContextMenuOptionNotAvailable( + option: MessageListPage.ContextMenu, + forMessageAtIndex index: Int = 0, + file: StaticString = #filePath, + line: UInt = #line + ) -> Self { openContextMenu(messageCellIndex: index) XCTAssertFalse(option.element.exists, "Context menu option is visible", file: file, line: line) return self @@ -442,7 +471,7 @@ extension UserRobot { XCTAssertTrue(errorButton.exists, "There is no error icon", file: file, line: line) return self } - + @discardableResult func waitForMessageDeliveryStatus( _ deliveryStatus: MessageDeliveryStatus?, @@ -489,9 +518,11 @@ extension UserRobot { return self } - func assertComposerLimits(toNumberOfLines limit: Int, - file: StaticString = #filePath, - line: UInt = #line) { + func assertComposerLimits( + toNumberOfLines limit: Int, + file: StaticString = #filePath, + line: UInt = #line + ) { let composer = MessageListPage.Composer.inputField var composerHeight = composer.height for i in 1.. Self { _ = messageCell(withIndex: messageCellIndex).waitForHitPoint() @@ -680,8 +715,8 @@ extension UserRobot { } // MARK: Quoted Messages -extension UserRobot { +extension UserRobot { @discardableResult func assertQuotedMessage( replyText: String = "", // empty text by default for attachment messages @@ -695,7 +730,7 @@ extension UserRobot { let actualText = message.waitForText(quotedText).text XCTAssertEqual(quotedText, actualText) XCTAssertTrue(message.exists, "Quoted message was not showed") - + if !replyText.isEmpty { let message = attributes.text(in: messageCell).wait() let actualText = message.waitForText(replyText).text @@ -703,7 +738,7 @@ extension UserRobot { } return self } - + @discardableResult func assertQuotedMessageWithAttachment( quotedText: String, @@ -720,15 +755,17 @@ extension UserRobot { } // MARK: Thread Replies -extension UserRobot { +extension UserRobot { @discardableResult func assertThreadIsOpen(file: StaticString = #filePath, line: UInt = #line) -> Self { let alsoSendInChannelCheckbox = ThreadPage.alsoSendInChannelCheckbox.wait() - XCTAssertTrue(alsoSendInChannelCheckbox.exists, - "alsoSendInChannel checkbox is not visible", - file: file, - line: line) + XCTAssertTrue( + alsoSendInChannelCheckbox.exists, + "alsoSendInChannel checkbox is not visible", + file: file, + line: line + ) return self } @@ -777,27 +814,35 @@ extension UserRobot { @discardableResult func assertCooldownIsShown(file: StaticString = #filePath, line: UInt = #line) -> Self { - XCTAssertEqual(MessageListPage.Composer.placeholder.text, - L10n.Composer.Placeholder.slowMode, - file: file, - line: line) - XCTAssertTrue(MessageListPage.Composer.cooldown.wait().exists, - "Cooldown should be visible", - file: file, - line: line) + XCTAssertEqual( + MessageListPage.Composer.placeholder.text, + L10n.Composer.Placeholder.slowMode, + file: file, + line: line + ) + XCTAssertTrue( + MessageListPage.Composer.cooldown.wait().exists, + "Cooldown should be visible", + file: file, + line: line + ) return self } @discardableResult func assertCooldownIsNotShown(file: StaticString = #filePath, line: UInt = #line) -> Self { - XCTAssertNotEqual(MessageListPage.Composer.placeholder.text, - L10n.Composer.Placeholder.slowMode, - file: file, - line: line) - XCTAssertFalse(MessageListPage.Composer.cooldown.exists, - "Cooldown should not be visible", - file: file, - line: line) + XCTAssertNotEqual( + MessageListPage.Composer.placeholder.text, + L10n.Composer.Placeholder.slowMode, + file: file, + line: line + ) + XCTAssertFalse( + MessageListPage.Composer.cooldown.exists, + "Cooldown should not be visible", + file: file, + line: line + ) return self } @@ -816,15 +861,18 @@ extension UserRobot { ) -> Self { let messageCell = messageCell(withIndex: messageCellIndex, file: file, line: line) let threadReplyCountButton = attributes.threadReplyCountButton(in: messageCell).wait() - XCTAssertTrue(threadReplyCountButton.exists, - "There is no thread reply count button", - file: file, - line: line) + XCTAssertTrue( + threadReplyCountButton.exists, + "There is no thread reply count button", + file: file, + line: line + ) return self } } // MARK: Reactions + extension UserRobot { @discardableResult func assertReaction( @@ -845,9 +893,11 @@ extension UserRobot { /// /// - Returns: Self @discardableResult - func waitForNewReaction(at messageCellIndex: Int? = nil, - file: StaticString = #filePath, - line: UInt = #line) -> Self { + func waitForNewReaction( + at messageCellIndex: Int? = nil, + file: StaticString = #filePath, + line: UInt = #line + ) -> Self { let cell = messageCell(withIndex: messageCellIndex, file: file, line: line).wait() attributes.reactionButton(in: cell).wait() return self @@ -857,7 +907,6 @@ extension UserRobot { // MARK: Ephemeral messages extension UserRobot { - @discardableResult func assertGiphyImage( at messageCellIndex: Int? = nil, @@ -898,8 +947,8 @@ extension UserRobot { } // MARK: Keyboard -extension UserRobot { +extension UserRobot { @discardableResult func assertKeyboard( isVisible: Bool, @@ -908,18 +957,20 @@ extension UserRobot { ) -> Self { let keyboard = app.keyboards.firstMatch keyboard.wait(timeout: 1.5) - XCTAssertEqual(isVisible, - keyboard.exists, - "Keyboard should be \(isVisible ? "visible" : "hidden")", - file: file, - line: line) + XCTAssertEqual( + isVisible, + keyboard.exists, + "Keyboard should be \(isVisible ? "visible" : "hidden")", + file: file, + line: line + ) return self } } // MARK: Attachments -extension UserRobot { +extension UserRobot { @discardableResult func assertImage( isPresent: Bool, diff --git a/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift b/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift index 9f2d112f3..f03af913b 100644 --- a/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift +++ b/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift @@ -3,12 +3,11 @@ // import Foundation -import XCTest import StreamChat +import XCTest /// Simulates user behavior final class UserRobot: Robot { - let composer = MessageListPage.Composer.self let contextMenu = MessageListPage.ContextMenu.self let debugAlert = MessageListPage.Alert.Debug.self @@ -64,7 +63,6 @@ final class UserRobot: Robot { // MARK: Message List extension UserRobot { - @discardableResult func openContextMenu(messageCellIndex: Int = 0) -> Self { messageCell(withIndex: messageCellIndex).press(forDuration: 1) @@ -82,11 +80,13 @@ extension UserRobot { } @discardableResult - func sendMessage(_ text: String, - at messageCellIndex: Int? = nil, - waitForAppearance: Bool = true, - file: StaticString = #filePath, - line: UInt = #line) -> Self { + func sendMessage( + _ text: String, + at messageCellIndex: Int? = nil, + waitForAppearance: Bool = true, + file: StaticString = #filePath, + line: UInt = #line + ) -> Self { server.channelsEndpointWasCalled = false typeText(text) @@ -194,17 +194,21 @@ extension UserRobot { } @discardableResult - func quoteMessage(_ text: String, - messageCellIndex: Int = 0, - waitForAppearance: Bool = true, - file: StaticString = #filePath, - line: UInt = #line) -> Self { + func quoteMessage( + _ text: String, + messageCellIndex: Int = 0, + waitForAppearance: Bool = true, + file: StaticString = #filePath, + line: UInt = #line + ) -> Self { selectOptionFromContextMenu(option: .reply, forMessageAtIndex: messageCellIndex) - sendMessage(text, - at: messageCellIndex, - waitForAppearance: waitForAppearance, - file: file, - line: line) + sendMessage( + text, + at: messageCellIndex, + waitForAppearance: waitForAppearance, + file: file, + line: line + ) return self } @@ -293,11 +297,13 @@ extension UserRobot { if alsoSendInChannel { threadCheckbox.wait().safeTap() } - sendMessage(text, - at: messageCellIndex, - waitForAppearance: waitForAppearance, - file: file, - line: line) + sendMessage( + text, + at: messageCellIndex, + waitForAppearance: waitForAppearance, + file: file, + line: line + ) return self } @@ -346,6 +352,7 @@ extension UserRobot { @discardableResult func openComposerCommands() -> Self { + // swiftformat:disable:next isEmpty if MessageListPage.ComposerCommands.cells.count == 0 { MessageListPage.Composer.commandButton.wait().safeTap() } @@ -430,7 +437,6 @@ extension UserRobot { // MARK: Debug menu extension UserRobot { - @discardableResult private func tapOnDebugMenu() -> Self { MessageListPage.NavigationBar.debugMenu.safeTap() @@ -471,7 +477,6 @@ extension UserRobot { // MARK: Connectivity extension UserRobot { - /// Toggles the visibility of the connectivity switch control. When set to `.on`, the switch control will be displayed in the navigation bar. @discardableResult func setConnectivitySwitchVisibility(to state: SwitchState) -> Self { @@ -490,7 +495,6 @@ extension UserRobot { // MARK: Config extension UserRobot { - @discardableResult func setIsLocalStorageEnabled(to state: SwitchState) -> Self { setSwitchState(Settings.isLocalStorageEnabled.element, state: state) diff --git a/StreamChatSwiftUITestsAppTests/StreamChatSwiftUITests.swift b/StreamChatSwiftUITestsAppTests/StreamChatSwiftUITests.swift index 33dbeb3fb..ed36a6938 100644 --- a/StreamChatSwiftUITestsAppTests/StreamChatSwiftUITests.swift +++ b/StreamChatSwiftUITestsAppTests/StreamChatSwiftUITests.swift @@ -2,8 +2,8 @@ // Copyright © 2025 Stream.io Inc. All rights reserved. // +import Foundation @_exported import StreamChatTestMockServer @_exported import StreamSwiftTestHelpers -import Foundation final class StreamChatSwiftUITests {} diff --git a/StreamChatSwiftUITestsAppTests/Tests/Attachments_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/Attachments_Tests.swift index b125e52d7..05fd667a9 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Attachments_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Attachments_Tests.swift @@ -5,10 +5,11 @@ import XCTest final class Attachments_Tests: StreamTestCase { - override func setUpWithError() throws { - try XCTSkipIf(ProcessInfo().operatingSystemVersion.majorVersion >= 18, - "Attachments tests freeze the test app on iOS > 18") + try XCTSkipIf( + ProcessInfo().operatingSystemVersion.majorVersion >= 18, + "Attachments tests freeze the test app on iOS > 18" + ) try super.setUpWithError() addTags([.coreFeatures]) @@ -78,5 +79,4 @@ final class Attachments_Tests: StreamTestCase { userRobot.assertFile(isPresent: true) } } - } diff --git a/StreamChatSwiftUITestsAppTests/Tests/Base TestCase/StreamTestCase.swift b/StreamChatSwiftUITestsAppTests/Tests/Base TestCase/StreamTestCase.swift index c6bcd4494..17a77ff5a 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Base TestCase/StreamTestCase.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Base TestCase/StreamTestCase.swift @@ -8,7 +8,6 @@ import XCTest let app = XCUIApplication() class StreamTestCase: XCTestCase { - let deviceRobot = DeviceRobot(app) var userRobot: UserRobot! var backendRobot: BackendRobot! @@ -45,7 +44,6 @@ class StreamTestCase: XCTestCase { } extension StreamTestCase { - func assertMockServer() { XCTAssertFalse(mockServerCrashed, "Mock server failed on start") } diff --git a/StreamChatSwiftUITestsAppTests/Tests/ChannelList_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/ChannelList_Tests.swift index b4cd7f105..0f2bae593 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/ChannelList_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/ChannelList_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class ChannelList_Tests: StreamTestCase { - let message = "message" override func setUpWithError() throws { @@ -246,7 +245,6 @@ extension ChannelList_Tests { // MARK: - Truncate channel extension ChannelList_Tests { - func test_messageList_and_channelPreview_AreUpdatedWhenChannelTruncatedWithMessage() throws { linkToScenario(withId: 357) diff --git a/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift index 453a8cc92..aa74183b7 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class Ephemeral_Messages_Tests: StreamTestCase { - override func setUpWithError() throws { try super.setUpWithError() assertMockServer() diff --git a/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus+ChannelList_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus+ChannelList_Tests.swift index af04a93f0..121936b18 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus+ChannelList_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus+ChannelList_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class MessageDeliveryStatus_ChannelList_Tests: StreamTestCase { - let message = "message" var failedMessage: String { "failed \(message)" } @@ -63,7 +62,6 @@ final class MessageDeliveryStatus_ChannelList_Tests: StreamTestCase { userRobot .assertMessageReadCountInChannelPreview(readBy: 0) .assertMessageDeliveryStatusInChannelPreview(.sent) - } } @@ -172,7 +170,6 @@ final class MessageDeliveryStatus_ChannelList_Tests: StreamTestCase { // MARK: Thread Reply extension MessageDeliveryStatus_ChannelList_Tests { - func test_noCheckmarkShownForMessageInPreview_whenThreadReplyIsSent() throws { linkToScenario(withId: 430) diff --git a/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus_Tests.swift index acf04b42d..e33ae7254 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Message Delivery Status/MessageDeliveryStatus_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class MessageDeliveryStatus_Tests: StreamTestCase { - let message = "message" var pendingMessage: String { "pending \(message)" } var failedMessage: String { "failed \(message)" } @@ -21,6 +20,7 @@ final class MessageDeliveryStatus_Tests: StreamTestCase { } // MARK: Message List + func test_singleCheckmarkShown_whenMessageIsSent() throws { linkToScenario(withId: 397) @@ -71,7 +71,6 @@ final class MessageDeliveryStatus_Tests: StreamTestCase { .login() .setConnectivity(to: .off) .openChannel() - } WHEN("user sends a new message") { userRobot.sendMessage(failedMessage, waitForAppearance: false) @@ -227,8 +226,8 @@ final class MessageDeliveryStatus_Tests: StreamTestCase { // MARK: Thread Reply extension MessageDeliveryStatus_Tests { - // MARK: Thread Previews + func test_singleCheckmarkShown_whenMessageIsSent_andPreviewedInThread() throws { linkToScenario(withId: 405) @@ -534,7 +533,6 @@ extension MessageDeliveryStatus_Tests { // MARK: Disabled Read Events feature extension MessageDeliveryStatus_Tests { - // MARK: Messages func test_deliveryStatusHidden_whenMessageIsSentAndReadEventsIsDisabled() throws { diff --git a/StreamChatSwiftUITestsAppTests/Tests/MessageList_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/MessageList_Tests.swift index 821986de5..8ee85d954 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/MessageList_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/MessageList_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class MessageList_Tests: StreamTestCase { - override func setUpWithError() throws { try super.setUpWithError() addTags([.coreFeatures]) @@ -359,7 +358,6 @@ final class MessageList_Tests: StreamTestCase { // MARK: Scroll to bottom extension MessageList_Tests { - func test_messageListScrollsDown_whenMessageListIsScrolledUp_andUserSendsNewMessage() throws { linkToScenario(withId: 359) @@ -511,7 +509,6 @@ extension MessageList_Tests { // MARK: Pagination extension MessageList_Tests { - func test_paginationOnMessageList() throws { linkToScenario(withId: 370) @@ -549,7 +546,6 @@ extension MessageList_Tests { // MARK: Mentions extension MessageList_Tests { - func test_addingCommandHidesLeftButtons() throws { linkToScenario(withId: 372) @@ -610,7 +606,6 @@ extension MessageList_Tests { // MARK: Links preview extension MessageList_Tests { - func test_addMessageWithLinkToUnsplash() { linkToScenario(withId: 375) @@ -683,6 +678,7 @@ extension MessageList_Tests { } // MARK: - Thread replies + extension MessageList_Tests { func test_threadReplyAppearsInThread_whenParticipantAddsThreadReply() throws { linkToScenario(withId: 379) diff --git a/StreamChatSwiftUITestsAppTests/Tests/PushNotification_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/PushNotification_Tests.swift index ae8239069..65ca6f65c 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/PushNotification_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/PushNotification_Tests.swift @@ -6,7 +6,6 @@ import XCTest // Requires running a standalone Sinatra server final class PushNotification_Tests: StreamTestCase { - let sender = "Han Solo" let message = "How are you? 🙂" @@ -30,7 +29,7 @@ final class PushNotification_Tests: StreamTestCase { GIVEN("user goes to channel list") { userRobot .login() - .openChannel() // this is required to let the mock server know + .openChannel() // this is required to let the mock server know .tapOnBackButton() // which channel to use for push notifications } checkHappyPath(message: message, sender: sender) @@ -61,7 +60,7 @@ final class PushNotification_Tests: StreamTestCase { version: "", messageId: "", cid: "" - ) + ) GIVEN("user goes to message list") { userRobot.login().openChannel() @@ -125,9 +124,11 @@ final class PushNotification_Tests: StreamTestCase { mockPushNotification(body: nil) WHEN("participant sends a message (push body param is nil)") { - participantRobot.wait(2).sendMessage("\(message)_0", - withPushNotification: true, - bundleIdForPushNotification: app.bundleId()) + participantRobot.wait(2).sendMessage( + "\(message)_0", + withPushNotification: true, + bundleIdForPushNotification: app.bundleId() + ) } THEN("user does not receive a push notification") { userRobot.assertPushNotificationDoesNotAppear() @@ -135,9 +136,11 @@ final class PushNotification_Tests: StreamTestCase { mockPushNotification(body: "") WHEN("participant sends a message (push body param is empty)") { - participantRobot.sendMessage("\(message)_1", - withPushNotification: true, - bundleIdForPushNotification: app.bundleId()) + participantRobot.sendMessage( + "\(message)_1", + withPushNotification: true, + bundleIdForPushNotification: app.bundleId() + ) } THEN("user does not receive a push notification") { userRobot.assertPushNotificationDoesNotAppear() @@ -145,9 +148,11 @@ final class PushNotification_Tests: StreamTestCase { mockPushNotification(body: 42) WHEN("participant sends a message (push body param contains incorrect type)") { - participantRobot.sendMessage("\(message)_2", - withPushNotification: true, - bundleIdForPushNotification: app.bundleId()) + participantRobot.sendMessage( + "\(message)_2", + withPushNotification: true, + bundleIdForPushNotification: app.bundleId() + ) } THEN("user does not receive a push notification") { userRobot.assertPushNotificationDoesNotAppear() diff --git a/StreamChatSwiftUITestsAppTests/Tests/QuotedReply_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/QuotedReply_Tests.swift index fb935677b..44833c433 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/QuotedReply_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/QuotedReply_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class QuotedReply_Tests: StreamTestCase { - let messageCount = 30 let parentMessage = "1" let quotedMessage = "quoted reply" @@ -107,7 +106,7 @@ final class QuotedReply_Tests: StreamTestCase { } func test_quotedReplyNotInList_whenParticipantAddsQuotedReply_Message() { - linkToScenario(withId: 1702) + linkToScenario(withId: 1702) GIVEN("user opens the channel") { backendRobot.generateChannels(count: 1, messagesCount: messageCount) @@ -133,7 +132,7 @@ final class QuotedReply_Tests: StreamTestCase { } func test_quotedReplyNotInList_whenParticipantAddsQuotedReply_File() { - linkToScenario(withId: 1703) + linkToScenario(withId: 1703) GIVEN("user opens the channel") { backendRobot.generateChannels(count: 1, messagesCount: messageCount) @@ -160,7 +159,7 @@ final class QuotedReply_Tests: StreamTestCase { } func test_quotedReplyNotInList_whenParticipantAddsQuotedReply_Giphy() { - linkToScenario(withId: 1704) + linkToScenario(withId: 1704) GIVEN("user opens the channel") { backendRobot.generateChannels(count: 1, messagesCount: messageCount) @@ -187,7 +186,7 @@ final class QuotedReply_Tests: StreamTestCase { } func test_quotedReplyIsDeletedByParticipant_deletedMessageIsShown() { - linkToScenario(withId: 388) + linkToScenario(withId: 388) GIVEN("user opens the channel") { backendRobot.generateChannels(count: 1, messagesCount: 1) @@ -205,7 +204,7 @@ final class QuotedReply_Tests: StreamTestCase { } func test_quotedReplyIsDeletedByUser_deletedMessageIsShown() { - linkToScenario(withId: 389) + linkToScenario(withId: 389) GIVEN("user opens the channel") { backendRobot.generateChannels(count: 1, messagesCount: 1) @@ -223,7 +222,7 @@ final class QuotedReply_Tests: StreamTestCase { } func test_unreadCount_whenUserSendsInvalidCommand_and_jumpingOnQuotedMessage() throws { - linkToScenario(withId: 1705) + linkToScenario(withId: 1705) let invalidCommand = "invalid command" diff --git a/StreamChatSwiftUITestsAppTests/Tests/Reactions_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/Reactions_Tests.swift index b97de225a..df9422970 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Reactions_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Reactions_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class Reactions_Tests: StreamTestCase { - override func setUpWithError() throws { try super.setUpWithError() addTags([.coreFeatures]) diff --git a/StreamChatSwiftUITestsAppTests/Tests/SlowMode_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/SlowMode_Tests.swift index 132efdf76..8884d9b5d 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/SlowMode_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/SlowMode_Tests.swift @@ -5,7 +5,6 @@ import XCTest final class SlowMode_Tests: StreamTestCase { - let cooldownDuration = 15 let message = "message" let anotherNewMessage = "Another new message" diff --git a/StreamChatSwiftUITestsAppTests/Tests/StreamTestCase+Tags.swift b/StreamChatSwiftUITestsAppTests/Tests/StreamTestCase+Tags.swift index 55d641b85..2a289319e 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/StreamTestCase+Tags.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/StreamTestCase+Tags.swift @@ -13,6 +13,6 @@ extension StreamTestCase { } func addTags(_ tags: [Tags]) { - addTagsToScenario(tags.map{ $0.rawValue }) + addTagsToScenario(tags.map { $0.rawValue }) } } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index da6f0de56..4b637fc26 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -511,13 +511,9 @@ lane :run_swift_format do |options| Dir.chdir('..') do check_foundation_import strict = options[:strict] ? '--lint' : nil - sources_matrix[:swiftformat].each do |path| - sh("swiftformat #{strict} --config .swiftformat #{path}") - next if path.include?('Tests') - - sh("swiftlint lint --config .swiftlint.yml --fix --progress --reporter json #{path}") unless strict - sh("swiftlint lint --config .swiftlint.yml --strict --progress --reporter json #{path}") - end + sh("swiftformat #{strict} --config .swiftformat .") + sh("swiftlint lint --config .swiftlint.yml --fix --progress --reporter json") unless strict + sh("swiftlint lint --config .swiftlint.yml --strict --progress --reporter json") end end @@ -545,8 +541,7 @@ lane :sources_matrix do ruby: ['fastlane', 'Gemfile', 'Gemfile.lock'], size: ['Sources', xcode_project], sonar: ['Sources'], - public_interface: ['Sources'], - swiftformat: ['Sources', 'DemoAppSwiftUI', 'StreamChatSwiftUITests'] + public_interface: ['Sources'] } end diff --git a/lefthook.yml b/lefthook.yml index 1320df25c..61221d999 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -4,10 +4,6 @@ pre-commit: - run: swiftlint lint --config .swiftlint.yml --fix --progress --reporter json {staged_files} glob: "*.{swift}" stage_fixed: true - exclude: - - Sources/StreamChatSwiftUI/Generated/** - - Sources/StreamChatSwiftUI/StreamNuke/** - - Sources/StreamChatSwiftUI/StreamSwiftyGif/** skip: - merge - rebase @@ -15,10 +11,6 @@ pre-commit: - run: swiftformat --config .swiftformat {staged_files} glob: "*.{swift}" stage_fixed: true - exclude: - - Sources/StreamChatSwiftUI/Generated/** - - Sources/StreamChatSwiftUI/StreamNuke/** - - Sources/StreamChatSwiftUI/StreamSwiftyGif/** skip: - merge - rebase @@ -27,9 +19,5 @@ pre-push: jobs: - run: swiftlint lint --config .swiftlint.yml --strict --progress --reporter json {push_files} glob: "*.{swift}" - exclude: - - Sources/StreamChatSwiftUI/Generated/** - - Sources/StreamChatSwiftUI/StreamNuke/** - - Sources/StreamChatSwiftUI/StreamSwiftyGif/** skip: - merge-commit