@@ -389,6 +389,99 @@ commands:
389
389
echo "Waiting for Appium server... ($i/30)"
390
390
sleep 2
391
391
done
392
+ setup_ios_simulator :
393
+ steps :
394
+ - run :
395
+ name : Install iOS Simulator
396
+ command : |
397
+ xcversion simulators --install='iOS 15.5'
398
+
399
+ # Create simulator
400
+ UDID=$(xcrun simctl create "iPhone 11 Pro Max" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max com.apple.CoreSimulator.SimRuntime.iOS-15-5)
401
+
402
+ # Export simulator UDID for other steps
403
+ echo "export SIMULATOR_UDID=$UDID" >> $BASH_ENV
404
+ source $BASH_ENV
405
+
406
+ - run :
407
+ name : Start iOS Simulator
408
+ background : true
409
+ command : |
410
+ # Start Simulator in headless mode
411
+ xcrun simctl boot $SIMULATOR_UDID
412
+
413
+ # Start Simulator.app in headless mode
414
+ open -a Simulator --args -CurrentDeviceUDID $SIMULATOR_UDID -ConnectHardwareKeyboard 0 -StatusBar 1 -NoUIRestore 1
415
+
416
+ - run :
417
+ name : Wait for Simulator
418
+ command : |
419
+ # Wait for device to be ready
420
+ for i in $(seq 1 30); do
421
+ if xcrun simctl list | grep -q "Booted"; then
422
+ echo "Simulator is booted"
423
+ break
424
+ fi
425
+ echo "Waiting for simulator to start... ($i/30)"
426
+ sleep 10
427
+ done
428
+
429
+ # Wait for system to be ready
430
+ for i in $(seq 1 30); do
431
+ if xcrun simctl spawn $SIMULATOR_UDID launchctl print system | grep -q "com.apple.springboard"; then
432
+ echo "System is ready"
433
+ break
434
+ fi
435
+ echo "Waiting for system to be ready... ($i/30)"
436
+ sleep 10
437
+ done
438
+
439
+ # Verify simulator status
440
+ xcrun simctl list devices
441
+ xcrun simctl spawn $SIMULATOR_UDID launchctl print system
442
+
443
+ setup_ios_certificate :
444
+ steps :
445
+ - run :
446
+ name : Install and Trust Certificate
447
+ command : |
448
+ # Wait for MITM certificate
449
+ while [ ! -f ~/.mitmproxy/mitmproxy-ca-cert.cer ]; do
450
+ echo "Waiting for MITM certificate..."
451
+ sleep 2
452
+ done
453
+
454
+ # Create certificates directory
455
+ mkdir -p ~/certificates
456
+ cd ~/certificates
457
+
458
+ # Process certificate
459
+ cp ~/.mitmproxy/mitmproxy-ca-cert.cer ./
460
+ openssl x509 -in mitmproxy-ca-cert.cer -inform PEM -out mitmproxy-ca-cert.pem
461
+ openssl x509 -in mitmproxy-ca-cert.pem -outform DER -out mitmproxy-ca-cert.der
462
+
463
+ # Install in simulator
464
+ xcrun simctl keychain $SIMULATOR_UDID add-root-cert mitmproxy-ca-cert.der
465
+ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain mitmproxy-ca-cert.pem
466
+
467
+ # Add to simulator profiles
468
+ xcrun simctl spawn $SIMULATOR_UDID mkdir -p /Library/Keychains/
469
+ xcrun simctl push $SIMULATOR_UDID mitmproxy-ca-cert.der /Library/Keychains/mitmproxy-ca-cert.der
470
+ xcrun simctl spawn $SIMULATOR_UDID profiles trust-root-cert /Library/Keychains/mitmproxy-ca-cert.der
471
+
472
+ echo "Certificate installation completed"
473
+
474
+ setup_ios_proxy :
475
+ steps :
476
+ - run :
477
+ name : Configure iOS Proxy Settings
478
+ command : |
479
+ xcrun simctl spawn $SIMULATOR_UDID defaults write com.apple.mobilesafari WebKitPreferences.encryption "HTTP/1.1"
480
+ xcrun simctl spawn $SIMULATOR_UDID defaults write com.apple.CFNetwork.plist HTTPProxy -dict HTTPEnable 1 HTTPPort 8080 HTTPProxy localhost
481
+ xcrun simctl spawn $SIMULATOR_UDID defaults write com.apple.CFNetwork.plist HTTPSProxy -dict HTTPSEnable 1 HTTPSPort 8080 HTTPSProxy localhost
482
+
483
+ echo "Verifying proxy settings..."
484
+ xcrun simctl spawn $SIMULATOR_UDID defaults read com.apple.CFNetwork.plist
392
485
393
486
jobs :
394
487
danger :
@@ -768,7 +861,54 @@ jobs:
768
861
node --experimental-vm-modules node_modules/jest/bin/jest.js --config=jest.config.js
769
862
environment :
770
863
E2E_DEVICE : ' android'
864
+ appium_e2e_ios :
865
+ parameters :
866
+ working_directory :
867
+ type : string
868
+ macos :
869
+ xcode : 13.4.1
870
+ steps :
871
+ - advanced-checkout/shallow-checkout
872
+ - install_node_modules :
873
+ app-dir : << parameters.working_directory >>
874
+ - build_and_pack_sdk :
875
+ working_directory : << parameters.working_directory >>
876
+ # Build iOS app
877
+ - run :
878
+ name : Install CocoaPods
879
+ working_directory : <<parameters.working_directory>>/ios
880
+ command : pod install
881
+ - run :
882
+ name : Build iOS App
883
+ working_directory : <<parameters.working_directory>>/ios
884
+ command : |
885
+ xcodebuild -workspace HybridSampleApp.xcworkspace \
886
+ -scheme HybridSampleApp \
887
+ -configuration Release \
888
+ -sdk iphonesimulator \
889
+ -destination "platform=iOS Simulator,name=iPhone 11 Pro Max,OS=15.5" \
890
+ build
891
+ # Setup testing environment
892
+ - setup_mitm_proxy
893
+ - setup_ios_simulator
894
+ - setup_ios_certificate
895
+ - setup_ios_proxy
896
+ - setup_appium
897
+ - run :
898
+ name : Start MITM Proxy
899
+ background : true
900
+ command : |
901
+ mitmdump -p 8080 --set block_global=false &
902
+ sleep 5
771
903
904
+ # Run tests
905
+ - run :
906
+ name : Run E2E Tests
907
+ working_directory : << parameters.working_directory >>
908
+ command : |
909
+ node --experimental-vm-modules node_modules/jest/bin/jest.js --config=jest.config.js
910
+ environment :
911
+ E2E_DEVICE : ' ios'
772
912
workflows :
773
913
publish :
774
914
jobs :
0 commit comments