Skip to content

Commit

Permalink
Fix ios tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaSimsic committed Feb 12, 2025
1 parent d0c021d commit 8355801
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 20 deletions.
78 changes: 60 additions & 18 deletions .github/workflows/NativePipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ jobs:
if-no-files-found: ignore
ios-tests:
needs: [scope, mendix-version, project, ios-app]
runs-on: macos-15
runs-on: macos-14
steps:
- name: "Check out code"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
Expand All @@ -497,13 +497,6 @@ jobs:
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: mda
# Used when new xCode version of simulator should be created
# - name: Update Xcode
# run: sudo xcode-select --switch /Applications/Xcode_14.0.1.app
- name: "Clean detox framework cache"
run: npx detox clean-framework-cache
- name: "Build detox framework cache"
run: npx detox build-framework-cache
- name: "Start runtime"
uses: ./.github/actions/start-runtime
with:
Expand All @@ -518,19 +511,68 @@ jobs:
run: |
mkdir -p detox/apps
find ios-app -type d -iname "*.app" -exec cp -R {} detox/apps/ \;
# - name: "List contents of apps directory"
# run: |
# echo "Listing contents of detox/apps directory:"
# ls -R detox/apps

- name: Install Detox Dependencies
run: |
brew tap wix/brew
brew tap wix/brew
brew install applesimutils
- name: Check available runtimes
run: xcrun simctl list runtimes
- name: Check avialble device types
run: xcrun simctl list devicetypes
# - name: Create iOS 16.0 simulator for iPhone 14
# run: xcrun simctl create "iPhone 14" com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-16-0
- name: List supported iOS devices
run: applesimutils --list
# - name: Create iOS 18.1 simulator for iPhone 16
# run: xcrun simctl create "iPhone 16" com.apple.CoreSimulator.SimDeviceType.iPhone-16 com.apple.CoreSimulator.SimRuntime.iOS-18-1

- name: Boot Simulator
run: xcrun simctl boot "iPhone 15"
- name: Wait for Simulator to Boot
run: |
while ! xcrun simctl list | grep "Booted"; do
echo "Waiting for simulator to boot..."
sleep 5
done
- name: "Check if iOS app exists in detox/apps"
run: |
APP_PATH="detox/apps/NativeTemplate.app"
if [ ! -d "$APP_PATH" ]; then
echo "App not found at path: $APP_PATH"
else
echo "App found at path: $APP_PATH"
fi
- name: "Check if iOS app exists in full BINARY_PATH"
run: |
BINARY_PATH="/Users/runner/work/native-widgets/native-widgets/detox/apps/NativeTemplate.app"
echo "BINARY_PATH=$BINARY_PATH" >> $GITHUB_ENV
if [ ! -d "$BINARY_PATH" ]; then
echo "App not found at path: $BINARY_PATH"
echo "Listing contents of the apps directory:"
ls -R /Users/runner/work/native-widgets/native-widgets/detox/apps # List contents of the apps directory for debugging
else
echo "App found at path: $BINARY_PATH"
fi
- name: "List contents of the app bundle"
run: |
echo "Listing contents of the app bundle at $BINARY_PATH:"
ls -R "$BINARY_PATH"
- name: "Install app on simulator"
run: |
SIMULATOR_ID=$(xcrun simctl list devices | grep "iPhone 15" | grep "Booted" | awk -F '[()]' '{print $2}')
if [ -z "$SIMULATOR_ID" ]; then
echo "No booted simulator found for iPhone 15."
exit 1
fi
echo "Installing app on simulator with ID: $SIMULATOR_ID"
xcrun simctl install "$SIMULATOR_ID" "$BINARY_PATH"
- name: "Run tests"
env:
DETOX_LOGLEVEL: trace
run: yarn workspaces foreach ${{ needs.scope.outputs.scope }} run test:e2e:ios
- name: "Archive runtime logs"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand All @@ -554,4 +596,4 @@ jobs:
with:
name: ios-artifacts
path: packages/pluggableWidgets/**/artifacts/
if-no-files-found: ignore
if-no-files-found: ignore
4 changes: 2 additions & 2 deletions detox/detox.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const ANDROID_SDK_VERSION = "30"; // Set to 30 because: https://github.com/wix/Detox/issues/3071
const ANDROID_DEVICE_TYPE = "pixel";
const IOS_SDK_VERSION = "18.1";
const IOS_DEVICE_TYPE = "iPhone 16";
const IOS_SDK_VERSION = "17.5";
const IOS_DEVICE_TYPE = "iPhone 15";

module.exports = {
ANDROID_SDK_VERSION,
Expand Down

0 comments on commit 8355801

Please sign in to comment.