Skip to content
Merged
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
52 changes: 52 additions & 0 deletions .github/workflows/example-ui-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Example UI Tests

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

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

jobs:
smoke-test:
name: Example launch (iOS)
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Checkout the repository
uses: actions/checkout@v7

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Install build tools
run: brew install xcodegen xcbeautify

- name: Prepare iOS Simulator
id: simulator
uses: kula-app/wait-for-services-action/ios-simulator@v1
with:
platform: iOS
device: iPhone 17 Pro
boot: true
timeout: 300

- name: Run example smoke test
env:
IOS_SIMULATOR_OS: ${{ steps.simulator.outputs.runtime }}
IOS_DEVICE_NAME: iPhone 17 Pro
run: make test-example-ios

- name: Upload test diagnostics on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: Example UI Test Diagnostics
path: |
raw-test-example-ios.log
build/ExampleUITests/*.xcresult
16 changes: 16 additions & 0 deletions Example/Example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,27 @@ targets:
ENABLE_USER_SELECTED_FILES: readonly
ENABLE_PREVIEWS: YES
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
ExampleUITests:
type: bundle.ui-testing
platform: iOS
sources:
- path: UITests
dependencies:
- target: Example
settings:
base:
SWIFT_VERSION: "5.0"
GENERATE_INFOPLIST_FILE: YES
TEST_TARGET_NAME: Example
schemes:
Example:
build:
targets:
Example: all
test:
config: Debug
targets:
- ExampleUITests
run:
config: Debug
profile:
Expand Down
26 changes: 26 additions & 0 deletions Example/UITests/ExampleLaunchTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ExampleLaunchTests.swift
// TPPDF
//
// Created by Philip Niedertscheider on 12.10.2026.
// Copyright © 2016-2026 techprimate GmbH. All rights reserved.
//

import XCTest

final class ExampleLaunchTests: XCTestCase {
@MainActor
func testAppLaunchesWithoutErrors() {
continueAfterFailure = false
let app = XCUIApplication()
app.launch()
defer { app.terminate() }

XCTAssertTrue(app.navigationBars["Examples"].waitForExistence(timeout: 10))
XCTAssertEqual(app.state, .runningForeground)
XCTAssertFalse(app.alerts.firstMatch.exists)
XCTAssertFalse(app.staticTexts.matching(
NSPredicate(format: "label BEGINSWITH %@", "Generation failed:")
).firstMatch.exists)
}
}
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@ build-example-ios: generate-example
-derivedDataPath build/Example \
CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified

## Run the SwiftUI example launch smoke test on iOS Simulator
#
# Builds and launches the example app on the configured iOS Simulator.
# Writes logs to raw-test-example-ios.log and saves results in build/ExampleUITests.
.PHONY: test-example-ios
test-example-ios: generate-example
set -o pipefail && NSUnbufferedIO=YES xcrun xcodebuild \
-project Example/Example.xcodeproj \
-scheme Example \
-destination 'platform=iOS Simulator,OS=$(IOS_SIMULATOR_OS),name=$(IOS_DEVICE_NAME)' \
-derivedDataPath build/Example \
-resultBundlePath build/ExampleUITests/$(shell date +%Y%m%d-%H%M%S).xcresult \
-only-testing:ExampleUITests \
-parallel-testing-enabled NO \
CODE_SIGNING_ALLOWED=NO test | tee raw-test-example-ios.log | xcbeautify --preserve-unbeautified

## Build the SwiftUI example for Mac Catalyst
#
# Builds the SwiftUI example app without requiring signing credentials.
Expand Down
Loading