Skip to content

Commit

Permalink
#9 Create script to boot test simulators
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailgulek committed Jul 4, 2022
1 parent 23d93ca commit 88b1bb9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tools/Scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ Usage:
```
./localizer.py
```

## Boot Test Simulator
Boots a desired simulator and makes status bar overrides on that.

Usage:
```
./bootTestSimulator.py 'iPhone 13 Pro Max'
```
27 changes: 27 additions & 0 deletions Tools/Scripts/bootTestSimulator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/python2.7

import os
import subprocess
import sys
import json

if len(sys.argv) != 2:
print('Usage: ./bootTestSimulator.py \'Simulator Name\'')
exit(1)

simulator_name=sys.argv[1]

os_version='15-5'
runtimes_map=subprocess.check_output("xcrun simctl list --json devices available", shell=True)
runtime='com.apple.CoreSimulator.SimRuntime.iOS-' + os_version
json_object=json.loads(runtimes_map)
devices=json_object['devices'][runtime]

for device in devices:
if device['name'] == simulator_name:
UDID=device['udid']
print("Found device UDID: " + UDID)
os.system("/usr/bin/xcrun simctl boot '" + UDID + "' > /dev/null 2>&1")
os.system("/usr/bin/xcrun simctl status_bar '" + UDID + "' override --time '2007-01-09T09:41:00+00:00' --dataNetwork 'wifi' --wifiMode 'active' --wifiBars 3 --cellularMode 'active' --cellularBars 4 --batteryState 'charged' --batteryLevel 100 > /dev/null 2>&1")
os.system("/usr/bin/xcrun simctl status_bar '" + UDID + "' override --time '09:41' > /dev/null 2>&1")
break

0 comments on commit 88b1bb9

Please sign in to comment.