Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/legal-eagles-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"posthog-ios": minor
---

Support survey auto-submit on selection. Honor skipSubmitButton for ratings and single-choice questions without an open-ended choice, matching posthog-js, and expose the setting to custom survey delegates.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
# Retries (3 iterations) protect merges from transient simulator flakiness; the macOS `test`
# job runs without retries, so a genuine flake still surfaces as a hard failure there.
run: make testOniOSSimulator
- name: Test survey interactions on iOS Simulator
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: make testSurveyUI
- name: Report flaky (retried) tests
# Retries can hide flakiness by turning a transient red into green. Surface any test that only
# passed after a retry so flakes get tracked and fixed instead of silently masked. Best-effort:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ PostHogTests/__MaskSnapshotFailures__/
mask-snapshots.log
# Raw xcodebuild log the testOniOSSimulator target tees for the CI retry check
xcodebuild-ios.log

# Survey UI test run output
survey-ui-tests.log
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ excluded: # case-sensitive paths to ignore during linting. Takes precedence over
- PostHogExampleWithPods
- PostHogExampleWithSPM
- PostHogTests
- PostHogSurveyUITests
- PostHog/Utils/ReadWriteLock.swift
- PostHog/Utils/Reachability.swift
- PostHog/Utils/Data+Gzip.swift
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build buildSdk buildExamples format swiftLint swiftFormat swiftLintCheck swiftFormatCheck installSwiftLint installSwiftFormat test testUploadSymbols recordEventShapeSnapshots testDowngradeCompatibility testOniOSSimulator testOnMacSimulator maskSnapshots recordMaskSnapshots checkMaskSnapshotRuntime lint bootstrap releaseCocoaPods api apiCheck apiUpdate buildIOS
.PHONY: testSurveyUI build buildSdk buildExamples format swiftLint swiftFormat swiftLintCheck swiftFormatCheck installSwiftLint installSwiftFormat test testUploadSymbols recordEventShapeSnapshots testDowngradeCompatibility testOniOSSimulator testOnMacSimulator maskSnapshots recordMaskSnapshots checkMaskSnapshotRuntime lint bootstrap releaseCocoaPods api apiCheck apiUpdate buildIOS

build: buildSdk buildExamples

Expand Down Expand Up @@ -105,6 +105,16 @@ testOniOSSimulator:
status=$$?; \
scripts/check-ios-test-result.sh "$$status" xcodebuild-ios.log

# Mounted interaction tests use a small test host and the SDK's real survey views.
# Override SURVEY_UI_DESTINATION to select an installed simulator explicitly.
SURVEY_UI_DESTINATION ?= platform=iOS Simulator,name=$$(xcrun simctl list devices available | grep -E '^[[:space:]]*iPhone' | head -1 | sed -E 's/^[[:space:]]*//; s/ \(.*//')
testSurveyUI:
set -o pipefail && xcrun xcodebuild test -project PostHog.xcodeproj -scheme PostHogSurveyUI \
-destination "$(SURVEY_UI_DESTINATION)" -parallel-testing-enabled NO \
$(SURVEY_UI_XCODEBUILD_ARGS) | tee survey-ui-tests.log | xcpretty
@grep -qE "Test Case .*SurveyAutoSubmitUITests.* passed" survey-ui-tests.log || { \
echo "error: no survey UI tests executed."; exit 1; }

testOnMacSimulator:
set -o pipefail && xcrun xcodebuild test -scheme PostHog -destination 'platform=macOS' | xcpretty

Expand Down
Loading
Loading