Commit Graph

209 Commits

Author SHA1 Message Date
Stefan Ceriu 11651bcd23 Normalize generated schemes to match Xcode's output
XcodeGen (through XcodeProj) serializes schemes slightly differently to
Xcode, so Xcode rewrites them as soon as it touches them (running tests,
switching test plans, opening the scheme editor), leaving recurring local
changes behind.

Add a small Swift script, run from XcodeGen's postGenCommand, that rewrites
the generated schemes the way Xcode saves them: it drops default-valued
attributes and empty CommandLineArguments, orders TestPlanReference
attributes, and moves TestPlans to the end of the TestAction, omitting the
redundant empty Testables.

Regenerated schemes are byte-identical to the copies saved by Xcode. The
script can be removed once https://github.com/tuist/XcodeProj/pull/1189
ships in XcodeGen.
2026-10-15 12:54:48 +03:00
Mauro 831234865b Fix Swift 6.4 warnings (#6240) 2026-10-01 10:55:19 +02:00
Mauro b1ed870474 Support for Xcode 27 on CI (#6217)
* Run the tests on iOS 27.0

Bump the required simulator OS in the preview, UI and Compound tests, and the CI tool's default OS, from 26.5 to 27.0. Test devices stay the same.

iOS 27 writes transcoded videos 146 bytes larger, so update the expected sizes in MediaUploadingPreprocessorTests.

* Build and test on CI with Xcode 27

Select Xcode 27 in ci_common.sh and move every macOS workflow to the xcode-27 runner image, as macos-26 doesn't include Xcode 27. The Compound workflow now also creates its simulator on the iOS 27.0 runtime.

The xcode-27 runners are slower, so give the unit, Enterprise, Compound and snapshot recording jobs longer timeouts.

* Fix the preview snapshot layout on iOS 27

On iOS 27 the hosting controller applies the window's safe area when rendering, but the snapshot size comes from sizeThatFits, which ignores it. Component previews were shifted down and clipped at the bottom. Disable the hosting controller's safe area regions for these snapshots so the measured and rendered layouts match.

swift-snapshot-testing also renders into a window without a scene, and on iOS 27 a navigation stack in such a window reserves space for a large title it never shows, leaving a gap below the navigation bar. Attach the render window to the app's scene until swift-snapshot-testing handles it.

The invite users and add rooms screens sized their selected items row from a measured width stored in state, which is zero on the first layout pass, so snapshots could draw the row empty. Use containerRelativeFrame instead. The add rooms search previews now also wait for their results, and the search previews that show a clear button get a small precision tolerance, as it renders inconsistently in snapshots.

* Re-record the preview snapshots on iOS 27.0

Recorded on an iPhone SE (3rd generation) simulator running iOS 27.0 with Xcode 27.0 (27A266a). The changes come from iOS 27 rendering: text anti-aliasing, hyphenation and line breaking, navigation bars and toggles that now render in snapshots, lazy stacks that were blank on iOS 26, and pseudo-language locale formatting.

* Fix the UI tests on iOS 27

iOS 27 no longer exposes accessibility identifiers on SwiftUI menu items, so the space exploration test now finds them by label within the menu. On iPad, the start chat search field keeps focus after submitting and can swallow the next tap, so retry the tap if the create room screen doesn't appear.

* Re-record the UI test snapshots on iOS 27.0

Recorded on iPhone 17 and iPad (A16) simulators running iOS 27.0 with Xcode 27.0. The changes come from iOS 27 styling, like the keyboard height and glass borders. This also removes the iPad app lock setup snapshots, which have been orphaned since those tests stopped running on iPad.

* Fix the accessibility tests crashing on iOS 27

The accessibility tests' previews wrapper kept its ImageRenderer alive across the awaits that follow the render. On iOS 27, releasing it at that point tears down its view graph outside of a SwiftUI update, which hits an assertion and crashes the app. Release the renderer as soon as the image has been rendered.

* Keep the accessibility tests' image renderers alive on iOS 27

Releasing the ImageRenderer straight away wasn't enough: on iOS 27, releasing one that rendered a preview crashes SwiftUI whichever context it happens in. Keep the renderers alive instead. Each test launches a fresh app, so they only live for the one test.

* Share the UI tests' app settings with their mock user session

Since the user session flow reads its settings from UserSettings, the UI tests' mock user session was wrapping a fresh volatile AppSettings instead of the one the tests configure. The flags that skip onboarding weren't picked up, so every user session UI test got stuck on the notifications permission screen.

* Re-record the Compound snapshots on iOS 27.0

Apply the same safe area fix as the app's preview tests, so size-that-fits snapshots aren't clipped on iOS 27, and re-record the snapshots on an iPhone SE (3rd generation) simulator running iOS 27.0 in English (US).

* Fix a race reading the keyboard in the accessibility tests

On iOS 27 the QR code login screen's keyboard can be dismissing between checking that it exists and reading its frame, which fails the test. Snapshot it in a single query instead.
2026-09-29 17:02:48 +02:00
Stefan Ceriu c8250f6aa4 Tweak the BuildSDK command line tool now that ElementCall also links the SDK 2026-09-23 18:01:39 +03:00
Stefan Ceriu 379a5cd1bc Drop Intel device support from the build scripts and project 2026-09-22 19:56:06 +03:00
Valere Fedronic fb49f5b83b Add experimental native calls behind a developer flag (#6159)
Add the element-call-ios dependency and a developer option for native calls

The package carries the call UI and the matrix-rust-rtc media stack, pinned by
exact version the way the SDK is, with the local path kept commented out for
working against a checkout. Its media xcframework has no Intel simulator slice
and a package cannot say so for the projects that consume it, hence the
excluded architecture at the project level.

The developer option is off by default and nothing reads it yet. It is placed
next to the Element Call URL override, which only applies to the web view that
native calls replace.
2026-09-17 19:42:18 +03:00
Stefan Ceriu 8a3468658b Address PR comments 2026-08-21 12:26:02 +03:00
Stefan Ceriu 0bd571d068 Relaunch the test process on retrying after failures.
So that runner exits continue the retry flows.
2026-08-21 12:26:02 +03:00
Stefan Ceriu cd453bc6fa Move xcresultparser to the Tools to avoid long recompilation times through brew 2026-08-19 07:41:26 +03:00
Stefan Ceriu 771d10ac6b Cache CI test run compilations 2026-08-19 07:41:26 +03:00
Stefan Ceriu e302b37b6a Move Variants into the Components folder
Continue grouping the standalone modules under Components. Updates the
nightly.yml include path and the app icon banner path used by the
configure-nightly CI command.
2026-08-12 16:52:26 +03:00
Stefan Ceriu 5866c4340a Move SDKMocks into the Components folder
Group the standalone modules that live outside of the app targets under a
single Components folder. Updates the XcodeGen include, the Codecov ignore
path and the Sourcery output path used by the generate-sdk-mocks tool.
2026-08-12 16:52:26 +03:00
Stefan Ceriu 1febb3ef91 Retry failed XCUITests 2026-08-11 19:51:33 +03:00
Stefan Ceriu 42a7b6e8ee Annotate failures for Github Actions so they're easier to spot. 2026-08-10 20:33:43 +03:00
Stefan Ceriu 0856fdc146 Improve integration test diagnostics in an attempt to catch run crashes 2026-08-10 13:19:41 +03:00
Mauro 9093631f8b Periphery cleanup (#5893) 2026-07-20 11:16:11 +02:00
Mauro 0be5693779 Constrained tests tool implementation + skill (#5873)
* constrained tests tool implementation + skill

* pr suggestions
2026-07-15 12:17:51 +02:00
Doug 5915713a02 Introduce a build setting to detect Nightly builds. (#5852)
* Allow the AppIconBanner tool to be called with purely the build number.

And use that for the Element Pro Nightly.

* Use a build setting to determine Nightly builds.
2026-07-09 13:56:26 +01:00
Doug 81b33da6ab Switch back to using the stable version of SwiftFormat. (#5850) 2026-07-08 11:01:55 +01:00
Mauro 2d486ece33 Use iOS 26 Observation for Unit and Preview tests. (#5797)
* use observation in unit and preview tests instead of the async stream

* use a parsing approach that is independent of the sourcery annotation

* Fix observation deferred fulfillments not receiving the initial value

Observation's observe only emits transitions, not the value present at subscription time. Drop the leading initial value from the affected transitionValues sequences and assert it directly with #expect instead.

* improved docs
2026-06-30 14:01:08 +02:00
Doug 59ba4a238e Fix macros on CI.
The explicit SDK usage means macros fail to compile for macOS. The SDK will be inferred by the destination platform.
Note: We no longer use a plugin so I've remove that argument too.
2026-06-29 10:34:32 +01:00
Mauro a520d94760 Swift 6 Migration (#5733)
* Enable Swift 6.2 with default main actor isolation for the app target

Turn on SWIFT_VERSION 6.2, SWIFT_APPROACHABLE_CONCURRENCY and SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor for the ElementX target, matching the NSE and Share Extension (which already use 6.2 without the main actor default).

# Conflicts:
#	ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

* Update the code generation templates for Swift 6

Emit nonisolated/@unchecked Sendable mocks and nonisolated string enums, and mark async mock methods @concurrent so they keep suspending like the real implementations (otherwise intermediate states are unobservable in tests). Includes the regenerated mocks and strings.

# Conflicts:
#	ElementX/Sources/Mocks/Generated/GeneratedMocks.swift

* Make the data layer and services nonisolated and Sendable

Annotate the value-type models, Rust SDK proxy wrappers, timeline item graph, settings, logging and NSE-shared types as nonisolated, and conform the service protocols to Sendable so their existentials can cross isolation boundaries. These types run off the main actor and no longer inherit the target's default main actor isolation.

* Adopt the new isolation across call sites, mocks and signatures

Update call sites, closure signatures and mock configuration helpers to match the nonisolated/Sendable data layer, including the main actor isolated mock inits and the @Sendable filter on recentlyVisitedRooms.

^ Conflicts:
^	ElementX/Sources/Services/SecureBackup/SecureBackupController.swift

* Remove redundant @MainActor annotations

With the app target defaulting to main actor isolation, the explicit @MainActor on view models, coordinators, views and their protocols is no longer required.

* Fix concurrency hotspots surfaced by the migration

Resolve the room summary main-thread deadlock by moving diff processing onto AsyncStreams, add the SDKListener.onMainActor FIFO bridge for SDK callbacks, hop KVO/timer/UIKit callbacks to the main actor via assumeIsolated, add isolated deinits, and apply the few justified nonisolated(unsafe) escapes for queue-confined Apple APIs.

* Fix the unit tests for Swift 6 concurrency

Hop the waitForConfirmation body onto the caller's actor (Swift Testing runs confirmation closures off-actor), and adjust the affected suites and async signatures.

* offload diffs on concurrent threads instead of main actor

* make room info protocols sendable

* use a task group for fetching data so that everything runs concurrently in the TextRoomTimelineView when getting the preview.

* use the generic onMainActor implementation, which already makes a stream and send the continuation on the main actor.

* small pr comments issues being addressed

* update enterprise

* Update StaticCode to 1.1.0 and specify the required Swift isolation.

* fix ElementCallServiceTests

* update enterprise

* re-generate mocks

* update enterprise

* enterprise new code conformed to swift 6

---------

Co-authored-by: Doug <douglase@element.io>
2026-06-18 17:55:31 +02:00
Mauro ad6ae390d1 use swift 6.2 for dev tools (#5720) 2026-06-09 10:46:29 +02:00
Stefan Ceriu 2fddb597b8 Bump the CI workflows to iOS 26.5, centralise default OS version 2026-06-08 19:54:07 +03:00
Stefan Ceriu c6d2c6b025 Switch the mock stencil templates to use NSLock instead of dispatch queues 2026-06-03 08:57:04 +03:00
Doug fa67713726 Run SwiftFormat. 2026-05-27 17:11:42 +01:00
Doug 5138e05e47 Use SwiftFormat from develop and enabled indent-blank-lines option. 2026-05-27 17:11:42 +01:00
Michael 22d14ff8e4 AppSettings are Mockable (#5589)
* create DependenciesProtocol and replace ServiceLocator registration with it

replace mocking calls for ServiceLocator to Dependencies

replace ServiceLocator with instance level calls

replace ServiceLocator configs with TestDependencies config in Tests

replace servicelocator usage in analytics service

replace remaining ServiceLocator calls in unit tests

that depended on the UnitTestAppCoordinator configuration with per suite dependencies instances

fix swiftlint warning

remove remaining references to ServiceLocator

make dependencies properties consistent in tests

delete Dependencies and DependenciesProtocol

fix whitespace modifications

updates from PR feedback

a pass over converting AppSettings and AnalyticsService test instance properties to per test instantiation

fix a missed PR feedback

Sync up after rebase

create DependenciesProtocol and replace ServiceLocator registration with it

replace mocking calls for ServiceLocator to Dependencies

replace ServiceLocator with instance level calls

replace ServiceLocator configs with TestDependencies config in Tests

replace servicelocator usage in analytics service

replace remaining ServiceLocator calls in unit tests

that depended on the UnitTestAppCoordinator configuration with per suite dependencies instances

fix swiftlint warning

remove remaining references to ServiceLocator

make dependencies properties consistent in tests

delete Dependencies and DependenciesProtocol

* AppSettings is instance level mockable now

* replace mocked and preview usages of reset + AppSettings global init with

AppSettings(store: UserDefaultsMock())

* AppSettings.UserDefaultsKeys is now a RawRep struct, making it extensible

* update tests with new AppSettings so it builds

* update remaining AppSettings test/mock inits

* AppSettings.UserDefaultsKey conformed to ExpressibleByStringLiteral

* addressed issues found in first pass ai review

* update AppSettings instantiations after rebase

* fix accessibility tests coordinator after rebase

* Rename to VolatileUserDefaults

* AppSettings init uses mandatory parameter

* Revert UserDefaultsKey to enum

* Add TrackedUserDefaults to be able to reset the defaults object

* Added volatile static func to AppSettings

* Use .volatile() static func instead of full init

* review fixups

* Resolve build issues after rebase

* updated enterprise module

* remove the static reset settings call from the preview tests

---------

Co-authored-by: Mauro Romito <mauro.romito@element.io>
2026-05-22 15:14:08 +02:00
Doug af44833850 Show which test suite failed in the UnitTest logs. 2026-05-04 14:03:28 +03:00
Mauro Romito fa801b5791 splitting runtime sim version from the os version 2026-04-27 14:13:13 +02:00
Mauro Romito 04202676aa use the default preview tests configuration 2026-04-27 14:13:13 +02:00
Mauro Romito 078c249262 use 26.4 os version on SE 3rd gen for preview tests 2026-04-27 14:13:13 +02:00
Mauro a9fae7b4e7 update sim version to 26.4.1 (#5479) 2026-04-24 11:59:15 +02:00
Stefan Ceriu 751ea16b0d Add a snapshot re-recording option to the snapshot tests CI command. 2026-04-20 11:54:44 +03:00
Stefan Ceriu f6fe112789 Split out the preview tests from the unit tests and move them to their own CI tool. 2026-04-20 11:54:44 +03:00
Doug 683c05019e Move the Acknowledgements generation to the post-renovate workflow. (#5438)
* Move the Acknowledgements generation to the post-renovate workflow.

* Use macOS 26.
2026-04-17 14:26:08 +01:00
Doug 63422f8f6b Upgrade the project to use Xcode 26.4 (and the 26.4 simulator for tests). (#5375)
* Upgrade the project to use Xcode 26.4 (and iOS 26.4 when running tests).

* Update the test OS assertions.

* updated preview tests

# Conflicts:
#	PreviewTests/Sources/__Snapshots__/PreviewTests/homeScreenInviteCell.iPhone-en-GB-0.png
#	PreviewTests/Sources/__Snapshots__/PreviewTests/homeScreenInviteCell.iPhone-pseudo-0.png

* update compound preview tests

---------

Co-authored-by: Mauro Romito <mauro.romito@element.io>
2026-04-16 14:33:20 +02:00
Mauro Romito 8b2d83f068 use swift regex and also apply the same logic to stringsdict 2026-04-10 16:21:57 +02:00
Mauro Romito 11dd6f0323 order strings alphabetically by key after downloading them 2026-04-10 16:21:57 +02:00
Stefan Ceriu df7914d052 Fix template screen ElementNavigationStack errors 2026-03-31 18:21:14 +03:00
Doug 8ce6f1f0d3 Really fix the release script. 2026-03-24 19:45:07 +00:00
Doug 86cea87c0f Fix the release script. 2026-03-24 17:06:44 +00:00
Stefan Ceriu c18eb92145 Revert "Move CI GitHub token usage to the global git configuration"
This reverts commit 519cd4052d.
2026-03-19 08:59:30 +02:00
Stefan Ceriu 519cd4052d Move CI GitHub token usage to the global git configuration 2026-03-13 16:57:01 +02:00
Copilot ac56a0ba43 Fix screen template unit tests to use Swift Testing conventions (#5187) 2026-03-11 15:20:21 +00:00
Stefan Ceriu bce9119bc3 Replace the last of the fastlane lanes with swift tooling
- move more sharable code to CI static methods
- merge `release_to_github` and `prepare_next_release` into one single command as they had dependencies on each other
- remove all traces of ruby and fastlane
2026-03-11 10:06:44 +02:00
Doug f8039e274b Actually fix the post-build command. 2026-03-05 17:41:24 +00:00
Doug 0d4ff5ea87 Fix the post-build command. 2026-03-05 17:08:54 +00:00
Stefan Ceriu e23959a201 Convert more fastlane tools to swift commands (#5163)
* Upload dSYMs to sentry using swift and the sentry-cli instead of fastlane.

* Replace the fastlane `config_production` lane with a swift tools `ConfigureProduction` command.

* Replace Zsh with CI.run in the new ConfigureNightly command

* Replace the fastlane `tag_nightly` lane with a swift tools `TagNightly` command.

* Print out all the commands going through CI.Run and their arguments

* Address PR comments
2026-03-05 16:14:09 +02:00
Stefan Ceriu 0ab6458e4e Fix new redundantSendable and redundantSwiftTestingSuite swiftformat errors 2026-03-04 17:02:11 +02:00