'Webdriverio iOS restart app with processArguments

I have iOS app which implemented UI testing with Appium. And when I want to restart app with this code, processArguments are lost. Could anyone tell me how to restart app without losing processArguments or pass processArguments when restart app?

await driver.terminateApp(bundleId);
await driver.activateApp(bundleId);


Solution 1:[1]

We need to pass arguments in drvier.execute function. Here's the solution.

const restartApp = async () => {
  await driver.terminateApp(bundleId);
  const processArgs = ['--mock-fes-api', '--mock-attester-api']; // your process arguments
  const args = {
    bundleId, // your bundle id
    arguments: processArgs
  }
  await driver.execute('mobile: launchApp', args);
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ioan Moldovan