| 1930 | } |
| 1931 | |
| 1932 | function preapproveFixtureUrlScheme() { |
| 1933 | const plist = path.join( |
| 1934 | os.homedir(), |
| 1935 | "Library", |
| 1936 | "Developer", |
| 1937 | "CoreSimulator", |
| 1938 | "Devices", |
| 1939 | simulatorUDID, |
| 1940 | "data", |
| 1941 | "Library", |
| 1942 | "Preferences", |
| 1943 | "com.apple.launchservices.schemeapproval.plist", |
| 1944 | ); |
| 1945 | const key = `com.apple.CoreSimulator.CoreSimulatorBridge-->${fixtureUrlScheme}`; |
| 1946 | fs.mkdirSync(path.dirname(plist), { recursive: true }); |
| 1947 | |
| 1948 | const setResult = spawnSync( |
| 1949 | "/usr/libexec/PlistBuddy", |
| 1950 | ["-c", `Set :${key} ${fixtureBundleId}`, plist], |
| 1951 | { |
| 1952 | cwd: root, |
| 1953 | encoding: "utf8", |
| 1954 | timeout: 60_000, |
| 1955 | }, |
| 1956 | ); |
| 1957 | if (setResult.status === 0) { |
| 1958 | logStep(`preapproved fixture URL scheme in ${path.basename(plist)}`); |
| 1959 | return; |
| 1960 | } |
| 1961 | |
| 1962 | runText( |
| 1963 | "/usr/libexec/PlistBuddy", |
| 1964 | ["-c", `Add :${key} string ${fixtureBundleId}`, plist], |
| 1965 | { timeoutMs: 60_000 }, |
| 1966 | ); |
| 1967 | logStep(`preapproved fixture URL scheme in ${path.basename(plist)}`); |
| 1968 | } |
| 1969 | |
| 1970 | function assertSimulatorListed(udid) { |
| 1971 | const payload = simdeckJson(["list"]); |