diff --git a/DemoApp/Shared/DemoUsers.swift b/DemoApp/Shared/DemoUsers.swift index 76da7b62e65..8b83aed4522 100644 --- a/DemoApp/Shared/DemoUsers.swift +++ b/DemoApp/Shared/DemoUsers.swift @@ -5,7 +5,7 @@ import Foundation import StreamChat -let apiKeyString = "8br4watad788" +let apiKeyString = ProcessInfo.processInfo.arguments.contains("SWIFTUI_API_KEY") ? "zcgvnykxsfm8" : "8br4watad788" let applicationGroupIdentifier = "group.io.getstream.iOS.ChatDemoApp" enum DemoUserType { diff --git a/StreamChatUITestsApp/StreamChat/User.swift b/StreamChatUITestsApp/StreamChat/User.swift index 4119a0acf76..38d4540b163 100644 --- a/StreamChatUITestsApp/StreamChat/User.swift +++ b/StreamChatUITestsApp/StreamChat/User.swift @@ -8,10 +8,22 @@ import StreamChat extension UserCredentials { static var `default`: UserCredentials { + ProcessInfo.processInfo.arguments.contains("SWIFTUI_API_KEY") ? .swiftUI : .swift + } + + static var swift: 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.kFSLHRB5X62t0Zlc7nwczWUfsQMwfkpylC6jCUZ6Mc0", birthLand: "Tatooine") } + + static var swiftUI: 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/StreamChatUITestsAppUITests/Tests/Base TestCase/StreamTestCase.swift b/StreamChatUITestsAppUITests/Tests/Base TestCase/StreamTestCase.swift index 8d665f1c389..876f3c1996b 100644 --- a/StreamChatUITestsAppUITests/Tests/Base TestCase/StreamTestCase.swift +++ b/StreamChatUITestsAppUITests/Tests/Base TestCase/StreamTestCase.swift @@ -16,6 +16,7 @@ class StreamTestCase: XCTestCase { var server: StreamMockServer! var recordVideo = false var mockServerEnabled = true + var switchApiKey = false override func setUpWithError() throws { continueAfterFailure = false @@ -58,6 +59,9 @@ extension StreamTestCase { .httpHost: "\(MockServerConfiguration.httpHost)", .port: "\(MockServerConfiguration.port)" ]) + } else if switchApiKey { + // Use SwiftUI api key instead + app.setLaunchArguments(.switchApiKey) } } diff --git a/StreamChatUITestsAppUITests/Tests/Performance/ChannelListScrollTime.swift b/StreamChatUITestsAppUITests/Tests/Performance/ChannelListScrollTime.swift index 4340802970e..d8575d0346a 100644 --- a/StreamChatUITestsAppUITests/Tests/Performance/ChannelListScrollTime.swift +++ b/StreamChatUITestsAppUITests/Tests/Performance/ChannelListScrollTime.swift @@ -9,12 +9,12 @@ class ChannelListScrollTime: StreamTestCase { override func setUpWithError() throws { mockServerEnabled = false + switchApiKey = true try super.setUpWithError() } func testChannelListScrollTime() { WHEN("user opens the channel list") { - backendRobot.generateChannels(count: 100, messagesCount: 1) userRobot.login().waitForChannelListToLoad() } THEN("user scrolls the channel list") { diff --git a/TestTools/StreamChatTestMockServer/Utilities/LaunchArgument.swift b/TestTools/StreamChatTestMockServer/Utilities/LaunchArgument.swift index 1c85068e8e9..7fe4377d3e1 100644 --- a/TestTools/StreamChatTestMockServer/Utilities/LaunchArgument.swift +++ b/TestTools/StreamChatTestMockServer/Utilities/LaunchArgument.swift @@ -24,6 +24,7 @@ public enum EnvironmentVariable: String { public enum LaunchArgument: String { case useMockServer = "USE_MOCK_SERVER" + case switchApiKey = "SWIFTUI_API_KEY" case jwt = "MOCK_JWT" }