Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/backend-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Backend Checks

on:
workflow_dispatch:

pull_request: #TODO: DELETE AFTER TESTING
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove TODO or define the trigger intention.

The TODO comment suggests this pull_request trigger is temporary for testing. Either remove it before merging or clarify the intended trigger conditions for this workflow.

🤖 Prompt for AI Agents
In .github/workflows/backend-checks.yml around line 6, the pull_request trigger
is marked with a TODO indicating it's temporary for testing; either remove the
pull_request entry if it’s not intended to run on PRs, or replace the TODO with
a clear trigger definition (e.g., specify which branches, paths, or events
should trigger this workflow) and delete the TODO comment so the workflow's
intent is explicit before merging.


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
HOMEBREW_NO_INSTALL_CLEANUP: 1 # Disable cleanup for homebrew, we don't need it on CI
IOS_SIMULATOR_DEVICE: "iPhone 16 Pro (18.5)"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test-backend-integration:
name: Test Backend Integration
runs-on: macos-15
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/bootstrap
env:
INSTALL_YEETD: true
SKIP_SWIFT_BOOTSTRAP: true
- name: Run UI Tests (Debug)
run: bundle exec fastlane test_e2e device:"${{ env.IOS_SIMULATOR_DEVICE }}"
timeout-minutes: 100
- name: Parse xcresult
if: failure()
run: |
brew install chargepoint/xcparse/xcparse
xcparse logs fastlane/test_output/StreamChatUITestsApp.xcresult fastlane/test_output/logs/
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Test Data Backend Integration
path: |
fastlane/recordings
fastlane/sinatra_log.txt
fastlane/test_output/logs/*/Diagnostics/**/*.txt
fastlane/test_output/logs/*/Diagnostics/simctl_diagnostics/DiagnosticReports/*
14 changes: 14 additions & 0 deletions StreamChat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@
8274A7962B7FAC3900D8696B /* ChannelListScrollTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8274A7952B7FAC3900D8696B /* ChannelListScrollTime.swift */; };
8279706F29689680006741A3 /* UserDetails_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8279706E29689680006741A3 /* UserDetails_Tests.swift */; };
827DD1A0289D5B3300910AC5 /* MessageActionsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 827DD19F289D5B3300910AC5 /* MessageActionsVC.swift */; };
82865DA42EC4B87B007D7053 /* Backend_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82865DA32EC4B874007D7053 /* Backend_Tests.swift */; };
8292D6DB29B78476007A17D1 /* QuotedReply_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8292D6DA29B78476007A17D1 /* QuotedReply_Tests.swift */; };
829762E028C7587500B953E8 /* PushNotification_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 829762DF28C7587500B953E8 /* PushNotification_Tests.swift */; };
829CD5C52848C2EA003C3877 /* ParticipantRobot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 829CD5C32848C25F003C3877 /* ParticipantRobot.swift */; };
Expand Down Expand Up @@ -3691,6 +3692,8 @@
8274A7952B7FAC3900D8696B /* ChannelListScrollTime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelListScrollTime.swift; sourceTree = "<group>"; };
8279706E29689680006741A3 /* UserDetails_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDetails_Tests.swift; sourceTree = "<group>"; };
827DD19F289D5B3300910AC5 /* MessageActionsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageActionsVC.swift; sourceTree = "<group>"; };
82865DA12EC4B84F007D7053 /* Backend.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = Backend.xctestplan; path = StreamChatUITestsAppUITests/Backend.xctestplan; sourceTree = "<group>"; };
82865DA32EC4B874007D7053 /* Backend_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Backend_Tests.swift; sourceTree = "<group>"; };
8292D6DA29B78476007A17D1 /* QuotedReply_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuotedReply_Tests.swift; sourceTree = "<group>"; };
829762DF28C7587500B953E8 /* PushNotification_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushNotification_Tests.swift; sourceTree = "<group>"; };
8298C8E827D22C3E004082D3 /* UserRobot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserRobot.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6312,6 +6315,14 @@
path = Swifter;
sourceTree = "<group>";
};
82865DA22EC4B86A007D7053 /* Backend */ = {
isa = PBXGroup;
children = (
82865DA32EC4B874007D7053 /* Backend_Tests.swift */,
);
path = Backend;
sourceTree = "<group>";
};
829CD5C22848C244003C3877 /* Robots */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6370,6 +6381,7 @@
82AD02BE27D8E453000611B7 /* Tests */ = {
isa = PBXGroup;
children = (
82865DA22EC4B86A007D7053 /* Backend */,
82EBA1822B30A63800B3A048 /* Performance */,
A3600B3D283F63C700E1C930 /* Base TestCase */,
A3B78F16282A670600348AD1 /* Message Delivery Status */,
Expand Down Expand Up @@ -6843,6 +6855,7 @@
8AD5EC8522E9A3E8005CFAC9 = {
isa = PBXGroup;
children = (
82865DA12EC4B84F007D7053 /* Backend.xctestplan */,
4A4E184528D06CA30062378D /* Documentation.docc */,
AD9BE32526680E4200A6D284 /* Stream.playground */,
792E3D6A25C97D920040B0C2 /* Package.swift */,
Expand Down Expand Up @@ -12534,6 +12547,7 @@
8232B84F28635C4A0032C7DB /* Attachments_Tests.swift in Sources */,
822F266027D9FDB500E454FB /* URLProtocol_Mock.swift in Sources */,
82BA52EF27E1EF7B00951B87 /* MessageList_Tests.swift in Sources */,
82865DA42EC4B87B007D7053 /* Backend_Tests.swift in Sources */,
A33FA818282E559A00DC40E8 /* SlowMode_Tests.swift in Sources */,
A39B040B27F196F200D6B18A /* StreamChatUITests.swift in Sources */,
825A32CF27DBB48D000402A9 /* StartPage.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<TestPlanReference
reference = "container:StreamChatUITestsAppUITests/Performance.xctestplan">
</TestPlanReference>
<TestPlanReference
reference = "container:StreamChatUITestsAppUITests/Backend.xctestplan">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
Expand Down
28 changes: 28 additions & 0 deletions StreamChatUITestsAppUITests/Backend.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations" : [
{
"id" : "2125E461-58C7-480E-9DB9-4CF3B51D3C5C",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {

},
"testTargets" : [
{
"selectedTests" : [
"Backend_Tests\/test_message()",
"Backend_Tests\/test_reaction()"
],
"target" : {
"containerPath" : "container:StreamChat.xcodeproj",
"identifier" : "A34407DB27D8C3400044F150",
"name" : "StreamChatUITestsAppUITests"
}
}
],
"version" : 1
}
2 changes: 2 additions & 0 deletions StreamChatUITestsAppUITests/StreamChatUITestsApp.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"testTargets" : [
{
"skippedTests" : [
"Backend_Tests",
"Backend_Tests\/test_messageListUpdates_whenUserSendsMessage()",
Comment on lines +23 to +24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Test method doesn't exist.

Line 24 references Backend_Tests/test_messageListUpdates_whenUserSendsMessage(), but this test method doesn't exist in StreamChatUITestsAppUITests/Tests/Backend/Backend_Tests.swift. The actual test file only contains test_message() and test_reaction().

If you only want to skip the entire Backend_Tests suite (which makes sense since they run in a separate test plan), remove the specific test reference:

       "skippedTests" : [
         "Backend_Tests",
-        "Backend_Tests\/test_messageListUpdates_whenUserSendsMessage()",
         "ChannelListScrollTime",
         "MessageListScrollTime"
       ],
🤖 Prompt for AI Agents
In StreamChatUITestsAppUITests/StreamChatUITestsApp.xctestplan around lines
23-24, the plan references a non-existent test case
"Backend_Tests/test_messageListUpdates_whenUserSendsMessage()"; update the plan
to either remove the specific test reference (so the whole Backend_Tests suite
is skipped) or replace it with a valid test identifier from
StreamChatUITestsAppUITests/Tests/Backend/Backend_Tests.swift (e.g.,
test_message or test_reaction), ensuring the test path matches the actual method
name and signature.

"ChannelListScrollTime",
"MessageListScrollTime"
],
Expand Down
67 changes: 67 additions & 0 deletions StreamChatUITestsAppUITests/Tests/Backend/Backend_Tests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// Copyright © 2025 Stream.io Inc. All rights reserved.
//

import XCTest

final class Backend_Tests: StreamTestCase {
override func setUpWithError() throws {
mockServerEnabled = false
switchApiKey = "8br4watad788"
try super.setUpWithError()
}

func test_message() {
let originalMessage = "hi"
let editedMessage = "hello"

GIVEN("user opens the channel") {
userRobot
.login()
.openChannel()
}
WHEN("user sends a message") {
userRobot.sendMessage(originalMessage)
}
THEN("message appears") {
userRobot.assertMessage(originalMessage)
}
WHEN("user edits the message") {
userRobot.editMessage(editedMessage)
}
THEN("the message is edited") {
userRobot.assertMessage(editedMessage)
}
WHEN("user deletes the message") {
userRobot.deleteMessage()
}
THEN("the message is deleted") {
userRobot.assertDeletedMessage()
}
}

func test_reaction() throws {
let message = "test"

GIVEN("user opens the channel") {
userRobot.login().openChannel()
}
WHEN("user sends the message: '\(message)'") {
userRobot.sendMessage(message)
}
AND("user adds the reaction") {
userRobot
.addReaction(type: .like)
.waitForNewReaction()
}
THEN("the reaction is added") {
userRobot.assertReaction(isPresent: true)
}
AND("user removes the reaction") {
userRobot.deleteReaction(type: .like)
}
THEN("the reaction is removed") {
userRobot.assertReaction(isPresent: false)
}
}
}
26 changes: 26 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,32 @@ private_lane :xcmetrics_log_parser do |options|
metrics
end

desc 'Runs e2e ui tests using real backend server in Debug config'
lane :test_e2e do |options|
scan_options = {
project: xcode_project,
scheme: 'StreamChatUITestsApp',
testplan: 'Backend',
result_bundle: true,
derived_data_path: derived_data_path,
cloned_source_packages_path: source_packages_path,
clean: is_localhost,
test_without_building: options[:test_without_building],
xcargs: buildcache_xcargs,
devices: options[:device],
prelaunch_simulator: is_ci,
number_of_retries: 3
}

begin
scan(scan_options)
rescue StandardError
failed_tests = retreive_failed_tests
UI.important("Re-running #{failed_tests.size} failed tests ⌛️")
scan(scan_options.merge(only_testing: failed_tests))
end
end

desc 'Runs e2e ui tests using mock server in Debug config'
lane :test_e2e_mock do |options|
next unless is_check_required(sources: sources_matrix[:e2e], force_check: @force_check)
Expand Down
Loading