Search code examples
javascriptioswebdriverappiumwebdriver-io

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

  • 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);
    }